docs(hot_reload): fix 2 stale claims (example registration + trigger_key)
This commit is contained in:
+10
-19
@@ -224,32 +224,23 @@ The error is captured via Python's standard `traceback.format_exc()` and stored
|
|||||||
|
|
||||||
## Registration
|
## 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
|
```python
|
||||||
# At the top of src/gui_2.py (or in a separate registration file)
|
# At the top of src/gui_2.py (or in a separate registration file)
|
||||||
from src.hot_reloader import HotReloader, HotModule
|
from src.hot_reloader import HotReloader, HotModule
|
||||||
|
|
||||||
|
if 'src.gui_2' not in HotReloader.HOT_MODULES:
|
||||||
HotReloader.register(HotModule(
|
HotReloader.register(HotModule(
|
||||||
name="src.gui_2",
|
name='src.gui_2',
|
||||||
file_path="C:/projects/manual_slop/src/gui_2.py",
|
file_path=__file__,
|
||||||
state_keys=[
|
state_keys=['active_discussion', 'show_windows', 'ui_file_paths', 'ui_screenshot_paths', 'disc_entries', 'disc_roles'],
|
||||||
"ai_input",
|
delegation_targets=['_render_main_interface', '_render_discussion_hub', '_render_files_and_media', '_render_ai_settings_hub', '_render_operations_hub', '_render_mma_dashboard'],
|
||||||
"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",
|
|
||||||
],
|
|
||||||
))
|
))
|
||||||
```
|
```
|
||||||
|
|
||||||
|
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.
|
**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:
|
**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
|
### 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
|
### GUI Button
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user