Change for windows onyl & pyinstaller script
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import sys
|
||||
import os
|
||||
from pathlib import Path
|
||||
from PyQt6 import uic
|
||||
from PyQt6.QtCore import Qt
|
||||
from PyQt6.QtGui import QFontDatabase, QFont
|
||||
@@ -17,6 +18,11 @@ if sys.platform.startswith('linux'):
|
||||
if sys.platform=='windows' or sys.platform=="win32":
|
||||
from win11toast import toast # type: ignore
|
||||
|
||||
if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
|
||||
bundle_dir = Path(sys._MEIPASS)
|
||||
else:
|
||||
bundle_dir = Path(__file__).parent
|
||||
|
||||
# Remove this into final release
|
||||
from fake_patch_notes import patch_note
|
||||
NO_STAFF = True
|
||||
@@ -48,7 +54,7 @@ class MainWindow(QMainWindow):
|
||||
# Track mouse position for dragging
|
||||
self._drag_pos = None
|
||||
|
||||
uic.loadUi(f"{os.path.dirname(CURRENT)}/ui/mainwindow.ui", self)
|
||||
uic.loadUi(f"{bundle_dir}/ui/mainwindow.ui", self)
|
||||
|
||||
# Fixe some qss properties not taken into account
|
||||
self.subtitle_label.setStyleSheet("color: rgb(163, 177, 198);")
|
||||
@@ -66,7 +72,8 @@ class MainWindow(QMainWindow):
|
||||
self.minimize_btn.clicked.connect(self.minimize_link)
|
||||
self.connexion_btn.clicked.connect(self.connexion_btn_link)
|
||||
|
||||
def close_link(self):
|
||||
@staticmethod
|
||||
def close_link():
|
||||
sys.exit(app.exec())
|
||||
|
||||
def minimize_link(self):
|
||||
@@ -90,7 +97,8 @@ class MainWindow(QMainWindow):
|
||||
self._drag_pos = None
|
||||
event.accept()
|
||||
|
||||
def connexion_btn_link(self):
|
||||
@staticmethod
|
||||
def connexion_btn_link():
|
||||
icon = {
|
||||
'src': ':/assets/background.png',
|
||||
'placement': 'appLogoOverride'
|
||||
@@ -104,7 +112,7 @@ class MainWindow(QMainWindow):
|
||||
if __name__ == "__main__":
|
||||
app = QApplication(sys.argv)
|
||||
|
||||
with open(f"{os.path.dirname(CURRENT)}/styles/styles.qss", 'r') as f:
|
||||
with open(f"{bundle_dir}/styles/styles.qss", 'r') as f:
|
||||
style = f.read()
|
||||
|
||||
# Load and set the global font
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# Created by: The Resource Compiler for Qt version 6.10.2
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
from PySide6 import QtCore
|
||||
from PyQt6 import QtCore
|
||||
|
||||
qt_resource_data = b"\
|
||||
\x00\x00\x0bp\
|
||||
|
||||
Reference in New Issue
Block a user