Module provides GUI to edit settings. This GUI may be used by other core modules and by plugins.
Settings dialogue subsystem consists of 3 major entities:
UISettings.ui GUI form. Contains of controls.
*Option classes.
Every object of the class links together control on GUI and option in the config file. It loads its option from config to GUI, and saves from GUI to config.
config may be either enki.core.config.Config or python dictionary
enki.core.uisettings.UISettingsManager. Invokes the dialogue. Emits signals when Plugins shall add own settings to the dialogue and when Plugins shall apply settings
If you need to add own settings to UISettings dialog, you should:
Base class for all Options. Every class knows control on UISettings form, configuration option name, and can load/save the option
Do not create dirrectly, use *Option classes
Load the value from config to GUI. To be implemented by child classes
Save the value from GUI to config. To be implemented by child classes
Bases: enki.core.uisettings.Option
Bool option.
Control may be QCheckBox, QGroupBox or other control, which has .isChecked() and .setChecked()
Load the value from config to GUI
Save the value from GUI to config
Bases: enki.core.uisettings.Option
Text option
Control may be QLineEdit
Load the value from config to GUI
Save the value from GUI to config
Bases: enki.core.uisettings.Option
List of strings. One item per line.
Control may be QPlainTextEdit
Load the value from config to GUI
Save the value from GUI to config
Bases: enki.core.uisettings.Option
Numeric option.
Control may be QSlider or other control, which has .value() and .setValue() methods
Load the value from config to GUI
Save the value from GUI to config
Bases: enki.core.uisettings.Option
Color option
Control must be enki.widgets.ColorButton
Load the value from config to GUI
Save the value from GUI to config
Bases: enki.core.uisettings.Option
Font option.
Option has 2 controls:
This option opens Font dialogue automatically, when button has been clicked
Load the value from config to GUI
Save the value from GUI to config
Bases: enki.core.uisettings.Option
This option allows to choose value from few possible.
It is presented as set of QRadioButton’s
controlToValue dictionary contains mapping checked radio button name: option value
Load the value from config to GUI
Save the value from GUI to config
Bases: QDialog
Settings dialog widget
Append page to the tree. Called by a plugin for creating own page. Example:
widget = MitSchemeSettings(dialog)
dialog.appendPage(u"Modes/MIT Scheme", widget, QIcon(':/enkiicons/languages/scheme.png'))
Bases: QObject
Add to the main menu Settings->Settings action and execute settings dialogue
aboutToExecute(enki.core.uisettings.UISettings)
Signal emitted, when dialog is about to be executed. Plugins shall add own settings to the dialogue
accepted()
Signal emitted, when dialog has been accepted. Plugins shall save and apply settings