uisettings — Settings dialogue¶
Module provides GUI to edit settings. This GUI may be used by other core modules and by plugins.
Conception¶
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 dictionaryenki.core.uisettings.UISettingsManager
. Invokes the dialogue. Emits signals when Plugins shall add own settings to the dialogue and when Plugins shall apply settings
GUI dialog invocation workflow¶
Enki starts. Each plugin connects themselves to UISettingsManager.aboutToExecute
An user clicks Settings->Settings
UISettings.ui are created
enki.core.uisettings.UISettingsManager
emits aboutToExecuteEach plugins adds own options to the dialogue
Each option loads its value from the
enki.core.config.Config
The user edits settigns
The user clicks OK
Each option writes it’s new value to the config
enki.core.uisettings.UISettingsManager
emits dialogAcceptedEach plugin applies own settings
Adding new settings¶
If you need to add own settings to UISettings dialog, you should:
Connect to UISettingsManager.aboutToExecute and UISettingsManager.dialogAccepted
Add controls to the dialog. You may edit UISettings.ui or add your controls dynamically during dialog creation (connect to UISettingsManager.aboutToExecute for adding dynamically)
Create *Option class instance for every configurable option on UISettingsManager.aboutToExecute
Classes¶
- Main classes:
enki.core.uisettings.UISettings
- settings dialogue. Created when shall be executedenki.core.uisettings.UISettingsManager
- manager. Exists always
- Option types:
enki.core.uisettings.CheckableOption
- bool option, CheckBoxenki.core.uisettings.TextOption
- string option, line editenki.core.uisettings.ListOnePerLineOption
- list of strings option, text editenki.core.uisettings.NumericOption
- numeric option, any numeric controlenki.core.uisettings.ColorOption
- color option, buttonenki.core.uisettings.FontOption
- font option, buttonenki.core.uisettings.ChoiseOption
- string from the set option, combo box