déplacement de valeur vers des constantes et config mypy vscode

This commit is contained in:
2026-03-13 14:21:05 +01:00
parent 8e22b69f81
commit d877a5cc91
4 changed files with 19 additions and 9 deletions

13
.vscode/settings.json vendored
View File

@@ -1,6 +1,15 @@
{
"python.analysis.autoImportCompletions": true,
"python.analysis.extraPaths": [".venv/lib/python3.11/site-packages"],
"python.analysis.extraPaths": [".venv/lib/site-packages"],
"python.analysis.fixAll": ["source.unusedImports"],
"python.languageServer": "Pylance"
"python.languageServer": "Pylance",
"mypy-type-checker.args": [
"--disallow-untyped-defs=True",
"--disallow-untyped-calls=True",
"--check-untyped-defs=True",
"--warn_return_any=True",
"--no-implicit-optional=True",
"--strict_optional=True",
"--ignore_missing_imports=True",
]
}

View File

@@ -8,11 +8,12 @@ URLS = {
"intranet": "https://la-taniere.fun/connexion/",
}
RESOURCES_MP3 = ":/assets/the-beat-of-nature.mp3"
RESOURCES_FONT = ":/assets/fonts/Roboto-Regular.ttf"
GLOW_COLOR = QColor(255, 140, 0, 255)
GLOW_BLUR_BASE = 15
GLOW_BLUR_PEAK = 70
GLOW_ANIM_DURATION = 1200
MP3_PATH = ":/assets/the-beat-of-nature.mp3"
NO_STAFF = True

View File

@@ -3,7 +3,7 @@ from PySide6.QtMultimedia import QMediaPlayer, QAudioOutput
from config.config_manager import ConfigManager, VOLUME_KEY
from constants import MP3_PATH
from constants import RESOURCES_MP3
class AudioController:
# Encapsule toute la logique audio : lecture, volume, mute.
@@ -20,7 +20,7 @@ class AudioController:
self._player.setLoops(-1)
# Chargement du MP3 depuis les ressources Qt
mp3file = QFile(MP3_PATH)
mp3file = QFile(RESOURCES_MP3)
mp3file.open(QFile.ReadOnly)
mp3data = mp3file.readAll()
mp3file.close()

View File

@@ -5,10 +5,10 @@ from PySide6.QtCore import QResource
from PySide6.QtGui import QFontDatabase, QFont
from PySide6.QtWidgets import QApplication
import resources as resources # noqa: F401
import resources as resources
from ui.main_window import MainWindow
from constants import RESOURCES_FONT
# ---------------------------------------------------------------------------
# Bundle path resolution
@@ -27,7 +27,7 @@ QResource.registerResource(f"{bundle_dir}/resources.py")
# ---------------------------------------------------------------------------
def load_custom_font() -> str:
font_id = QFontDatabase.addApplicationFont(":/assets/Avocado-Cake-Demo.otf")
font_id = QFontDatabase.addApplicationFont(RESOURCES_FONT)
if font_id == -1:
raise RuntimeError("Failed to load font from resources.")
font_families = QFontDatabase.applicationFontFamilies(font_id)