diff --git a/opencore_legacy_patcher/support/defaults.py b/opencore_legacy_patcher/support/defaults.py index 502067714..ea2256f2d 100644 --- a/opencore_legacy_patcher/support/defaults.py +++ b/opencore_legacy_patcher/support/defaults.py @@ -430,6 +430,10 @@ def _load_gui_defaults(self) -> None: continue constants_key = key.replace("GUI:", "") + + if plist[key] == "PYTHON_NONE_VALUE": + plist[key] = None + if hasattr(self.constants, constants_key): logging.info(f"Setting {constants_key} to {plist[key]}") setattr(self.constants, constants_key, plist[key]) \ No newline at end of file diff --git a/opencore_legacy_patcher/wx_gui/gui_settings.py b/opencore_legacy_patcher/wx_gui/gui_settings.py index 89d0bdb45..231c3426f 100644 --- a/opencore_legacy_patcher/wx_gui/gui_settings.py +++ b/opencore_legacy_patcher/wx_gui/gui_settings.py @@ -1106,12 +1106,14 @@ 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) - global_settings.GlobalEnviromentSettings().write_property(f"GUI:{variable}", value) + tmp_value = value or "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}") - global_settings.GlobalEnviromentSettings().write_property(variable, value) + tmp_value = value or "PYTHON_NONE_VALUE" + global_settings.GlobalEnviromentSettings().write_property(variable, tmp_value) if global_setting is not None: self._update_setting(global_setting, value) @@ -1161,12 +1163,12 @@ def on_sip_value(self, event: wx.Event) -> None: if hex(self.sip_value) == "0x0": self.constants.custom_sip_value = None self.constants.sip_status = True - global_settings.GlobalEnviromentSettings().write_property("GUI:custom_sip_value", None) + global_settings.GlobalEnviromentSettings().write_property("GUI:custom_sip_value", "PYTHON_NONE_VALUE") global_settings.GlobalEnviromentSettings().write_property("GUI:sip_status", True) elif hex(self.sip_value) == "0x803": self.constants.custom_sip_value = None self.constants.sip_status = False - global_settings.GlobalEnviromentSettings().write_property("GUI:custom_sip_value", None) + global_settings.GlobalEnviromentSettings().write_property("GUI:custom_sip_value", "PYTHON_NONE_VALUE") global_settings.GlobalEnviromentSettings().write_property("GUI:sip_status", False) else: self.constants.custom_sip_value = hex(self.sip_value) @@ -1228,7 +1230,7 @@ def fu_selection_click(self, event: wx.Event) -> None: self.constants.fu_status = True self.constants.fu_arguments = None global_settings.GlobalEnviromentSettings().write_property("GUI:fu_status", True) - global_settings.GlobalEnviromentSettings().write_property("GUI:fu_arguments", "") + global_settings.GlobalEnviromentSettings().write_property("GUI:fu_arguments", "PYTHON_NONE_VALUE") return if value == "Partial": @@ -1243,7 +1245,7 @@ def fu_selection_click(self, event: wx.Event) -> None: self.constants.fu_status = False self.constants.fu_arguments = None global_settings.GlobalEnviromentSettings().write_property("GUI:fu_status", False) - global_settings.GlobalEnviromentSettings().write_property("GUI:fu_arguments", "") + global_settings.GlobalEnviromentSettings().write_property("GUI:fu_arguments", "PYTHON_NONE_VALUE") def _populate_graphics_override(self, panel: wx.Panel) -> None: