Settings widgets

class Sisyphe.widgets.functionsSettingsWidget.SettingsWidget(function: str, parent: QWidget | None = None)

SettingsWidget class

Description

Widget to manage application settings from an XML file (settings.xml). This widget displays a list of the parameters of a function/section, i.e. first level node of the XML file.

It has a main button that toggles the visibility of the parameters, as well as four IO buttons:

  • ‘Reset’: Reset the settings to their default values from a settings file.

  • ‘Load’: load settings from a custom XML file.

  • ‘Save’: save the current settings to the user’s default settings file (~/.PySisyphe/settings.xml)

  • ‘Save As’: save the current settings to a custom XML file.

Parameter types in the settings.xml are as follows:

  • str, represented by a QLineEdit widget

  • int, represented by a QSpinBox widget

  • float, represented by a QDoubleSpinBox2 widget

  • percent, percent parameter (0 to 100), represented by a QSlider widget

  • bool, represented by a QCheckBox widget

  • visibility, two states parameter i.e. show/hide, represented by a VisibilityLabel widget

  • lstr, list of str, represented by QComboBox widgets

  • lint, list of int, represented by multiple QSpinBox widgets

  • lfloat,list of float, represented by multiple QDoubleSpinBox widgets

  • lbool, list of bool, represented by multiple QComboBox (True/False items) widgets

  • color, represented by a ColorSelectPushButton widget

  • lut, lut name, represented by a ComboBoxLut widget

  • font, font name, represented by a FontSelect widget

  • date, date str, represented by a QDateEdit widget

  • vol, PySisyphe volume file name, represented by a FileSelectionWidget

  • roi, PySisyphe ROI file name, represented by a FileSelectionWidget

  • dcm, Dicom file name, represented by a FileSelectionWidget

  • dir, Path, represented by a FileSelectionWidget

  • vols, list of PySisyphe volume file names, represented by a FilesSelectionWidget

  • rois, list of PySisyphe ROI file names, represented by a FilesSelectionWidget

  • dcms, list of Dicom file names, represented by a FilesSelectionWidget

  • dirs, list of paths, represented by a FilesSelectionWidget

  • txt, text file name, represented by a FileSelectionWidget

Inheritance

QWidget -> SettingsWidget -> FunctionSettingsWidget

Creation: 11/08/2022 Last revision: 11/06/2026

classSisypheSettings

alias of SisypheSettings

classmethod formatLabel(label: str) → str

Reformat a str label: split words using capital letters as separators.

Parameters

labelstr

label to be formatted.

Returns

str

reformatted label

getButtonsVisibility() → bool

Get the visibility state of all buttons.

Returns

bool

True if the reset button is visible, False otherwise.

classmethod getDefaultIconDirectory() → str

Get the path to the default icon directory based on the current system theme (dark/light).

Returns

str

absolute path to the icon directory.

classmethod getDefaultIconSize() → int

Get the default icon size based on the current display DPI.

Returns

int

icon size in pixels.

classmethod getDefaultToolbarIconDirectory() → str

Get the path to the default toolbar icon directory based on the current system theme (dark/light).

Returns

str

absolute path to the toolbar icon directory.

getFontSize() → int

Get the font size of the widget.

Returns

int

font point size.

getFunctionName() → str

Get the name of the function associated with this settings widget.

Returns

str

function name.

getIOButtonsVisibility() → bool

Get the visibility state of the settings I/O buttons.

Returns

bool

True if the reset button is visible, False otherwise.

classmethod getNumberOfDecimals(v: float) → int

Get the number of decimal places in a floating-point number.

Parameters

vfloat

floating-point number.

Returns

int

number of decimal places.

getParameterValue(parameter: str) → Any

Get the current value of a specific parameter.

Parameters

parameterstr

name of the parameter.

Returns

Any

value of the parameter.

getParameterVisibility(parameter: str) → bool

Get the visibility of a specific parameter widget.

Parameters

parameterstr

name of the parameter.

Returns

bool

True if the widget is visible, False otherwise.

getParameterWidget(parameter: str) → QWidget

Get the widget associated with a specific parameter.

Parameters

parameterstr

name of the parameter.

Returns

QWidget

widget for the given parameter.

getParametersDict() → dict[str, Any]

Get a dictionary of all parameters and their current values.

Returns

dict[str, Any]

dictionary with parameter names as keys and their values.

getParametersList() → list[str]

