use same icon for about dialog
This commit is contained in:
@@ -4,6 +4,7 @@ from PyQt6.QtCore import Qt
|
||||
from PyQt6.QtGui import QFont, QPixmap
|
||||
from PyQt6.QtWidgets import *
|
||||
|
||||
import constants
|
||||
from label import Label
|
||||
from vbox import VBox
|
||||
|
||||
@@ -27,7 +28,7 @@ class AboutDialog(QDialog):
|
||||
version.setAlignment(Qt.AlignmentFlag.AlignLeft)
|
||||
|
||||
app_icon = QLabel()
|
||||
app_icon.setPixmap(QPixmap("icon7.png"))
|
||||
app_icon.setPixmap(QPixmap(constants.raven_icon))
|
||||
heading = QWidget(self)
|
||||
hbox = QHBoxLayout(heading)
|
||||
hbox.addWidget(app_icon)
|
||||
|
||||
1
constants.py
Normal file
1
constants.py
Normal file
@@ -0,0 +1 @@
|
||||
raven_icon = "icon7_gold3.png"
|
||||
7
main.py
7
main.py
@@ -9,6 +9,7 @@ from PyQt6.QtCore import *
|
||||
from PyQt6.QtGui import *
|
||||
import sys
|
||||
|
||||
import constants
|
||||
import urlutils
|
||||
from aboutdialog import AboutDialog
|
||||
from cutesettings import CuteSettings
|
||||
@@ -23,7 +24,7 @@ MAX_LINE_LENGTH = 4096
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
log = logging.getLogger("main")
|
||||
|
||||
raven_icon = "icon7_gold3.png"
|
||||
|
||||
|
||||
|
||||
class MainWindow(QMainWindow):
|
||||
@@ -101,7 +102,7 @@ class MainWindow(QMainWindow):
|
||||
def help_menu(self) -> QMenu:
|
||||
help_menu = QMenu(self.tr("&Help", "name of the help menu"), self)
|
||||
|
||||
about_action = QAction(QIcon(raven_icon), self.tr("&About"), self)
|
||||
about_action = QAction(QIcon(constants.raven_icon), self.tr("&About"), self)
|
||||
about_action.triggered.connect(lambda: AboutDialog().exec())
|
||||
help_menu.addAction(about_action)
|
||||
|
||||
@@ -190,7 +191,7 @@ def stop_signal(signum, _stackframe):
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = QApplication(sys.argv)
|
||||
app.setWindowIcon(QIcon(raven_icon)) # works only for Linux
|
||||
app.setWindowIcon(QIcon(constants.raven_icon)) # works only for Linux
|
||||
|
||||
# make icon appear in Windows
|
||||
# see https://stackoverflow.com/questions/1551605/how-to-set-applications-taskbar-icon-in-windows-7/1552105#1552105
|
||||
|
||||
Reference in New Issue
Block a user