# Copyright (C) 2026 Seth Hillbrand # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . """Image parameters panel that contains all collapsible settings sections.""" from PySide6.QtCore import Signal from PySide6.QtWidgets import ( QWidget, QVBoxLayout, QHBoxLayout, QLabel, QPushButton, QComboBox, QSizePolicy, ) from PySide6.QtGui import QFont from ..theme import COLOR_ACCENT, COLOR_BG_PANEL, COLOR_BORDER, COLOR_TEXT_SECONDARY from ..widgets import PresetBar from .graphics_section import GraphicsSection from .image_section import ImageSection from .focus_section import FocusSection from .zoom_section import ZoomSection from .exposure_section import ExposureSection from .white_balance_section import WhiteBalanceSection from .audio_section import AudioSection class ImageParamsPanel(QWidget): """Scrollable panel containing all camera parameter sections.""" param_changed = Signal(str, object) save_scene_requested = Signal() refresh_requested = Signal() def __init__(self, parent=None): super().__init__(parent) self.setObjectName("imageParamsPanel") self.setStyleSheet(f"#imageParamsPanel {{ background-color: {COLOR_BG_PANEL}; }}") outer = QVBoxLayout(self) outer.setContentsMargins(0, 0, 0, 0) outer.setSpacing(0) top_bar = QWidget() top_bar.setFixedHeight(44) top_layout = QHBoxLayout(top_bar) top_layout.setContentsMargins(12, 6, 12, 6) top_layout.setSpacing(8) self.camera_combo = QComboBox() self.camera_combo.addItem("Y-CAM (disconnected)") self.camera_combo.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed) top_layout.addWidget(self.camera_combo) self.capture_btn = QPushButton() self.capture_btn.setText("\u25cf") self.capture_btn.setFixedSize(32, 32) self.capture_btn.setStyleSheet(f""" QPushButton {{ background-color: {COLOR_ACCENT}; color: white; border: none; border-radius: 16px; font-size: 18px; }} QPushButton:hover {{ background-color: #f02574; }} """) top_layout.addWidget(self.capture_btn) outer.addWidget(top_bar) header = QWidget() header.setFixedHeight(36) header_layout = QHBoxLayout(header) header_layout.setContentsMargins(12, 4, 12, 4) header_layout.setSpacing(8) title = QLabel("Image Parameters") title_font = QFont() title_font.setBold(True) title_font.setPointSize(11) title.setFont(title_font) header_layout.addWidget(title) header_layout.addStretch() self.refresh_btn = QPushButton("\u21bb") self.refresh_btn.setFixedSize(28, 28) self.refresh_btn.setToolTip("Refresh parameters from camera") self.refresh_btn.setStyleSheet(f""" QPushButton {{ background: transparent; color: {COLOR_TEXT_SECONDARY}; border: none; font-size: 16px; }} QPushButton:hover {{ color: white; }} """) self.refresh_btn.clicked.connect(self.refresh_requested.emit) header_layout.addWidget(self.refresh_btn) self.save_scene_btn = QPushButton("Save Scene") self.save_scene_btn.setProperty("accent", True) self.save_scene_btn.setFixedHeight(28) self.save_scene_btn.clicked.connect(self.save_scene_requested.emit) header_layout.addWidget(self.save_scene_btn) outer.addWidget(header) self.preset_bar = PresetBar() outer.addWidget(self.preset_bar) self.graphics = GraphicsSection() self.image = ImageSection() self.focus = FocusSection() self.zoom = ZoomSection() self.exposure = ExposureSection() self.white_balance = WhiteBalanceSection() self.audio = AudioSection() for section in [self.graphics, self.image, self.focus, self.zoom, self.exposure, self.white_balance, self.audio]: section.param_changed.connect(self.param_changed.emit) outer.addWidget(section) outer.addStretch()