79 lines
2.7 KiB
Python
79 lines
2.7 KiB
Python
# 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 <https://www.gnu.org/licenses/>.
|
|
|
|
"""Graphics settings section (frame rate, lens shading)."""
|
|
|
|
from PySide6.QtCore import Signal
|
|
from PySide6.QtWidgets import QWidget, QHBoxLayout, QLabel, QComboBox
|
|
|
|
from ..widgets import CollapsibleSection, ToggleSwitch
|
|
|
|
|
|
class GraphicsSection(CollapsibleSection):
|
|
"""Collapsible panel for graphics/output settings."""
|
|
|
|
param_changed = Signal(str, object)
|
|
|
|
def __init__(self, parent=None):
|
|
super().__init__("Graphics Settings", parent)
|
|
|
|
self.framerate_combo = QComboBox()
|
|
self.framerate_combo.addItems(["25", "30", "50", "60"])
|
|
self.framerate_combo.setCurrentText("30")
|
|
self.framerate_combo.currentTextChanged.connect(
|
|
lambda v: self.param_changed.emit("frame-rate", int(v))
|
|
)
|
|
self.add_widget(self._labeled("Frame Rate", self.framerate_combo))
|
|
|
|
self.shading_toggle = ToggleSwitch(checked=True)
|
|
self.shading_toggle.toggled.connect(
|
|
lambda v: self.param_changed.emit("shading", v)
|
|
)
|
|
self.add_widget(self._toggle_row("Lens Shading", self.shading_toggle))
|
|
|
|
@staticmethod
|
|
def _labeled(text: str, widget: QWidget) -> QWidget:
|
|
row = QWidget()
|
|
layout = QHBoxLayout(row)
|
|
layout.setContentsMargins(0, 2, 0, 2)
|
|
layout.setSpacing(8)
|
|
lbl = QLabel(text)
|
|
lbl.setFixedWidth(110)
|
|
layout.addWidget(lbl)
|
|
layout.addWidget(widget)
|
|
layout.addStretch()
|
|
return row
|
|
|
|
@staticmethod
|
|
def _toggle_row(text: str, toggle: ToggleSwitch) -> QWidget:
|
|
row = QWidget()
|
|
layout = QHBoxLayout(row)
|
|
layout.setContentsMargins(0, 2, 0, 2)
|
|
layout.setSpacing(8)
|
|
lbl = QLabel(text)
|
|
lbl.setFixedWidth(170)
|
|
layout.addWidget(lbl)
|
|
layout.addStretch()
|
|
layout.addWidget(toggle)
|
|
return row
|
|
|
|
def set_frame_rate(self, value: int):
|
|
self.framerate_combo.blockSignals(True)
|
|
self.framerate_combo.setCurrentText(str(value))
|
|
self.framerate_combo.blockSignals(False)
|
|
|
|
def set_shading(self, enabled: bool):
|
|
self.shading_toggle.set_checked(enabled, emit=False)
|