docs(hot_reload): fix 2 stale claims (example registration + trigger_key)
This commit is contained in:
+12
-21
@@ -224,32 +224,23 @@ The error is captured via Python's standard `traceback.format_exc()` and stored
|
||||
|
||||
## Registration
|
||||
|
||||
To opt a module into hot reload, register it at module import time:
|
||||
To opt a module into hot reload, register it at module import time. The actual registration used by `src/gui_2.py` is at `src/gui_2.py:282-287`:
|
||||
|
||||
```python
|
||||
# At the top of src/gui_2.py (or in a separate registration file)
|
||||
from src.hot_reloader import HotReloader, HotModule
|
||||
|
||||
HotReloader.register(HotModule(
|
||||
name="src.gui_2",
|
||||
file_path="C:/projects/manual_slop/src/gui_2.py",
|
||||
state_keys=[
|
||||
"ai_input",
|
||||
"project_system_prompt",
|
||||
"global_system_prompt",
|
||||
"discussion_history",
|
||||
"selected_files",
|
||||
],
|
||||
delegation_targets=[
|
||||
"render_main_window",
|
||||
"render_context_panel",
|
||||
"render_ai_settings",
|
||||
"render_discussion_hub",
|
||||
"render_mma_dashboard",
|
||||
],
|
||||
))
|
||||
if 'src.gui_2' not in HotReloader.HOT_MODULES:
|
||||
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'],
|
||||
))
|
||||
```
|
||||
|
||||
Note: `delegation_targets` lists the App's `_render_*` wrapper methods (not the module-level `render_*` functions), and `state_keys` are the App attributes actually snapshotted on reload.
|
||||
|
||||
**When to register**: At module import time, ideally near the top of the file. The registration is idempotent — calling `register()` twice with the same name raises `ValueError` to prevent accidental double-registration.
|
||||
|
||||
**What to put in `state_keys`**: Attributes that:
|
||||
@@ -267,9 +258,9 @@ For pure-renderer modules that don't touch app state, `state_keys` can be empty.
|
||||
|
||||
### Keyboard Shortcut
|
||||
|
||||
`Ctrl+Alt+R` (configurable via `config.toml` → `[hot_reload].trigger_key`).
|
||||
`Ctrl+Alt+R` (handler wired in `src/gui_2.py:5340-5346`; not yet a config key — the literal is hard-coded in the source).
|
||||
|
||||
The keyboard handler is in `src/gui_2.py` and calls `HotReloader.reload_all(app)`.
|
||||
The keyboard handler is `_trigger_hot_reload()` at `src/gui_2.py:540-544`, which calls `HotReloader.reload_all(self)`.
|
||||
|
||||
### GUI Button
|
||||
|
||||
|
||||
Reference in New Issue
Block a user