make icon appear in windows task bar

This commit is contained in:
2021-11-03 09:03:29 +01:00
parent 8a5574e336
commit bbbd656f7f

10
main.py
View File

@@ -1,6 +1,7 @@
import logging
import os
import signal
import ctypes
from PyQt6 import QtCore
from PyQt6.QtWidgets import *
@@ -189,7 +190,12 @@ def stop_signal(signum, _stackframe):
if __name__ == "__main__":
app = QApplication(sys.argv)
app.setWindowIcon(QIcon(raven_icon))
app.setWindowIcon(QIcon(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
myappid = 'opentext.ravenlog.0.1' # arbitrary string
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)
# translator = QTranslator()
# if translator.load(QLocale("de"), "messages_de.ts"):
@@ -211,7 +217,7 @@ if __name__ == "__main__":
#window.open_file("/home/andi/ws/performanceDb/data/production/vapbdcom.csv")
#window.open_file("/var/log/syslog")
#window.open_file("/home/andi/ws/ravenlog/example.log")
window.open_file("C:\\Users\\andi\\ws\\some.log")
#window.open_file("C:\\Users\\andi\\ws\\some.log")
signal.signal(signal.SIGINT, stop_signal)
signal.signal(signal.SIGTERM, stop_signal)