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
+11 -4
View File
@@ -168,9 +168,13 @@ Please build OpenCore first!"""
# cancelled prompt # cancelled prompt
return return
else: else:
utilities.TUIOnlyPrint( if self.constants.gui_mode is False:
["Copying OpenCore"], "Press [Enter] to go back.\n", ["An error occurred!"] + result.stderr.decode().split("\n") + ["", "Please report this to the devs at GitHub."] utilities.TUIOnlyPrint(
).start() ["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 return
partition_info = plistlib.loads(subprocess.run(f"diskutil info -plist {full_disk_identifier}".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()) 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"] parent_disk = partition_info["ParentWholeDisk"]
@@ -242,7 +246,10 @@ Please build OpenCore first!"""
print("\nPress [Enter] to continue.\n") print("\nPress [Enter] to continue.\n")
input() input()
else: 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): def rmtree_handler(func, path, exc_info):
if exc_info[0] == FileNotFoundError: if exc_info[0] == FileNotFoundError:
+1
View File
@@ -16,6 +16,7 @@ class OpenCoreLegacyPatcher:
self.generate_base_data() self.generate_base_data()
if utilities.check_cli_args() is None: if utilities.check_cli_args() is None:
if launch_gui is True: if launch_gui is True:
utilities.disable_cls()
from gui import gui_main from gui import gui_main
gui_main.wx_python_gui(self.constants) gui_main.wx_python_gui(self.constants)
else: else: