install.py: Resolve error handling in GUI

This commit is contained in:
Mykola Grymalyuk
2022-02-06 10:16:59 -07:00
parent e2aa6b4b48
commit 4d8aa1a541
2 changed files with 12 additions and 4 deletions

View File

@@ -168,9 +168,13 @@ Please build OpenCore first!"""
# cancelled prompt
return
else:
utilities.TUIOnlyPrint(
["Copying OpenCore"], "Press [Enter] to go back.\n", ["An error occurred!"] + result.stderr.decode().split("\n") + ["", "Please report this to the devs at GitHub."]
).start()
if self.constants.gui_mode is False:
utilities.TUIOnlyPrint(
["Copying OpenCore"], "Press [Enter] to go back.\n", ["An error occurred!"] + result.stderr.decode().split("\n") + [""]
).start()
else:
print("An error occurred!")
print(result.stderr.decode().split("\n") + [""])
return
partition_info = plistlib.loads(subprocess.run(f"diskutil info -plist {full_disk_identifier}".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
parent_disk = partition_info["ParentWholeDisk"]
@@ -242,7 +246,10 @@ Please build OpenCore first!"""
print("\nPress [Enter] to continue.\n")
input()
else:
utilities.TUIOnlyPrint(["Copying OpenCore"], "Press [Enter] to go back.\n", ["EFI failed to mount!", "Please report this to the devs at GitHub."]).start()
if self.constants.gui_mode is False:
utilities.TUIOnlyPrint(["Copying OpenCore"], "Press [Enter] to go back.\n", ["EFI failed to mount!"]).start()
else:
print("EFI failed to mount!")
def rmtree_handler(func, path, exc_info):
if exc_info[0] == FileNotFoundError:

View File

@@ -16,6 +16,7 @@ class OpenCoreLegacyPatcher:
self.generate_base_data()
if utilities.check_cli_args() is None:
if launch_gui is True:
utilities.disable_cls()
from gui import gui_main
gui_main.wx_python_gui(self.constants)
else: