Coverage for src / ezqt_app / services / runtime / runtime_service.py: 57.58%
33 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-03-26 07:07 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-03-26 07:07 +0000
1# ///////////////////////////////////////////////////////////////
2# SERVICES.RUNTIME.SERVICE - Runtime state service
3# Project: ezqt_app
4# ///////////////////////////////////////////////////////////////
6"""Runtime state service implementation."""
8from __future__ import annotations
10# ///////////////////////////////////////////////////////////////
11# IMPORTS
12# ///////////////////////////////////////////////////////////////
13# Local imports
14from ...domain.models.runtime import RuntimeStateModel
15from ...domain.ports.runtime_state_service import RuntimeStateServiceProtocol
16from .._registry import ServiceRegistry
19# ///////////////////////////////////////////////////////////////
20# CLASSES
21# ///////////////////////////////////////////////////////////////
22class RuntimeStateService(RuntimeStateServiceProtocol):
23 """Service managing runtime flags and legacy global UI state."""
25 def __init__(self) -> None:
26 """Initialize runtime state."""
27 self._state = RuntimeStateModel()
29 def set_debug_mode(self, enabled: bool = True) -> None:
30 self._state.debug_mode = enabled
32 def set_verbose_mode(self, enabled: bool = True) -> None:
33 self._state.verbose_mode = enabled
35 def is_debug_mode(self) -> bool:
36 return self._state.debug_mode
38 def is_verbose_mode(self) -> bool:
39 return self._state.verbose_mode
41 def mark_app_initialized(self) -> None:
42 self._state.app_initialized = True
44 def mark_app_running(self) -> None:
45 self._state.app_running = True
47 def is_app_initialized(self) -> bool:
48 return self._state.app_initialized
50 def is_app_running(self) -> bool:
51 return self._state.app_running
53 def get_global_state(self) -> bool:
54 return self._state.global_state
56 def set_global_state(self, state: bool) -> None:
57 self._state.global_state = state
59 def get_global_title_bar(self) -> bool:
60 return self._state.global_title_bar
62 def set_global_title_bar(self, enabled: bool) -> None:
63 self._state.global_title_bar = enabled
66# ///////////////////////////////////////////////////////////////
67# FUNCTIONS
68# ///////////////////////////////////////////////////////////////
69def get_runtime_state_service() -> RuntimeStateService:
70 """Return the singleton runtime state service."""
71 return ServiceRegistry.get(RuntimeStateService, RuntimeStateService)