39 lines
1.3 KiB
Python
39 lines
1.3 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/>.
|
|
|
|
"""Zoom settings section."""
|
|
|
|
from PySide6.QtCore import Signal
|
|
|
|
from ..widgets import CollapsibleSection, ParamSlider
|
|
|
|
|
|
class ZoomSection(CollapsibleSection):
|
|
"""Collapsible panel for zoom control."""
|
|
|
|
param_changed = Signal(str, object)
|
|
|
|
def __init__(self, parent=None):
|
|
super().__init__("Zoom", parent)
|
|
|
|
self.zoom_slider = ParamSlider(
|
|
"Zoom", min_val=1.0, max_val=4.0, default=1.0, step=0.1, decimals=1, suffix="x"
|
|
)
|
|
self.zoom_slider.value_changed.connect(lambda v: self.param_changed.emit("zoom", v))
|
|
self.add_widget(self.zoom_slider)
|
|
|
|
def set_zoom(self, mult: float):
|
|
self.zoom_slider.set_value(mult, emit=False)
|