Fix plugins not loading properly after restart of app

This commit is contained in:
Raffson 2023-03-18 00:52:11 +01:00
parent f3241c286c
commit 918903f831
No known key found for this signature in database
GPG Key ID: B0402B2C9B764D99
2 changed files with 6 additions and 7 deletions

View File

@ -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:

View File

@ -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)