constants.py: Load icons from relative resources

Resolves issues with icons failing to load on macOS download UI
This commit is contained in:
Mykola Grymalyuk
2023-11-01 07:18:06 -06:00
parent d57a758c73
commit 6d026290ac
2 changed files with 14 additions and 12 deletions

View File

@@ -8,6 +8,8 @@
- Add new Launch Daemon for clean up on macOS updates - Add new Launch Daemon for clean up on macOS updates
- Resolves KDKless Macs failing to boot after updating from 14.0 to 14.x - Resolves KDKless Macs failing to boot after updating from 14.0 to 14.x
- `/Library/LaunchDaemons/com.dortania.opencore-legacy-patcher.macos-update.plist` - `/Library/LaunchDaemons/com.dortania.opencore-legacy-patcher.macos-update.plist`
- Load UI icons from local path
- Resolves macOS downloader crash on slower machines
- Remove News Widget removal from Control Centre - Remove News Widget removal from Control Centre
- News Widget no longer crashes on 3802-based GPUs - News Widget no longer crashes on 3802-based GPUs
- Resolve i210 NIC support for macOS Sonoma - Resolve i210 NIC support for macOS Sonoma

View File

@@ -707,6 +707,13 @@ class Constants:
return self.payload_path / Path("Tools/RSRRepair") return self.payload_path / Path("Tools/RSRRepair")
# Icons # Icons
@property
def icns_resource_path(self):
if self.launcher_script:
return self.payload_path / Path("Icon/AppIcons")
return Path(self.launcher_binary).parent.parent / Path("Resources")
@property @property
def app_icon_path(self): def app_icon_path(self):
return self.payload_path / Path("OC-Patcher.icns") return self.payload_path / Path("OC-Patcher.icns")
@@ -729,23 +736,23 @@ class Constants:
@property @property
def icon_path_macos_generic(self): def icon_path_macos_generic(self):
return self.payload_path / Path("Icon/AppIcons/Generic.icns") return self.icns_resource_path / Path("Generic.icns")
@property @property
def icon_path_macos_big_sur(self): def icon_path_macos_big_sur(self):
return self.payload_path / Path("Icon/AppIcons/BigSur.icns") return self.icns_resource_path / Path("BigSur.icns")
@property @property
def icon_path_macos_monterey(self): def icon_path_macos_monterey(self):
return self.payload_path / Path("Icon/AppIcons/Monterey.icns") return self.icns_resource_path / Path("Monterey.icns")
@property @property
def icon_path_macos_ventura(self): def icon_path_macos_ventura(self):
return self.payload_path / Path("Icon/AppIcons/Ventura.icns") return self.icns_resource_path / Path("Ventura.icns")
@property @property
def icon_path_macos_sonoma(self): def icon_path_macos_sonoma(self):
return self.payload_path / Path("Icon/AppIcons/Sonoma.icns") return self.icns_resource_path / Path("Sonoma.icns")
@property @property
def gui_path(self): def gui_path(self):
@@ -768,13 +775,6 @@ class Constants:
def kdk_download_path(self): def kdk_download_path(self):
return self.payload_path / Path("KDK.dmg") return self.payload_path / Path("KDK.dmg")
@property
def icns_resource_path(self):
if self.launcher_script:
return self.payload_path / Path("Icon/AppIcons")
return Path(self.launcher_binary).parent.parent / Path("Resources")
@property @property
def icons_path(self): def icons_path(self):
return [ return [