1
0
Fork 0
mirror of synced 2024-06-16 17:44:44 +12:00

ImageManager: Check if desktop icons are supported on current plaform

Before creating icons, check if desktop links are supported by Rare
on the current platform.

Fixes Dummerle/Rare#262
This commit is contained in:
loathingKernel 2023-05-13 17:57:39 +03:00 committed by Dummerle
parent ae8cee76ae
commit 737730583f
2 changed files with 8 additions and 3 deletions

View file

@ -34,7 +34,7 @@ from legendary.models.game import Game
from rare.lgndr.core import LegendaryCore
from rare.models.image import ImageSize
from rare.models.signals import GlobalSignals
from rare.utils.paths import image_dir, resources_path, desktop_icon_suffix
from rare.utils.paths import image_dir, resources_path, desktop_icon_suffix, desktop_links_supported
# from requests_futures.sessions import FuturesSession
@ -281,8 +281,9 @@ class ImageManager(QObject):
painter.end()
cover = cover.scaled(ImageSize.Image.size, Qt.KeepAspectRatio, Qt.SmoothTransformation)
icon = self.__convert_icon(cover)
icon.save(str(self.__img_desktop_icon(game.app_name)), format=desktop_icon_suffix().upper())
if desktop_links_supported():
icon = self.__convert_icon(cover)
icon.save(str(self.__img_desktop_icon(game.app_name)), format=desktop_icon_suffix().upper())
# this is not required if we ever want to re-apply the alpha channel
# cover = cover.convertToFormat(QImage.Format_Indexed8)

View file

@ -83,6 +83,10 @@ __link_suffix = {
"link": "desktop",
"icon": "png",
},
# "Darwin": {
# "link": "",
# "icon": "icns",
# },
}
def desktop_links_supported() -> bool: