gui_main.py: Add disk highlighting during install

This commit is contained in:
Mykola Grymalyuk
2022-04-26 21:24:45 -06:00
parent 4b5f1b4016
commit 3340f10fbd
7 changed files with 78 additions and 4 deletions
+1
View File
@@ -42,6 +42,7 @@
- Streamline GUI relaunch for Root Patch/Unpatch (remembering previous state during patching) - Streamline GUI relaunch for Root Patch/Unpatch (remembering previous state during patching)
- Grey out return buttons while performing sensitive tasks - Grey out return buttons while performing sensitive tasks
- Add `Currently Booted SIP` info to SIP Settings - Add `Currently Booted SIP` info to SIP Settings
- Add Disk Highlighting during Build/Install for previously installed disks
- Remove manual root unpatching - Remove manual root unpatching
- Removed due to reliablity issues - Removed due to reliablity issues
- `bless` based reversion still supported in Big Sur+ - `bless` based reversion still supported in Big Sur+
+7
View File
@@ -16,6 +16,7 @@ Here are some common errors users may experience while using this patcher:
* [No DisplayPort Output on Mac Pros with Nvidia Kepler](#no-displayport-output-on-mac-pros-with-nvidia-kepler) * [No DisplayPort Output on Mac Pros with Nvidia Kepler](#no-displayport-output-on-mac-pros-with-nvidia-kepler)
* [Volume Hash Mismatch Error in macOS Monterey](#volume-hash-mismatch-error-in-macos-monterey) * [Volume Hash Mismatch Error in macOS Monterey](#volume-hash-mismatch-error-in-macos-monterey)
* [Cannot Disable SIP in recoveryOS](#cannot-disable-sip-in-recoveryos) * [Cannot Disable SIP in recoveryOS](#cannot-disable-sip-in-recoveryos)
* [Stuck on "Less than a minute remaining..."](#stuck-on-less-than-a-minute-remaining)
## Stuck on `This version of Mac OS X is not supported on this platform` ## Stuck on `This version of Mac OS X is not supported on this platform`
@@ -135,3 +136,9 @@ For those experiencing issues with USB 1.1 devices (such as mice, keyboards and
Because of this, we recommend placing a USB 2.0/3.0 hub between your devices and the port on the Mac Pro. UHCI and EHCI cannot both be used at once, so using a USB hub will always force the EHCI controller on. Because of this, we recommend placing a USB 2.0/3.0 hub between your devices and the port on the Mac Pro. UHCI and EHCI cannot both be used at once, so using a USB hub will always force the EHCI controller on.
* Alternatively, you can try cold starting the hardware and see if macOS recognizes the UHCI controller properly * Alternatively, you can try cold starting the hardware and see if macOS recognizes the UHCI controller properly
## Stuck on "Less than a minute remaining..."
A common area for systems to get "stuck", namely for units that are missing the `AES` CPU instruction/older mobile hardware. During this stange a lot of heavy cryptography is performed, which can make systems appear to be stuck when in reality they are working quite hard to finish up the installation.
Be patient at this stage, do not manually reboot your machine. This will break the installation and require you to reinstall.
+28 -4
View File
@@ -567,9 +567,26 @@ class wx_python_gui:
) )
self.missing_disks.Centre(wx.HORIZONTAL) self.missing_disks.Centre(wx.HORIZONTAL)
self.color_note = wx.StaticText(self.frame, label="Note: Blue represent the disk OpenCore is currently booted from")
self.color_note.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
self.color_note.SetPosition(
wx.Point(
self.missing_disks.GetPosition().x,
self.missing_disks.GetPosition().y + self.missing_disks.GetSize().height + 5
)
)
self.color_note.Centre(wx.HORIZONTAL)
# Request Disks Present # Request Disks Present
list_disks = install.tui_disk_installation(self.constants).list_disks() list_disks = install.tui_disk_installation(self.constants).list_disks()
if list_disks: if list_disks:
if self.constants.booted_oc_disk is not None:
# disk6s1 -> disk6
disk_root = self.constants.booted_oc_disk.strip("disk")
disk_root = "disk" + disk_root.split("s")[0]
else:
disk_root = None
for disk in list_disks: for disk in list_disks:
# Create a button for each disk # Create a button for each disk
print(f"{list_disks[disk]['disk']} - {list_disks[disk]['name']} - {list_disks[disk]['size']}") print(f"{list_disks[disk]['disk']} - {list_disks[disk]['name']} - {list_disks[disk]['size']}")
@@ -577,21 +594,25 @@ class wx_python_gui:
self.install_button.SetLabel(f"{list_disks[disk]['disk']} - {list_disks[disk]['name']} - {list_disks[disk]['size']}") self.install_button.SetLabel(f"{list_disks[disk]['disk']} - {list_disks[disk]['name']} - {list_disks[disk]['size']}")
self.install_button.SetPosition( self.install_button.SetPosition(
wx.Point( wx.Point(
self.missing_disks.GetPosition().x, self.color_note.GetPosition().x,
self.missing_disks.GetPosition().y + self.missing_disks.GetSize().height + 3 + i self.color_note.GetPosition().y + self.color_note.GetSize().height + 3 + i
) )
) )
self.install_button.Bind(wx.EVT_BUTTON, lambda event, temp=disk: self.install_oc_disk_select(temp, list_disks)) self.install_button.Bind(wx.EVT_BUTTON, lambda event, temp=disk: self.install_oc_disk_select(temp, list_disks))
self.install_button.Centre(wx.HORIZONTAL) self.install_button.Centre(wx.HORIZONTAL)
i += self.install_button.GetSize().height + 3 i += self.install_button.GetSize().height + 3
if disk_root == list_disks[disk]['disk']:
# Set label colour to red
self.install_button.SetForegroundColour((25, 179, 231))
else: else:
# Label: No disks found # Label: No disks found
self.install_button = wx.StaticText(self.frame, label="Failed to find any applicable disks") self.install_button = wx.StaticText(self.frame, label="Failed to find any applicable disks")
self.install_button.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD)) self.install_button.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD))
self.install_button.SetPosition( self.install_button.SetPosition(
wx.Point( wx.Point(
self.missing_disks.GetPosition().x, self.color_note.GetPosition().x,
self.missing_disks.GetPosition().y + self.missing_disks.GetSize().height + 3 self.color_note.GetPosition().y + self.color_note.GetSize().height + 3
) )
) )
self.install_button.Centre(wx.HORIZONTAL) self.install_button.Centre(wx.HORIZONTAL)
@@ -644,6 +665,9 @@ class wx_python_gui:
self.install_button.Bind(wx.EVT_BUTTON, lambda event, temp=partition: self.install_oc_process(temp)) self.install_button.Bind(wx.EVT_BUTTON, lambda event, temp=partition: self.install_oc_process(temp))
self.install_button.Centre(wx.HORIZONTAL) self.install_button.Centre(wx.HORIZONTAL)
i += self.install_button.GetSize().height + 3 i += self.install_button.GetSize().height + 3
if self.constants.booted_oc_disk == list_partitions[partition]['partition']:
# Set label colour to red
self.install_button.SetForegroundColour((25, 179, 231))
self.return_to_main_menu = wx.Button(self.frame, label="Return to Main Menu") self.return_to_main_menu = wx.Button(self.frame, label="Return to Main Menu")
self.return_to_main_menu.SetPosition( self.return_to_main_menu.SetPosition(
+1
View File
@@ -192,6 +192,7 @@ class Constants:
self.allow_nvme_fixing = True # Allow NVMe Kernel Space Patches self.allow_nvme_fixing = True # Allow NVMe Kernel Space Patches
self.disable_xcpm = False # Disable XCPM (X86PlatformPlugin.kext) self.disable_xcpm = False # Disable XCPM (X86PlatformPlugin.kext)
self.root_patcher_succeded = False # Determine if root patcher succeeded self.root_patcher_succeded = False # Determine if root patcher succeeded
self.booted_oc_disk = None # Determine current disk OCLP booted from
self.legacy_accel_support = [ self.legacy_accel_support = [
os_data.os_data.mojave, os_data.os_data.mojave,
+2
View File
@@ -475,6 +475,7 @@ class Computer:
cpu: Optional[CPU] = None cpu: Optional[CPU] = None
oclp_version: Optional[str] = None oclp_version: Optional[str] = None
opencore_version: Optional[str] = None opencore_version: Optional[str] = None
opencore_path: Optional[str] = None
bluetooth_chipset: Optional[str] = None bluetooth_chipset: Optional[str] = None
ambient_light_sensor: Optional[bool] = False ambient_light_sensor: Optional[bool] = False
third_party_sata_ssd: Optional[bool] = False third_party_sata_ssd: Optional[bool] = False
@@ -696,6 +697,7 @@ class Computer:
# OCLP version # OCLP version
self.oclp_version = utilities.get_nvram("OCLP-Version", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=True) self.oclp_version = utilities.get_nvram("OCLP-Version", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=True)
self.opencore_version = utilities.get_nvram("opencore-version", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=True) self.opencore_version = utilities.get_nvram("opencore-version", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=True)
self.opencore_path = utilities.get_nvram("boot-path", "4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102", decode=True)
def cpu_probe(self): def cpu_probe(self):
self.cpu = CPU( self.cpu = CPU(
+1
View File
@@ -30,6 +30,7 @@ class OpenCoreLegacyPatcher:
self.constants.computer = device_probe.Computer.probe() self.constants.computer = device_probe.Computer.probe()
self.constants.recovery_status = utilities.check_recovery() self.constants.recovery_status = utilities.check_recovery()
self.computer = self.constants.computer self.computer = self.constants.computer
self.constants.booted_oc_disk = utilities.find_disk_off_uuid(utilities.clean_device_path(self.computer.opencore_path))
launcher_script = None launcher_script = None
launcher_binary = sys.executable launcher_binary = sys.executable
if "python" in launcher_binary: if "python" in launcher_binary:
+38
View File
@@ -403,6 +403,44 @@ def download_file(link, location, is_gui=None, verify_checksum=False):
print(link) print(link)
return None return None
def dump_constants(constants):
with open(os.path.join(os.path.expanduser('~'), 'Desktop', 'internal_data.txt'), 'w') as f:
f.write(str(vars(constants)))
def clean_device_path(device_path: str):
# ex:
# 'PciRoot(0x0)/Pci(0xA,0x0)/Sata(0x0,0x0,0x0)/HD(1,GPT,C0778F23-3765-4C8E-9BFA-D60C839E7D2D,0x28,0x64000)/EFI\OC\OpenCore.efi'
# 'PciRoot(0x0)/Pci(0x1A,0x7)/USB(0x0,0x0)/USB(0x2,0x0)/HD(2,GPT,4E929909-2074-43BA-9773-61EBC110A670,0x64800,0x38E3000)/EFI\OC\OpenCore.efi'
# return:
# 'C0778F23-3765-4C8E-9BFA-D60C839E7D2D'
# '4E929909-2074-43BA-9773-61EBC110A670'
if device_path:
device_path_array = device_path.split("/")
# we can always assume [-1] is 'EFI\OC\OpenCore.efi'
if len(device_path_array) >= 2:
device_path_stripped = device_path_array[-2]
device_path_root_array = device_path_stripped.split(",")
return device_path_root_array[2]
return None
def find_disk_off_uuid(uuid):
# Find disk by UUID
disk_list = None
try:
disk_list = plistlib.loads(subprocess.run(["diskutil", "info", "-plist", uuid], stdout=subprocess.PIPE).stdout)
except TypeError:
pass
if disk_list:
try:
return disk_list["DeviceIdentifier"]
except KeyError:
pass
return None
def grab_mount_point_from_disk(disk): def grab_mount_point_from_disk(disk):
data = plistlib.loads(subprocess.run(f"diskutil info -plist {disk}".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()) data = plistlib.loads(subprocess.run(f"diskutil info -plist {disk}".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
return data["MountPoint"] return data["MountPoint"]