From 8c19bf96a1887735394162df7d9cbbf6536f168b Mon Sep 17 00:00:00 2001 From: Anthony Samms Date: Sat, 1 Nov 2025 14:31:56 -0400 Subject: [PATCH] circular import oops --- libs/global_data.py | 77 +++++++++++++++++++++++++++++++++++++++++-- libs/utils.py | 79 ++------------------------------------------- 2 files changed, 77 insertions(+), 79 deletions(-) diff --git a/libs/global_data.py b/libs/global_data.py index 45cb4c5..7a0da76 100644 --- a/libs/global_data.py +++ b/libs/global_data.py @@ -1,8 +1,81 @@ from dataclasses import dataclass, field from pathlib import Path -from typing import Any +from typing import Any, TypedDict -from libs.utils import Config +class GeneralConfig(TypedDict): + fps_counter: bool + audio_offset: int + visual_offset: int + language: str + hard_judge: int + touch_enabled: bool + timer_frozen: bool + judge_counter: bool + nijiiro_notes: bool + log_level: int + +class NameplateConfig(TypedDict): + name: str + title: str + title_bg: int + dan: int + gold: bool + +class PathsConfig(TypedDict): + tja_path: list[str] + video_path: list[str] + +class Keys1PConfig(TypedDict): + exit_key: str + left_kat: list[str] + left_don: list[str] + right_don: list[str] + right_kat: list[str] + +class Keys2PConfig(TypedDict): + left_kat: list[str] + left_don: list[str] + right_don: list[str] + right_kat: list[str] + +class GamepadConfig(TypedDict): + left_kat: list[int] + left_don: list[int] + right_don: list[int] + right_kat: list[int] + +class AudioConfig(TypedDict): + device_type: int + sample_rate: int + buffer_size: int + exclusive: bool + +class VolumeConfig(TypedDict): + sound: float + music: float + voice: float + hitsound: float + attract_mode: float + +class VideoConfig(TypedDict): + screen_width: int + screen_height: int + fullscreen: bool + borderless: bool + target_fps: int + vsync: bool + +class Config(TypedDict): + general: GeneralConfig + nameplate_1p: NameplateConfig + nameplate_2p: NameplateConfig + paths: PathsConfig + keys_1p: Keys1PConfig + keys_2p: Keys2PConfig + gamepad: GamepadConfig + audio: AudioConfig + volume: VolumeConfig + video: VideoConfig @dataclass class Modifiers: diff --git a/libs/utils.py b/libs/utils.py index f596589..f85c89f 100644 --- a/libs/utils.py +++ b/libs/utils.py @@ -5,10 +5,10 @@ import sys import logging import time import json -from libs.global_data import global_data +from libs.global_data import Config, global_data from functools import lru_cache from pathlib import Path -from typing import Any, Optional, TypedDict +from typing import Any, Optional import pyray as ray import tomlkit @@ -22,81 +22,6 @@ from libs.texture import TextureWrapper logger = logging.getLogger(__name__) -class GeneralConfig(TypedDict): - fps_counter: bool - audio_offset: int - visual_offset: int - language: str - hard_judge: int - touch_enabled: bool - timer_frozen: bool - judge_counter: bool - nijiiro_notes: bool - log_level: int - -class NameplateConfig(TypedDict): - name: str - title: str - title_bg: int - dan: int - gold: bool - -class PathsConfig(TypedDict): - tja_path: list[str] - video_path: list[str] - -class Keys1PConfig(TypedDict): - exit_key: str - left_kat: list[str] - left_don: list[str] - right_don: list[str] - right_kat: list[str] - -class Keys2PConfig(TypedDict): - left_kat: list[str] - left_don: list[str] - right_don: list[str] - right_kat: list[str] - -class GamepadConfig(TypedDict): - left_kat: list[int] - left_don: list[int] - right_don: list[int] - right_kat: list[int] - -class AudioConfig(TypedDict): - device_type: int - sample_rate: int - buffer_size: int - exclusive: bool - -class VolumeConfig(TypedDict): - sound: float - music: float - voice: float - hitsound: float - attract_mode: float - -class VideoConfig(TypedDict): - screen_width: int - screen_height: int - fullscreen: bool - borderless: bool - target_fps: int - vsync: bool - -class Config(TypedDict): - general: GeneralConfig - nameplate_1p: NameplateConfig - nameplate_2p: NameplateConfig - paths: PathsConfig - keys_1p: Keys1PConfig - keys_2p: Keys2PConfig - gamepad: GamepadConfig - audio: AudioConfig - volume: VolumeConfig - video: VideoConfig - def force_dedicated_gpu(): """Force Windows to use dedicated GPU for this application""" if sys.platform == "win32":