Skip to content

Config & private data ​

Read and write this plugin's config, small KV state and private data directory.


Reading and writing config ​

python
host.get_plugin_config(plugin_id: str) -> dict
host.set_plugin_config_value(plugin_id: str, key: str, value: Any) -> bool
host.save_plugin_config(plugin_id: str, config_dict: dict) -> bool
  • Keys that are not set are filled in from default in config_schema.
  • set_plugin_config_value / save_plugin_config persist + hot-sync by calling the plugin's update_config(delta).
  • Compatible aliases: getPluginConfig / setPluginConfigValue / savePluginConfig.

Change broadcast contract ​

When config changes, the host broadcasts the pluginConfigChanged(plugin_id) signal on the Qt main thread:

  • Python instance: update_config(delta) is triggered automatically.
  • QML component: you must listen for it with Connections to get seamless hot refresh — bridge.getPluginConfig() is a transient function call, not a reactive property, so reading it once will not update. See UI extensions (QML) for the standard pattern.

Boundaries (important) ​

  • Only read and write this plugin's config; modifying other plugins or the main app's global settings is forbidden.
  • When the host resolves ASR / MT / TTS and saves built-in cloud settings (Hunyuan / MiMo / DashScope / Kokoro), it hot-updates only the official engine's own fields onto the corresponding official plugin. Other plugins only read and write plugins_config/<this plugin id> and will not receive another vendor's api_key / base_url / model etc. A vendor name appearing in a plugin id does not collapse it into an official short name either.
  • An empty string will not wipe a value the plugin already holds in an update_config hot update.

Private data directory ​

python
host.get_plugin_data_dir(plugin_id: str) -> str
  • Path: <install dir>/data/plugins/<plugin_id>/ (created automatically).
  • Does not go through the user's home directory — avoids Chinese usernames / OneDrive redirection skewing the path.
  • Put caches, exported files, local databases and cloned-voice reference audio here.
  • Shortcut: self.get_data_dir() (provided by BasePlugin).

Small KV state ​

python
host.get_plugin_kv(plugin_id: str, key: str, default: Any = None) -> Any
host.set_plugin_kv(plugin_id: str, key: str, value: Any) -> bool
host.delete_plugin_kv(plugin_id: str, key: str) -> bool
  • Persisted in a JSON file; good for small state: window position, recent records, token cache pointer, one-shot flags.
  • Values must be JSON-serialisable; a failed write returns False instead of raising.
  • Do not store large binary blobs / big JSON in KV — use a file in the data directory.

What to store, and where ​

ContentLocation
Config options (user-editable parameters)config_schema + self._config
Small state (position / counters / flags)host.get_plugin_kv()
Caches / exports / data files / reference audioself.get_data_dir()
Model weightsManaged by the host, see Model artifacts

Credentials: never hard-code private keys or personal paths in the plugin; let the user fill them in through config_schema ("type": "password", "is_secret": true).


TransBox — empowering borderless cross-language communication for everyone