feat: plugins config APIs

This commit is contained in:
peachismomo
2026-07-12 16:55:04 +08:00
parent a00fac9b72
commit ce21a09cb1
8 changed files with 224 additions and 10 deletions
+10
View File
@@ -339,6 +339,16 @@ void bind_python_api(pybind11::module_& m)
"Override to return the custom configuration UI as an HTML string. Only called when\n"
"has_config_ui() is True; an empty result falls back to the default JSON editor.\n"
"Inside the page, use window.orca.getConfig()/saveConfig() to reach this same config.")
.def(
"get_default_config",
[](const PluginCapabilityInterface& self) {
nlohmann::json config = self.get_default_config();
return json_to_py(config); // GIL held (binding body)
},
"Override to return the config that the Config tab's \"Restore defaults\" action writes\n"
"back. Optional: without it the action stores an empty dict, which already restores the\n"
"defaults of a capability that keeps its stored config sparse and applies its own\n"
"defaults on read. Override it to write an explicit starting config instead.")
.def(
"get_config",
[](const PluginCapabilityInterface& self) {