# sas.qtgui.Utilities.Preferences package

## Subpackages

- sas.qtgui.Utilities.Preferences.UI package
  - Submodules
  - sas.qtgui.Utilities.Preferences.UI.PreferencesUI module
    - `Ui_preferencesUI`
      - `Ui_preferencesUI.retranslateUi()`
      - `Ui_preferencesUI.setupUi()`
  - Module contents

## Submodules

## sas.qtgui.Utilities.Preferences.DisplayPreferencesWidget module

class sas.qtgui.Utilities.Preferences.DisplayPreferencesWidget.DisplayPreferencesWidget

  Bases: `PreferencesWidget`

  staticMetaObject = PySide6.QtCore.QMetaObject("DisplayPreferencesWidget" inherits "PreferencesWidget": )

## sas.qtgui.Utilities.Preferences.PlottingPreferencesWidget module

class sas.qtgui.Utilities.Preferences.PlottingPreferencesWidget.PlottingPreferencesWidget

  Bases: `PreferencesWidget`

  staticMetaObject = PySide6.QtCore.QMetaObject("PlottingPreferencesWidget" inherits "PreferencesWidget": )

## sas.qtgui.Utilities.Preferences.PreferencesPanel module

class sas.qtgui.Utilities.Preferences.PreferencesPanel.PreferencesPanel(parent: Any | None = None)

  Bases: `QDialog`, `Ui_preferencesUI`

  A preferences panel to house all SasView related settings. The left side of the window is a listWidget with a options menus available. The right side of the window is a stackedWidget object that houses the options associated with each listWidget item.

  addWidget(widget: QWidget, name: str | None = None)

    Add a single widget to the panel

  addWidgets(widgets: dict[str, Callable])

    Add a list of named widgets to the window

  close()

    Save the configuration values when the preferences window is closed

  closeEvent(event)

    Capture all window close events and ensure the window is in a base state

  help()

    Open the help window associated with the preferences window

  prefMenuChanged()

    When the preferences menu selection changes, change to the appropriate preferences widget

  registerPerspectivePreferences(perspective: Perspective)

    Register preferences from a perspective

  restoreDefaultPreferences()

    Reset preferences for the active widget to the default values.

  setMenuByName(name: str)

    Set the index of the listWidget and stackedWidget, using the display name as the search term

  setWidgetIndex(row: int)

    Set the menu and options stack to a given index

  set_invalid_input(key: str)

    Widgets should call this if an input is invalid to disable the ‘OK’ and ‘Apply’ buttons.

  stageSingleChange(key: str, value: str | bool | float | int | list[str | float | int], config_restart_message: str | None = '')

    Preferences widgets should call this method when changing a variable to prevent direct configuration changes

  staticMetaObject = PySide6.QtCore.QMetaObject("PreferencesPanel" inherits "QDialog": )
  unStageSingleChange(key: str, config_restart_message: str | None = '')

    Preferences widgets should call this method when removing an invalid value from the staged changes.

  unset_invalid_input(key: str)

    Remove the key from the invalid staged values, if necessary

sas.qtgui.Utilities.Preferences.PreferencesPanel.restart_main()

## sas.qtgui.Utilities.Preferences.PreferencesWidget module

class sas.qtgui.Utilities.Preferences.PreferencesWidget.PrefDoubleValidator

  Bases: `QDoubleValidator`

  Override the base validator class to return a floating point value when validated.

  fixup(input: str) → None
  staticMetaObject = PySide6.QtCore.QMetaObject("PrefDoubleValidator" inherits "QDoubleValidator": )
  validate(arg__1: str, arg__2: int)

class sas.qtgui.Utilities.Preferences.PreferencesWidget.PrefFloatEdit(parent)

  Bases: `QLineEdit`

  staticMetaObject = PySide6.QtCore.QMetaObject("PrefFloatEdit" inherits "QLineEdit": )
  text()

class sas.qtgui.Utilities.Preferences.PreferencesWidget.PrefIntEdit(parent)

  Bases: `QLineEdit`

  staticMetaObject = PySide6.QtCore.QMetaObject("PrefIntEdit" inherits "QLineEdit": )
  text()

class sas.qtgui.Utilities.Preferences.PreferencesWidget.PreferencesWidget(name: str, build_gui=True)

  Bases: `QWidget`

  A helper class that bundles all values needed to add a new widget to the preferences panel

  addCheckBox(title: str, checked: bool | None = False) → QCheckBox

    Add a title and check box within the widget. :param title: The title of the check box to be added to the preferences panel. :param checked: An optional boolean value to specify if the check box is checked. Defaults to unchecked. :return: QCheckBox instance to allow subclasses to assign instance name

  addComboBox(title: str, params: list[str | int | float], default: str | None = None) → QComboBox

    Add a title and combo box within the widget. :param title: The title of the combo box to be added to the preferences panel. :param params: A list of options to be added to the combo box. :param default: The default option to be selected in the combo box. The first item is selected if None. :return: QComboBox instance to allow subclasses to assign instance name

  addFloatInput(title: str, default_number: int | None = 0) → QLineEdit

    Similar to the text input creator, this creates a text input with an float validator assigned to it. :param title: The title of the text box to be added to the preferences panel. :param default_number: An optional value to be put within the text box as a default. Defaults to an empty string. :return: QLineEdit instance to allow subclasses to assign instance name

  addHeaderText(text: str)

    Add a static text box to the widget, likely as a heading to separate options :param text: The title of the check box to be added to the preferences panel.

  addHorizontalLine()

    Add a horizontal line as a divider.

  addIntegerInput(title: str, default_number: int | None = 0) → QLineEdit

    Similar to the text input creator, this creates a text input with an integer validator assigned to it. :param title: The title of the text box to be added to the preferences panel. :param default_number: An optional value to be put within the text box as a default. Defaults to an empty string. :return: QLineEdit instance to allow subclasses to assign instance name

  addTextInput(title: str, default_text: str | None = '') → QLineEdit

    Add a title and text box within the widget. :param title: The title of the text box to be added to the preferences panel. :param default_text: An optional value to be put within the text box as a default. Defaults to an empty string. :return: QLineEdit instance to allow subclasses to assign instance name

  applyNonConfigValues()

    Applies values that aren’t stored in config. Only widgets that require this need to override this method.

  restoreDefaults()

    Generic method to restore all default values for the widget.

  restoreGUIValuesFromConfig()

    A generic method that blocks all signalling, and restores the GUI values from the config file. Called when staging is cancelled or defaults should be restored.

  staticMetaObject = PySide6.QtCore.QMetaObject("PreferencesWidget" inherits "QWidget": )

class sas.qtgui.Utilities.Preferences.PreferencesWidget.QHLine

  Bases: `QFrame`

  ::CRUFT:: This creates a horizontal line in PyQt5. PyQt6 QFrame has finer shape control

  staticMetaObject = PySide6.QtCore.QMetaObject("QHLine" inherits "QFrame": )

sas.qtgui.Utilities.Preferences.PreferencesWidget.cb_replace_all_items_with_new(cb: QComboBox, new_items: list[str], default_item: str | None = None)

  Helper method that removes existing ComboBox values, replaces them and sets a default item, if defined :param cb: A QComboBox object :param new_items: A list of strings that will be used to populate the QComboBox :param default_item: The value to set the QComboBox to, if set

## Module contents