mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-06-21 22:50:51 +10:00
gui_main.py: Add extra error handling for payload unpacking
This commit is contained in:
+21
-4
@@ -108,6 +108,23 @@ class wx_python_gui:
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def is_unpack_finished(self):
|
||||||
|
if not self.constants.unpack_thread.is_alive():
|
||||||
|
if Path(self.constants.payload_path).exists():
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
# Raise error to end program
|
||||||
|
self.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 redownloading the application.",
|
||||||
|
"Internal Error occured!",
|
||||||
|
style = wx.OK | wx.ICON_EXCLAMATION
|
||||||
|
)
|
||||||
|
self.popup.ShowModal()
|
||||||
|
self.frame.Freeze()
|
||||||
|
self.OnCloseFrame(None)
|
||||||
|
return False
|
||||||
|
|
||||||
def pulse_alternative(self, progress_bar):
|
def pulse_alternative(self, progress_bar):
|
||||||
if self.non_metal_required is True:
|
if self.non_metal_required is True:
|
||||||
if progress_bar.GetValue() == 0:
|
if progress_bar.GetValue() == 0:
|
||||||
@@ -565,7 +582,7 @@ class wx_python_gui:
|
|||||||
def build_start(self, event=None):
|
def build_start(self, event=None):
|
||||||
self.build_opencore.Disable()
|
self.build_opencore.Disable()
|
||||||
|
|
||||||
while self.constants.unpack_thread.is_alive():
|
while self.is_unpack_finished() is False:
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
|
|
||||||
build.BuildOpenCore(self.constants.custom_model or self.constants.computer.real_model, self.constants).build_opencore()
|
build.BuildOpenCore(self.constants.custom_model or self.constants.computer.real_model, self.constants).build_opencore()
|
||||||
@@ -1023,7 +1040,7 @@ class wx_python_gui:
|
|||||||
|
|
||||||
self.frame.SetSize(-1, self.progress_bar.GetPosition().y + self.progress_bar.GetSize().height + 60)
|
self.frame.SetSize(-1, self.progress_bar.GetPosition().y + self.progress_bar.GetSize().height + 60)
|
||||||
self.frame.Show()
|
self.frame.Show()
|
||||||
while self.constants.unpack_thread.is_alive():
|
while self.is_unpack_finished() is False:
|
||||||
self.pulse_alternative(self.progress_bar)
|
self.pulse_alternative(self.progress_bar)
|
||||||
wx.GetApp().Yield()
|
wx.GetApp().Yield()
|
||||||
|
|
||||||
@@ -1169,7 +1186,7 @@ class wx_python_gui:
|
|||||||
sys.stdout = menu_redirect.RedirectText(self.text_box, True)
|
sys.stdout = menu_redirect.RedirectText(self.text_box, True)
|
||||||
sys.stderr = menu_redirect.RedirectText(self.text_box, True)
|
sys.stderr = menu_redirect.RedirectText(self.text_box, True)
|
||||||
wx.GetApp().Yield()
|
wx.GetApp().Yield()
|
||||||
while self.constants.unpack_thread.is_alive():
|
while self.is_unpack_finished() is False:
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
try:
|
try:
|
||||||
sys_patch.PatchSysVolume(self.constants.custom_model or self.constants.computer.real_model, self.constants, self.patches).start_unpatch()
|
sys_patch.PatchSysVolume(self.constants.custom_model or self.constants.computer.real_model, self.constants, self.patches).start_unpatch()
|
||||||
@@ -1288,7 +1305,7 @@ class wx_python_gui:
|
|||||||
thread_ia = threading.Thread(target=ia)
|
thread_ia = threading.Thread(target=ia)
|
||||||
thread_ia.start()
|
thread_ia.start()
|
||||||
|
|
||||||
while thread_ia.is_alive() or self.constants.unpack_thread.is_alive():
|
while thread_ia.is_alive() or self.is_unpack_finished() is False:
|
||||||
self.pulse_alternative(self.progress_bar)
|
self.pulse_alternative(self.progress_bar)
|
||||||
wx.GetApp().Yield()
|
wx.GetApp().Yield()
|
||||||
available_installers = self.available_installers
|
available_installers = self.available_installers
|
||||||
|
|||||||
@@ -42,8 +42,6 @@ class reroute_payloads:
|
|||||||
print("- Failed to mount payloads.dmg")
|
print("- Failed to mount payloads.dmg")
|
||||||
print(f"Output: {output.stdout.decode()}")
|
print(f"Output: {output.stdout.decode()}")
|
||||||
print(f"Return Code: {output.returncode}")
|
print(f"Return Code: {output.returncode}")
|
||||||
print("- Exiting...")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
def unmount_active_dmgs(self):
|
def unmount_active_dmgs(self):
|
||||||
# Find all DMGs that are mounted, and forcefully unmount them
|
# Find all DMGs that are mounted, and forcefully unmount them
|
||||||
|
|||||||
Reference in New Issue
Block a user