diff --git a/arts/logo.kra b/arts/logo.kra new file mode 100644 index 00000000..a9f016f5 Binary files /dev/null and b/arts/logo.kra differ diff --git a/src/View/MainWindow.py b/src/View/MainWindow.py index 16076aa6..9db4cd64 100644 --- a/src/View/MainWindow.py +++ b/src/View/MainWindow.py @@ -28,7 +28,7 @@ from tools import logger_exception from PyQt5 import QtGui from PyQt5.QtGui import ( - QKeySequence, QDesktopServices, + QKeySequence, QDesktopServices, QIcon, ) from PyQt5.QtCore import ( @@ -333,6 +333,15 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): self.update_enable_action() # self.showMaximized() + image = os.path.abspath( + os.path.join( + os.path.dirname(__file__), + "ui", "ressources", + "Pamhyr2_logo.png" + ) + ) + self.setWindowIcon(QIcon(image)) + def set_debug_lvl(self, debug=True): if debug: logger.setLevel(logging.DEBUG) diff --git a/src/View/Tools/ASubWindow.py b/src/View/Tools/ASubWindow.py index 7dc57b0d..4f88d99b 100644 --- a/src/View/Tools/ASubWindow.py +++ b/src/View/Tools/ASubWindow.py @@ -496,12 +496,7 @@ class ASubMainWindow(QMainWindow, ASubWindowFeatures, WindowToolKit): super(ASubMainWindow, self).__init__(parent=parent) if ui is not None: self.ui = loadUi( - os.path.abspath( - os.path.join( - os.path.dirname(__file__), - "..", "ui", f"{ui}.ui" - ) - ), + os.path.join(self._get_ui_directory(), f"{ui}.ui"), self ) @@ -510,6 +505,14 @@ class ASubMainWindow(QMainWindow, ASubWindowFeatures, WindowToolKit): if self.parent is not None: self.parent.sub_win_add(name, self) + def _get_ui_directory(self): + return os.path.abspath( + os.path.join( + os.path.dirname(__file__), + "..", "ui" + ) + ) + def closeEvent(self, event): if self.parent is not None: self.parent.sub_win_del(self.hash()) diff --git a/src/View/Tools/PamhyrWindow.py b/src/View/Tools/PamhyrWindow.py index 7e8a01df..4a9b2c61 100644 --- a/src/View/Tools/PamhyrWindow.py +++ b/src/View/Tools/PamhyrWindow.py @@ -16,10 +16,11 @@ # -*- coding: utf-8 -*- +import os import logging from PyQt5.QtGui import ( - QKeySequence, + QKeySequence, QIcon, ) from PyQt5.QtWidgets import ( @@ -97,6 +98,17 @@ class PamhyrWindowTools(object): """ self.ui.setWindowTitle(self._title) + def _set_icon(self): + self.setWindowIcon( + QIcon( + os.path.join( + self._get_ui_directory(), + "ressources", + "Pamhyr2_logo.png" + ) + ) + ) + def _update(self): """Update window display component @@ -173,6 +185,7 @@ class PamhyrWindow(ASubMainWindow, ListedSubWindow, PamhyrWindowTools): self._hash_data.append(self._config) self._set_title() + self._set_icon() def closeEvent(self, event): self._close_sub_window() diff --git a/src/View/ui/ressources/Pamhyr2_logo.png b/src/View/ui/ressources/Pamhyr2_logo.png new file mode 100644 index 00000000..220199a2 Binary files /dev/null and b/src/View/ui/ressources/Pamhyr2_logo.png differ