The Pytigon desktop client uses a plugin system to extend functionality without modifying core code.
Plugins are Python modules that are dynamically discovered, downloaded, and initialized at application startup.
The plugin system searches three directories:
- pytigon_path/appdata/plugins/ — Built-in plugins
- data_path/plugins/ — User-installed plugins
- cwd/plugins/ — Application-specific plugins
Plugins in an auto/ subdirectory or listed in auto_plugins configuration are loaded automatically at startup. Manual plugins can be loaded on demand.
Each plugin module can expose an init_plugin(app, frame, panels) function:
def init_plugin(app, frame, panels):
"""Called when the plugin is loaded.
Args:
app: The wx.App instance
frame: The main application frame
panels: Available panel containers
"""
# Register custom controls, toolbar buttons, or modify the UI
pass
/schsys/plugins/<plugin>/ endpointplugins_cache/Plugins can:
- Register custom controls — Add new wxPython widgets or modify existing ones via the guictrl.factory system
- Add toolbar buttons — Extend toolbars with custom actions
- Modify namespace — Dynamically extend guictrl.ctrl namespace (e.g., HTML2 viewer class is set by webview plugins like cef or wxwebview)
- Create child pages — new_plugin_child_page() creates dynamic notebook pages from plugin data
- Handle events — Connect to the signal/event system
Plugin names are parsed from configuration data rows with data == "plugins". Values are semicolon-separated plugin paths, e.g.:
standard/keymap;standard/install
This sets app.plugins with the list of active plugins.
Use import_plugin() from guilib.tools to dynamically load plugins by dotted module name:
from pytigon_gui.guilib.tools import import_plugin
my_plugin = import_plugin('plugins.my_plugin')