Skip to content

Commit

Permalink
gui_settings.py: Fix typing for boolean values
Browse files Browse the repository at this point in the history
  • Loading branch information
khronokernel committed Nov 3, 2024
1 parent bb56544 commit 2a57873
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# OpenCore Legacy Patcher changelog

## 2.1.1
- Resolve boolean GUI settings saving incorrectly as Python's None type

## 2.1.0
- Disable FeatureUnlock by default
- Intended to maintain long term stability
Expand Down
2 changes: 1 addition & 1 deletion opencore_legacy_patcher/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
class Constants:
def __init__(self) -> None:
# Patcher Versioning
self.patcher_version: str = "2.1.0" # OpenCore-Legacy-Patcher
self.patcher_version: str = "2.1.1" # OpenCore-Legacy-Patcher
self.patcher_support_pkg_version: str = "1.8.4" # PatcherSupportPkg
self.copyright_date: str = "Copyright © 2020-2024 Dortania"
self.patcher_name: str = "OpenCore Legacy Patcher"
Expand Down
8 changes: 6 additions & 2 deletions opencore_legacy_patcher/wx_gui/gui_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -1115,13 +1115,17 @@ def on_spinctrl(self, event: wx.Event, label: str) -> None:
def _update_setting(self, variable, value):
logging.info(f"Updating Local Setting: {variable} = {value}")
setattr(self.constants, variable, value)
tmp_value = value or "PYTHON_NONE_VALUE"
tmp_value = value
if tmp_value is None:
tmp_value = "PYTHON_NONE_VALUE"
global_settings.GlobalEnviromentSettings().write_property(f"GUI:{variable}", tmp_value)


def _update_global_settings(self, variable, value, global_setting = None):
logging.info(f"Updating Global Setting: {variable} = {value}")
tmp_value = value or "PYTHON_NONE_VALUE"
tmp_value = value
if tmp_value is None:
tmp_value = "PYTHON_NONE_VALUE"
global_settings.GlobalEnviromentSettings().write_property(variable, tmp_value)
if global_setting is not None:
self._update_setting(global_setting, value)
Expand Down

0 comments on commit 2a57873

Please sign in to comment.