mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Fix plugins not loading properly after restart of app
This commit is contained in:
parent
f3241c286c
commit
918903f831
@ -131,7 +131,6 @@ class LuaPlugin(PluginSettings):
|
|||||||
def __init__(self, definition: LuaPluginDefinition) -> None:
|
def __init__(self, definition: LuaPluginDefinition) -> None:
|
||||||
self.definition = definition
|
self.definition = definition
|
||||||
super().__init__(self.definition.identifier, self.definition.enabled_by_default)
|
super().__init__(self.definition.identifier, self.definition.enabled_by_default)
|
||||||
self.enabled = self.definition.enabled_by_default
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self) -> str:
|
def name(self) -> str:
|
||||||
@ -145,6 +144,10 @@ class LuaPlugin(PluginSettings):
|
|||||||
def options(self) -> List[LuaPluginOption]:
|
def options(self) -> List[LuaPluginOption]:
|
||||||
return self.definition.options
|
return self.definition.options
|
||||||
|
|
||||||
|
@property
|
||||||
|
def enabled(self) -> bool:
|
||||||
|
return type(self.value) == bool and self.value
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_json(cls, name: str, path: Path) -> Optional[LuaPlugin]:
|
def from_json(cls, name: str, path: Path) -> Optional[LuaPlugin]:
|
||||||
try:
|
try:
|
||||||
@ -155,10 +158,6 @@ class LuaPlugin(PluginSettings):
|
|||||||
|
|
||||||
return cls(definition)
|
return cls(definition)
|
||||||
|
|
||||||
def set_enabled(self, enabled: bool) -> None:
|
|
||||||
self.set_value(enabled)
|
|
||||||
self.enabled = enabled
|
|
||||||
|
|
||||||
def set_settings(self, settings: Settings) -> None:
|
def set_settings(self, settings: Settings) -> None:
|
||||||
super().set_settings(settings)
|
super().set_settings(settings)
|
||||||
for option in self.definition.options:
|
for option in self.definition.options:
|
||||||
|
|||||||
@ -28,8 +28,8 @@ class PluginsBox(QGroupBox):
|
|||||||
layout.addWidget(QLabel(plugin.name), row, 0)
|
layout.addWidget(QLabel(plugin.name), row, 0)
|
||||||
|
|
||||||
checkbox = QCheckBox()
|
checkbox = QCheckBox()
|
||||||
checkbox.setChecked(plugin.enabled)
|
checkbox.setChecked(plugin.get_value)
|
||||||
checkbox.toggled.connect(plugin.set_enabled)
|
checkbox.toggled.connect(plugin.set_value)
|
||||||
layout.addWidget(checkbox, row, 1)
|
layout.addWidget(checkbox, row, 1)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user