This commit is contained in:
jupfi 2024-06-25 19:35:25 +02:00
parent 2637db3320
commit fc017eb943
2 changed files with 29 additions and 12 deletions

View file

@ -38,7 +38,11 @@ class BaseSpectrometerModel(ModuleModel):
self.quackseq_model = None self.quackseq_model = None
self.quackseq_visuals = dict() self.quackseq_visuals = dict()
def visualize_settings(self): def visualize_settings(self) -> None:
"""Visualizes the settings of the spectrometer.
This method creates a dictionary of visual settings from the settings of the spectrometer.
"""
settings = self.quackseq_model.settings settings = self.quackseq_model.settings
for name, setting in settings.items(): for name, setting in settings.items():

View file

@ -30,11 +30,12 @@ class VisualSetting(QObject):
Args: Args:
setting (Setting): The setting that is used to create the visual setting. setting (Setting): The setting that is used to create the visual setting.
args: Additional arguments.
kwargs: Additional keyword arguments.
""" """
self.widget = None self.widget = None
self.setting = setting self.setting = setting
super().__init__() super().__init__(*args, **kwargs)
class VisualFloatSetting(VisualSetting): class VisualFloatSetting(VisualSetting):
@ -67,7 +68,11 @@ class VisualFloatSetting(VisualSetting):
self.widget.spin_box.setValue(setting.default) self.widget.spin_box.setValue(setting.default)
self.spin_box = True self.spin_box = True
else: else:
self.widget = DuckSpinBox(min_value=setting.min_value, max_value=setting.max_value, double_box=True) self.widget = DuckSpinBox(
min_value=setting.min_value,
max_value=setting.max_value,
double_box=True,
)
self.widget.set_value(setting.default) self.widget.set_value(setting.default)
self.widget.state_updated.connect(self.on_state_updated) self.widget.state_updated.connect(self.on_state_updated)
@ -187,9 +192,7 @@ class VisualBooleanSetting(VisualSetting):
def __init__(self, setting: BooleanSetting) -> None: def __init__(self, setting: BooleanSetting) -> None:
"""Create a new boolean setting.""" """Create a new boolean setting."""
super().__init__( super().__init__(setting)
setting
)
# Overrides the default widget # Overrides the default widget
self.widget = self.get_widget() self.widget = self.get_widget()
@ -345,3 +348,13 @@ class VisualStringSetting(VisualSetting):
""" """
self.value = value self.value = value
self.settings_changed.emit() self.settings_changed.emit()
class VisualTableSetting:
"""A setting that is a table.
Args:
setting (TableSetting) : The setting that is used to create the visual setting.
"""
pass