diff --git a/game/plugins/luaplugin.py b/game/plugins/luaplugin.py index 586204e1..cd61d380 100644 --- a/game/plugins/luaplugin.py +++ b/game/plugins/luaplugin.py @@ -131,7 +131,6 @@ class LuaPlugin(PluginSettings): def __init__(self, definition: LuaPluginDefinition) -> None: self.definition = definition super().__init__(self.definition.identifier, self.definition.enabled_by_default) - self.enabled = self.definition.enabled_by_default @property def name(self) -> str: @@ -145,6 +144,10 @@ class LuaPlugin(PluginSettings): def options(self) -> List[LuaPluginOption]: return self.definition.options + @property + def enabled(self) -> bool: + return type(self.value) == bool and self.value + @classmethod def from_json(cls, name: str, path: Path) -> Optional[LuaPlugin]: try: @@ -155,10 +158,6 @@ class LuaPlugin(PluginSettings): return cls(definition) - def set_enabled(self, enabled: bool) -> None: - self.set_value(enabled) - self.enabled = enabled - def set_settings(self, settings: Settings) -> None: super().set_settings(settings) for option in self.definition.options: diff --git a/qt_ui/windows/settings/plugins.py b/qt_ui/windows/settings/plugins.py index 19cbc641..8d12b6d6 100644 --- a/qt_ui/windows/settings/plugins.py +++ b/qt_ui/windows/settings/plugins.py @@ -28,8 +28,8 @@ class PluginsBox(QGroupBox): layout.addWidget(QLabel(plugin.name), row, 0) checkbox = QCheckBox() - checkbox.setChecked(plugin.enabled) - checkbox.toggled.connect(plugin.set_enabled) + checkbox.setChecked(plugin.get_value) + checkbox.toggled.connect(plugin.set_value) layout.addWidget(checkbox, row, 1)