refactor(gui): Modularize _render_context_composition_panel into sub-methods
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
# Implementation Plan: Modular Context Composition UI
|
||||
|
||||
## Objective
|
||||
Refactor the monolithic `_render_context_composition_panel` in `src/gui_2.py` into smaller, semantic methods to improve readability, maintainability, and reduce the complexity of the main GUI orchestrator.
|
||||
|
||||
## Key Files & Context
|
||||
- `src/gui_2.py`: The target for refactoring.
|
||||
- `src/imgui_scopes.py`: Used for scoped ImGui blocks.
|
||||
|
||||
## Implementation Steps
|
||||
|
||||
### Phase 1: Infrastructure & Background Tasks
|
||||
- [ ] Task: Extract file stats background worker logic into `_update_context_file_stats()`.
|
||||
- [ ] Task: In `_render_context_composition_panel`, ensure state variables (`_file_stats_cache`, etc.) are initialized once.
|
||||
|
||||
### Phase 2: Extract Sub-Panels
|
||||
- [ ] Task: Extract the batch action bar logic into `_render_context_batch_actions()`.
|
||||
- [ ] Task: Extract the grouped files tree table logic into `_render_context_files_table()`.
|
||||
- [ ] Task: Extract the screenshots section into `_render_context_screenshots()`.
|
||||
- [ ] Task: Extract the context presets section into `_render_context_presets()`.
|
||||
|
||||
### Phase 3: Assembly & Verification
|
||||
- [ ] Task: Reassemble `_render_context_composition_panel` by calling the new sub-methods.
|
||||
- [ ] Task: Run the custom AST linter to ensure all scopes are correctly closed.
|
||||
- [ ] Task: Run fast render tests to verify no regressions in the context panel.
|
||||
|
||||
## Verification & Testing
|
||||
- **AST Linting**: `uv run python scripts/check_imgui_scopes.py src/gui_2.py`
|
||||
- **Fast Render Tests**: `uv run pytest tests/test_gui_fast_render.py`
|
||||
- **Manual Verification**: Open the Context Composition panel, verify batch actions work, files are correctly grouped and listed, and presets can be saved/loaded.
|
||||
Reference in New Issue
Block a user