feat(hot-reload): Add trigger integration for hot reload system
- Task 1.1: Added _hot_reload_error state to App.__init__ - Task 1.2: Added _trigger_hot_reload() method to App - Task 1.3: Added Ctrl+Alt+R keyboard capture in _gui_func() - Task 1.4: Registered src.gui_2 with HotReloader in App.__init__ - Task 1.5: Added Hot Reload button in _render_mma_global_controls - Tests: Added test_hot_reload_integration.py with 13 passing tests
This commit is contained in:
@@ -117,6 +117,13 @@ class App:
|
||||
self._is_applying_snapshot: bool = False
|
||||
# --- Initialization ---
|
||||
self.controller.init_state()
|
||||
from src.hot_reloader import HotReloader, HotModule
|
||||
HotReloader.register(HotModule(
|
||||
name='src.gui_2',
|
||||
file_path=__file__,
|
||||
state_keys=['active_discussion', 'show_windows', 'ui_file_paths', 'ui_screenshot_paths', 'disc_entries', 'disc_roles'],
|
||||
delegation_targets=['_render_main_interface', '_render_discussion_hub', '_render_files_and_media', '_render_ai_settings_hub', '_render_operations_hub', '_render_mma_dashboard']
|
||||
))
|
||||
self.workspace_manager = workspace_manager.WorkspaceManager(project_root=self.controller.active_project_root)
|
||||
self.disc_entries = self.controller.disc_entries
|
||||
self.disc_roles = self.controller.disc_roles
|
||||
@@ -249,6 +256,7 @@ class App:
|
||||
self.ui_crt_filter = False
|
||||
self.ui_tool_filter_category = "All"
|
||||
self.shader_uniforms = {'crt': 1.0, 'scanline': 0.5, 'bloom': 0.8}
|
||||
self._hot_reload_error: Optional[str] = None
|
||||
|
||||
def _simulate_save_preset(self, name: str) -> None:
|
||||
from src import models
|
||||
@@ -265,6 +273,12 @@ class App:
|
||||
def _post_init(self) -> None:
|
||||
theme.apply_current()
|
||||
|
||||
def _trigger_hot_reload(self) -> bool:
|
||||
from src.hot_reloader import HotReloader
|
||||
result = HotReloader.reload_all(self)
|
||||
self._hot_reload_error = HotReloader.last_error
|
||||
return result
|
||||
|
||||
def run(self) -> None:
|
||||
"""
|
||||
|
||||
@@ -734,6 +748,10 @@ class App:
|
||||
imgui.close_current_popup()
|
||||
|
||||
def _gui_func(self) -> None:
|
||||
io = imgui.get_io()
|
||||
if io.key_ctrl and io.key_alt and io.keys_down[ord('R')]:
|
||||
self._trigger_hot_reload()
|
||||
|
||||
self._render_custom_title_bar()
|
||||
self._render_shader_live_editor()
|
||||
self._render_history_window()
|
||||
@@ -4879,6 +4897,16 @@ def hello():
|
||||
c = vec4(255, 72, 64, alpha) if theme.is_nerv_active() else imgui.ImVec4(1, 0.3, 0.3, alpha)
|
||||
imgui.same_line(); imgui.text_colored(c, " APPROVAL PENDING"); imgui.same_line()
|
||||
if imgui.button("Go to Approval"): pass
|
||||
imgui.separator()
|
||||
imgui.text("Hot Reload:")
|
||||
imgui.same_line()
|
||||
if imgui.button("Reload GUI"):
|
||||
success = self._trigger_hot_reload()
|
||||
if success:
|
||||
imgui.text_colored(imgui.ImVec4(0, 1, 0, 1), "Reloaded!")
|
||||
else:
|
||||
imgui.text_colored(imgui.ImVec4(1, 0, 0, 1), f"Error: {self._hot_reload_error or 'Unknown'}")
|
||||
imgui.same_line(); imgui.text_disabled("(Ctrl+Alt+R)")
|
||||
|
||||
def _render_mma_usage_section(self) -> None:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user