This commit is contained in:
jupfi 2024-04-26 12:28:33 +02:00
parent 833f23675f
commit a9fee217c3
3 changed files with 25 additions and 8 deletions

View file

@ -88,7 +88,7 @@ class BaseSpectrometerModel(ModuleModel):
for option in self.options:
if option.name == name:
return option
raise ValueError("Option with name %s not found" % name)
raise ValueError(f"Option with name {name} not found")
def __init__(self, module):
"""Initializes the spectrometer model.
@ -127,7 +127,7 @@ class BaseSpectrometerModel(ModuleModel):
for setting in self.settings[category]:
if setting.name == name:
return setting
raise ValueError("Setting with name %s not found" % name)
raise ValueError(f"Setting with name {name} not found")
def add_pulse_parameter_option(
self, name: str, pulse_parameter_class: PulseParameter

View file

@ -38,7 +38,7 @@ class BaseSpectrometerView(ModuleView):
grid = self._ui_form.gridLayout
self._ui_form.verticalLayout.removeItem(self._ui_form.gridLayout)
# Add name of the spectrometer to the view
label = QLabel("%s Settings:" % self.module.model.toolbar_name)
label = QLabel(f"{self.module.model.toolbar_name} Settings:")
label.setStyleSheet("font-weight: bold;")
self._ui_form.verticalLayout.setSpacing(5)
self._ui_form.verticalLayout.addWidget(label)
@ -47,7 +47,7 @@ class BaseSpectrometerView(ModuleView):
for category_count, category in enumerate(self.module.model.settings.keys()):
logger.debug("Adding settings for category: %s", category)
category_layout = QVBoxLayout()
category_label = QLabel("%s:" % category)
category_label = QLabel(f"{category}:" % category)
category_label.setStyleSheet("font-weight: bold;")
row = category_count // 2
column = category_count % 2

View file

@ -141,7 +141,7 @@ class FunctionOption(Option):
for function in self.functions:
if function.name == name:
return function
raise ValueError("Function with name %s not found" % name)
raise ValueError(f"Function with name {name} not found")
def to_json(self):
"""Returns a json representation of the option.
@ -172,8 +172,13 @@ class FunctionOption(Option):
class TXRectFunction(RectFunction):
"""TX Rectangular function.
Adds the pixmap of the function to the class.
"""
def __init__(self) -> None:
"""Initializes the TX Rectangular function."""
super().__init__()
self.name = "Rectangular"
@ -182,8 +187,12 @@ class TXRectFunction(RectFunction):
return PulseParamters.TXRect()
class TXSincFunction(SincFunction):
"""TX Sinc function.
Adds the pixmap of the function to the class.
"""
def __init__(self) -> None:
"""Initializes the TX Sinc function."""
super().__init__()
self.name = "Sinc"
@ -193,8 +202,12 @@ class TXSincFunction(SincFunction):
class TXGaussianFunction(GaussianFunction):
"""TX Gaussian function.
Adds the pixmap of the function to the class.
"""
def __init__(self) -> None:
"""Initializes the TX Gaussian function."""
super().__init__()
self.name = "Gaussian"
@ -204,8 +217,12 @@ class TXGaussianFunction(GaussianFunction):
class TXCustomFunction(CustomFunction):
"""TX Custom function.
Adds the pixmap of the function to the class.
"""
def __init__(self) -> None:
"""Initializes the TX Custom function."""
super().__init__()
self.name = "Custom"