diff --git a/CHANGELOG.md b/CHANGELOG.md index b3adef5b9..bbca9e594 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ - Resolve SharedSupport.dmg pathing error during macOS Installer Verification - Applicable to systems with 2 (or more) USB Installers with the same name plugged in - Resolve payloads path being mis-routed during CLI calls + - Add UI when fetching root patches for host ## 0.6.6 - Implement option to disable ColorSync downgrade on HD 3000 Macs diff --git a/resources/wx_gui/gui_about.py b/resources/wx_gui/gui_about.py index 1bb18be05..611675de6 100644 --- a/resources/wx_gui/gui_about.py +++ b/resources/wx_gui/gui_about.py @@ -4,6 +4,8 @@ import wx import wx.adv import logging +from resources.wx_gui import gui_support + from resources import constants @@ -16,7 +18,7 @@ class AboutFrame(wx.Frame): logging.info("Generating About frame") super(AboutFrame, self).__init__(None, title="About", size=(350, 350), style=wx.DEFAULT_FRAME_STYLE & ~(wx.RESIZE_BORDER | wx.MAXIMIZE_BOX)) self.constants: constants.Constants = global_constants - self.Centre() + gui_support.Centre(self, self.constants) self.hyperlink_colour = (25, 179, 231) self._generate_elements(self) diff --git a/resources/wx_gui/gui_build.py b/resources/wx_gui/gui_build.py index 5dafddf26..14041299b 100644 --- a/resources/wx_gui/gui_build.py +++ b/resources/wx_gui/gui_build.py @@ -38,7 +38,7 @@ class BuildFrame(wx.Frame): if self.constants.update_stage != gui_support.AutoUpdateStages.INACTIVE: self.constants.update_stage = gui_support.AutoUpdateStages.BUILDING - self.Centre() + gui_support.Centre(self, self.constants) self.frame_modal.ShowWindowModal() self._invoke_build() diff --git a/resources/wx_gui/gui_install_oc.py b/resources/wx_gui/gui_install_oc.py index 70c2cbcb0..ae14bfd52 100644 --- a/resources/wx_gui/gui_install_oc.py +++ b/resources/wx_gui/gui_install_oc.py @@ -33,7 +33,7 @@ class InstallOCFrame(wx.Frame): if self.constants.update_stage != gui_support.AutoUpdateStages.INACTIVE: self.constants.update_stage = gui_support.AutoUpdateStages.INSTALLING - self.Centre() + gui_support.Centre(self, self.constants) self.Show() self._display_disks() diff --git a/resources/wx_gui/gui_macos_installer_download.py b/resources/wx_gui/gui_macos_installer_download.py index adc569164..e92370fdc 100644 --- a/resources/wx_gui/gui_macos_installer_download.py +++ b/resources/wx_gui/gui_macos_installer_download.py @@ -84,7 +84,7 @@ class macOSInstallerDownloadFrame(wx.Frame): """ super(macOSInstallerDownloadFrame, self).__init__(None, title=self.title, size=(300, 200), style=wx.DEFAULT_FRAME_STYLE & ~(wx.RESIZE_BORDER | wx.MAXIMIZE_BOX)) gui_support.GenerateMenubar(self, self.constants).generate() - self.Centre() + gui_support.Centre(self, self.constants) # Title: Pulling installer catalog title_label = wx.StaticText(self, label="Pulling installer catalog", pos=(-1,5)) diff --git a/resources/wx_gui/gui_macos_installer_flash.py b/resources/wx_gui/gui_macos_installer_flash.py index fef0c066e..4fb518eb3 100644 --- a/resources/wx_gui/gui_macos_installer_flash.py +++ b/resources/wx_gui/gui_macos_installer_flash.py @@ -39,7 +39,7 @@ class macOSInstallerFlashFrame(wx.Frame): self._generate_elements() - self.Centre() + gui_support.Centre(self, self.constants) self.Show() self._populate_installers() @@ -79,7 +79,6 @@ class macOSInstallerFlashFrame(wx.Frame): wx.Yield() frame_modal = wx.Dialog(self, title=self.title, size=(350, 200)) - frame_modal.Centre(wx.HORIZONTAL) # Title: Select macOS Installer title_label = wx.StaticText(frame_modal, label="Select local macOS Installer", pos=(-1,5)) diff --git a/resources/wx_gui/gui_main_menu.py b/resources/wx_gui/gui_main_menu.py index 8a574abd8..1c8de792e 100644 --- a/resources/wx_gui/gui_main_menu.py +++ b/resources/wx_gui/gui_main_menu.py @@ -39,7 +39,7 @@ class MainFrame(wx.Frame): self._generate_elements() - self.Centre() + gui_support.Centre(self, self.constants) self.Show() self._preflight_checks() diff --git a/resources/wx_gui/gui_support.py b/resources/wx_gui/gui_support.py index 504c889a8..689f6f142 100644 --- a/resources/wx_gui/gui_support.py +++ b/resources/wx_gui/gui_support.py @@ -50,7 +50,7 @@ class GenerateMenubar: class GaugePulseCallback: """ - Uses an alternative Pulse() method for wx.Gauge() on macOS Monterey+ + Uses an alternative Pulse() method for wx.Gauge() on macOS Monterey+ with non-Metal GPUs Dirty hack, however better to display some form of animation than none at all """ @@ -101,6 +101,54 @@ class GaugePulseCallback: time.sleep(0.005) +class Centre: + """ + Alternative to wx.Frame.Centre() for macOS Ventura+ on non-Metal GPUs + ---------- + As reported by socamx#3874, all of their non-Metal Mac minis would incorrectly centre + at the top of the screen, rather than the screen centre. Half of the window frame would + be off-screen, making it rather difficult to grab frame handle and move the window. + + This bug is only triggered when the application is launched via AppleScript, + ie. Relaunch as root for root patching. + + As calculating screen centre is trivial, this is safe for all non-Metal Macs. + + Test unit specs: + - Macmini4,1 (2010, Nvidia Tesla) + - Asus VP228HE 21.5" Display (1920x1080) + """ + + def __init__(self, frame: wx.Frame, global_constants: constants.Constants) -> None: + self.frame: wx.Frame = frame + self.constants: constants.Constants = global_constants + + self._centre() + + + def _centre(self) -> None: + """ + Calculate centre position of screen and set window position + """ + if self.constants.detected_os < os_data.os_data.ventura: + self.frame.Centre() + return + + if CheckProperties(self.constants).host_is_non_metal() is False: + self.frame.Centre() + return + + # Get screen resolution + screen_resolution = wx.DisplaySize() + window_size = self.frame.GetSize() + + # Calculate window position + x_pos = int((screen_resolution[0] - window_size[0]) / 2) + y_pos = int((screen_resolution[1] - window_size[1]) / 2) + + self.frame.SetPosition((x_pos, y_pos)) + + class CheckProperties: def __init__(self, global_constants: constants.Constants) -> None: diff --git a/resources/wx_gui/gui_sys_patch_display.py b/resources/wx_gui/gui_sys_patch_display.py index 6129a11dd..04d155b27 100644 --- a/resources/wx_gui/gui_sys_patch_display.py +++ b/resources/wx_gui/gui_sys_patch_display.py @@ -32,7 +32,7 @@ class SysPatchDisplayFrame(wx.Frame): else: super().__init__(parent, title=title, size=(360, 200), style=wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER ^ wx.MAXIMIZE_BOX) self.frame = self - self.frame.Centre() + gui_support.Centre(self.frame, self.constants) self.title = title self.constants: constants.Constants = global_constants diff --git a/resources/wx_gui/gui_sys_patch_start.py b/resources/wx_gui/gui_sys_patch_start.py index ffef152a9..153fa460a 100644 --- a/resources/wx_gui/gui_sys_patch_start.py +++ b/resources/wx_gui/gui_sys_patch_start.py @@ -43,22 +43,7 @@ class SysPatchStartFrame(wx.Frame): super(SysPatchStartFrame, self).__init__(parent, title=title, size=(350, 200), style=wx.DEFAULT_FRAME_STYLE & ~(wx.RESIZE_BORDER | wx.MAXIMIZE_BOX)) gui_support.GenerateMenubar(self, self.constants).generate() - - - logging.info("Display Properties before CentreOnScreen() call:") - logging.info(f" Screen Size: {wx.DisplaySize()}") - logging.info(f" Screen Position: {wx.Display().GetGeometry().GetPosition()}") - logging.info(f" Frame Size: {self.GetSize()}") - logging.info(f" Frame Position: {self.GetPosition()}") - - self.CentreOnScreen() - - logging.info("Display Properties after CentreOnScreen() call:") - logging.info(f" Screen Size: {wx.DisplaySize()}") - logging.info(f" Screen Position: {wx.Display().GetGeometry().GetPosition()}") - logging.info(f" Frame Size: {self.GetSize()}") - logging.info(f" Frame Position: {self.GetPosition()}") - + gui_support.Centre(self, self.constants) if self.patches == {}: self.patches = sys_patch_detect.DetectRootPatch(self.constants.computer.real_model, self.constants).detect_patch_set() diff --git a/resources/wx_gui/gui_update.py b/resources/wx_gui/gui_update.py index b3e862ef0..d9b685686 100644 --- a/resources/wx_gui/gui_update.py +++ b/resources/wx_gui/gui_update.py @@ -38,10 +38,10 @@ class UpdateFrame(wx.Frame): self.application_path = self.constants.payload_path / "OpenCore-Patcher.app" self.screen_location: wx.Point = screen_location if parent: - self.parent.Centre() + gui_support.Centre(self.parent, self.constants) self.screen_location = parent.GetScreenPosition() else: - self.Centre() + gui_support.Centre(self, self.constants) self.screen_location = self.GetScreenPosition() @@ -82,7 +82,7 @@ class UpdateFrame(wx.Frame): self.progress_bar = progress_bar self.progress_bar_animation = progress_bar_animation - self.frame.Centre() + gui_support.Centre(self.frame, self.constants) self.frame.Show() wx.Yield()