bec_widgets.utils.settings_dialog#

Classes#

SettingWidget

Abstract class for a settings widget to enforce the implementation of the accept_changes and display_current_settings.

SettingsDialog

Dialog to display and edit the settings of a widget with accept and cancel buttons.

Module Contents#

class SettingWidget(parent=None, *args, **kwargs)#

Bases: qtpy.QtWidgets.QWidget

Abstract class for a settings widget to enforce the implementation of the accept_changes and display_current_settings. Can be used for toolbar actions to display the settings of a widget.

Parameters:

target_widget (QWidget) – The widget that the settings will be taken from and applied to.

accept_changes()#

Accepts the changes made in the settings widget and applies them to the target widget.

cleanup()#

Cleanup the settings widget.

closeEvent(event: qtpy.QtGui.QCloseEvent) None#
display_current_settings(config_dict: dict)#

Displays the current settings of the target widget in the settings widget.

Parameters:

config_dict (dict) – The current settings of the target widget.

set_target_widget(target_widget: qtpy.QtWidgets.QWidget)#
target_widget = None#
class SettingsDialog(parent=None, settings_widget: SettingWidget = None, window_title: str = 'Settings', config: dict = None, modal: bool = False, *args, **kwargs)#

Bases: qtpy.QtWidgets.QDialog

Dialog to display and edit the settings of a widget with accept and cancel buttons.

Parameters:
  • parent (QWidget) – The parent widget of the dialog.

  • target_widget (QWidget) – The widget that the settings will be taken from and applied to.

  • settings_widget (SettingWidget) – The widget that will display the settings.

accept()#

Accept the changes made in the settings widget and close the dialog.

apply_changes()#

Apply the changes made in the settings widget without closing the dialog.

cleanup()#

Cleanup the dialog.

closeEvent(event)#
reject()#

Reject the changes made in the settings widget and close the dialog.

apply_button#
button_box#
layout#
widget = None#