macos icons

This commit is contained in:
dries.k
2022-09-24 15:49:11 +02:00
parent f2ff2f9e85
commit e36899f811
11 changed files with 16 additions and 9 deletions

View File

@@ -4,6 +4,8 @@ import platform
block_cipher = None
logo = "gotify_tray/gui/images/logo.ico" if platform.system() != "Darwin" else "gotify_tray/gui/images/logo-macos.ico"
a = Analysis(['gotify_tray/__main__.py'],
pathex=[os.getcwd()],
binaries=[],
@@ -29,7 +31,7 @@ exe = EXE(pyz,
upx=True,
console=False,
version='version.py',
icon='logo.ico')
icon=logo)
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
@@ -41,5 +43,5 @@ coll = COLLECT(exe,
if platform.system() == "Darwin":
app = BUNDLE(coll,
name='Gotify Tray.app',
icon='logo.ico',
icon=logo,
bundle_identifier=None)

View File

@@ -18,7 +18,7 @@ from gotify_tray.tasks import (
GetMessagesTask,
ServerConnectionWatchdogTask,
)
from gotify_tray.utils import get_abs_path, verify_server
from gotify_tray.utils import get_icon, verify_server
from PyQt6 import QtCore, QtGui, QtWidgets
from ..__version__ import __title__
@@ -410,9 +410,7 @@ def start_gui():
app = MainApplication(sys.argv)
app.setApplicationName(title)
app.setQuitOnLastWindowClosed(False)
app.setWindowIcon(
QtGui.QIcon(get_abs_path("gotify_tray/gui/images/gotify-small.png"))
)
app.setWindowIcon(QtGui.QIcon(get_icon("gotify-small")))
app.setStyle("fusion")
init_logger(logger)

Binary file not shown.

After

Width:  |  Height:  |  Size: 339 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

View File

Before

Width:  |  Height:  |  Size: 132 KiB

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 KiB

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -2,7 +2,7 @@ import logging
from PyQt6 import QtGui, QtWidgets
from gotify_tray.__version__ import __title__
from gotify_tray.utils import get_abs_path
from gotify_tray.utils import get_icon
logger = logging.getLogger("gotify-tray")
@@ -44,7 +44,7 @@ class Tray(QtWidgets.QSystemTrayIcon):
self.setContextMenu(menu)
def set_icon_ok(self):
self.setIcon(QtGui.QIcon(get_abs_path("gotify_tray/gui/images/gotify-small.png")))
self.setIcon(QtGui.QIcon(get_icon("tray")))
def set_icon_error(self):
self.setIcon(QtGui.QIcon(get_abs_path("gotify_tray/gui/images/gotify-small-error.png")))
self.setIcon(QtGui.QIcon(get_icon("tray-error")))

View File

@@ -57,3 +57,10 @@ def open_file(filename: str):
os.startfile(filename)
elif platform.system() == "Darwin":
subprocess.call(["open", filename])
def get_icon(name: str) -> str:
if platform.system() == "Darwin":
name += "-macos"
return get_abs_path(f"gotify_tray/gui/images/{name}.png")