GUI: Wait for payloads.dmg mount

This commit is contained in:
Mykola Grymalyuk
2023-05-07 12:23:57 -06:00
parent 1204daa330
commit 4068bc1661
4 changed files with 36 additions and 0 deletions

View File

@@ -79,6 +79,9 @@ class BuildFrame(wx.Frame):
def _invoke_build(self):
while gui_support.PayloadMount(self.constants, self).is_unpack_finished() is False:
wx.Yield()
thread = threading.Thread(target=self._build)
thread.start()

View File

@@ -20,6 +20,7 @@ class SupportedEntryPoints:
MAIN_MENU = gui_main_menu.MainMenu
BUILD_OC = gui_build.BuildFrame
INSTALL_OC = gui_install_oc.InstallOCFrame
SYS_PATCH = gui_sys_patch.SysPatchMenu
class EntryPoint:

View File

@@ -6,14 +6,43 @@ import logging
import subprocess
from pathlib import Path
from resources import constants
class PayloadMount:
def __init__(self, global_constants: constants.Constants, frame: wx.Frame) -> None:
self.constants: constants.Constants = global_constants
self.frame: wx.Frame = frame
def is_unpack_finished(self):
if self.constants.unpack_thread.is_alive():
return False
if Path(self.constants.payload_kexts_path).exists():
return True
# Raise error to end program
popup = wx.MessageDialog(
self.frame,
f"During unpacking of our internal files, we seemed to have encountered an error.\n\nIf you keep seeing this error, please try rebooting and redownloading the application.",
"Internal Error occurred!",
style = wx.OK | wx.ICON_EXCLAMATION
)
popup.ShowModal()
self.frame.Freeze()
sys.exit(1)
class ThreadHandler(logging.Handler):
def __init__(self, text_box: wx.TextCtrl):
logging.Handler.__init__(self)
self.text_box = text_box
def emit(self, record):
wx.CallAfter(self.text_box.AppendText, self.format(record) + '\n')

View File

@@ -336,6 +336,9 @@ class SysPatchMenu(wx.Frame):
def start_root_patching(self, patches: dict):
logging.info("Starting root patching")
while gui_support.PayloadMount(self.constants, self).is_unpack_finished() is False:
wx.Yield()
if patches["Settings: Kernel Debug Kit missing"] is True:
if self._kdk_download(self) is False:
self.on_return_to_main_menu()