Optimize imports
This commit is contained in:
@@ -4,6 +4,7 @@ from typing import Any, Callable, NotRequired, TypedDict, cast
|
||||
|
||||
from tools.utils import get_executable_dir
|
||||
|
||||
|
||||
class ConfigData(TypedDict):
|
||||
discord_user_id: NotRequired[str]
|
||||
volume: NotRequired[int]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from enum import Enum
|
||||
from dataclasses import dataclass
|
||||
from enum import Enum
|
||||
|
||||
from PySide6.QtGui import QColor
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
from PySide6.QtCore import QFile
|
||||
import tempfile
|
||||
|
||||
import cyminiaudio as cma
|
||||
import tempfile
|
||||
from config.config_manager import ConfigManager, VOLUME_KEY
|
||||
from PySide6.QtCore import QFile
|
||||
|
||||
from config.config_manager import ConfigManager, VOLUME_KEY
|
||||
from config.constants import Resources
|
||||
|
||||
|
||||
class AudioController:
|
||||
# Encapsule toute la logique audio : lecture, volume, mute.
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import psutil
|
||||
|
||||
from pypresence import Presence
|
||||
from fivemserver.get_server_token import GetServerTokenForDiscord
|
||||
|
||||
from config.constants import Urls
|
||||
from discord.discord_oauth import CLIENT_ID
|
||||
from fivemserver.get_server_token import GetServerTokenForDiscord
|
||||
|
||||
|
||||
class DiscordToken:
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
# workers/auth_worker.py
|
||||
from PySide6.QtCore import QThread, Signal
|
||||
|
||||
from config.constants import Urls
|
||||
from fivemserver.get_server_token import GetServerTokenForDiscord
|
||||
from tools.http_client import ApiError # Importe ton exception personnalisée
|
||||
|
||||
|
||||
class AuthWorker(QThread):
|
||||
# Signaux pour communiquer avec l'UI
|
||||
# finished(success, session_id, error_message)
|
||||
@@ -61,4 +63,4 @@ class AuthWorker(QThread):
|
||||
def stop(self):
|
||||
"""Permet d'annuler le thread proprement."""
|
||||
self._is_running = False
|
||||
self.requestInterruption() # Demande l'interruption à QThread
|
||||
self.requestInterruption() # Demande l'interruption à QThread
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import subprocess
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
from config.constants import FIVEMURL
|
||||
|
||||
class FiveMLauncher:
|
||||
def __init__(self, fivem_path: str):
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import base64
|
||||
|
||||
from cryptography.hazmat.primitives import serialization, hashes
|
||||
from cryptography.hazmat.primitives.asymmetric import ec
|
||||
from cryptography.hazmat.primitives.kdf.hkdf import HKDF
|
||||
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
|
||||
from cryptography.hazmat.primitives.kdf.hkdf import HKDF
|
||||
|
||||
from config.constants import Urls
|
||||
from tools.http_client import http_post, ApiError
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import requests
|
||||
import time
|
||||
from typing import Callable
|
||||
|
||||
from config.constants import Urls, ApiEndPoints
|
||||
import requests
|
||||
|
||||
from config.constants import PlayerServerInfo # ← à ajouter si pas déjà importé
|
||||
from config.constants import Urls, ApiEndPoints
|
||||
|
||||
|
||||
class QueueManager:
|
||||
def __init__(self, user_id: str, on_update: Callable[[str], None]):
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from tools.http_client import ApiError, http_get
|
||||
|
||||
from config.constants import PlayerServerInfo
|
||||
from tools.http_client import ApiError, http_get
|
||||
|
||||
WHITELIST_URL_ENDPOINT = "iswhitelist/"
|
||||
|
||||
|
||||
+4
-9
@@ -1,29 +1,24 @@
|
||||
import ctypes
|
||||
import sys
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from tools.utils import get_internal_dir
|
||||
|
||||
from PySide6.QtGui import QFontDatabase, QFont, QIcon
|
||||
from PySide6.QtWidgets import QApplication
|
||||
|
||||
# Ne pas supprimer ! Enregistre les ressources Qt
|
||||
import resources # noqa: F401 - required to register Qt resources
|
||||
# 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
|
||||
|
||||
from tools.utils import get_internal_dir
|
||||
# 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
|
||||
|
||||
if getattr(sys, 'frozen', False):
|
||||
os.environ["TMPDIR"] = tempfile.gettempdir()
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ from typing import Any, Literal
|
||||
|
||||
import requests
|
||||
|
||||
|
||||
DEFAULT_TIMEOUT = 15
|
||||
HttpMethod = Literal["GET", "POST", "PUT", "PATCH", "DELETE"]
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from PySide6.QtWidgets import QApplication
|
||||
|
||||
PROJECT_ROOT = Path(__file__).resolve().parents[2]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from PySide6.QtWidgets import (QDialog, QVBoxLayout, QHBoxLayout,
|
||||
QLabel, QPushButton, QWidget, QGraphicsDropShadowEffect)
|
||||
from PySide6.QtCore import Qt, QPropertyAnimation, QEasingCurve
|
||||
from PySide6.QtGui import QColor
|
||||
from PySide6.QtWidgets import (QDialog, QVBoxLayout, QHBoxLayout,
|
||||
QLabel, QPushButton, QWidget, QGraphicsDropShadowEffect)
|
||||
|
||||
|
||||
class CustomMessageBox(QDialog):
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# ui/hazard_stripes.py
|
||||
|
||||
from PySide6.QtWidgets import QPushButton, QStyleOptionButton, QStyle
|
||||
from PySide6.QtGui import QPainter, QColor, QPainterPath, QPen, QPolygon
|
||||
from PySide6.QtCore import Qt, QPoint
|
||||
from PySide6.QtGui import QPainter, QColor, QPainterPath, QPen, QPolygon
|
||||
from PySide6.QtWidgets import QPushButton, QStyleOptionButton, QStyle
|
||||
|
||||
|
||||
class HazardButton(QPushButton):
|
||||
|
||||
+13
-14
@@ -1,29 +1,28 @@
|
||||
import webbrowser
|
||||
|
||||
from sys import platform
|
||||
from os import environ, unlink
|
||||
from sys import platform
|
||||
|
||||
from PySide6.QtGui import QIcon, QMouseEvent, QCursor, QGuiApplication
|
||||
from PySide6.QtCore import Qt, QTimer
|
||||
from PySide6.QtWidgets import QMainWindow, QSizePolicy
|
||||
from PySide6.QtCore import QThread, Signal
|
||||
from PySide6.QtCore import Qt, QTimer
|
||||
from PySide6.QtGui import QIcon, QMouseEvent, QCursor, QGuiApplication
|
||||
from PySide6.QtWidgets import QMainWindow, QSizePolicy
|
||||
|
||||
from ui.ui_mainwindow_vertical_pager import Ui_MainWindow
|
||||
from config.config_manager import ConfigManager
|
||||
from config.constants import PlayerServerInfo, Urls
|
||||
from tools.http_client import ApiError
|
||||
from ui.error_dialog import show_qt_error
|
||||
from ui.hazard_stripes import HazardButton
|
||||
from controllers.audio_controller import AudioController
|
||||
from controllers.glow_animator import GlowAnimator
|
||||
from controllers.window_dragger import WindowDragger
|
||||
from discord import discord_oauth
|
||||
from fivemserver.whitelistmanager import WhiteList
|
||||
from fivemserver.fivemlauncher import FiveMLauncher
|
||||
from fivemserver.queuemanager import QueueManager
|
||||
from fivemserver.get_server_token import GetServerTokenForDiscord
|
||||
from fivemserver.auth_worker import AuthWorker
|
||||
from fake_patch_notes import patch_note
|
||||
from fivemserver.auth_worker import AuthWorker
|
||||
from fivemserver.fivemlauncher import FiveMLauncher
|
||||
from fivemserver.get_server_token import GetServerTokenForDiscord
|
||||
from fivemserver.queuemanager import QueueManager
|
||||
from fivemserver.whitelistmanager import WhiteList
|
||||
from tools.http_client import ApiError
|
||||
from ui.error_dialog import show_qt_error
|
||||
from ui.hazard_stripes import HazardButton
|
||||
from ui.ui_mainwindow_vertical_pager import Ui_MainWindow
|
||||
|
||||
# For Linux Wayland to authorize moving window
|
||||
if platform.startswith('linux'):
|
||||
|
||||
Reference in New Issue
Block a user