Application Layer¶
Application orchestration components: main window, app services, and bootstrap flow.
EzQt_App¶
EzQt_App
¶
Bases: QMainWindow
Main EzQt_App application.
This class represents the main application window with all its components (menu, pages, settings, etc.).
Initialize the EzQt_App application.
| PARAMETER | DESCRIPTION |
|---|---|
theme_file_name
|
Deprecated — no longer used. All
TYPE:
|
**kwargs
|
Backward compatibility for legacy arguments (e.g., themeFileName).
TYPE:
|
Source code in src/ezqt_app/app.py
no_menu
¶
no_menu() -> EzQt_App
Disable the left menu for this application instance.
| RETURNS | DESCRIPTION |
|---|---|
EzQt_App
|
Self instance for chaining.
TYPE:
|
no_settings_panel
¶
no_settings_panel() -> EzQt_App
Disable the settings slide-in panel for this application instance.
| RETURNS | DESCRIPTION |
|---|---|
EzQt_App
|
Self instance for chaining.
TYPE:
|
build
¶
build() -> EzQt_App
Explicitly build the UI layout.
Automatically called on first show() if not called.
| RETURNS | DESCRIPTION |
|---|---|
EzQt_App
|
Self instance for chaining.
TYPE:
|
Source code in src/ezqt_app/app.py
showEvent
¶
Ensure UI is built before showing the window.
| PARAMETER | DESCRIPTION |
|---|---|
event
|
The QShowEvent instance.
TYPE:
|
set_app_theme
¶
Update and apply the application theme based on current settings.
The theme was already persisted and applied to SettingsService by
_on_theme_selector_changed before this slot fires. We only need to
trigger a full UI refresh here.
Source code in src/ezqt_app/app.py
update_ui
¶
Force a full UI refresh including themes, icons, and styles.
Source code in src/ezqt_app/app.py
refresh_theme
¶
refresh_theme() -> EzQt_App
Re-apply the theme stylesheet and polish all widgets.
Call this after adding custom widgets to the application to ensure
that QSS rules (especially #objectName selectors) are correctly
evaluated against the newly added widgets. Also refreshes all
ThemeIcon instances so that icons added after build() (e.g.
via add_menu()) are correctly coloured for the current theme.
| RETURNS | DESCRIPTION |
|---|---|
self
|
Allows method chaining.
TYPE:
|
Example::
window = EzQt_App().build()
window.show()
add_things_to_my_app(window, Icons)
window.refresh_theme()
Source code in src/ezqt_app/app.py
set_app_icon
¶
Set the application logo in the header.
| PARAMETER | DESCRIPTION |
|---|---|
icon
|
Path to icon or QPixmap object.
TYPE:
|
y_shrink
|
Vertical shrink factor.
TYPE:
|
y_offset
|
Vertical offset adjustment.
TYPE:
|
Source code in src/ezqt_app/app.py
add_menu
¶
Add a new menu item and corresponding page.
| PARAMETER | DESCRIPTION |
|---|---|
name
|
Label for the menu and page.
TYPE:
|
icon
|
Icon name or path.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
QWidget
|
The created page widget.
TYPE:
|
Source code in src/ezqt_app/app.py
switch_menu
¶
Update active state of menu buttons based on sender.
Source code in src/ezqt_app/app.py
resizeEvent
¶
Handle window resize events to update UI components.
| PARAMETER | DESCRIPTION |
|---|---|
_event
|
The QResizeEvent instance (unused).
TYPE:
|
Source code in src/ezqt_app/app.py
mousePressEvent
¶
Handle mouse press events for window dragging and diagnostics.
| PARAMETER | DESCRIPTION |
|---|---|
event
|
The QMouseEvent instance.
TYPE:
|
Source code in src/ezqt_app/app.py
set_credits
¶
Set credit text in the bottom bar.
| PARAMETER | DESCRIPTION |
|---|---|
credits
|
Text or object to display as credits.
TYPE:
|
Source code in src/ezqt_app/app.py
set_version
¶
Set version text in the bottom bar.
| PARAMETER | DESCRIPTION |
|---|---|
version
|
Version string to display.
TYPE:
|
get_translation_stats
¶
Retrieve current translation statistics.
| RETURNS | DESCRIPTION |
|---|---|
dict
|
Statistics about translated and missing strings.
TYPE:
|
Source code in src/ezqt_app/app.py
enable_auto_translation
¶
Enable or disable automatic translation collection.
| PARAMETER | DESCRIPTION |
|---|---|
enabled
|
Whether to enable auto-translation.
TYPE:
|
Source code in src/ezqt_app/app.py
clear_translation_cache
¶
collect_strings_for_translation
¶
collect_strings_for_translation(widget: QWidget | None = None, recursive: bool = True) -> dict[str, Any]
Scan widgets for translatable strings and add them to the collector.
| PARAMETER | DESCRIPTION |
|---|---|
widget
|
Root widget to start scanning from (default: self).
TYPE:
|
recursive
|
Whether to scan child widgets recursively.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict
|
Summary of the collection process.
TYPE:
|
Source code in src/ezqt_app/app.py
get_new_strings
¶
Get all newly discovered strings since last save.
| RETURNS | DESCRIPTION |
|---|---|
set[str]
|
set[str]: Set of new translatable strings. |
get_string_collector_stats
¶
Get statistics from the string collector.
| RETURNS | DESCRIPTION |
|---|---|
dict
|
Collector statistics.
TYPE:
|
Source code in src/ezqt_app/app.py
setAppTheme
¶
Deprecated alias for set_app_theme. .. deprecated:: 1.0.0
Source code in src/ezqt_app/app.py
updateUI
¶
Deprecated alias for update_ui. .. deprecated:: 1.0.0
setAppIcon
¶
Deprecated alias for set_app_icon. .. deprecated:: 1.0.0
Source code in src/ezqt_app/app.py
addMenu
¶
Deprecated alias for add_menu. .. deprecated:: 1.0.0
Source code in src/ezqt_app/app.py
switchMenu
¶
Deprecated alias for switch_menu. .. deprecated:: 1.0.0
AppService¶
AppService
¶
Central orchestration service for application lifecycle.
Aggregates config, asset, resource and settings operations into a single cohesive snake_case API used by widgets, CLI and bootstrap.
check_assets_requirements
staticmethod
¶
check_assets_requirements(base_path: Path | None = None, bin_path: Path | None = None, overwrite_policy: str = 'ask') -> None
Generate asset binaries, QRC and RC files at APP_PATH.
| PARAMETER | DESCRIPTION |
|---|---|
base_path
|
Optional base path for assets.
TYPE:
|
bin_path
|
Optional binary path.
TYPE:
|
overwrite_policy
|
Policy for overwriting existing files (default: "ask").
TYPE:
|
Source code in src/ezqt_app/services/application/app_service.py
make_required_files
staticmethod
¶
make_required_files(mk_theme: bool = True, mk_config: bool = True, mk_translations: bool = True, base_path: Path | None = None, bin_path: Path | None = None, overwrite_policy: str = 'ask') -> None
Copy YAML, QSS theme and translation files into project directories.
| PARAMETER | DESCRIPTION |
|---|---|
mk_theme
|
When True also copies the QSS theme file.
TYPE:
|
mk_config
|
When True copies configuration files.
TYPE:
|
mk_translations
|
When True copies translation files.
TYPE:
|
base_path
|
Optional base path.
TYPE:
|
bin_path
|
Optional binary path.
TYPE:
|
overwrite_policy
|
Policy for overwriting (default: "ask").
TYPE:
|
Source code in src/ezqt_app/services/application/app_service.py
set_project_root
staticmethod
¶
Set the project root directory used by the config service.
| PARAMETER | DESCRIPTION |
|---|---|
project_root
|
The Path to the project root.
TYPE:
|
Source code in src/ezqt_app/services/application/app_service.py
load_config
staticmethod
¶
Load a named configuration from its YAML file.
| PARAMETER | DESCRIPTION |
|---|---|
config_name
|
Logical name of the configuration (e.g. "app").
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict
|
The loaded configuration data.
TYPE:
|
Source code in src/ezqt_app/services/application/app_service.py
get_config_value
staticmethod
¶
Get a value from a named configuration using dot-separated path.
| PARAMETER | DESCRIPTION |
|---|---|
config_name
|
Logical name of the configuration.
TYPE:
|
key_path
|
Dot-separated key path, e.g. "app.name".
TYPE:
|
default
|
Value returned when the path is absent.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Any
|
The configuration value or default.
TYPE:
|
Source code in src/ezqt_app/services/application/app_service.py
save_config
staticmethod
¶
Persist a named configuration to its YAML file.
| PARAMETER | DESCRIPTION |
|---|---|
config_name
|
Logical name of the configuration.
TYPE:
|
data
|
Full configuration dict to write.
TYPE:
|
Source code in src/ezqt_app/services/application/app_service.py
write_yaml_config
staticmethod
¶
Write a single value into a YAML config using a key list immediately.
| PARAMETER | DESCRIPTION |
|---|---|
keys
|
List where keys[0] is config name and keys[1:] is the path.
TYPE:
|
val
|
Value to assign at the leaf key.
TYPE:
|
Source code in src/ezqt_app/services/application/app_service.py
stage_config_value
staticmethod
¶
Mutate a config value in the shared cache and mark it dirty for flush.
| PARAMETER | DESCRIPTION |
|---|---|
keys
|
List where keys[0] is config name and keys[1:] is the path.
TYPE:
|
val
|
Value to assign at the leaf key.
TYPE:
|
Source code in src/ezqt_app/services/application/app_service.py
flush_all
staticmethod
¶
Write all dirty configs to disk and clear the dirty set.
Source code in src/ezqt_app/services/application/app_service.py
copy_package_configs_to_project
staticmethod
¶
Copy package default configs into the child project directory.
get_package_resource
staticmethod
¶
Return a Path to an installed package resource.
| PARAMETER | DESCRIPTION |
|---|---|
resource_path
|
Relative path inside the package.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Path
|
Absolute path to the resource.
TYPE:
|
Source code in src/ezqt_app/services/application/app_service.py
get_package_resource_content
staticmethod
¶
Return the text content of an installed package resource.
| PARAMETER | DESCRIPTION |
|---|---|
resource_path
|
Relative path inside the package.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
Content of the resource.
TYPE:
|
Source code in src/ezqt_app/services/application/app_service.py
load_fonts_resources
staticmethod
¶
Load .ttf font files into Qt's font database.
| PARAMETER | DESCRIPTION |
|---|---|
app
|
Whether to also load fonts from the bin/fonts/ directory.
TYPE:
|
Source code in src/ezqt_app/services/application/app_service.py
load_app_settings
staticmethod
¶
Load app settings from YAML and apply to SettingsService.
| RETURNS | DESCRIPTION |
|---|---|
dict
|
Loaded settings.
TYPE:
|
InitService¶
InitService
¶
Coordinates initialization with a single options object.
Source code in src/ezqt_app/services/bootstrap/init_service.py
run
¶
run(options: InitOptions | None = None) -> InitResult
Run initialization sequence with normalized options.
Source code in src/ezqt_app/services/bootstrap/init_service.py
is_initialized
¶
InitOptions¶
InitOptions
dataclass
¶
InitOptions(project_root: Path | None = None, bin_path: Path | None = None, mk_theme: bool = True, mk_config: bool = True, mk_translations: bool = True, build_resources: bool = True, generate_main: bool = False, verbose: bool = True, overwrite_policy: OverwritePolicy = ASK)
Options driving initialization behavior across API and CLI.
| ATTRIBUTE | DESCRIPTION |
|---|---|
project_root |
Absolute path to the project root directory. When
TYPE:
|
bin_path |
Directory where generated assets (
TYPE:
|
mk_theme |
Generate QSS theme files under
TYPE:
|
mk_config |
Generate the
TYPE:
|
mk_translations |
Generate the
TYPE:
|
build_resources |
Compile the QRC file with
TYPE:
|
generate_main |
Write a
TYPE:
|
verbose |
Print step-by-step progress to stdout.
TYPE:
|
overwrite_policy |
Controls behavior when generated files already
exist. See :class:
TYPE:
|
resolve
¶
resolve() -> InitOptions
Return a copy with normalized paths and defaults resolved.
Source code in src/ezqt_app/services/bootstrap/contracts/options.py
InitializationSequence¶
InitializationSequence
¶
InitializationSequence(options: InitOptions | None = None)
Orchestrates the ordered initialization steps for EzQt_App.
Each step is registered with a name, description, callable and a required flag. If a required step fails the sequence stops immediately; non-required steps are allowed to fail silently.
Source code in src/ezqt_app/services/bootstrap/sequence.py
add_step
¶
Append a new step to the sequence.
Source code in src/ezqt_app/services/bootstrap/sequence.py
execute
¶
Run all registered steps in order.
Returns¶
InitResult Typed aggregate result with step-level execution details.
Source code in src/ezqt_app/services/bootstrap/sequence.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | |
StartupConfig¶
StartupConfig
¶
Manages system-level startup configuration.
Handles encoding, locale, environment variables and project root
detection. Idempotent: subsequent calls to :meth:configure are
no-ops once the instance is configured.
Source code in src/ezqt_app/services/bootstrap/startup_config.py
configure
¶
Run all startup configuration steps (idempotent).