diff --git a/src/config/constants.py b/src/config/constants.py index 8f608ac..14c4b31 100644 --- a/src/config/constants.py +++ b/src/config/constants.py @@ -7,6 +7,7 @@ from PySide6.QtGui import QColor # --------------------------------------------------------------------------- NO_STAFF = True +NO_WHITELIST = True REDIRECT_URI = "http://localhost:5000/callback" SCOPES = ["identify"] diff --git a/src/main.py b/src/main.py index 4a5bed0..2c23996 100644 --- a/src/main.py +++ b/src/main.py @@ -7,16 +7,18 @@ from PySide6.QtWidgets import QApplication # Imports pour la gestion de la configuration from config.config_manager import ConfigManager +from config.constants import Resources # Imports pour la vérification Discord from discord.discord_tools import CheckDiscord + +# Import pour la partie ui from ui.custom_message_box import CustomMessageBox +from ui.main_window import MainWindow # Ne pas supprimer ! Enregistre les ressources Qt import resources # noqa: F401 - required to register Qt resources -from ui.main_window import MainWindow -from config.constants import Resources # --------------------------------------------------------------------------- # Bundle path resolution diff --git a/src/tools/utils.py b/src/tools/utils.py index ceb80b9..721d7b4 100644 --- a/src/tools/utils.py +++ b/src/tools/utils.py @@ -1,5 +1,6 @@ import sys from pathlib import Path +from PySide6.QtWidgets import QApplication PROJECT_ROOT = Path(__file__).resolve().parents[2] @@ -17,3 +18,10 @@ def get_executable_dir() -> Path: # sys.executable est le chemin complet vers l'application .exe return Path(sys.executable).parent.resolve() return Path(__file__).resolve().parents[2] + +def quit_application(exit_code: int = 0) -> None: + app = QApplication.instance() + if app is not None: + app.closeAllWindows() + app.exit(exit_code) + sys.exit(exit_code) diff --git a/src/ui/main_window.py b/src/ui/main_window.py index 103d396..53ef5bd 100644 --- a/src/ui/main_window.py +++ b/src/ui/main_window.py @@ -12,7 +12,9 @@ from controllers.audio_controller import AudioController from controllers.glow_animator import GlowAnimator from controllers.window_dragger import WindowDragger from discord import discord_oauth -from config.constants import NO_STAFF, Urls +from config.constants import NO_STAFF, Urls, NO_WHITELIST +from ui.custom_message_box import CustomMessageBox +from tools.utils import quit_application from fake_patch_notes import patch_note @@ -61,6 +63,18 @@ class MainWindow(QMainWindow): self._center_window() self.show() + if NO_WHITELIST: + msg = CustomMessageBox( + title="La Tanière: Non whitelisté", + message="\n\nTu n'est pas whitelisté sur le serveur\n\n" + "Assure-toi de te faire whitelister.\n\n" + "Lorsque cela sera fait, relance le launcher.", + icon_type=CustomMessageBox.WARNING, + buttons=CustomMessageBox.OK + ) + msg.exec() + quit_application() + # ------------------------------------------------------------------ # Setup # ------------------------------------------------------------------ diff --git a/styles/styles.qss b/styles/styles.qss index 38b0f88..a15623c 100644 --- a/styles/styles.qss +++ b/styles/styles.qss @@ -239,7 +239,8 @@ QWidget#MsgBoxMainContainer QLabel, QWidget#MsgBoxMainContainer QPushButton { color: white; - font-family: 'Segoe UI'; + /*font-size: 18px; +/* font-family: 'Segoe UI';*/ } QPushButton#MsgBoxOkButton, @@ -283,7 +284,7 @@ QPushButton#MsgBoxCloseButton:hover { QLabel#MsgBoxTitleLabel { font-weight: bold; - font-size: 10px; + font-size: 14px; color: rgba(255,255,255,0.7); letter-spacing: 1px; }