wonambi.widgets.settings module

Large and simple widget to indicate settings/Settings.

class wonambi.widgets.settings.Config(widget, update_widget)[source]

Bases: QWidget

Base class for widgets used in the Settings.

Parameters:
  • widget (str) – name of the widget

  • update_widget (function) – function to run to update the main window with new values

modified

if the preference widget has been changed

Type:

bool

value

dictionary with the actual current values

Type:

dict

index

dictionary with the instances of the small widgets

Type:

dict

Notes

You’ll need to implement create_config with the QGroupBox and layouts

create_config()[source]

Placeholder: it’ll be replaced with actual layout.

create_indices(value_names)[source]

Create empty indices as None. They’ll be created by create_config.

create_values(value_names)[source]

Read original values from the settings or the defaults.

Parameters:

value_names (list of str) – list of value names to read

Returns:

dict – dictionary with the value names as keys

get_values()[source]

Get values from the GUI and save them in preference file.

put_values()[source]

Put values to the GUI.

Notes

In addition, when one small widget has been changed, it calls set_modified, so that we know that the preference widget was modified.

set_modified()[source]

Simply mark that the preference widget was modified.

Notes

You cannot use lambda because they don’t accept assignments.

class wonambi.widgets.settings.ConfigUtils(update_widget)[source]

Bases: Config

create_config()[source]

Placeholder: it’ll be replaced with actual layout.

class wonambi.widgets.settings.HelpDialog[source]

Bases: QDialog

Generic help dialog, showing uneditable HTML text.

create_dialog()[source]
set_text(message)[source]

Insert HTML text.

class wonambi.widgets.settings.Settings(parent)[source]

Bases: QDialog

Window showing the Settings/settings.

Parameters:

parent (instance of QMainWindow) – the main window

button_clicked(button)[source]

Action when button was clicked.

Parameters:

button (instance of QPushButton) – which button was pressed

change_widget(new_row)[source]

Change the widget on the right side.

Parameters:

new_row (int) – index of the widgets

create_settings()[source]

Create the widget, organized in two parts.

Notes

When you add widgets in config, remember to update show_settings too

wonambi.widgets.settings.read_settings(widget, value_name)[source]

Read Settings information, either from INI or from default values.

Parameters:
  • widget (str) – name of the widget

  • value_name (str) – name of the value of interest.

Returns:

multiple types – type depends on the type in the default values. We make it more flexible so that if the default type is int, it accepts float