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 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

Edit the diagramm

GUI dialog invocation workflow

  1. Enki starts. Each plugin connects themselves to UISettingsManager.aboutToExecute

  2. An user clicks Settings->Settings

  3. UISettings.ui are created

  4. enki.core.uisettings.UISettingsManager emits aboutToExecute

  5. Each plugins adds own options to the dialogue

  6. Each option loads its value from the enki.core.config.Config

  7. The user edits settigns

  8. The user clicks OK

  9. Each option writes it’s new value to the config

  10. enki.core.uisettings.UISettingsManager emits dialogAccepted

  11. Each plugin applies own settings

Adding new settings

If you need to add own settings to UISettings dialog, you should:

  1. Connect to UISettingsManager.aboutToExecute and UISettingsManager.dialogAccepted

  2. 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)

  3. Create *Option class instance for every configurable option on UISettingsManager.aboutToExecute

Classes

Main classes:
  • enki.core.uisettings.UISettings - settings dialogue. Created when shall be executed

  • enki.core.uisettings.UISettingsManager - manager. Exists always

Option types:
  • enki.core.uisettings.CheckableOption - bool option, CheckBox

  • enki.core.uisettings.TextOption - string option, line edit

  • enki.core.uisettings.ListOnePerLineOption - list of strings option, text edit

  • enki.core.uisettings.NumericOption - numeric option, any numeric control

  • enki.core.uisettings.ColorOption - color option, button

  • enki.core.uisettings.FontOption - font option, button

  • enki.core.uisettings.ChoiseOption - string from the set option, combo box