Module pluginconf.gui

PySimpleGUI window to populate config dict via plugin options

config window

Functions

def option_entry(opt, config)

widgets for single config option

def plugin_entry(pmd, plugin_states)

checkbox for plugin name

def plugin_layout(pmd_list, config, plugin_states, opt_label=False)

craft list of widgets: *( plugin_entry(), *option_entry() )

def read_options(files)

read files, return dict of {id:pmd} for all plugins

def window(config, plugin_states, files=['*/*.py'], **kwargs)

Reads *.py files and crafts a settings dialog from meta data.

Where plugin_states{} is usually an entry in config{} itself. Depending on plugin and option names, it might even be a flat/shared namespace for both. Per default you'd set files=["plugins/*.py", __file__] to be read. But with files=[] it's possible to provide a plugins=pluginconf.get_plugin_meta() or prepared plugin/options dict instead.

Params
config dict 🔁 Config settings, updated after dialog completion
plugin_states dict 🔁 Plugin activation states, also input/output
files list Glob list of *.py files to extract meta definitions from
plugins dict Alternatively to files=[] list, a preparsed list of pluginmeta+config dicts can be injected
opt_label bool Show config name= as label (instead of description)
theme str Set PSG window theme.
**kwargs dict Other options are passed on to PySimpleGUI
Returns True if updated config{} values should be [Saved]
def wrap(text, width=50)

textwrap for description and help option fields

Classes

class Cast

map option types (from strings)

Static methods

def bool(val)

map boolean literals

def fromtype(val, opt)

cast according to option type

def int(val)

verify integer