mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-24 03:50:14 +10:00
GUI: Strip Centre() work-around
This commit is contained in:
@@ -18,7 +18,7 @@ class AboutFrame(wx.Frame):
|
|||||||
logging.info("Generating About 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))
|
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.constants: constants.Constants = global_constants
|
||||||
gui_support.Centre(self, self.constants)
|
self.Centre()
|
||||||
self.hyperlink_colour = (25, 179, 231)
|
self.hyperlink_colour = (25, 179, 231)
|
||||||
|
|
||||||
self._generate_elements(self)
|
self._generate_elements(self)
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class BuildFrame(wx.Frame):
|
|||||||
if self.constants.update_stage != gui_support.AutoUpdateStages.INACTIVE:
|
if self.constants.update_stage != gui_support.AutoUpdateStages.INACTIVE:
|
||||||
self.constants.update_stage = gui_support.AutoUpdateStages.BUILDING
|
self.constants.update_stage = gui_support.AutoUpdateStages.BUILDING
|
||||||
|
|
||||||
gui_support.Centre(self, self.constants)
|
self.Centre()
|
||||||
self.frame_modal.ShowWindowModal()
|
self.frame_modal.ShowWindowModal()
|
||||||
|
|
||||||
self._invoke_build()
|
self._invoke_build()
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class InstallOCFrame(wx.Frame):
|
|||||||
if self.constants.update_stage != gui_support.AutoUpdateStages.INACTIVE:
|
if self.constants.update_stage != gui_support.AutoUpdateStages.INACTIVE:
|
||||||
self.constants.update_stage = gui_support.AutoUpdateStages.INSTALLING
|
self.constants.update_stage = gui_support.AutoUpdateStages.INSTALLING
|
||||||
|
|
||||||
gui_support.Centre(self, self.constants)
|
self.Centre()
|
||||||
self.Show()
|
self.Show()
|
||||||
|
|
||||||
self._display_disks()
|
self._display_disks()
|
||||||
|
|||||||
@@ -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))
|
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()
|
gui_support.GenerateMenubar(self, self.constants).generate()
|
||||||
gui_support.Centre(self, self.constants)
|
self.Centre()
|
||||||
|
|
||||||
# Title: Pulling installer catalog
|
# Title: Pulling installer catalog
|
||||||
title_label = wx.StaticText(self, label="Pulling installer catalog", pos=(-1,5))
|
title_label = wx.StaticText(self, label="Pulling installer catalog", pos=(-1,5))
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class macOSInstallerFlashFrame(wx.Frame):
|
|||||||
|
|
||||||
self._generate_elements()
|
self._generate_elements()
|
||||||
|
|
||||||
gui_support.Centre(self, self.constants)
|
self.Centre()
|
||||||
self.Show()
|
self.Show()
|
||||||
|
|
||||||
self._populate_installers()
|
self._populate_installers()
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class MainFrame(wx.Frame):
|
|||||||
|
|
||||||
self._generate_elements()
|
self._generate_elements()
|
||||||
|
|
||||||
gui_support.Centre(self, self.constants)
|
self.Centre()
|
||||||
self.Show()
|
self.Show()
|
||||||
|
|
||||||
self._preflight_checks()
|
self._preflight_checks()
|
||||||
|
|||||||
@@ -101,54 +101,6 @@ class GaugePulseCallback:
|
|||||||
time.sleep(0.005)
|
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:
|
class CheckProperties:
|
||||||
|
|
||||||
def __init__(self, global_constants: constants.Constants) -> None:
|
def __init__(self, global_constants: constants.Constants) -> None:
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class SysPatchDisplayFrame(wx.Frame):
|
|||||||
else:
|
else:
|
||||||
super().__init__(parent, title=title, size=(360, 200), style=wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER ^ wx.MAXIMIZE_BOX)
|
super().__init__(parent, title=title, size=(360, 200), style=wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER ^ wx.MAXIMIZE_BOX)
|
||||||
self.frame = self
|
self.frame = self
|
||||||
gui_support.Centre(self.frame, self.constants)
|
self.frame.Centre()
|
||||||
|
|
||||||
self.title = title
|
self.title = title
|
||||||
self.constants: constants.Constants = global_constants
|
self.constants: constants.Constants = global_constants
|
||||||
|
|||||||
@@ -43,7 +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))
|
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()
|
gui_support.GenerateMenubar(self, self.constants).generate()
|
||||||
gui_support.Centre(self, self.constants)
|
self.Centre()
|
||||||
|
|
||||||
if self.patches == {}:
|
if self.patches == {}:
|
||||||
self.patches = sys_patch_detect.DetectRootPatch(self.constants.computer.real_model, self.constants).detect_patch_set()
|
self.patches = sys_patch_detect.DetectRootPatch(self.constants.computer.real_model, self.constants).detect_patch_set()
|
||||||
|
|||||||
@@ -38,10 +38,10 @@ class UpdateFrame(wx.Frame):
|
|||||||
self.application_path = self.constants.payload_path / "OpenCore-Patcher.app"
|
self.application_path = self.constants.payload_path / "OpenCore-Patcher.app"
|
||||||
self.screen_location: wx.Point = screen_location
|
self.screen_location: wx.Point = screen_location
|
||||||
if parent:
|
if parent:
|
||||||
gui_support.Centre(self.parent, self.constants)
|
self.parent.Centre()
|
||||||
self.screen_location = parent.GetScreenPosition()
|
self.screen_location = parent.GetScreenPosition()
|
||||||
else:
|
else:
|
||||||
gui_support.Centre(self, self.constants)
|
self.Centre()
|
||||||
self.screen_location = self.GetScreenPosition()
|
self.screen_location = self.GetScreenPosition()
|
||||||
|
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ class UpdateFrame(wx.Frame):
|
|||||||
self.progress_bar = progress_bar
|
self.progress_bar = progress_bar
|
||||||
self.progress_bar_animation = progress_bar_animation
|
self.progress_bar_animation = progress_bar_animation
|
||||||
|
|
||||||
gui_support.Centre(self.frame, self.constants)
|
self.frame.Centre()
|
||||||
self.frame.Show()
|
self.frame.Show()
|
||||||
wx.Yield()
|
wx.Yield()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user