From 52e4c01f3db341d5a8ba79ee46e8c35aef00745c Mon Sep 17 00:00:00 2001 From: Xarkam Date: Mon, 9 Mar 2026 12:22:49 +0100 Subject: [PATCH] =?UTF-8?q?Passage=20=C3=A0=20PySide6=20car=20licence=20pl?= =?UTF-8?q?us=20permissive?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- requirements.txt | 17 ++++++++--- src/mainwindow.py | 74 ++++++++++++++++++--------------------------- src/resources.py | 2 +- styles/styles.qss | 8 +++++ ui/mainwindow.ui | 5 +-- ui/mainwindow_ui.py | 31 ++++++++----------- 6 files changed, 65 insertions(+), 72 deletions(-) diff --git a/requirements.txt b/requirements.txt index d4059f6..20a7535 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,10 +1,19 @@ -PyQt6==6.10.2 -PyQt6-Qt6==6.10.2 -PyQt6_sip==13.11.0 -shiboken6==6.10.2 +altgraph==0.17.5 librt==0.8.1 +modulegraph==0.19.7 mypy==1.19.1 mypy_extensions==1.1.0 +packaging==26.0 +pathspec==1.0.4 +pefile==2024.8.26 +pyinstaller==6.19.0 +pyinstaller-hooks-contrib==2026.2 +PySide6==6.10.2 +PySide6_Addons==6.10.2 +PySide6_Essentials==6.10.2 +pywin32-ctypes==0.2.3 +setuptools==82.0.0 +shiboken6==6.10.2 typing_extensions==4.15.0 win11toast==0.36.3 winrt-runtime==3.2.1 diff --git a/src/mainwindow.py b/src/mainwindow.py index 7ac40b2..2cd2ed8 100644 --- a/src/mainwindow.py +++ b/src/mainwindow.py @@ -1,32 +1,29 @@ import sys import os from pathlib import Path -from PyQt6 import uic -from PyQt6.QtCore import Qt -from PyQt6.QtGui import QFontDatabase, QFont -from PyQt6.QtWidgets import QApplication, QMainWindow +from PySide6 import QtGui +from PySide6.QtCore import Qt +from PySide6.QtGui import QFontDatabase, QFont +from PySide6.QtUiTools import QUiLoader +from PySide6.QtWidgets import QMainWindow, QApplication # Compile resources.qrc into resources_rc.py # rcc -g python .\resources.qrc -o .\src\resources_rc.py import resources as resources # This is generated from the .qrc file # noqa: F401 -# À placer tout en haut, avant les imports PyQt6 si possible -if sys.platform.startswith('linux'): - os.environ["QT_QPA_PLATFORM"] = "xcb" - 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 + bundle_dir = Path(__file__).parent.parent # Remove this into final release from fake_patch_notes import patch_note -NO_STAFF = True +NO_STAFF = True CURRENT = os.path.dirname(os.path.realpath(__file__)) def load_custom_font(): @@ -42,67 +39,54 @@ def load_custom_font(): return font_families[0] class MainWindow(QMainWindow): + def __init__(self): + super().__init__() + + self.ui = QUiLoader().load(f"{bundle_dir}/ui/mainwindow.ui", self) + central = self.ui.centralWidget() + self.setCentralWidget(central) - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) # Remove the title bar and window frame - self.setWindowFlags(Qt.WindowType.FramelessWindowHint |Qt.WindowType.Window) - + self.setWindowFlags(Qt.WindowType.FramelessWindowHint | Qt.WindowType.Window) # Optional: Make background transparent (if you want rounded corners, etc.) self.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground) # Track mouse position for dragging self._drag_pos = None - 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);") - self.queue_position.setStyleSheet("color: rgb(17, 248, 183);") - if NO_STAFF : - self.staff_btn.hide() - self.spacer_substitution.hide() + self.ui.staff_btn.hide() + self.ui.spacer_substitution.hide() - self.info_text.setMarkdown(patch_note) + self.ui.info_text.setMarkdown(patch_note) # Find the button by its objectName in Qt Designer # Example: objectName = "close_btn" - self.close_btn.clicked.connect(self.close_link) - self.minimize_btn.clicked.connect(self.minimize_link) - self.connexion_btn.clicked.connect(self.connexion_btn_link) + self.ui.close_btn.clicked.connect(self.close) + self.ui.minimize_btn.clicked.connect(self.showMinimized) + self.ui.connexion_btn.clicked.connect(self.connexion_btn_link) - @staticmethod - def close_link(): - sys.exit(app.exec()) + self.show() - def minimize_link(self): - # Minimize the application - self.setWindowState(Qt.WindowState.WindowMinimized) - - # Mouse press event to start dragging - def mousePressEvent(self, event): + # Mouse press event to start dragging + def mousePressEvent(self, event: QtGui.QMouseEvent) -> None: if event.button() == Qt.MouseButton.LeftButton: self._drag_pos = event.globalPosition().toPoint() - self.frameGeometry().topLeft() - event.accept() + super().mousePressEvent(event) # Mouse move event to drag window - def mouseMoveEvent(self, event): - if event.buttons() == Qt.MouseButton.LeftButton and self._drag_pos is not None: + def mouseMoveEvent(self, event: QtGui.QMouseEvent) -> None: + if event.buttons() & Qt.MouseButton.LeftButton and self._drag_pos is not None: self.move(event.globalPosition().toPoint() - self._drag_pos) - event.accept() + super().mouseMoveEvent(event) # Mouse release event to stop dragging def mouseReleaseEvent(self, event): self._drag_pos = None - event.accept() + super().mouseReleaseEvent(event) @staticmethod def connexion_btn_link(): - icon = { - 'src': ':/assets/background.png', - 'placement': 'appLogoOverride' - } buttons = [ {'activationType': 'protocol', 'arguments': '', 'content': 'Entrer en jeu'}, ] @@ -124,5 +108,5 @@ if __name__ == "__main__": app.setStyleSheet(style) window = MainWindow() - window.show() + sys.exit(app.exec()) diff --git a/src/resources.py b/src/resources.py index 23e919a..8c95d41 100644 --- a/src/resources.py +++ b/src/resources.py @@ -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 PyQt6 import QtCore +from PySide6 import QtCore qt_resource_data = b"\ \x00\x00\x0bp\ diff --git a/styles/styles.qss b/styles/styles.qss index 1bd7e20..106c749 100644 --- a/styles/styles.qss +++ b/styles/styles.qss @@ -7,6 +7,7 @@ QLabel#maintitle_label { font-size: 38px; + color: rgb(255, 255, 255); } QLabel#subtitle_label { @@ -18,9 +19,14 @@ QLabel#queue_position { color: rgb(17, 248, 183); } +QLabel#queue_lbl { + color: rgb(255, 255, 255); +} + QPushButton#connexion_btn { border-radius: 15px; background-color: rgb(255, 120, 0); + color: rgb(255, 255, 255); } QPushButton#connexion_btn:hover { @@ -32,6 +38,7 @@ QPushButton#intranet_btn { border-radius: 15px; background-color: rgb(32, 58, 67); + color: rgb(255, 255, 255); } QPushButton#discord_btn:hover, @@ -73,6 +80,7 @@ QFrame#info_frame{ QTextEdit#info_text { background-color: transparent; border: none; + color: rgb(255, 255, 255); } QSlider::groove:horizontal { diff --git a/ui/mainwindow.ui b/ui/mainwindow.ui index 26cdfd2..49379ed 100644 --- a/ui/mainwindow.ui +++ b/ui/mainwindow.ui @@ -41,9 +41,6 @@ :/assets/Icone.ico:/assets/Icone.ico - - color: rgb(255, 255, 255); - @@ -351,7 +348,7 @@ - + false diff --git a/ui/mainwindow_ui.py b/ui/mainwindow_ui.py index 55af743..1fc6c0f 100644 --- a/ui/mainwindow_ui.py +++ b/ui/mainwindow_ui.py @@ -1,24 +1,20 @@ # -*- coding: utf-8 -*- ################################################################################ -## Form generated from reading UI file 'mainwindow.ui' +## Form generated from reading UI file 'mainwindowdJHBSQ.ui' ## ## Created by: Qt User Interface Compiler version 6.10.2 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ################################################################################ -from PyQt6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale, - QMetaObject, QObject, QPoint, QRect, - QSize, QTime, QUrl, Qt) -from PyQt6.QtGui import (QBrush, QColor, QConicalGradient, QCursor, - QFont, QFontDatabase, QGradient, QIcon, - QImage, QKeySequence, QLinearGradient, QPainter, - QPalette, QPixmap, QRadialGradient, QTransform) -from PyQt6.QtWidgets import (QApplication, QFrame, QHBoxLayout, QLabel, - QMainWindow, QPushButton, QSizePolicy, QSlider, - QSpacerItem, QTextEdit, QVBoxLayout, QWidget) import resources_rc +from PySide6.QtCore import (QCoreApplication, QMetaObject, QSize, Qt) +from PySide6.QtGui import (QIcon) +from PySide6.QtWidgets import (QFrame, QHBoxLayout, QLabel, + QPushButton, QSizePolicy, QSlider, + QSpacerItem, QTextEdit, QVBoxLayout, QWidget) + class Ui_MainWindow(object): def setupUi(self, MainWindow): @@ -37,7 +33,6 @@ class Ui_MainWindow(object): icon = QIcon() icon.addFile(u":/assets/Icone.ico", QSize(), QIcon.Mode.Normal, QIcon.State.Off) MainWindow.setWindowIcon(icon) - MainWindow.setStyleSheet(u"color: rgb(255, 255, 255);") self.main_container = QWidget(MainWindow) self.main_container.setObjectName(u"main_container") self.main_container.setMinimumSize(QSize(1199, 703)) @@ -144,12 +139,12 @@ class Ui_MainWindow(object): self.frame_5.setFrameShadow(QFrame.Shadow.Raised) self.horizontalLayout_8 = QHBoxLayout(self.frame_5) self.horizontalLayout_8.setObjectName(u"horizontalLayout_8") - self.label = QLabel(self.frame_5) - self.label.setObjectName(u"label") - self.label.setAutoFillBackground(False) - self.label.setAlignment(Qt.AlignmentFlag.AlignCenter) + self.queue_lbl = QLabel(self.frame_5) + self.queue_lbl.setObjectName(u"queue_lbl") + self.queue_lbl.setAutoFillBackground(False) + self.queue_lbl.setAlignment(Qt.AlignmentFlag.AlignCenter) - self.horizontalLayout_8.addWidget(self.label) + self.horizontalLayout_8.addWidget(self.queue_lbl) self.queue_position = QLabel(self.frame_5) self.queue_position.setObjectName(u"queue_position") @@ -387,7 +382,7 @@ class Ui_MainWindow(object): MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"MainWindow", None)) self.minimize_btn.setText("") self.close_btn.setText("") - self.label.setText(QCoreApplication.translate("MainWindow", u"Position en file d'attente: ", None)) + self.queue_lbl.setText(QCoreApplication.translate("MainWindow", u"Position en file d'attente: ", None)) self.queue_position.setText(QCoreApplication.translate("MainWindow", u"20", None)) self.volume_btn.setText("") self.maintitle_label.setText(QCoreApplication.translate("MainWindow", u"LA TANI\u00c8RE", None))