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

28 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-03-26 07:07 +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# Local imports 

43from .app import EzApplication, EzQt_App 

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

45from .services.settings import SettingsService, get_settings_service 

46from .services.translation import ( 

47 change_language, 

48 change_language_by_code, 

49 clear_auto_translation_cache, 

50 enable_auto_translation, 

51 get_available_languages, 

52 get_current_language, 

53 get_translation_stats, 

54 tr, 

55) 

56from .services.ui import UIFunctions 

57from .version import __version__ 

58from .widgets.core.header import Header 

59from .widgets.core.menu import Menu 

60from .widgets.core.page_container import PageContainer 

61from .widgets.core.settings_panel import SettingsPanel 

62from .widgets.ui_main import Ui_MainWindow 

63 

64# /////////////////////////////////////////////////////////////// 

65# META INFORMATIONS 

66# /////////////////////////////////////////////////////////////// 

67 

68__author__ = "Neuraaak" 

69__maintainer__ = "Neuraaak" 

70__description__ = ( 

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

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

73) 

74__python_requires__ = ">=3.11" 

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

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

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

78 

79# /////////////////////////////////////////////////////////////// 

80# PYTHON VERSION CHECK 

81# /////////////////////////////////////////////////////////////// 

82 

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

84 raise RuntimeError( 

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

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

87 ) 

88 

89# /////////////////////////////////////////////////////////////// 

90# PUBLIC API 

91# /////////////////////////////////////////////////////////////// 

92 

93__all__ = [ 

94 # Application 

95 "EzApplication", 

96 "EzQt_App", 

97 # Bootstrap 

98 "init", 

99 "setup_project", 

100 "generate_assets", 

101 "configure_startup", 

102 # UI 

103 "UIFunctions", 

104 "Ui_MainWindow", 

105 # Settings 

106 "SettingsService", 

107 "get_settings_service", 

108 # Translation 

109 "tr", 

110 "change_language", 

111 "change_language_by_code", 

112 "get_available_languages", 

113 "get_current_language", 

114 "get_translation_stats", 

115 "enable_auto_translation", 

116 "clear_auto_translation_cache", 

117 # Widgets 

118 "Header", 

119 "Menu", 

120 "PageContainer", 

121 "SettingsPanel", 

122 # Metadata 

123 "__version__", 

124 "__author__", 

125 "__maintainer__", 

126 "__description__", 

127 "__python_requires__", 

128 "__keywords__", 

129 "__url__", 

130 "__repository__", 

131] 

132 

133 

134def __getattr__(name: str): 

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

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

137 from .cli.main import cli 

138 

139 return cli 

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