Plugin Settings¶
For your plugin to have settings, you need to make a SettingsTemplate.yaml file.
SettingsTemplate.yaml¶
The SettingsTemplate.yaml file is how to tell flow what settings to display in the settings menu.
Settings API¶
To access the settings from your plugin, you can use the flogin.plugin.Plugin.settings attribute to get a Settings instance, which you will use to access your plugin’s settings.
Typing¶
To add proper typing to your settings instance, create a subclass of Settings and add your settings. Example:
1from flogin import Settings
2
3class MySettings(Settings):
4 my_setting: str | None
To register your subclass, pass it as a generic argument to your plugin. For example:
1from flogin import Plugin
2from settings import MySettings # import my new settings object
3
4class MyPlugin(Plugin[MySettings]):
5 ...
or as an instance:
1plugin: Plugin[MySettings] = Plugin(...)