mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-21 18:40:16 +10:00
GUI: Unify Centre() calls
This commit is contained in:
@@ -57,28 +57,28 @@ class BuildFrame(wx.Frame):
|
||||
|
||||
title_label = wx.StaticText(frame, label="Build and Install OpenCore", pos=(-1,5))
|
||||
title_label.SetFont(wx.Font(19, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
|
||||
title_label.Center(wx.HORIZONTAL)
|
||||
title_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
model_label = wx.StaticText(frame, label=f"Model: {self.constants.custom_model or self.constants.computer.real_model}", pos=(-1,30))
|
||||
model_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
|
||||
model_label.Center(wx.HORIZONTAL)
|
||||
model_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Button: Install OpenCore
|
||||
install_button = wx.Button(frame, label="🔩 Install OpenCore", pos=(-1, model_label.GetPosition()[1] + model_label.GetSize()[1]), size=(150, 30))
|
||||
install_button.Bind(wx.EVT_BUTTON, self.on_install)
|
||||
install_button.Center(wx.HORIZONTAL)
|
||||
install_button.Centre(wx.HORIZONTAL)
|
||||
install_button.Disable()
|
||||
self.install_button = install_button
|
||||
|
||||
# Read-only text box: {empty}
|
||||
text_box = wx.TextCtrl(frame, value="", pos=(-1, install_button.GetPosition()[1] + install_button.GetSize()[1] + 10), size=(400, 350), style=wx.TE_READONLY | wx.TE_MULTILINE | wx.TE_RICH2)
|
||||
text_box.Center(wx.HORIZONTAL)
|
||||
text_box.Centre(wx.HORIZONTAL)
|
||||
self.text_box = text_box
|
||||
|
||||
# Button: Return to Main Menu
|
||||
return_button = wx.Button(frame, label="Return to Main Menu", pos=(-1, text_box.GetPosition()[1] + text_box.GetSize()[1] + 5), size=(200, 30))
|
||||
return_button.Bind(wx.EVT_BUTTON, self.on_return_to_main_menu)
|
||||
return_button.Center(wx.HORIZONTAL)
|
||||
return_button.Centre(wx.HORIZONTAL)
|
||||
return_button.Disable()
|
||||
self.return_button = return_button
|
||||
|
||||
|
||||
@@ -36,26 +36,26 @@ class DownloadFrame(wx.Frame):
|
||||
|
||||
title_label = wx.StaticText(frame, label=f"Downloading: {self.item_name}", pos=(-1,5))
|
||||
title_label.SetFont(wx.Font(19, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
|
||||
title_label.Center(wx.HORIZONTAL)
|
||||
title_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
label_amount = wx.StaticText(frame, label="0.00 B downloaded of 0.00B (0.00%)", pos=(-1, title_label.GetPosition()[1] + title_label.GetSize()[1] + 5))
|
||||
label_amount.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
|
||||
label_amount.Center(wx.HORIZONTAL)
|
||||
label_amount.Centre(wx.HORIZONTAL)
|
||||
|
||||
label_speed = wx.StaticText(frame, label="Average download speed: Unknown", pos=(-1, label_amount.GetPosition()[1] + label_amount.GetSize()[1] + 5))
|
||||
label_speed.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
|
||||
label_speed.Center(wx.HORIZONTAL)
|
||||
label_speed.Centre(wx.HORIZONTAL)
|
||||
|
||||
label_est_time = wx.StaticText(frame, label="Estimated time remaining: Unknown", pos=(-1, label_speed.GetPosition()[1] + label_speed.GetSize()[1] + 5))
|
||||
label_est_time.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
|
||||
label_est_time.Center(wx.HORIZONTAL)
|
||||
label_est_time.Centre(wx.HORIZONTAL)
|
||||
|
||||
progress_bar = wx.Gauge(frame, range=100, pos=(-1, label_est_time.GetPosition()[1] + label_est_time.GetSize()[1] + 5), size=(300, 20))
|
||||
progress_bar.Center(wx.HORIZONTAL)
|
||||
progress_bar.Centre(wx.HORIZONTAL)
|
||||
|
||||
return_button = wx.Button(frame, label="Return", pos=(-1, progress_bar.GetPosition()[1] + progress_bar.GetSize()[1] + 5))
|
||||
return_button.Bind(wx.EVT_BUTTON, lambda event: self.terminate_download())
|
||||
return_button.Center(wx.HORIZONTAL)
|
||||
return_button.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Set size of frame
|
||||
frame.SetSize((-1, return_button.GetPosition()[1] + return_button.GetSize()[1] + 40))
|
||||
@@ -68,7 +68,7 @@ class DownloadFrame(wx.Frame):
|
||||
else:
|
||||
amount_str = f"{utilities.human_fmt(self.download_obj.downloaded_file_size)} downloaded of {utilities.human_fmt(self.download_obj.total_file_size)} ({self.download_obj.get_percent():.2f}%)"
|
||||
label_amount.SetLabel(amount_str)
|
||||
label_amount.Center(wx.HORIZONTAL)
|
||||
label_amount.Centre(wx.HORIZONTAL)
|
||||
|
||||
label_speed.SetLabel(
|
||||
f"Average download speed: {utilities.human_fmt(self.download_obj.get_speed())}/s"
|
||||
|
||||
@@ -35,11 +35,11 @@ class HelpFrame(wx.Frame):
|
||||
|
||||
title_label = wx.StaticText(frame, label="Patcher Resources", pos=(-1,5))
|
||||
title_label.SetFont(wx.Font(19, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
|
||||
title_label.Center(wx.HORIZONTAL)
|
||||
title_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
text_label = wx.StaticText(frame, label="Following resources are available:", pos=(-1,30))
|
||||
text_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
|
||||
text_label.Center(wx.HORIZONTAL)
|
||||
text_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
buttons = {
|
||||
"Official Guide": self.constants.guide_link,
|
||||
@@ -50,12 +50,12 @@ class HelpFrame(wx.Frame):
|
||||
for button in buttons:
|
||||
help_button = wx.Button(frame, label=button, pos=(-1, text_label.GetPosition()[1] + text_label.GetSize()[1] + (list(buttons.keys()).index(button) * 30)), size=(200, 30))
|
||||
help_button.Bind(wx.EVT_BUTTON, lambda event, temp=buttons[button]: webbrowser.open(temp))
|
||||
help_button.Center(wx.HORIZONTAL)
|
||||
help_button.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Button: Return to Main Menu
|
||||
return_button = wx.Button(frame, label="Return to Main Menu", pos=(-1, help_button.GetPosition()[1] + help_button.GetSize()[1]), size=(150, 30))
|
||||
return_button.Bind(wx.EVT_BUTTON, lambda event: frame.Close())
|
||||
return_button.Center(wx.HORIZONTAL)
|
||||
return_button.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Set size of frame
|
||||
frame.SetSize((-1, return_button.GetPosition()[1] + return_button.GetSize()[1] + 40))
|
||||
|
||||
@@ -49,17 +49,17 @@ class InstallOCFrame(wx.Frame):
|
||||
# Title label: Install OpenCore
|
||||
title_label = wx.StaticText(self, label="Install OpenCore", pos=(-1,5))
|
||||
title_label.SetFont(wx.Font(19, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
|
||||
title_label.Center(wx.HORIZONTAL)
|
||||
title_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Text: Parsing local disks...
|
||||
text_label = wx.StaticText(self, label="Fetching information on local disks...", pos=(-1,30))
|
||||
text_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
|
||||
text_label.Center(wx.HORIZONTAL)
|
||||
text_label.Centre(wx.HORIZONTAL)
|
||||
self.text_label = text_label
|
||||
|
||||
# Progress bar: {indeterminate}
|
||||
progress_bar = wx.Gauge(self, range=100, pos=(-1, text_label.GetPosition()[1] + text_label.GetSize()[1]), size=(150, 30), style=wx.GA_HORIZONTAL | wx.GA_SMOOTH)
|
||||
progress_bar.Center(wx.HORIZONTAL)
|
||||
progress_bar.Centre(wx.HORIZONTAL)
|
||||
|
||||
progress_bar_animation = gui_support.GaugePulseCallback(self.constants, progress_bar)
|
||||
progress_bar_animation.start_pulse()
|
||||
@@ -102,17 +102,17 @@ class InstallOCFrame(wx.Frame):
|
||||
# Title label: Install OpenCore
|
||||
title_label = wx.StaticText(dialog, label="Install OpenCore", pos=(-1,5))
|
||||
title_label.SetFont(wx.Font(19, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
|
||||
title_label.Center(wx.HORIZONTAL)
|
||||
title_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Text: select disk to install OpenCore onto
|
||||
text_label = wx.StaticText(dialog, label="Select disk to install OpenCore onto:", pos=(-1, title_label.GetPosition()[1] + title_label.GetSize()[1] + 5))
|
||||
text_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
|
||||
text_label.Center(wx.HORIZONTAL)
|
||||
text_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Add note: "Missing disks? Ensure they're FAT32 or formatted as GUID/GPT"
|
||||
gpt_note = wx.StaticText(dialog, label="Missing disks? Ensure they're FAT32 or formatted as GUID/GPT", pos=(-1, text_label.GetPosition()[1] + text_label.GetSize()[1] + 5))
|
||||
gpt_note.SetFont(wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
|
||||
gpt_note.Center(wx.HORIZONTAL)
|
||||
gpt_note.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Add buttons for each disk
|
||||
if self.available_disks:
|
||||
@@ -132,7 +132,7 @@ class InstallOCFrame(wx.Frame):
|
||||
# Create a button for each disk
|
||||
logging.info(f"- {self.available_disks[disk]['disk']} - {self.available_disks[disk]['name']} - {self.available_disks[disk]['size']}")
|
||||
disk_button = wx.Button(dialog, label=f"{self.available_disks[disk]['disk']} - {self.available_disks[disk]['name']} - {self.available_disks[disk]['size']}", size=(longest_label ,30), pos=(-1, gpt_note.GetPosition()[1] + gpt_note.GetSize()[1] + 5 + spacer))
|
||||
disk_button.Center(wx.HORIZONTAL)
|
||||
disk_button.Centre(wx.HORIZONTAL)
|
||||
disk_button.Bind(wx.EVT_BUTTON, lambda event, disk=disk: self._display_volumes(disk, self.available_disks))
|
||||
if disk_root == self.available_disks[disk]['disk'] or items == 1:
|
||||
disk_button.SetDefault()
|
||||
@@ -142,7 +142,7 @@ class InstallOCFrame(wx.Frame):
|
||||
# Add note: "Note: Blue represent the disk OpenCore is currently booted from"
|
||||
disk_label = wx.StaticText(dialog, label="Note: Blue represent the disk OpenCore is currently booted from", pos=(-1, disk_button.GetPosition()[1] + disk_button.GetSize()[1] + 5))
|
||||
disk_label.SetFont(wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
|
||||
disk_label.Center(wx.HORIZONTAL)
|
||||
disk_label.Centre(wx.HORIZONTAL)
|
||||
else:
|
||||
disk_label = wx.StaticText(dialog, label="", pos=(-1, disk_button.GetPosition()[1] + 15))
|
||||
disk_label.SetFont(wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
|
||||
@@ -150,16 +150,16 @@ class InstallOCFrame(wx.Frame):
|
||||
# Text: Failed to find any applicable disks
|
||||
disk_label = wx.StaticText(dialog, label="Failed to find any applicable disks", pos=(-1, gpt_note.GetPosition()[1] + gpt_note.GetSize()[1] + 5))
|
||||
disk_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
|
||||
disk_label.Center(wx.HORIZONTAL)
|
||||
disk_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Add button: Search for disks again
|
||||
search_button = wx.Button(dialog, label="Search for disks again", size=(160,30), pos=(-1, disk_label.GetPosition()[1] + disk_label.GetSize()[1] + 5))
|
||||
search_button.Center(wx.HORIZONTAL)
|
||||
search_button.Centre(wx.HORIZONTAL)
|
||||
search_button.Bind(wx.EVT_BUTTON, self.on_reload_frame)
|
||||
|
||||
# Add button: Return to main menu
|
||||
return_button = wx.Button(dialog, label="Return to main menu", size=(160,30), pos=(-1, search_button.GetPosition()[1] + 20))
|
||||
return_button.Center(wx.HORIZONTAL)
|
||||
return_button.Centre(wx.HORIZONTAL)
|
||||
return_button.Bind(wx.EVT_BUTTON, self.on_return_to_main_menu)
|
||||
|
||||
# Set size
|
||||
@@ -186,7 +186,7 @@ class InstallOCFrame(wx.Frame):
|
||||
# Add text: "Volumes on {disk}"
|
||||
text_label = wx.StaticText(dialog, label=f"Volumes on {disk}", pos=(-1, 10))
|
||||
text_label.SetFont(wx.Font(19, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
|
||||
text_label.Center(wx.HORIZONTAL)
|
||||
text_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
partitions = install.tui_disk_installation(self.constants).list_partitions(disk, dataset)
|
||||
items = len(partitions)
|
||||
@@ -195,14 +195,14 @@ class InstallOCFrame(wx.Frame):
|
||||
for partition in partitions:
|
||||
logging.info(f"- {partitions[partition]['partition']} - {partitions[partition]['name']} - {partitions[partition]['size']}")
|
||||
disk_button = wx.Button(dialog, label=f"{partitions[partition]['partition']} - {partitions[partition]['name']} - {partitions[partition]['size']}", size=(longest_label,30), pos=(-1, text_label.GetPosition()[1] + text_label.GetSize()[1] + 5))
|
||||
disk_button.Center(wx.HORIZONTAL)
|
||||
disk_button.Centre(wx.HORIZONTAL)
|
||||
disk_button.Bind(wx.EVT_BUTTON, lambda event, partition=partition: self._install_oc_process(partition))
|
||||
if partitions[partition]['partition'].startswith(f"{disk}s") or items == 1:
|
||||
disk_button.SetDefault()
|
||||
|
||||
# Add button: Return to main menu
|
||||
return_button = wx.Button(dialog, label="Return to main menu", size=(150,30), pos=(-1, disk_button.GetPosition()[1] + disk_button.GetSize()[1]))
|
||||
return_button.Center(wx.HORIZONTAL)
|
||||
return_button.Centre(wx.HORIZONTAL)
|
||||
return_button.Bind(wx.EVT_BUTTON, self.on_return_to_main_menu)
|
||||
|
||||
# Set size
|
||||
@@ -230,16 +230,16 @@ class InstallOCFrame(wx.Frame):
|
||||
# Add text: "Installing OpenCore to {partition}"
|
||||
text_label = wx.StaticText(dialog, label=f"Installing OpenCore to {partition}", pos=(-1, 10))
|
||||
text_label.SetFont(wx.Font(19, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
|
||||
text_label.Center(wx.HORIZONTAL)
|
||||
text_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Read-only text box: {empty}
|
||||
text_box = wx.TextCtrl(dialog, value="", pos=(-1, text_label.GetPosition()[1] + text_label.GetSize()[1] + 10), size=(370, 200), style=wx.TE_READONLY | wx.TE_MULTILINE | wx.TE_RICH2)
|
||||
text_box.Center(wx.HORIZONTAL)
|
||||
text_box.Centre(wx.HORIZONTAL)
|
||||
self.text_box = text_box
|
||||
|
||||
# Add button: Return to main menu
|
||||
return_button = wx.Button(dialog, label="Return to main menu", size=(200,30), pos=(-1, text_box.GetPosition()[1] + text_box.GetSize()[1] + 10))
|
||||
return_button.Center(wx.HORIZONTAL)
|
||||
return_button.Centre(wx.HORIZONTAL)
|
||||
return_button.Bind(wx.EVT_BUTTON, self.on_return_to_main_menu)
|
||||
return_button.Disable()
|
||||
|
||||
|
||||
@@ -53,22 +53,22 @@ class macOSInstallerDownloadFrame(wx.Frame):
|
||||
|
||||
title_label = wx.StaticText(frame, label="Create macOS Installer", pos=(-1,5))
|
||||
title_label.SetFont(wx.Font(19, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
|
||||
title_label.Center(wx.HORIZONTAL)
|
||||
title_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Button: Download macOS Installer
|
||||
download_button = wx.Button(frame, label="Download macOS Installer", pos=(-1, title_label.GetPosition()[1] + title_label.GetSize()[1] + 5), size=(200, 30))
|
||||
download_button.Bind(wx.EVT_BUTTON, self.on_download)
|
||||
download_button.Center(wx.HORIZONTAL)
|
||||
download_button.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Button: Use existing macOS Installer
|
||||
existing_button = wx.Button(frame, label="Use existing macOS Installer", pos=(-1, download_button.GetPosition()[1] + download_button.GetSize()[1] - 5), size=(200, 30))
|
||||
existing_button.Bind(wx.EVT_BUTTON, self.on_existing)
|
||||
existing_button.Center(wx.HORIZONTAL)
|
||||
existing_button.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Button: Return to Main Menu
|
||||
return_button = wx.Button(frame, label="Return to Main Menu", pos=(-1, existing_button.GetPosition()[1] + existing_button.GetSize()[1] + 5), size=(150, 30))
|
||||
return_button.Bind(wx.EVT_BUTTON, self.on_return)
|
||||
return_button.Center(wx.HORIZONTAL)
|
||||
return_button.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Set size of frame
|
||||
frame.SetSize((-1, return_button.GetPosition()[1] + return_button.GetSize()[1] + 40))
|
||||
@@ -84,11 +84,11 @@ class macOSInstallerDownloadFrame(wx.Frame):
|
||||
# Title: Pulling installer catalog
|
||||
title_label = wx.StaticText(self, label="Pulling installer catalog", pos=(-1,5))
|
||||
title_label.SetFont(wx.Font(19, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
|
||||
title_label.Center(wx.HORIZONTAL)
|
||||
title_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Progress bar
|
||||
progress_bar = wx.Gauge(self, range=100, pos=(-1, title_label.GetPosition()[1] + title_label.GetSize()[1] + 5), size=(250, 30))
|
||||
progress_bar.Center(wx.HORIZONTAL)
|
||||
progress_bar.Centre(wx.HORIZONTAL)
|
||||
progress_bar_animation = gui_support.GaugePulseCallback(self.constants, progress_bar)
|
||||
progress_bar_animation.start_pulse()
|
||||
|
||||
@@ -124,12 +124,12 @@ class macOSInstallerDownloadFrame(wx.Frame):
|
||||
# Title: Select macOS Installer
|
||||
title_label = wx.StaticText(dialog, label="Select macOS Installer", pos=(-1,5))
|
||||
title_label.SetFont(wx.Font(19, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
|
||||
title_label.Center(wx.HORIZONTAL)
|
||||
title_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Subtitle: Installers currently available from Apple:
|
||||
subtitle_label = wx.StaticText(dialog, label="Installers currently available from Apple:", pos=(-1, title_label.GetPosition()[1] + title_label.GetSize()[1] + 5))
|
||||
subtitle_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
|
||||
subtitle_label.Center(wx.HORIZONTAL)
|
||||
subtitle_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
# List of installers
|
||||
installers = self.available_installers_latest if show_full is False else self.available_installers
|
||||
@@ -141,7 +141,7 @@ class macOSInstallerDownloadFrame(wx.Frame):
|
||||
|
||||
installer_button = wx.Button(dialog, label=f"macOS {installers[app]['Version']}{extra} ({installers[app]['Build']} - {utilities.human_fmt(installers[app]['Size'])})", pos=(-1, subtitle_label.GetPosition()[1] + subtitle_label.GetSize()[1] + 5 + spacer), size=(270, 30))
|
||||
installer_button.Bind(wx.EVT_BUTTON, lambda event, temp=app: self.on_download_installer(installers[temp]))
|
||||
installer_button.Center(wx.HORIZONTAL)
|
||||
installer_button.Centre(wx.HORIZONTAL)
|
||||
spacer += 25
|
||||
|
||||
# Since installers are sorted by version, set the latest installer as the default button
|
||||
@@ -152,12 +152,12 @@ class macOSInstallerDownloadFrame(wx.Frame):
|
||||
# Show all available installers
|
||||
show_all_button = wx.Button(dialog, label="Show all available installers" if show_full is False else "Show only latest installers", pos=(-1, installer_button.GetPosition()[1] + installer_button.GetSize()[1]), size=(200, 30))
|
||||
show_all_button.Bind(wx.EVT_BUTTON, lambda event: self._display_available_installers(event, not show_full))
|
||||
show_all_button.Center(wx.HORIZONTAL)
|
||||
show_all_button.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Return to Main Menu
|
||||
return_button = wx.Button(dialog, label="Return to Main Menu", pos=(-1, show_all_button.GetPosition()[1] + show_all_button.GetSize()[1] - 7), size=(150, 30))
|
||||
return_button.Bind(wx.EVT_BUTTON, self.on_return_to_main_menu)
|
||||
return_button.Center(wx.HORIZONTAL)
|
||||
return_button.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Set size of frame
|
||||
dialog.SetSize((-1, return_button.GetPosition()[1] + return_button.GetSize()[1] + 40))
|
||||
@@ -206,16 +206,16 @@ class macOSInstallerDownloadFrame(wx.Frame):
|
||||
# Title: Validating macOS Installer
|
||||
title_label = wx.StaticText(self, label="Validating macOS Installer", pos=(-1,5))
|
||||
title_label.SetFont(wx.Font(19, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
|
||||
title_label.Center(wx.HORIZONTAL)
|
||||
title_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Label: Validating chunk 0 of 0
|
||||
chunk_label = wx.StaticText(self, label="Validating chunk 0 of 0", pos=(-1, title_label.GetPosition()[1] + title_label.GetSize()[1] + 5))
|
||||
chunk_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
|
||||
chunk_label.Center(wx.HORIZONTAL)
|
||||
chunk_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Progress bar
|
||||
progress_bar = wx.Gauge(self, range=100, pos=(-1, chunk_label.GetPosition()[1] + chunk_label.GetSize()[1] + 5), size=(270, 30))
|
||||
progress_bar.Center(wx.HORIZONTAL)
|
||||
progress_bar.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Set size of frame
|
||||
self.SetSize((-1, progress_bar.GetPosition()[1] + progress_bar.GetSize()[1] + 40))
|
||||
@@ -235,7 +235,7 @@ class macOSInstallerDownloadFrame(wx.Frame):
|
||||
while chunk_obj.status == integrity_verification.ChunklistStatus.IN_PROGRESS:
|
||||
progress_bar.SetValue(chunk_obj.current_chunk)
|
||||
chunk_label.SetLabel(f"Validating chunk {chunk_obj.current_chunk} of {chunk_obj.total_chunks}")
|
||||
chunk_label.Center(wx.HORIZONTAL)
|
||||
chunk_label.Centre(wx.HORIZONTAL)
|
||||
wx.App.Get().Yield()
|
||||
|
||||
if chunk_obj.status == integrity_verification.ChunklistStatus.FAILURE:
|
||||
@@ -245,10 +245,10 @@ class macOSInstallerDownloadFrame(wx.Frame):
|
||||
|
||||
# Extract installer
|
||||
title_label.SetLabel("Extracting macOS Installer")
|
||||
title_label.Center(wx.HORIZONTAL)
|
||||
title_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
chunk_label.SetLabel("May take a few minutes...")
|
||||
chunk_label.Center(wx.HORIZONTAL)
|
||||
chunk_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
progress_bar_animation = gui_support.GaugePulseCallback(self.constants, progress_bar)
|
||||
progress_bar_animation.start_pulse()
|
||||
@@ -271,19 +271,19 @@ class macOSInstallerDownloadFrame(wx.Frame):
|
||||
progress_bar_animation.stop_pulse()
|
||||
progress_bar.Hide()
|
||||
chunk_label.SetLabel("Successfully extracted macOS installer" if self.result is True else "Failed to extract macOS installer")
|
||||
chunk_label.Center(wx.HORIZONTAL)
|
||||
chunk_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Create macOS Installer button
|
||||
create_installer_button = wx.Button(self, label="Create macOS Installer", pos=(-1, progress_bar.GetPosition()[1]), size=(170, 30))
|
||||
create_installer_button.Bind(wx.EVT_BUTTON, self.on_existing)
|
||||
create_installer_button.Center(wx.HORIZONTAL)
|
||||
create_installer_button.Centre(wx.HORIZONTAL)
|
||||
if self.result is False:
|
||||
create_installer_button.Disable()
|
||||
|
||||
# Return to main menu button
|
||||
return_button = wx.Button(self, label="Return to Main Menu", pos=(-1, create_installer_button.GetPosition()[1] + create_installer_button.GetSize()[1]), size=(150, 30))
|
||||
return_button.Bind(wx.EVT_BUTTON, self.on_return_to_main_menu)
|
||||
return_button.Center(wx.HORIZONTAL)
|
||||
return_button.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Set size of frame
|
||||
self.SetSize((-1, return_button.GetPosition()[1] + return_button.GetSize()[1] + 40))
|
||||
|
||||
@@ -51,11 +51,11 @@ class macOSInstallerFlashFrame(wx.Frame):
|
||||
# Title: Fetching local macOS Installers
|
||||
title_label = wx.StaticText(self, label="Fetching local macOS Installers", pos=(-1,1))
|
||||
title_label.SetFont(wx.Font(19, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
|
||||
title_label.Center(wx.HORIZONTAL)
|
||||
title_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Progress bar
|
||||
progress_bar = wx.Gauge(self, range=100, pos=(-1, 30), size=(200, 30))
|
||||
progress_bar.Center(wx.HORIZONTAL)
|
||||
progress_bar.Centre(wx.HORIZONTAL)
|
||||
|
||||
progress_bar_animation = gui_support.GaugePulseCallback(self.constants, progress_bar)
|
||||
progress_bar_animation.start_pulse()
|
||||
@@ -77,12 +77,12 @@ class macOSInstallerFlashFrame(wx.Frame):
|
||||
wx.Yield()
|
||||
|
||||
frame_modal = wx.Dialog(self, title=self.title, size=(350, 200))
|
||||
frame_modal.Center(wx.HORIZONTAL)
|
||||
frame_modal.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Title: Select macOS Installer
|
||||
title_label = wx.StaticText(frame_modal, label="Select local macOS Installer", pos=(-1,5))
|
||||
title_label.SetFont(wx.Font(19, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
|
||||
title_label.Center(wx.HORIZONTAL)
|
||||
title_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
# List of installers
|
||||
if self.available_installers_local:
|
||||
@@ -103,7 +103,7 @@ class macOSInstallerFlashFrame(wx.Frame):
|
||||
|
||||
installer_button = wx.Button(frame_modal, label=app_str, pos=(-1, title_label.GetPosition()[1] + title_label.GetSize()[1] + spacer), size=(300, 30))
|
||||
installer_button.Bind(wx.EVT_BUTTON, lambda event, temp=app: self.on_select(self.available_installers_local[temp]))
|
||||
installer_button.Center(wx.HORIZONTAL)
|
||||
installer_button.Centre(wx.HORIZONTAL)
|
||||
spacer += 25
|
||||
if unsupported:
|
||||
installer_button.Disable()
|
||||
@@ -113,12 +113,12 @@ class macOSInstallerFlashFrame(wx.Frame):
|
||||
else:
|
||||
installer_button = wx.StaticText(frame_modal, label="No installers found in '/Applications'", pos=(-1, title_label.GetPosition()[1] + title_label.GetSize()[1] + 5))
|
||||
installer_button.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
|
||||
installer_button.Center(wx.HORIZONTAL)
|
||||
installer_button.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Button: Return to Main Menu
|
||||
cancel_button = wx.Button(frame_modal, label="Return to Main Menu", pos=(-1, installer_button.GetPosition()[1] + installer_button.GetSize()[1]), size=(150, 30))
|
||||
cancel_button.Bind(wx.EVT_BUTTON, self.on_return_to_main_menu)
|
||||
cancel_button.Center(wx.HORIZONTAL)
|
||||
cancel_button.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Set size of frame
|
||||
frame_modal.SetSize((-1, cancel_button.GetPosition()[1] + cancel_button.GetSize()[1] + 40))
|
||||
@@ -138,11 +138,11 @@ class macOSInstallerFlashFrame(wx.Frame):
|
||||
# Fetching information on local disks
|
||||
title_label = wx.StaticText(self, label="Fetching information on local disks", pos=(-1,1))
|
||||
title_label.SetFont(wx.Font(19, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
|
||||
title_label.Center(wx.HORIZONTAL)
|
||||
title_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Progress bar
|
||||
progress_bar = wx.Gauge(self, range=100, pos=(-1, 30), size=(200, 30))
|
||||
progress_bar.Center(wx.HORIZONTAL)
|
||||
progress_bar.Centre(wx.HORIZONTAL)
|
||||
|
||||
progress_bar_animation = gui_support.GaugePulseCallback(self.constants, progress_bar)
|
||||
progress_bar_animation.start_pulse()
|
||||
@@ -173,12 +173,12 @@ class macOSInstallerFlashFrame(wx.Frame):
|
||||
# Title: Select local disk
|
||||
title_label = wx.StaticText(self.frame_modal, label="Select local disk", pos=(-1,5))
|
||||
title_label.SetFont(wx.Font(19, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
|
||||
title_label.Center(wx.HORIZONTAL)
|
||||
title_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Label: Selected USB will be erased, please backup any data
|
||||
warning_label = wx.StaticText(self.frame_modal, label="Selected USB will be erased, please backup any data", pos=(-1, title_label.GetPosition()[1] + title_label.GetSize()[1] + 5))
|
||||
warning_label.SetFont(wx.Font(11, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
|
||||
warning_label.Center(wx.HORIZONTAL)
|
||||
warning_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
# List of disks
|
||||
if self.available_disks:
|
||||
@@ -188,24 +188,24 @@ class macOSInstallerFlashFrame(wx.Frame):
|
||||
logging.info(f"{disk}: {self.available_disks[disk]['name']} - {utilities.human_fmt(self.available_disks[disk]['size'])}")
|
||||
disk_button = wx.Button(self.frame_modal, label=f"{disk}: {self.available_disks[disk]['name']} - {utilities.human_fmt(self.available_disks[disk]['size'])}", pos=(-1, warning_label.GetPosition()[1] + warning_label.GetSize()[1] + spacer), size=(300, 30))
|
||||
disk_button.Bind(wx.EVT_BUTTON, lambda event, temp=disk: self.on_select_disk(self.available_disks[temp], installer))
|
||||
disk_button.Center(wx.HORIZONTAL)
|
||||
disk_button.Centre(wx.HORIZONTAL)
|
||||
if entries == 1:
|
||||
disk_button.SetDefault()
|
||||
spacer += 25
|
||||
else:
|
||||
disk_button = wx.StaticText(self.frame_modal, label="No disks found", pos=(-1, warning_label.GetPosition()[1] + warning_label.GetSize()[1] + 5))
|
||||
disk_button.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
|
||||
disk_button.Center(wx.HORIZONTAL)
|
||||
disk_button.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Search for disks again
|
||||
search_button = wx.Button(self.frame_modal, label="Search for disks again", pos=(-1, disk_button.GetPosition()[1] + disk_button.GetSize()[1]), size=(160, 30))
|
||||
search_button.Bind(wx.EVT_BUTTON, lambda event, temp=installer: self.on_select(temp))
|
||||
search_button.Center(wx.HORIZONTAL)
|
||||
search_button.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Button: Return to Main Menu
|
||||
cancel_button = wx.Button(self.frame_modal, label="Return to Main Menu", pos=(-1, search_button.GetPosition()[1] + search_button.GetSize()[1] - 10), size=(160, 30))
|
||||
cancel_button.Bind(wx.EVT_BUTTON, self.on_return_to_main_menu)
|
||||
cancel_button.Center(wx.HORIZONTAL)
|
||||
cancel_button.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Set size of frame
|
||||
self.frame_modal.SetSize((-1, cancel_button.GetPosition()[1] + cancel_button.GetSize()[1] + 40))
|
||||
@@ -230,26 +230,26 @@ class macOSInstallerFlashFrame(wx.Frame):
|
||||
# Title: Creating Installer: {installer_name}
|
||||
title_label = wx.StaticText(self, label=f"Creating Installer: {installer['Short Name']}", pos=(-1,1))
|
||||
title_label.SetFont(wx.Font(19, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
|
||||
title_label.Center(wx.HORIZONTAL)
|
||||
title_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Label: Creating macOS installers can take 30min+ on slower USB drives.
|
||||
warning_label = wx.StaticText(self, label="Creating macOS installers can take 30min+ on slower USB drives.", pos=(-1, title_label.GetPosition()[1] + title_label.GetSize()[1] + 5))
|
||||
warning_label.SetFont(wx.Font(11, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
|
||||
warning_label.Center(wx.HORIZONTAL)
|
||||
warning_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Label: We will notify you when the installer is ready.
|
||||
warning_label = wx.StaticText(self, label="We will notify you when the installer is ready.", pos=(-1, warning_label.GetPosition()[1] + warning_label.GetSize()[1] + 5))
|
||||
warning_label.SetFont(wx.Font(11, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
|
||||
warning_label.Center(wx.HORIZONTAL)
|
||||
warning_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Label: Bytes Written: 0 MB
|
||||
bytes_written_label = wx.StaticText(self, label="Bytes Written: 0000.0 MB", pos=(-1, warning_label.GetPosition()[1] + warning_label.GetSize()[1] + 5))
|
||||
bytes_written_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
|
||||
bytes_written_label.Center(wx.HORIZONTAL)
|
||||
bytes_written_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Progress bar
|
||||
progress_bar = wx.Gauge(self, range=100, pos=(-1, bytes_written_label.GetPosition()[1] + bytes_written_label.GetSize()[1] + 5), size=(300, 30))
|
||||
progress_bar.Center(wx.HORIZONTAL)
|
||||
progress_bar.Centre(wx.HORIZONTAL)
|
||||
|
||||
progress_bar_animation = gui_support.GaugePulseCallback(self.constants, progress_bar)
|
||||
progress_bar_animation.start_pulse()
|
||||
|
||||
@@ -60,12 +60,12 @@ class MainFrame(wx.Frame):
|
||||
# Title label: OpenCore Legacy Patcher v{X.Y.Z}
|
||||
title_label = wx.StaticText(self, label=f"OpenCore Legacy Patcher v{self.constants.patcher_version}", pos=(-1,1))
|
||||
title_label.SetFont(wx.Font(19, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
|
||||
title_label.Center(wx.HORIZONTAL)
|
||||
title_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Text: Model: {Build or Host Model}
|
||||
model_label = wx.StaticText(self, label=f"Model: {self.constants.custom_model or self.constants.computer.real_model}", pos=(-1,30))
|
||||
model_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
|
||||
model_label.Center(wx.HORIZONTAL)
|
||||
model_label.Centre(wx.HORIZONTAL)
|
||||
self.model_label = model_label
|
||||
|
||||
# Buttons:
|
||||
@@ -80,7 +80,7 @@ class MainFrame(wx.Frame):
|
||||
for button_name, button_function in menu_buttons.items():
|
||||
button = wx.Button(self, label=button_name, pos=(-1, button_y), size=(200, 30))
|
||||
button.Bind(wx.EVT_BUTTON, button_function)
|
||||
button.Center(wx.HORIZONTAL)
|
||||
button.Centre(wx.HORIZONTAL)
|
||||
button_y += 30
|
||||
|
||||
if button_name == "Build and Install OpenCore":
|
||||
@@ -94,7 +94,7 @@ class MainFrame(wx.Frame):
|
||||
# Text: Copyright
|
||||
copy_label = wx.StaticText(self, label=self.constants.copyright_date, pos=(-1, button_y + 10))
|
||||
copy_label.SetFont(wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
|
||||
copy_label.Center(wx.HORIZONTAL)
|
||||
copy_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Set window size
|
||||
self.SetSize((350, copy_label.GetPosition()[1] + 50))
|
||||
|
||||
@@ -825,7 +825,7 @@ class SettingsFrame(wx.Frame):
|
||||
|
||||
|
||||
self.parent.model_label.SetLabel(f"Model: {selection}")
|
||||
self.parent.model_label.Center(wx.HORIZONTAL)
|
||||
self.parent.model_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
self.frame_modal.Destroy()
|
||||
SettingsFrame(
|
||||
|
||||
@@ -265,7 +265,7 @@ class RelaunchApplicationAsRoot:
|
||||
# Add count down label
|
||||
countdown_label = wx.StaticText(self.frame, label=f"Closing old process in {timer} seconds", pos=(0, header.GetPosition().y + header.GetSize().height + 3))
|
||||
countdown_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
|
||||
countdown_label.Center(wx.HORIZONTAL)
|
||||
countdown_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Set size of frame
|
||||
self.frame.SetSize((-1, countdown_label.GetPosition().y + countdown_label.GetSize().height + 40))
|
||||
|
||||
@@ -62,14 +62,14 @@ class SysPatchFrame(wx.Frame):
|
||||
|
||||
header = wx.StaticText(frame, label="Downloading Kernel Debug Kit", pos=(-1,5))
|
||||
header.SetFont(wx.Font(19, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
|
||||
header.Center(wx.HORIZONTAL)
|
||||
header.Centre(wx.HORIZONTAL)
|
||||
|
||||
subheader = wx.StaticText(frame, label="Fetching KDK database...", pos=(-1, header.GetPosition()[1] + header.GetSize()[1] + 5))
|
||||
subheader.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
|
||||
subheader.Center(wx.HORIZONTAL)
|
||||
subheader.Centre(wx.HORIZONTAL)
|
||||
|
||||
progress_bar = wx.Gauge(frame, range=100, pos=(-1, subheader.GetPosition()[1] + subheader.GetSize()[1] + 5), size=(250, 20))
|
||||
progress_bar.Center(wx.HORIZONTAL)
|
||||
progress_bar.Centre(wx.HORIZONTAL)
|
||||
|
||||
progress_bar_animation = gui_support.GaugePulseCallback(self.constants, progress_bar)
|
||||
progress_bar_animation.start_pulse()
|
||||
@@ -111,10 +111,10 @@ class SysPatchFrame(wx.Frame):
|
||||
return False
|
||||
|
||||
header.SetLabel(f"Validating KDK: {self.kdk_obj.kdk_url_build}")
|
||||
header.Center(wx.HORIZONTAL)
|
||||
header.Centre(wx.HORIZONTAL)
|
||||
|
||||
subheader.SetLabel("Checking if checksum is valid...")
|
||||
subheader.Center(wx.HORIZONTAL)
|
||||
subheader.Centre(wx.HORIZONTAL)
|
||||
wx.Yield()
|
||||
|
||||
progress_bar_animation.stop_pulse()
|
||||
@@ -149,12 +149,12 @@ class SysPatchFrame(wx.Frame):
|
||||
|
||||
title_label = wx.StaticText(frame, label="Post-Install Menu", pos=(-1, 10))
|
||||
title_label.SetFont(wx.Font(19, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
|
||||
title_label.Center(wx.HORIZONTAL)
|
||||
title_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Label: Available patches:
|
||||
available_label = wx.StaticText(frame, label="Available patches for your system:", pos=(-1, title_label.GetPosition()[1] + title_label.GetSize()[1] + 10))
|
||||
available_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
|
||||
available_label.Center(wx.HORIZONTAL)
|
||||
available_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Labels: {patch name}
|
||||
patches: dict = sys_patch_detect.DetectRootPatch(self.constants.computer.real_model, self.constants).detect_patch_set() if not patches else patches
|
||||
@@ -171,7 +171,7 @@ class SysPatchFrame(wx.Frame):
|
||||
# Prompt user with no patches found
|
||||
patch_label = wx.StaticText(frame, label="No patches required", pos=(-1, available_label.GetPosition()[1] + 20))
|
||||
patch_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
|
||||
patch_label.Center(wx.HORIZONTAL)
|
||||
patch_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
else:
|
||||
# Add Label for each patch
|
||||
@@ -179,7 +179,7 @@ class SysPatchFrame(wx.Frame):
|
||||
if no_new_patches is True:
|
||||
patch_label = wx.StaticText(frame, label="All applicable patches already installed", pos=(-1, available_label.GetPosition()[1] + 20))
|
||||
patch_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
|
||||
patch_label.Center(wx.HORIZONTAL)
|
||||
patch_label.Centre(wx.HORIZONTAL)
|
||||
i = i + 20
|
||||
else:
|
||||
longest_patch = ""
|
||||
@@ -189,7 +189,7 @@ class SysPatchFrame(wx.Frame):
|
||||
longest_patch = patch
|
||||
anchor = wx.StaticText(frame, label=longest_patch, pos=(-1, available_label.GetPosition()[1] + 20))
|
||||
anchor.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
|
||||
anchor.Center(wx.HORIZONTAL)
|
||||
anchor.Centre(wx.HORIZONTAL)
|
||||
anchor.Hide()
|
||||
|
||||
for patch in patches:
|
||||
@@ -201,13 +201,13 @@ class SysPatchFrame(wx.Frame):
|
||||
|
||||
if i == 20:
|
||||
patch_label.SetLabel(patch_label.GetLabel().replace("-", ""))
|
||||
patch_label.Center(wx.HORIZONTAL)
|
||||
patch_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
if patches["Validation: Patching Possible"] is False:
|
||||
# Cannot patch due to the following reasons:
|
||||
patch_label = wx.StaticText(frame, label="Cannot patch due to the following reasons:", pos=(-1, patch_label.GetPosition().y + 25))
|
||||
patch_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
|
||||
patch_label.Center(wx.HORIZONTAL)
|
||||
patch_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
for patch in patches:
|
||||
if not patch.startswith("Validation"):
|
||||
@@ -228,30 +228,30 @@ class SysPatchFrame(wx.Frame):
|
||||
|
||||
patch_label = wx.StaticText(frame, label="Root Volume last patched:", pos=(-1, patch_label.GetPosition().y + 25))
|
||||
patch_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
|
||||
patch_label.Center(wx.HORIZONTAL)
|
||||
patch_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
patch_label = wx.StaticText(frame, label=patch_text, pos=(available_label.GetPosition().x - 10, patch_label.GetPosition().y + 20))
|
||||
patch_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
|
||||
patch_label.Center(wx.HORIZONTAL)
|
||||
patch_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
|
||||
# Button: Start Root Patching
|
||||
start_button = wx.Button(frame, label="Start Root Patching", pos=(10, patch_label.GetPosition().y + 25), size=(170, 30))
|
||||
start_button.Bind(wx.EVT_BUTTON, lambda event: self.start_root_patching(frame, patches, no_new_patches))
|
||||
start_button.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
|
||||
start_button.Center(wx.HORIZONTAL)
|
||||
start_button.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Button: Revert Root Patches
|
||||
revert_button = wx.Button(frame, label="Revert Root Patches", pos=(10, start_button.GetPosition().y + start_button.GetSize().height - 5), size=(170, 30))
|
||||
revert_button.Bind(wx.EVT_BUTTON, lambda event: self.revert_root_patching(frame, patches, can_unpatch))
|
||||
revert_button.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
|
||||
revert_button.Center(wx.HORIZONTAL)
|
||||
revert_button.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Button: Return to Main Menu
|
||||
return_button = wx.Button(frame, label="Return to Main Menu", pos=(10, revert_button.GetPosition().y + revert_button.GetSize().height), size=(150, 30))
|
||||
return_button.Bind(wx.EVT_BUTTON, self.on_return_to_main_menu)
|
||||
return_button.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
|
||||
return_button.Center(wx.HORIZONTAL)
|
||||
return_button.Centre(wx.HORIZONTAL)
|
||||
self.return_button = return_button
|
||||
|
||||
# Disable buttons if unsupported
|
||||
@@ -292,13 +292,13 @@ class SysPatchFrame(wx.Frame):
|
||||
# Title
|
||||
title = wx.StaticText(dialog, label=variant, pos=(-1, 10))
|
||||
title.SetFont(wx.Font(19, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
|
||||
title.Center(wx.HORIZONTAL)
|
||||
title.Centre(wx.HORIZONTAL)
|
||||
|
||||
if variant == "Root Patching":
|
||||
# Label
|
||||
label = wx.StaticText(dialog, label="Root Patching will patch the following:", pos=(-1, title.GetPosition()[1] + 30))
|
||||
label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
|
||||
label.Center(wx.HORIZONTAL)
|
||||
label.Centre(wx.HORIZONTAL)
|
||||
|
||||
|
||||
# Get longest patch label, then create anchor for patch labels
|
||||
@@ -310,7 +310,7 @@ class SysPatchFrame(wx.Frame):
|
||||
|
||||
anchor = wx.StaticText(dialog, label=longest_patch, pos=(label.GetPosition()[0], label.GetPosition()[1] + 20))
|
||||
anchor.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
|
||||
anchor.Center(wx.HORIZONTAL)
|
||||
anchor.Centre(wx.HORIZONTAL)
|
||||
anchor.Hide()
|
||||
|
||||
# Labels
|
||||
@@ -324,29 +324,29 @@ class SysPatchFrame(wx.Frame):
|
||||
|
||||
if i == 20:
|
||||
patch_label.SetLabel(patch_label.GetLabel().replace("-", ""))
|
||||
patch_label.Center(wx.HORIZONTAL)
|
||||
patch_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
elif i == 0:
|
||||
patch_label = wx.StaticText(dialog, label="No patches to apply", pos=(label.GetPosition()[0], label.GetPosition()[1] + 20))
|
||||
patch_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
|
||||
patch_label.Center(wx.HORIZONTAL)
|
||||
patch_label.Centre(wx.HORIZONTAL)
|
||||
else:
|
||||
patch_label = wx.StaticText(dialog, label="Reverting to last sealed snapshot", pos=(-1, title.GetPosition()[1] + 30))
|
||||
patch_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
|
||||
patch_label.Center(wx.HORIZONTAL)
|
||||
patch_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
|
||||
# Text box
|
||||
text_box = wx.TextCtrl(dialog, pos=(10, patch_label.GetPosition()[1] + 30), size=(400, 400), style=wx.TE_READONLY | wx.TE_MULTILINE | wx.TE_RICH2)
|
||||
text_box.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
|
||||
text_box.Center(wx.HORIZONTAL)
|
||||
text_box.Centre(wx.HORIZONTAL)
|
||||
self.text_box = text_box
|
||||
|
||||
# Button: Return to Main Menu
|
||||
return_button = wx.Button(dialog, label="Return to Main Menu", pos=(10, text_box.GetPosition()[1] + text_box.GetSize()[1] + 5), size=(150, 30))
|
||||
return_button.Bind(wx.EVT_BUTTON, self.on_return_to_main_menu)
|
||||
return_button.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
|
||||
return_button.Center(wx.HORIZONTAL)
|
||||
return_button.Centre(wx.HORIZONTAL)
|
||||
self.return_button = return_button
|
||||
|
||||
# Set frame size
|
||||
|
||||
@@ -65,11 +65,11 @@ class UpdateFrame(wx.Frame):
|
||||
# Title: Preparing update
|
||||
title_label = wx.StaticText(self.frame, label="Preparing download...", pos=(-1,1))
|
||||
title_label.SetFont(wx.Font(19, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
|
||||
title_label.Center(wx.HORIZONTAL)
|
||||
title_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Progress bar
|
||||
progress_bar = wx.Gauge(self.frame, range=100, pos=(10, 50), size=(300, 20))
|
||||
progress_bar.Center(wx.HORIZONTAL)
|
||||
progress_bar.Centre(wx.HORIZONTAL)
|
||||
progress_bar.Pulse()
|
||||
self.progress_bar = progress_bar
|
||||
|
||||
@@ -93,7 +93,7 @@ class UpdateFrame(wx.Frame):
|
||||
|
||||
# Title: Extracting update
|
||||
title_label.SetLabel("Extracting update...")
|
||||
title_label.Center(wx.HORIZONTAL)
|
||||
title_label.Centre(wx.HORIZONTAL)
|
||||
wx.Yield()
|
||||
|
||||
thread = threading.Thread(target=self._extract_update)
|
||||
@@ -104,7 +104,7 @@ class UpdateFrame(wx.Frame):
|
||||
|
||||
# Title: Installing update
|
||||
title_label.SetLabel("Installing update...")
|
||||
title_label.Center(wx.HORIZONTAL)
|
||||
title_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
thread = threading.Thread(target=self._install_update)
|
||||
thread.start()
|
||||
@@ -114,7 +114,7 @@ class UpdateFrame(wx.Frame):
|
||||
|
||||
# Title: Update complete
|
||||
title_label.SetLabel("Update complete!")
|
||||
title_label.Center(wx.HORIZONTAL)
|
||||
title_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Progress bar
|
||||
progress_bar.Hide()
|
||||
@@ -122,17 +122,17 @@ class UpdateFrame(wx.Frame):
|
||||
# Label: 0.6.6 has been installed to:
|
||||
installed_label = wx.StaticText(self.frame, label=f"{version_label} has been installed:", pos=(-1, progress_bar.GetPosition().y - 15))
|
||||
installed_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont"))
|
||||
installed_label.Center(wx.HORIZONTAL)
|
||||
installed_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Label: '/Library/Application Support/Dortania'
|
||||
installed_path_label = wx.StaticText(self.frame, label='/Library/Application Support/Dortania', pos=(-1, installed_label.GetPosition().y + 20))
|
||||
installed_path_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
|
||||
installed_path_label.Center(wx.HORIZONTAL)
|
||||
installed_path_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Label: Launching update shortly...
|
||||
launch_label = wx.StaticText(self.frame, label="Launching update shortly...", pos=(-1, installed_path_label.GetPosition().y + 30))
|
||||
launch_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont"))
|
||||
launch_label.Center(wx.HORIZONTAL)
|
||||
launch_label.Centre(wx.HORIZONTAL)
|
||||
|
||||
# Adjust frame size
|
||||
self.frame.SetSize((-1, launch_label.GetPosition().y + 60))
|
||||
@@ -146,7 +146,7 @@ class UpdateFrame(wx.Frame):
|
||||
timer = 5
|
||||
while True:
|
||||
launch_label.SetLabel(f"Closing old process in {timer} seconds")
|
||||
launch_label.Center(wx.HORIZONTAL)
|
||||
launch_label.Centre(wx.HORIZONTAL)
|
||||
wx.Yield()
|
||||
time.sleep(1)
|
||||
timer -= 1
|
||||
|
||||
Reference in New Issue
Block a user