1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
# pyright: reportUnsupportedDunderAll=false
"""Fungus Launcher — a game library manager for Linux/Wine."""
__all__ = [
"ConfigManager",
"FungusApp",
"Game",
"GameLauncher",
"GameLibrary",
"LaunchHandle",
"Main",
"PathManager",
"SandboxWarningDialog",
"SettingsDialog",
"app_dir",
"config_file_path",
"desktop_dir",
"envar_dir",
"format_title",
"fungus_launcher_dir",
"fungus_png",
"fungus_run",
"fungus_version",
"icons_dir",
]
__version__ = "0.1.0"
# Lazy imports — avoids loading GTK/GI dependencies when only
# pure modules (e.g. game_model, config_manager) are needed.
def __getattr__(name):
"""Lazy-load symbols on first access."""
_modules = {
"FungusApp": "fungus.app",
"ConfigManager": "fungus.config_manager",
"Game": "fungus.game_model",
"GameLauncher": "fungus.game_launcher",
"GameLibrary": "fungus.game_model",
"LaunchHandle": "fungus.game_launcher",
"Main": "fungus.main_window",
"PathManager": "fungus.path_manager",
"SandboxWarningDialog": "fungus.dialogs",
"SettingsDialog": "fungus.settings_dialog",
"format_title": "fungus.utils_pure",
}
if name in _modules:
import importlib
mod = importlib.import_module(_modules[name])
return getattr(mod, name.replace("_", "")) if name.startswith("_") else getattr(mod, name)
# Fall back to module-level constants
from fungus.constants import (
app_dir,
config_file_path,
desktop_dir,
envar_dir,
fungus_launcher_dir,
fungus_png,
fungus_run,
icons_dir,
fungus_version,
)
_constants = {
"app_dir": app_dir,
"config_file_path": config_file_path,
"desktop_dir": desktop_dir,
"envar_dir": envar_dir,
"fungus_launcher_dir": fungus_launcher_dir,
"fungus_png": fungus_png,
"fungus_run": fungus_run,
"icons_dir": icons_dir,
"fungus_version": fungus_version,
}
if name in _constants:
return _constants[name]
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|