diff --git a/PatcherSupportPkg b/PatcherSupportPkg new file mode 160000 index 000000000..b6b09530e --- /dev/null +++ b/PatcherSupportPkg @@ -0,0 +1 @@ +Subproject commit b6b09530e97097b4dfcdf3c3d22efb83bed73c7d diff --git a/resources/wx_gui/gui_about.py b/resources/wx_gui/gui_about.py index 73b0c84a1..107427f15 100644 --- a/resources/wx_gui/gui_about.py +++ b/resources/wx_gui/gui_about.py @@ -30,12 +30,12 @@ class AboutFrame(wx.Frame): # Set title title = wx.StaticText(frame, label="OpenCore Legacy Patcher", pos=(-1, 5)) - title.SetFont(wx.Font(19, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont")) + title.SetFont(gui_support.font_factory(19, wx.FONTWEIGHT_BOLD)) title.Centre(wx.HORIZONTAL) # Set version version = wx.StaticText(frame, label=f"Version: {self.constants.patcher_version}", pos=(-1, title.GetPosition()[1] + title.GetSize()[1] + 5)) - version.SetFont(wx.Font(11, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont")) + version.SetFont(gui_support.font_factory(11, wx.FONTWEIGHT_NORMAL)) version.Centre(wx.HORIZONTAL) # Description @@ -47,7 +47,7 @@ class AboutFrame(wx.Frame): spacer = 5 for line in description: desc = wx.StaticText(frame, label=line, pos=(-1, version.GetPosition()[1] + version.GetSize()[1] + 5 + spacer)) - desc.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont")) + desc.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) desc.Centre(wx.HORIZONTAL) spacer += 20 diff --git a/resources/wx_gui/gui_build.py b/resources/wx_gui/gui_build.py index 5dafddf26..d04f2c3b3 100644 --- a/resources/wx_gui/gui_build.py +++ b/resources/wx_gui/gui_build.py @@ -58,11 +58,11 @@ class BuildFrame(wx.Frame): frame = self if not frame else 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.SetFont(gui_support.font_factory(19, wx.FONTWEIGHT_BOLD)) 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.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) model_label.Centre(wx.HORIZONTAL) # Button: Install OpenCore diff --git a/resources/wx_gui/gui_download.py b/resources/wx_gui/gui_download.py index 1d6c028a6..bb496f9fb 100644 --- a/resources/wx_gui/gui_download.py +++ b/resources/wx_gui/gui_download.py @@ -8,6 +8,9 @@ from resources import ( utilities ) +from resources.wx_gui import gui_support + + class DownloadFrame(wx.Frame): """ @@ -36,19 +39,19 @@ class DownloadFrame(wx.Frame): frame = self if not frame else 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.SetFont(gui_support.font_factory(19, wx.FONTWEIGHT_BOLD)) 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.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) 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.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) 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.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) 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)) diff --git a/resources/wx_gui/gui_help.py b/resources/wx_gui/gui_help.py index 4f0871a7f..5907ebfb7 100644 --- a/resources/wx_gui/gui_help.py +++ b/resources/wx_gui/gui_help.py @@ -5,6 +5,8 @@ import webbrowser from resources import constants +from resources.wx_gui import gui_support + class HelpFrame(wx.Frame): """ @@ -35,11 +37,11 @@ class HelpFrame(wx.Frame): frame = self if not frame else 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.SetFont(gui_support.font_factory(19, wx.FONTWEIGHT_BOLD)) 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.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) text_label.Centre(wx.HORIZONTAL) buttons = { diff --git a/resources/wx_gui/gui_install_oc.py b/resources/wx_gui/gui_install_oc.py index 70c2cbcb0..7f083f43d 100644 --- a/resources/wx_gui/gui_install_oc.py +++ b/resources/wx_gui/gui_install_oc.py @@ -51,12 +51,12 @@ 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.SetFont(gui_support.font_factory(19, wx.FONTWEIGHT_BOLD)) 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.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) text_label.Centre(wx.HORIZONTAL) self.text_label = text_label @@ -104,17 +104,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.SetFont(gui_support.font_factory(19, wx.FONTWEIGHT_BOLD)) 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.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) 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.SetFont(gui_support.font_factory(10, wx.FONTWEIGHT_NORMAL)) gpt_note.Centre(wx.HORIZONTAL) # Add buttons for each disk @@ -146,15 +146,15 @@ class InstallOCFrame(wx.Frame): if disk_root: # 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.SetFont(gui_support.font_factory(10, wx.FONTWEIGHT_NORMAL)) 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")) + disk_label.SetFont(gui_support.font_factory(10, wx.FONTWEIGHT_NORMAL)) else: # 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.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_BOLD)) disk_label.Centre(wx.HORIZONTAL) # Add button: Search for disks again @@ -190,7 +190,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.SetFont(gui_support.font_factory(19, wx.FONTWEIGHT_BOLD)) text_label.Centre(wx.HORIZONTAL) partitions = install.tui_disk_installation(self.constants).list_partitions(disk, dataset) @@ -237,7 +237,7 @@ 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.SetFont(gui_support.font_factory(19, wx.FONTWEIGHT_BOLD)) text_label.Centre(wx.HORIZONTAL) # Read-only text box: {empty} diff --git a/resources/wx_gui/gui_macos_installer_download.py b/resources/wx_gui/gui_macos_installer_download.py index 7dbb536f3..d180bd1f0 100644 --- a/resources/wx_gui/gui_macos_installer_download.py +++ b/resources/wx_gui/gui_macos_installer_download.py @@ -57,7 +57,7 @@ class macOSInstallerDownloadFrame(wx.Frame): frame = self if not frame else 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.SetFont(gui_support.font_factory(19, wx.FONTWEIGHT_BOLD)) title_label.Centre(wx.HORIZONTAL) # Button: Download macOS Installer @@ -89,7 +89,7 @@ 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.SetFont(gui_support.font_factory(19, wx.FONTWEIGHT_BOLD)) title_label.Centre(wx.HORIZONTAL) # Progress bar @@ -140,7 +140,7 @@ class macOSInstallerDownloadFrame(wx.Frame): # Title: Select macOS Installer title_label = wx.StaticText(self.frame_modal, label="Select macOS Installer", pos=(-1,-1)) - title_label.SetFont(wx.Font(19, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont")) + title_label.SetFont(gui_support.font_factory(19, wx.FONTWEIGHT_BOLD)) # macOS Installers list id = wx.NewIdRef() @@ -190,7 +190,7 @@ class macOSInstallerDownloadFrame(wx.Frame): self.list.Bind(wx.EVT_LIST_ITEM_SELECTED, self.on_select_list) self.select_button = wx.Button(self.frame_modal, label="Download", pos=(-1, -1), size=(150, -1)) - self.select_button.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont")) + self.select_button.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) self.select_button.Bind(wx.EVT_BUTTON, lambda event, installers=installers: self.on_download_installer(installers)) self.select_button.SetToolTip("Download the selected macOS Installer.") self.select_button.SetDefault() @@ -198,7 +198,7 @@ class macOSInstallerDownloadFrame(wx.Frame): self.select_button.Disable() self.copy_button = wx.Button(self.frame_modal, label="Copy Link", pos=(-1, -1), size=(80, -1)) - self.copy_button.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont")) + self.copy_button.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) if show_full is True: self.copy_button.Disable() self.copy_button.SetToolTip("Copy the download link of the selected macOS Installer.") @@ -206,7 +206,7 @@ class macOSInstallerDownloadFrame(wx.Frame): return_button = wx.Button(self.frame_modal, label="Return to Main Menu", pos=(-1, -1), size=(150, -1)) 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.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) self.showolderversions_checkbox = wx.CheckBox(self.frame_modal, label="Show Older/Beta Versions", pos=(-1, -1)) if show_full is True: @@ -326,12 +326,12 @@ 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.SetFont(gui_support.font_factory(19, wx.FONTWEIGHT_BOLD)) 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.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) chunk_label.Centre(wx.HORIZONTAL) # Progress bar diff --git a/resources/wx_gui/gui_macos_installer_flash.py b/resources/wx_gui/gui_macos_installer_flash.py index 288052083..89e0036d4 100644 --- a/resources/wx_gui/gui_macos_installer_flash.py +++ b/resources/wx_gui/gui_macos_installer_flash.py @@ -52,7 +52,7 @@ 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.SetFont(gui_support.font_factory(19, wx.FONTWEIGHT_BOLD)) title_label.Centre(wx.HORIZONTAL) # Progress bar @@ -82,7 +82,7 @@ class macOSInstallerFlashFrame(wx.Frame): # 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.SetFont(gui_support.font_factory(19, wx.FONTWEIGHT_BOLD)) title_label.Centre(wx.HORIZONTAL) # List of installers @@ -113,7 +113,7 @@ 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.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) installer_button.Centre(wx.HORIZONTAL) # Button: Return to Main Menu @@ -139,7 +139,7 @@ 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.SetFont(gui_support.font_factory(19, wx.FONTWEIGHT_BOLD)) title_label.Centre(wx.HORIZONTAL) # Progress bar @@ -174,12 +174,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.SetFont(gui_support.font_factory(19, wx.FONTWEIGHT_BOLD)) 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.SetFont(gui_support.font_factory(11, wx.FONTWEIGHT_NORMAL)) warning_label.Centre(wx.HORIZONTAL) # List of disks @@ -197,7 +197,7 @@ class macOSInstallerFlashFrame(wx.Frame): 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.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_BOLD)) disk_button.Centre(wx.HORIZONTAL) # Search for disks again @@ -234,22 +234,22 @@ 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.SetFont(gui_support.font_factory(19, wx.FONTWEIGHT_BOLD)) 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.SetFont(gui_support.font_factory(11, wx.FONTWEIGHT_NORMAL)) 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.SetFont(gui_support.font_factory(11, wx.FONTWEIGHT_NORMAL)) warning_label.Centre(wx.HORIZONTAL) # Label: Bytes Written: 0 MB bytes_written_label = wx.StaticText(self, label="Bytes Written: 0.00 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.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) bytes_written_label.Centre(wx.HORIZONTAL) # Progress bar diff --git a/resources/wx_gui/gui_main_menu.py b/resources/wx_gui/gui_main_menu.py index 66266ef04..8e5960357 100644 --- a/resources/wx_gui/gui_main_menu.py +++ b/resources/wx_gui/gui_main_menu.py @@ -66,13 +66,13 @@ class MainFrame(wx.Frame): # Title label: OpenCore Legacy Patcher v{X.Y.Z} title_label = wx.StaticText(self, label=f"OpenCore Legacy Patcher {'' if self.constants.special_build else 'v'}{self.constants.patcher_version}", pos=(-1, 10)) - title_label.SetFont(wx.Font(19, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont")) + title_label.SetFont(gui_support.font_factory(19, wx.FONTWEIGHT_BOLD)) 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, title_label.GetPosition()[1] + 25 )) - model_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont")) + model_label.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) model_label.Centre(wx.HORIZONTAL) self.model_label = model_label @@ -143,12 +143,13 @@ class MainFrame(wx.Frame): button_y += 5 button = wx.Button(self, label=button_name, pos=(button_x + 70, button_y), size=(180, 30)) + button.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) button.Bind(wx.EVT_BUTTON, lambda event, function=button_function["function"]: function(event)) button_y += 30 # # Text: Description description_label = wx.StaticText(self, label='\n'.join(button_function["description"]), pos=(button_x + 75, button.GetPosition()[1] + button.GetSize()[1] + 3)) - description_label.SetFont(wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont")) + description_label.SetFont(gui_support.font_factory(10, wx.FONTWEIGHT_NORMAL)) # button_y += 15 for i, line in enumerate(button_function["description"]): @@ -182,7 +183,7 @@ class MainFrame(wx.Frame): # Text: Copyright copy_label = wx.StaticText(self, label=self.constants.copyright_date, pos=(-1, max_height - 15)) - copy_label.SetFont(wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont")) + copy_label.SetFont(gui_support.font_factory(10, wx.FONTWEIGHT_NORMAL)) copy_label.Centre(wx.HORIZONTAL) # Set window size diff --git a/resources/wx_gui/gui_settings.py b/resources/wx_gui/gui_settings.py index 8bf15fa16..75e0c28b1 100644 --- a/resources/wx_gui/gui_settings.py +++ b/resources/wx_gui/gui_settings.py @@ -56,24 +56,24 @@ class SettingsFrame(wx.Frame): """ notebook = wx.Notebook(frame) - notebook.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont")) + notebook.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) sizer = wx.BoxSizer(wx.VERTICAL) sizer.AddSpacer(10) model_label = wx.StaticText(frame, label="Target Model", pos=(-1, -1)) - model_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont")) + model_label.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_BOLD)) sizer.Add(model_label, 0, wx.ALIGN_CENTER | wx.ALL, 5) model_choice = wx.Choice(frame, choices=model_array.SupportedSMBIOS + ["Host Model"], pos=(-1, -1), size=(150, -1)) - model_choice.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont")) + model_choice.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) model_choice.Bind(wx.EVT_CHOICE, lambda event: self.on_model_choice(event, model_choice)) selection = self.constants.custom_model if self.constants.custom_model else "Host Model" model_choice.SetSelection(model_choice.FindString(selection)) sizer.Add(model_choice, 0, wx.ALIGN_CENTER | wx.ALL, 5) model_description = wx.StaticText(frame, label="Overrides Mac Model the Patcher will build for.", pos=(-1, -1)) - model_description.SetFont(wx.Font(11, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont")) + model_description.SetFont(gui_support.font_factory(11, wx.FONTWEIGHT_NORMAL)) sizer.Add(model_description, 0, wx.ALIGN_CENTER | wx.ALL, 5) tabs = list(self.settings.keys()) @@ -88,7 +88,7 @@ class SettingsFrame(wx.Frame): # Add return button return_button = wx.Button(frame, label="Return", pos=(-1, -1), size=(100, 30)) return_button.Bind(wx.EVT_BUTTON, self.on_return) - return_button.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont")) + return_button.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) sizer.Add(return_button, 0, wx.ALIGN_CENTER | wx.ALL, 10) frame.SetSizer(sizer) @@ -127,7 +127,7 @@ class SettingsFrame(wx.Frame): # Add title title = wx.StaticText(panel, label=setting, pos=(-1, -1)) - title.SetFont(wx.Font(19, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont")) + title.SetFont(gui_support.font_factory(19, wx.FONTWEIGHT_BOLD)) title.SetPosition((int(horizontal_center) - int(title.GetSize()[0] / 2) - 15, height)) highest_height_reached = height + title.GetSize()[1] + 10 @@ -137,7 +137,7 @@ class SettingsFrame(wx.Frame): if setting_info["type"] == "sub_title": # Add sub-title sub_title = wx.StaticText(panel, label=setting, pos=(-1, -1)) - sub_title.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont")) + sub_title.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) sub_title.SetPosition((int(horizontal_center) - int(sub_title.GetSize()[0] / 2) - 15, height)) highest_height_reached = height + sub_title.GetSize()[1] + 10 @@ -153,7 +153,7 @@ class SettingsFrame(wx.Frame): # Add checkbox, and description underneath checkbox = wx.CheckBox(panel, label=setting, pos=(10 + width, 10 + height), size = (300,-1)) checkbox.SetValue(setting_info["value"] if setting_info["value"] else False) - checkbox.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont")) + checkbox.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_BOLD)) event = lambda event, warning=setting_info["warning"] if "warning" in setting_info else "", override=bool(setting_info["override_function"]) if "override_function" in setting_info else False: self.on_checkbox(event, warning, override) checkbox.Bind(wx.EVT_CHECKBOX, event) if "condition" in setting_info: @@ -164,20 +164,20 @@ class SettingsFrame(wx.Frame): elif setting_info["type"] == "spinctrl": # Add spinctrl, and description underneath spinctrl = wx.SpinCtrl(panel, value=str(setting_info["value"]), pos=(width - 20, 10 + height), min=setting_info["min"], max=setting_info["max"], size = (45,-1)) - spinctrl.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont")) + spinctrl.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_BOLD)) spinctrl.Bind(wx.EVT_TEXT, lambda event, variable=setting: self.on_spinctrl(event, variable)) # Add label next to spinctrl label = wx.StaticText(panel, label=setting, pos=(spinctrl.GetSize()[0] + width - 16, spinctrl.GetPosition()[1])) - label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont")) + label.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_BOLD)) elif setting_info["type"] == "choice": # Title title = wx.StaticText(panel, label=setting, pos=(width + 30, 10 + height)) - title.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont")) + title.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_BOLD)) height += title.GetSize()[1] + 10 # Add combobox, and description underneath choice = wx.Choice(panel, pos=(width + 25, 10 + height), choices=setting_info["choices"], size = (150,-1)) - choice.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont")) + choice.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) choice.SetSelection(choice.FindString(setting_info["value"])) if "override_function" in setting_info: choice.Bind(wx.EVT_CHOICE, lambda event, variable=setting: self.settings[tab][variable]["override_function"](event)) @@ -186,7 +186,7 @@ class SettingsFrame(wx.Frame): height += 10 elif setting_info["type"] == "button": button = wx.Button(panel, label=setting, pos=(width + 25, 10 + height), size = (200,-1)) - button.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont")) + button.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) button.Bind(wx.EVT_BUTTON, lambda event, variable=setting: self.settings[tab][variable]["function"](event)) height += 10 @@ -195,7 +195,7 @@ class SettingsFrame(wx.Frame): lines = '\n'.join(setting_info["description"]) description = wx.StaticText(panel, label=lines, pos=(30 + width, 10 + height + 20)) - description.SetFont(wx.Font(11, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont")) + description.SetFont(gui_support.font_factory(11, wx.FONTWEIGHT_NORMAL)) height += 40 if "condition" in setting_info: if setting_info["condition"] is False: @@ -918,12 +918,12 @@ class SettingsFrame(wx.Frame): # Label: Flip individual bits corresponding to XNU's csr.h # If you're unfamiliar with how SIP works, do not touch this menu sip_label = wx.StaticText(panel, label="Flip individual bits corresponding to", pos=(sip_title.GetPosition()[0] - 20, sip_title.GetPosition()[1] + 30)) - sip_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont")) + sip_label.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) # Hyperlink: csr.h spacer = 1 if self.constants.detected_os >= os_data.os_data.big_sur else 3 sip_csr_h = wx.adv.HyperlinkCtrl(panel, id=wx.ID_ANY, label="XNU's csr.h", url="https://github.com/apple-oss-distributions/xnu/blob/xnu-8020.101.4/bsd/sys/csr.h", pos=(sip_label.GetPosition()[0] + sip_label.GetSize()[0] + 4, sip_label.GetPosition()[1] + spacer)) - sip_csr_h.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont")) + sip_csr_h.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) sip_csr_h.SetHoverColour(self.hyperlink_colour) sip_csr_h.SetNormalColour(self.hyperlink_colour) sip_csr_h.SetVisitedColour(self.hyperlink_colour) @@ -936,12 +936,12 @@ class SettingsFrame(wx.Frame): else: self.sip_value = 0x803 sip_configured_label = wx.StaticText(panel, label=f"Currently configured SIP: {hex(self.sip_value)}", pos=(sip_label.GetPosition()[0] + 35, sip_label.GetPosition()[1] + 20)) - sip_configured_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont")) + sip_configured_label.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_BOLD)) self.sip_configured_label = sip_configured_label # Label: SIP Status sip_booted_label = wx.StaticText(panel, label=f"Currently booted SIP: {hex(py_sip_xnu.SipXnu().get_sip_status().value)}", pos=(sip_configured_label.GetPosition()[0], sip_configured_label.GetPosition()[1] + 20)) - sip_booted_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont")) + sip_booted_label.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) # SIP toggles @@ -951,7 +951,7 @@ class SettingsFrame(wx.Frame): index = 1 for sip_bit in sip_data.system_integrity_protection.csr_values_extended: self.sip_checkbox = wx.CheckBox(panel, label=sip_data.system_integrity_protection.csr_values_extended[sip_bit]["name"].split("CSR_")[1], pos = (vertical_spacer, sip_booted_label.GetPosition()[1] + 20 + horizontal_spacer)) - self.sip_checkbox.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont")) + self.sip_checkbox.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) self.sip_checkbox.SetToolTip(f'Description: {sip_data.system_integrity_protection.csr_values_extended[sip_bit]["description"]}\nValue: {hex(sip_data.system_integrity_protection.csr_values_extended[sip_bit]["value"])}\nIntroduced in: macOS {sip_data.system_integrity_protection.csr_values_extended[sip_bit]["introduced_friendly"]}') if self.sip_value & sip_data.system_integrity_protection.csr_values_extended[sip_bit]["value"] == sip_data.system_integrity_protection.csr_values_extended[sip_bit]["value"]: @@ -959,7 +959,7 @@ class SettingsFrame(wx.Frame): horizontal_spacer += 20 if index == entries_per_row: - horizontal_spacer = 20 + horizontal_spacer = 15 vertical_spacer += 250 index += 1 @@ -975,11 +975,11 @@ class SettingsFrame(wx.Frame): # Label: Custom Serial Number custom_serial_number_label = wx.StaticText(panel, label="Custom Serial Number", pos=(title.GetPosition()[0] - 150, title.GetPosition()[1] + 30)) - custom_serial_number_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont")) + custom_serial_number_label.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_BOLD)) # Textbox: Custom Serial Number custom_serial_number_textbox = wx.TextCtrl(panel, pos=(custom_serial_number_label.GetPosition()[0] - 27, custom_serial_number_label.GetPosition()[1] + 20), size=(200, 25)) - custom_serial_number_textbox.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont")) + custom_serial_number_textbox.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) custom_serial_number_textbox.SetToolTip("Enter a custom serial number here. This will be used for the SMBIOS and iMessage.\n\nNote: This will not be used if the \"Use Custom Serial Number\" checkbox is not checked.") custom_serial_number_textbox.Bind(wx.EVT_TEXT, self.on_custom_serial_number_textbox) custom_serial_number_textbox.SetValue(self.constants.custom_serial_number) @@ -987,11 +987,11 @@ class SettingsFrame(wx.Frame): # Label: Custom Board Serial Number custom_board_serial_number_label = wx.StaticText(panel, label="Custom Board Serial Number", pos=(title.GetPosition()[0] + 120, custom_serial_number_label.GetPosition()[1])) - custom_board_serial_number_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont")) + custom_board_serial_number_label.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_BOLD)) # Textbox: Custom Board Serial Number custom_board_serial_number_textbox = wx.TextCtrl(panel, pos=(custom_board_serial_number_label.GetPosition()[0] - 5, custom_serial_number_textbox.GetPosition()[1]), size=(200, 25)) - custom_board_serial_number_textbox.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont")) + custom_board_serial_number_textbox.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) custom_board_serial_number_textbox.SetToolTip("Enter a custom board serial number here. This will be used for the SMBIOS and iMessage.\n\nNote: This will not be used if the \"Use Custom Board Serial Number\" checkbox is not checked.") custom_board_serial_number_textbox.Bind(wx.EVT_TEXT, self.on_custom_board_serial_number_textbox) custom_board_serial_number_textbox.SetValue(self.constants.custom_board_serial_number) @@ -999,7 +999,7 @@ class SettingsFrame(wx.Frame): # Button: Generate Serial Number (below) generate_serial_number_button = wx.Button(panel, label=f"Generate S/N: {self.constants.custom_model or self.constants.computer.real_model}", pos=(title.GetPosition()[0] - 30, custom_board_serial_number_label.GetPosition()[1] + 60), size=(200, 25)) - generate_serial_number_button.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont")) + generate_serial_number_button.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) generate_serial_number_button.Bind(wx.EVT_BUTTON, self.on_generate_serial_number) @@ -1032,7 +1032,7 @@ Hardware Information: """ # TextCtrl: properties self.app_stats = wx.TextCtrl(panel, value=lines, pos=(-1, title.GetPosition()[1] + 30), size=(600, 240), style=wx.TE_READONLY | wx.TE_MULTILINE | wx.TE_RICH2) - self.app_stats.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont")) + self.app_stats.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) def on_checkbox(self, event: wx.Event, warning_pop: str = "", override_function: bool = False) -> None: diff --git a/resources/wx_gui/gui_support.py b/resources/wx_gui/gui_support.py index 661df1948..b518b3685 100644 --- a/resources/wx_gui/gui_support.py +++ b/resources/wx_gui/gui_support.py @@ -1,20 +1,36 @@ -import wx -import os -import sys -import time +import datetime import logging +import os import plistlib -import threading +import random import subprocess -import applescript - -import packaging.version - +import sys +import threading +import time from pathlib import Path -from resources.wx_gui import gui_about -from resources import constants, device_probe +import applescript +import packaging.version +import wx + from data import model_array, os_data, smbios_data +from resources import constants, device_probe +from resources.wx_gui import gui_about + + +def get_font_face(): + if not get_font_face.font_face: + get_font_face.font_face = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT).GetFaceName() or "Lucida Grande" + + return get_font_face.font_face + + +get_font_face.font_face = None + + +# Centralize the common options for font creation +def font_factory(size: int, weight): + return wx.Font(size, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, weight, False, get_font_face()) class AutoUpdateStages: @@ -327,12 +343,12 @@ class RelaunchApplicationAsRoot: # Header header = wx.StaticText(self.frame, label="Relaunching as root", pos=(-1, 5)) - header.SetFont(wx.Font(19, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont")) + header.SetFont(font_factory(19, wx.FONTWEIGHT_BOLD)) header.Centre(wx.HORIZONTAL) # 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.SetFont(font_factory(13, wx.FONTWEIGHT_NORMAL)) countdown_label.Centre(wx.HORIZONTAL) # Set size of frame diff --git a/resources/wx_gui/gui_sys_patch_display.py b/resources/wx_gui/gui_sys_patch_display.py index 6129a11dd..78b57eeae 100644 --- a/resources/wx_gui/gui_sys_patch_display.py +++ b/resources/wx_gui/gui_sys_patch_display.py @@ -65,12 +65,12 @@ class SysPatchDisplayFrame(wx.Frame): frame = self if not frame else 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.SetFont(gui_support.font_factory(19, wx.FONTWEIGHT_BOLD)) title_label.Centre(wx.HORIZONTAL) # Label: Fetching patches... available_label = wx.StaticText(frame, label="Fetching patches for host", 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.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_BOLD)) available_label.Centre(wx.HORIZONTAL) # Progress bar @@ -118,7 +118,7 @@ class SysPatchDisplayFrame(wx.Frame): if not patches: # 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.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) patch_label.Centre(wx.HORIZONTAL) else: @@ -126,7 +126,7 @@ class SysPatchDisplayFrame(wx.Frame): i = 0 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.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) patch_label.Centre(wx.HORIZONTAL) i = i + 20 else: @@ -136,7 +136,7 @@ class SysPatchDisplayFrame(wx.Frame): if len(patch) > len(longest_patch): 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.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) anchor.Centre(wx.HORIZONTAL) anchor.Hide() @@ -146,7 +146,7 @@ class SysPatchDisplayFrame(wx.Frame): i = i + 20 logging.info(f"- {patch}") patch_label = wx.StaticText(frame, label=f"- {patch}", pos=(anchor.GetPosition()[0], available_label.GetPosition()[1] + i)) - patch_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont")) + patch_label.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) if i == 20: patch_label.SetLabel(patch_label.GetLabel().replace("-", "")) @@ -155,7 +155,7 @@ class SysPatchDisplayFrame(wx.Frame): 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()[1] + 25)) - patch_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont")) + patch_label.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_BOLD)) patch_label.Centre(wx.HORIZONTAL) longest_patch = "" @@ -170,7 +170,7 @@ class SysPatchDisplayFrame(wx.Frame): if len(patch) > len(longest_patch): longest_patch = patch anchor = wx.StaticText(frame, label=longest_patch.split('Validation: ')[1], pos=(-1, patch_label.GetPosition()[1] + 20)) - anchor.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont")) + anchor.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) anchor.Centre(wx.HORIZONTAL) anchor.Hide() @@ -184,7 +184,7 @@ class SysPatchDisplayFrame(wx.Frame): continue patch_label = wx.StaticText(frame, label=f"- {patch.split('Validation: ')[1]}", pos=(anchor.GetPosition()[0], anchor.GetPosition()[1] + i)) - patch_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont")) + patch_label.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) i = i + 20 if i == 20: @@ -199,30 +199,30 @@ class SysPatchDisplayFrame(wx.Frame): patch_text = f"{self.constants.computer.oclp_sys_version}, {date}" 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.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_BOLD)) 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.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) 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.on_start_root_patching(patches)) - start_button.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont")) + start_button.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) 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.on_revert_root_patching(patches)) - revert_button.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, ".AppleSystemUIFont")) + revert_button.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) 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_dismiss if self.init_with_parent else 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.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) return_button.Centre(wx.HORIZONTAL) self.return_button = return_button diff --git a/resources/wx_gui/gui_sys_patch_start.py b/resources/wx_gui/gui_sys_patch_start.py index 6fe6483dc..45958e418 100644 --- a/resources/wx_gui/gui_sys_patch_start.py +++ b/resources/wx_gui/gui_sys_patch_start.py @@ -56,11 +56,11 @@ class SysPatchStartFrame(wx.Frame): logging.info("KDK missing, generating KDK download 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.SetFont(gui_support.font_factory(19, wx.FONTWEIGHT_BOLD)) 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.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) subheader.Centre(wx.HORIZONTAL) progress_bar = wx.Gauge(frame, range=100, pos=(-1, subheader.GetPosition()[1] + subheader.GetSize()[1] + 5), size=(250, 20)) @@ -148,13 +148,13 @@ class SysPatchStartFrame(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.SetFont(gui_support.font_factory(19, wx.FONTWEIGHT_BOLD)) 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.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) label.Centre(wx.HORIZONTAL) @@ -166,7 +166,7 @@ class SysPatchStartFrame(wx.Frame): longest_patch = patch 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.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) anchor.Centre(wx.HORIZONTAL) anchor.Hide() @@ -177,7 +177,7 @@ class SysPatchStartFrame(wx.Frame): if (not patch.startswith("Settings") and not patch.startswith("Validation") and patches[patch] is True): logging.info(f"- {patch}") patch_label = wx.StaticText(dialog, label=f"- {patch}", pos=(anchor.GetPosition()[0], label.GetPosition()[1] + 20 + i)) - patch_label.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, ".AppleSystemUIFont")) + patch_label.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_BOLD)) i = i + 20 if i == 20: @@ -186,24 +186,24 @@ class SysPatchStartFrame(wx.Frame): 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.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_BOLD)) 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.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) 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.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) 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.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) return_button.Centre(wx.HORIZONTAL) self.return_button = return_button diff --git a/resources/wx_gui/gui_update.py b/resources/wx_gui/gui_update.py index 03ca75265..c9e9f24b6 100644 --- a/resources/wx_gui/gui_update.py +++ b/resources/wx_gui/gui_update.py @@ -70,7 +70,7 @@ 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.SetFont(gui_support.font_factory(19, wx.FONTWEIGHT_BOLD)) title_label.Centre(wx.HORIZONTAL) # Progress bar @@ -142,17 +142,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.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_BOLD)) 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.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) 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.SetFont(gui_support.font_factory(13, wx.FONTWEIGHT_NORMAL)) launch_label.Centre(wx.HORIZONTAL) # Adjust frame size