Coverage for src / ezqt_app / __init__.py: 85.29%

30 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-04-06 13:12 +0000

1# /////////////////////////////////////////////////////////////// 

2# EZQT_APP - Main Module 

3# Project: ezqt_app 

4# /////////////////////////////////////////////////////////////// 

5 

6""" 

7ezqt_app - Lightweight framework to quickly build modern Qt desktop applications. 

8 

9ezqt_app is a PySide6-based framework providing a complete application shell 

10with integrated resource management, theming, translation, and reusable 

11UI components. 

12 

13**Main Features:** 

14 - Ready-to-use application window (EzQt_App) with frameless design 

15 - Integrated theme system with QSS support 

16 - Built-in translation engine (multi-language support) 

17 - Modular initialization and asset generation 

18 - Settings persistence via YAML 

19 - Reusable core widgets (Header, Menu, PageContainer, SettingsPanel) 

20 

21**Quick Start:** 

22 >>> from ezqt_app import EzApplication, EzQt_App, init 

23 >>> import sys 

24 >>> 

25 >>> app = EzApplication(sys.argv) 

26 >>> init() 

27 >>> 

28 >>> window = EzQt_App() 

29 >>> window.show() 

30 >>> 

31 >>> sys.exit(app.exec()) 

32""" 

33 

34from __future__ import annotations 

35 

36# /////////////////////////////////////////////////////////////// 

37# IMPORTS 

38# /////////////////////////////////////////////////////////////// 

39# Standard library imports 

40import sys 

41 

42# Third-party imports 

43from ezplog.lib_mode import get_logger 

44 

45# Local imports 

46from ._version import __version__ 

47from .app import EzApplication, EzQt_App 

48from .main import configure_startup, generate_assets, init, setup_project 

49from .services.settings import SettingsService, get_settings_service 

50from .services.translation import ( 

51 change_language, 

52 change_language_by_code, 

53 clear_auto_translation_cache, 

54 enable_auto_translation, 

55 get_available_languages, 

56 get_current_language, 

57 get_translation_stats, 

58 tr, 

59) 

60from .services.ui import UIFunctions 

61from .widgets.core.header import Header 

62from .widgets.core.menu import Menu 

63from .widgets.core.page_container import PageContainer 

64from .widgets.core.settings_panel import SettingsPanel 

65from .widgets.ui_main import Ui_MainWindow 

66 

67# /////////////////////////////////////////////////////////////// 

68# META INFORMATIONS 

69# /////////////////////////////////////////////////////////////// 

70 

71__author__ = "Neuraaak" 

72__maintainer__ = "Neuraaak" 

73__description__ = ( 

74 "Lightweight framework based on PySide6 to quickly build modern desktop " 

75 "applications, with integrated resource, theme, and reusable component management." 

76) 

77__python_requires__ = ">=3.11" 

78__keywords__ = ["qt", "pyside6", "application", "framework", "gui", "desktop"] 

79__url__ = "https://github.com/neuraaak/ezqt-app" 

80__repository__ = "https://github.com/neuraaak/ezqt-app" 

81 

82# /////////////////////////////////////////////////////////////// 

83# PYTHON VERSION CHECK 

84# /////////////////////////////////////////////////////////////// 

85 

86if sys.version_info < (3, 11): # noqa: UP036 86 ↛ 87line 86 didn't jump to line 87 because the condition on line 86 was never true

87 raise RuntimeError( 

88 f"ezqt_app {__version__} requires Python 3.11 or higher. " 

89 f"Current version: {sys.version}" 

90 ) 

91 

92# Library logging contract: no global configuration side effects. 

93get_logger("ezqt_app") 

94 

95# /////////////////////////////////////////////////////////////// 

96# PUBLIC API 

97# /////////////////////////////////////////////////////////////// 

98 

99__all__ = [ 

100 # Application 

101 "EzApplication", 

102 "EzQt_App", 

103 # Bootstrap 

104 "init", 

105 "setup_project", 

106 "generate_assets", 

107 "configure_startup", 

108 # UI 

109 "UIFunctions", 

110 "Ui_MainWindow", 

111 # Settings 

112 "SettingsService", 

113 "get_settings_service", 

114 # Translation 

115 "tr", 

116 "change_language", 

117 "change_language_by_code", 

118 "get_available_languages", 

119 "get_current_language", 

120 "get_translation_stats", 

121 "enable_auto_translation", 

122 "clear_auto_translation_cache", 

123 # Widgets 

124 "Header", 

125 "Menu", 

126 "PageContainer", 

127 "SettingsPanel", 

128 # Metadata 

129 "__version__", 

130 "__author__", 

131 "__maintainer__", 

132 "__description__", 

133 "__python_requires__", 

134 "__keywords__", 

135 "__url__", 

136 "__repository__", 

137] 

138 

139 

140def __getattr__(name: str): 

141 """Lazy-load optional CLI entrypoint to avoid hard dependency at import time.""" 

142 if name == "cli": 142 ↛ 143line 142 didn't jump to line 143 because the condition on line 142 was never true

143 from .cli.main import cli 

144 

145 return cli 

146 raise AttributeError(f"module {__name__!r} has no attribute {name!r}")