use absolute paths to access images

This commit is contained in:
dries.k
2022-03-21 19:18:48 +01:00
parent 1b9cfa5440
commit 93a1207718
2 changed files with 5 additions and 4 deletions

View File

@@ -3,7 +3,7 @@ from PyQt6 import QtCore, QtGui, QtWidgets
from ..models.MessagesModel import MessageItemDataRole, MessagesModelItem from ..models.MessagesModel import MessageItemDataRole, MessagesModelItem
from ..designs.widget_message import Ui_Form from ..designs.widget_message import Ui_Form
from gotify_tray.database import Settings from gotify_tray.database import Settings
from gotify_tray.utils import convert_links from gotify_tray.utils import convert_links, get_abs_path
settings = Settings("gotify-tray") settings = Settings("gotify-tray")
@@ -62,7 +62,7 @@ class MessageWidget(QtWidgets.QWidget, Ui_Form):
) )
) )
self.pb_delete.setIcon(QtGui.QIcon("gotify_tray/gui/images/trashcan.svg")) self.pb_delete.setIcon(QtGui.QIcon(get_abs_path("gotify_tray/gui/images/trashcan.svg")))
self.pb_delete.setIconSize(QtCore.QSize(24, 24)) self.pb_delete.setIconSize(QtCore.QSize(24, 24))
self.link_callbacks() self.link_callbacks()

View File

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