mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-06-19 13:50:00 +10:00
Changes
This commit is contained in:
@@ -119,6 +119,7 @@ class Constants:
|
|||||||
self.original_path: Path = Path(__file__).parent.parent.resolve()
|
self.original_path: Path = Path(__file__).parent.parent.resolve()
|
||||||
self.payload_path: Path = self.current_path / Path("payloads")
|
self.payload_path: Path = self.current_path / Path("payloads")
|
||||||
|
|
||||||
|
|
||||||
# Patcher Settings
|
# Patcher Settings
|
||||||
## Internal settings
|
## Internal settings
|
||||||
self.allow_oc_everywhere: bool = False # Set whether Patcher can be run on unsupported Macs
|
self.allow_oc_everywhere: bool = False # Set whether Patcher can be run on unsupported Macs
|
||||||
@@ -235,6 +236,14 @@ class Constants:
|
|||||||
os_data.os_data.ventura,
|
os_data.os_data.ventura,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
self.icons_path = [
|
||||||
|
str(self.icon_path_macos_generic),
|
||||||
|
str(self.icon_path_macos_big_sur),
|
||||||
|
str(self.icon_path_macos_monterey),
|
||||||
|
str(self.icon_path_macos_ventura),
|
||||||
|
str(self.icon_path_macos_sonoma)
|
||||||
|
]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def special_build(self):
|
def special_build(self):
|
||||||
"""
|
"""
|
||||||
@@ -680,6 +689,26 @@ class Constants:
|
|||||||
def icon_path_ssd(self):
|
def icon_path_ssd(self):
|
||||||
return self.payload_path / Path("Icon/SSD/.VolumeIcon.icns")
|
return self.payload_path / Path("Icon/SSD/.VolumeIcon.icns")
|
||||||
|
|
||||||
|
@property
|
||||||
|
def icon_path_macos_generic(self):
|
||||||
|
return self.payload_path / Path("Icon/AppIcons/Generic.icns")
|
||||||
|
|
||||||
|
@property
|
||||||
|
def icon_path_macos_big_sur(self):
|
||||||
|
return self.payload_path / Path("Icon/AppIcons/BigSur.icns")
|
||||||
|
|
||||||
|
@property
|
||||||
|
def icon_path_macos_monterey(self):
|
||||||
|
return self.payload_path / Path("Icon/AppIcons/Monterey.icns")
|
||||||
|
|
||||||
|
@property
|
||||||
|
def icon_path_macos_ventura(self):
|
||||||
|
return self.payload_path / Path("Icon/AppIcons/Ventura.icns")
|
||||||
|
|
||||||
|
@property
|
||||||
|
def icon_path_macos_sonoma(self):
|
||||||
|
return self.payload_path / Path("Icon/AppIcons/Sonoma.icns")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def gui_path(self):
|
def gui_path(self):
|
||||||
return self.payload_path / Path("Icon/Resources.zip")
|
return self.payload_path / Path("Icon/Resources.zip")
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ class DownloadFrame(wx.Frame):
|
|||||||
title_label.SetFont(gui_support.font_factory(19, wx.FONTWEIGHT_BOLD))
|
title_label.SetFont(gui_support.font_factory(19, wx.FONTWEIGHT_BOLD))
|
||||||
title_label.Centre(wx.HORIZONTAL)
|
title_label.Centre(wx.HORIZONTAL)
|
||||||
|
|
||||||
progress_bar = wx.Gauge(frame, range=100, pos=(-1, title_label.GetPosition()[1] + title_label.GetSize()[1] + 5), size=(300, 20), style=wx.GA_PROGRESS| wx.GA_SMOOTH)
|
progress_bar = wx.Gauge(frame, range=100, pos=(-1, title_label.GetPosition()[1] + title_label.GetSize()[1] + 5), size=(300, 20))
|
||||||
progress_bar.Centre(wx.HORIZONTAL)
|
progress_bar.Centre(wx.HORIZONTAL)
|
||||||
|
|
||||||
label_amount = wx.StaticText(frame, label="Preparing download", pos=(-1, progress_bar.GetPosition()[1] + progress_bar.GetSize()[1]))
|
label_amount = wx.StaticText(frame, label="Preparing download", pos=(-1, progress_bar.GetPosition()[1] + progress_bar.GetSize()[1]))
|
||||||
|
|||||||
@@ -44,21 +44,22 @@ class macOSInstallerDownloadFrame(wx.Frame):
|
|||||||
self._generate_elements(self.frame_modal)
|
self._generate_elements(self.frame_modal)
|
||||||
self.frame_modal.ShowWindowModal()
|
self.frame_modal.ShowWindowModal()
|
||||||
|
|
||||||
self.icons_path = [
|
self.icons = [[self._icon_to_bitmap(i), self._icon_to_bitmap(i, (64, 64))] for i in self.constants.icons_path]
|
||||||
str(self.constants.icns_resource_path / "Generic.icns"),
|
|
||||||
str(self.constants.icns_resource_path / "BigSur.icns"),
|
|
||||||
str(self.constants.icns_resource_path / "Monterey.icns"),
|
|
||||||
str(self.constants.icns_resource_path / "Ventura.icns"),
|
|
||||||
str(self.constants.icns_resource_path / "Sonoma.icns")
|
|
||||||
]
|
|
||||||
|
|
||||||
self.icons = [
|
def _icon_to_bitmap(self, icon: str, size: tuple = (32, 32)) -> wx.Bitmap:
|
||||||
[wx.Bitmap(wx.Bitmap(str(self.constants.icns_resource_path / "Generic.icns"),wx.BITMAP_TYPE_ICON).ConvertToImage().Rescale(32, 32, wx.IMAGE_QUALITY_HIGH)),wx.Bitmap(wx.Bitmap(str(self.constants.icns_resource_path / "Generic.icns"),wx.BITMAP_TYPE_ICON).ConvertToImage().Rescale(64, 64, wx.IMAGE_QUALITY_HIGH))],
|
"""
|
||||||
[wx.Bitmap(wx.Bitmap(str(self.constants.icns_resource_path / "BigSur.icns"),wx.BITMAP_TYPE_ICON).ConvertToImage().Rescale(32, 32, wx.IMAGE_QUALITY_HIGH)),wx.Bitmap(wx.Bitmap(str(self.constants.icns_resource_path / "BigSur.icns"),wx.BITMAP_TYPE_ICON).ConvertToImage().Rescale(64, 64, wx.IMAGE_QUALITY_HIGH))],
|
Convert icon to bitmap
|
||||||
[wx.Bitmap(wx.Bitmap(str(self.constants.icns_resource_path / "Monterey.icns"),wx.BITMAP_TYPE_ICON).ConvertToImage().Rescale(32, 32, wx.IMAGE_QUALITY_HIGH)),wx.Bitmap(wx.Bitmap(str(self.constants.icns_resource_path / "Monterey.icns"),wx.BITMAP_TYPE_ICON).ConvertToImage().Rescale(64, 64, wx.IMAGE_QUALITY_HIGH))],
|
"""
|
||||||
[wx.Bitmap(wx.Bitmap(str(self.constants.icns_resource_path / "Ventura.icns"),wx.BITMAP_TYPE_ICON).ConvertToImage().Rescale(32, 32, wx.IMAGE_QUALITY_HIGH)),wx.Bitmap(wx.Bitmap(str(self.constants.icns_resource_path / "Ventura.icns"),wx.BITMAP_TYPE_ICON).ConvertToImage().Rescale(64, 64, wx.IMAGE_QUALITY_HIGH))],
|
return wx.Bitmap(wx.Bitmap(icon, wx.BITMAP_TYPE_ICON).ConvertToImage().Rescale(size[0], size[1], wx.IMAGE_QUALITY_HIGH))
|
||||||
[wx.Bitmap(wx.Bitmap(str(self.constants.icns_resource_path / "Sonoma.icns"),wx.BITMAP_TYPE_ICON).ConvertToImage().Rescale(32, 32, wx.IMAGE_QUALITY_HIGH)),wx.Bitmap(wx.Bitmap(str(self.constants.icns_resource_path / "Sonoma.icns"),wx.BITMAP_TYPE_ICON).ConvertToImage().Rescale(64, 64, wx.IMAGE_QUALITY_HIGH))]
|
|
||||||
]
|
def _macos_version_to_icon(self, version: int) -> int:
|
||||||
|
"""
|
||||||
|
Convert macOS version to icon
|
||||||
|
"""
|
||||||
|
if version < os_data.os_data.big_sur or version > os_data.os_data.sonoma:
|
||||||
|
return 0
|
||||||
|
else:
|
||||||
|
return version - 19
|
||||||
|
|
||||||
|
|
||||||
def _generate_elements(self, frame: wx.Frame = None) -> None:
|
def _generate_elements(self, frame: wx.Frame = None) -> None:
|
||||||
@@ -173,10 +174,7 @@ class macOSInstallerDownloadFrame(wx.Frame):
|
|||||||
extra = " Beta" if installers[item]['Variant'] in ["DeveloperSeed" , "PublicSeed"] else ""
|
extra = " Beta" if installers[item]['Variant'] in ["DeveloperSeed" , "PublicSeed"] else ""
|
||||||
logging.info(f"- macOS {installers[item]['Version']} ({installers[item]['Build']}):\n - Size: {utilities.human_fmt(installers[item]['Size'])}\n - Source: {installers[item]['Source']}\n - Variant: {installers[item]['Variant']}\n - Link: {installers[item]['Link']}\n")
|
logging.info(f"- macOS {installers[item]['Version']} ({installers[item]['Build']}):\n - Size: {utilities.human_fmt(installers[item]['Size'])}\n - Source: {installers[item]['Source']}\n - Variant: {installers[item]['Variant']}\n - Link: {installers[item]['Link']}\n")
|
||||||
index = self.list.InsertItem(self.list.GetItemCount(), f"macOS {installers[item]['Version']} {os_data.os_conversion.convert_kernel_to_marketing_name(int(installers[item]['Build'][:2]))}{extra} ({installers[item]['Build']})")
|
index = self.list.InsertItem(self.list.GetItemCount(), f"macOS {installers[item]['Version']} {os_data.os_conversion.convert_kernel_to_marketing_name(int(installers[item]['Build'][:2]))}{extra} ({installers[item]['Build']})")
|
||||||
if int(installers[item]['Build'][:2]) > os_data.os_data.sonoma:
|
self.list.SetItemImage(index, self._macos_version_to_icon(int(installers[item]['Build'][:2])))
|
||||||
self.list.SetItemImage(index, 0)
|
|
||||||
else:
|
|
||||||
self.list.SetItemImage(index, int(installers[item]['Build'][:2])-19) # Darwin version to index conversion. i.e. Darwin 20 -> 1 -> BigSur.icns
|
|
||||||
self.list.SetItem(index, 1, utilities.human_fmt(installers[item]['Size']))
|
self.list.SetItem(index, 1, utilities.human_fmt(installers[item]['Size']))
|
||||||
self.list.SetItem(index, 2, installers[item]['Date'].strftime("%x"))
|
self.list.SetItem(index, 2, installers[item]['Date'].strftime("%x"))
|
||||||
|
|
||||||
@@ -315,7 +313,7 @@ class macOSInstallerDownloadFrame(wx.Frame):
|
|||||||
global_constants=self.constants,
|
global_constants=self.constants,
|
||||||
download_obj=download_obj,
|
download_obj=download_obj,
|
||||||
item_name=f"macOS {list(installers.values())[selected_item]['Version']} ({list(installers.values())[selected_item]['Build']})",
|
item_name=f"macOS {list(installers.values())[selected_item]['Version']} ({list(installers.values())[selected_item]['Build']})",
|
||||||
download_icon=self.icons_path[int(list(installers.values())[selected_item]['Build'][:2])-19] if int(list(installers.values())[selected_item]['Build'][:2]) <= os_data.os_data.sonoma else self.icons_path[0]
|
download_icon=self.constants.icons_path[self._macos_version_to_icon(int(list(installers.values())[selected_item]['Build'][:2]))]
|
||||||
)
|
)
|
||||||
|
|
||||||
if download_obj.download_complete is False:
|
if download_obj.download_complete is False:
|
||||||
|
|||||||
Reference in New Issue
Block a user