wx_gui: Destroy frame on root patching

This commit is contained in:
Mykola Grymalyuk
2024-05-27 17:27:58 -06:00
parent c645f57572
commit d613581faa
3 changed files with 29 additions and 14 deletions

View File

@@ -920,13 +920,16 @@ class PatchSysVolume:
return
logging.info("- Verifying whether Root Patching possible")
if sys_patch_detect.DetectRootPatch(self.computer.real_model, self.constants).verify_patch_allowed(print_errors=not self.constants.wxpython_variant) is True:
logging.info("- Patcher is capable of patching")
if self._check_files():
if self._mount_root_vol() is True:
self._patch_root_vol()
else:
logging.info("- Recommend rebooting the machine and trying to patch again")
if sys_patch_detect.DetectRootPatch(self.computer.real_model, self.constants).verify_patch_allowed(print_errors=not self.constants.wxpython_variant) is False:
logging.error("- Cannot continue with patching!!!")
return
logging.info("- Patcher is capable of patching")
if self._check_files():
if self._mount_root_vol() is True:
self._patch_root_vol()
else:
logging.info("- Recommend rebooting the machine and trying to patch again")
def start_unpatch(self) -> None:
@@ -935,8 +938,11 @@ class PatchSysVolume:
"""
logging.info("- Starting Unpatch Process")
if sys_patch_detect.DetectRootPatch(self.computer.real_model, self.constants).verify_patch_allowed(print_errors=True) is True:
if self._mount_root_vol() is True:
self._unpatch_root_vol()
else:
logging.info("- Recommend rebooting the machine and trying to patch again")
if sys_patch_detect.DetectRootPatch(self.computer.real_model, self.constants).verify_patch_allowed(print_errors=True) is False:
logging.error("- Cannot continue with unpatching!!!")
return
if self._mount_root_vol() is True:
self._unpatch_root_vol()
else:
logging.info("- Recommend rebooting the machine and trying to patch again")

View File

@@ -33,6 +33,9 @@ class SysPatchMount:
If none, failed to mount.
"""
result = self._mount_root_volume()
if result is None:
logging.error("Failed to mount root volume")
return None
if not Path(result).exists():
logging.error(f"Attempted to mount root volume, but failed: {result}")
return None

View File

@@ -253,8 +253,11 @@ class SysPatchDisplayFrame(wx.Frame):
global_constants=self.constants,
patches=patches,
)
self.frame_modal.Hide()
self.frame_modal.Destroy()
self.frame.Hide()
self.frame.Destroy()
frame.start_root_patching()
self.on_return_dismiss() if self.init_with_parent else self.on_return_to_main_menu()
def on_revert_root_patching(self, patches: dict):
@@ -264,8 +267,11 @@ class SysPatchDisplayFrame(wx.Frame):
global_constants=self.constants,
patches=patches,
)
self.frame_modal.Hide()
self.frame_modal.Destroy()
self.frame.Hide()
self.frame.Destroy()
frame.revert_root_patching()
self.on_return_dismiss() if self.init_with_parent else self.on_return_to_main_menu()
def on_return_to_main_menu(self, event: wx.Event = None):