Get a list of all parameter names.

Returns

list[str]

list containing the names of all parameters.

hideButtons() → None

Hide all buttons.

hideIOButtons() → None

Hide the settings I/O buttons.

classmethod isDarkMode() → bool

Checks if the system is currently in dark mode.

Returns

bool

True if dark mode is detected, False otherwise.

classmethod isLightMode() → bool

Checks if the system is currently in light mode.

Returns

bool

True if light mode is detected, False otherwise.

loadSettings() → None

Open a dialog to load settings from a custom XML file.

resetSettings(filename: str = '', default: bool = False) → None

Reset the settings to their default values from a settings file.

Parameters

filenamestr (optional)

Path to a custom settings file. If empty (default), uses the user’s default settings (~/.PySisyphe/settings.xml).

default : bool (optional)

  • If True, loads from the application’s default settings file, ignoring filename.

  • If False (default), loads from the user’s settings file (~/.PySisyphe/settings.xml) or the custom settings file.

saveAsSettings() → None

Open a dialog to save the current settings to a custom XML file.

saveSettings() → None

Save the current settings to the user’s default settings file (~/.PySisyphe/settings.xml).

setButtonsVisibility(v: bool) → None

Set the visibility of all buttons.

Parameters

vbool

True to show the buttons, False to hide them.

setFontSize(v: int) → None

Set the font size for the widget and its children.

Parameters

vint

font point size.

setIOButtonsVisibility(v: bool) → None

Set the visibility of the settings I/O buttons (Reset, Load, Save, Save As).

Parameters

vbool

True to show the I/O buttons, False to hide them.

setParameterValue(parameter: str, v: Any) → None

Set the value of a specific parameter widget.

Parameters

parameterstr

name of the parameter.

vAny

new value to set.

setParameterVisibility(parameter: str, v: bool) → None

Set the visibility of a specific parameter widget and its label.

Parameters

parameterstr

name of the parameter.

vbool

True to show the widget, False to hide it.

setParametersFromDict(d: dict[str, Any]) → None

Set parameter values from a dictionary.

Parameters

ddict[str, Any]

dictionary with parameter names as keys and their new values.

setSettingsButtonDefaultText() → None

Reset the settings button text to its default value (‘Settings…’). This button is used to toggle visibility of the parameters.

setSettingsButtonFunctionText() → None

Set the settings button text based on the function name. This button is used to toggle visibility of the parameters.

setSettingsButtonText(txt: str) → None

Set the text of the settings button. This button is used to toggle visibility of the parameters.

Parameters

txtstr

new text for the button.

settingsVisibilityOff(signal: bool = True) → None

Hide the settings box if it is visible.

Parameters

signalbool

emit VisibilityToggled Qt signal if signal is True.

settingsVisibilityOn(signal: bool = True) → None

Show the settings box if it is not visible.

Parameters

signalbool

emit VisibilityToggled Qt signal if signal is True.

showButtons() → None

Show all buttons.

showIOButtons() → None

Show the settings I/O buttons.

toggleSettingsVisibility(signal: bool = True) → None

Toggle the visibility of the settings box.

Parameters

signalbool

emit VisibilityToggled Qt signal if signal is True.

class Sisyphe.widgets.functionsSettingsWidget.FunctionSettingsWidget(function: str, parent: QWidget | None = None)

FunctionSettingsWidget class

Description

Widget to manage function settings from an XML file (functions.xml).

Inheritance

QWidget -> SettingsWidget -> FunctionSettingsWidget

Creation: 11/08/2022

classSisypheSettings

alias of SisypheFunctionsSettings

class Sisyphe.widgets.functionsSettingsWidget.DialogSettingsWidget(function: str, parent: QWidget | None = None)

DialogSettingsWidget class

Description

Widget to manage dialog window from an XML file (dialog.xml).

Inheritance

QWidget -> SettingsWidget -> DialogSettingsWidget

Creation: 11/08/2022

classSisypheSettings

alias of SisypheDialogsSettings

class Sisyphe.widgets.functionsSettingsWidget.CustomSettingsWidget(filename: str, function: str, parent: QWidget | None = None)

CustomSettingsWidget class

Description

Widget to manage settings from a custom XML file.

Inheritance

QWidget -> SettingsWidget -> DialogSettingsWidget

Creation: 04/11/2025

classSisypheSettings

alias of SisypheCustomSettings