58 lines
2.4 KiB
Python
58 lines
2.4 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/>.
|
|
|
|
"""Image settings section (sharpness, contrast, saturation, dynamic range)."""
|
|
|
|
from PySide6.QtCore import Signal
|
|
|
|
from ..widgets import CollapsibleSection, ParamSlider
|
|
|
|
|
|
class ImageSection(CollapsibleSection):
|
|
"""Collapsible panel for image quality settings."""
|
|
|
|
param_changed = Signal(str, object)
|
|
|
|
def __init__(self, parent=None):
|
|
super().__init__("Image Settings", parent)
|
|
|
|
self.sharpness = ParamSlider("Sharpness", min_val=-10, max_val=30, default=5, step=1)
|
|
self.sharpness.value_changed.connect(lambda v: self.param_changed.emit("sharpness", v))
|
|
self.add_widget(self.sharpness)
|
|
|
|
self.contrast = ParamSlider("Contrast", min_val=0, max_val=100, default=50, step=1)
|
|
self.contrast.value_changed.connect(lambda v: self.param_changed.emit("contrast", v))
|
|
self.add_widget(self.contrast)
|
|
|
|
self.saturation = ParamSlider("Saturation", min_val=0, max_val=100, default=50, step=1)
|
|
self.saturation.value_changed.connect(lambda v: self.param_changed.emit("saturation", v))
|
|
self.add_widget(self.saturation)
|
|
|
|
self.dynamic_range = ParamSlider("Dynamic Range", min_val=0, max_val=100, default=50, step=1)
|
|
self.dynamic_range.value_changed.connect(lambda v: self.param_changed.emit("dynamic-range", v))
|
|
self.add_widget(self.dynamic_range)
|
|
|
|
def set_sharpness(self, value: int):
|
|
self.sharpness.set_value(float(value), emit=False)
|
|
|
|
def set_contrast(self, value: int):
|
|
self.contrast.set_value(float(value), emit=False)
|
|
|
|
def set_saturation(self, value: int):
|
|
self.saturation.set_value(float(value), emit=False)
|
|
|
|
def set_dynamic_range(self, value: int):
|
|
self.dynamic_range.set_value(float(value), emit=False)
|