2025-12-28 21:38:21 +01:00
|
|
|
|
|
|
|
|
import sys
|
2026-01-13 18:23:00 +01:00
|
|
|
import os
|
2026-01-13 19:11:31 +01:00
|
|
|
import platform
|
2025-12-28 21:38:21 +01:00
|
|
|
from PyQt6.QtWidgets import QApplication
|
2026-01-13 18:23:00 +01:00
|
|
|
from PyQt6.QtGui import QIcon
|
2025-12-28 21:38:21 +01:00
|
|
|
from teletext.ui import MainWindow
|
|
|
|
|
|
2026-01-13 18:23:00 +01:00
|
|
|
def resource_path(relative_path):
|
|
|
|
|
""" Get absolute path to resource, works for dev and for PyInstaller """
|
|
|
|
|
try:
|
|
|
|
|
# PyInstaller creates a temp folder and stores path in _MEIPASS
|
|
|
|
|
base_path = sys._MEIPASS
|
|
|
|
|
except Exception:
|
|
|
|
|
base_path = os.path.abspath(".")
|
|
|
|
|
|
|
|
|
|
return os.path.join(base_path, relative_path)
|
|
|
|
|
|
2025-12-28 21:38:21 +01:00
|
|
|
def main():
|
2026-01-13 19:11:31 +01:00
|
|
|
# Fix for Windows Taskbar Icon
|
|
|
|
|
if platform.system() == 'Windows':
|
|
|
|
|
import ctypes
|
|
|
|
|
myappid = 'ddybing.teletexteditor.1.0' # arbitrary string
|
|
|
|
|
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)
|
|
|
|
|
|
2025-12-28 21:38:21 +01:00
|
|
|
app = QApplication(sys.argv)
|
2026-01-13 18:23:00 +01:00
|
|
|
|
|
|
|
|
# Set App Icon
|
|
|
|
|
icon_path = resource_path("app_icon.png")
|
2026-01-13 19:11:31 +01:00
|
|
|
print(f"DEBUG: Looking for icon at: {icon_path}")
|
|
|
|
|
|
2026-01-13 18:23:00 +01:00
|
|
|
if os.path.exists(icon_path):
|
2026-01-13 19:11:31 +01:00
|
|
|
print("DEBUG: Icon file found.")
|
|
|
|
|
app_icon = QIcon(icon_path)
|
|
|
|
|
app.setWindowIcon(app_icon)
|
|
|
|
|
else:
|
|
|
|
|
print("DEBUG: Icon file NOT found.")
|
2026-01-13 18:23:00 +01:00
|
|
|
|
2025-12-28 21:38:21 +01:00
|
|
|
window = MainWindow()
|
2026-01-13 19:11:31 +01:00
|
|
|
# Ensure window inherits the icon
|
|
|
|
|
if os.path.exists(icon_path):
|
|
|
|
|
window.setWindowIcon(QIcon(icon_path))
|
|
|
|
|
|
2025-12-28 21:38:21 +01:00
|
|
|
window.show()
|
|
|
|
|
sys.exit(app.exec())
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
main()
|