Fix app icon visibility on Windows and add debug logs
This commit is contained in:
19
src/main.py
19
src/main.py
@@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
import platform
|
||||||
from PyQt6.QtWidgets import QApplication
|
from PyQt6.QtWidgets import QApplication
|
||||||
from PyQt6.QtGui import QIcon
|
from PyQt6.QtGui import QIcon
|
||||||
from teletext.ui import MainWindow
|
from teletext.ui import MainWindow
|
||||||
@@ -16,14 +17,30 @@ def resource_path(relative_path):
|
|||||||
return os.path.join(base_path, relative_path)
|
return os.path.join(base_path, relative_path)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
# Fix for Windows Taskbar Icon
|
||||||
|
if platform.system() == 'Windows':
|
||||||
|
import ctypes
|
||||||
|
myappid = 'ddybing.teletexteditor.1.0' # arbitrary string
|
||||||
|
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)
|
||||||
|
|
||||||
app = QApplication(sys.argv)
|
app = QApplication(sys.argv)
|
||||||
|
|
||||||
# Set App Icon
|
# Set App Icon
|
||||||
icon_path = resource_path("app_icon.png")
|
icon_path = resource_path("app_icon.png")
|
||||||
|
print(f"DEBUG: Looking for icon at: {icon_path}")
|
||||||
|
|
||||||
if os.path.exists(icon_path):
|
if os.path.exists(icon_path):
|
||||||
app.setWindowIcon(QIcon(icon_path))
|
print("DEBUG: Icon file found.")
|
||||||
|
app_icon = QIcon(icon_path)
|
||||||
|
app.setWindowIcon(app_icon)
|
||||||
|
else:
|
||||||
|
print("DEBUG: Icon file NOT found.")
|
||||||
|
|
||||||
window = MainWindow()
|
window = MainWindow()
|
||||||
|
# Ensure window inherits the icon
|
||||||
|
if os.path.exists(icon_path):
|
||||||
|
window.setWindowIcon(QIcon(icon_path))
|
||||||
|
|
||||||
window.show()
|
window.show()
|
||||||
sys.exit(app.exec())
|
sys.exit(app.exec())
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user