From b4396697ddbf9976d1695d49f8662013dfaeac86 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Tue, 17 Mar 2026 23:26:01 -0400 Subject: [PATCH] finished a track --- .../plan.md | 30 +++++++++---------- src/api_hooks.py | 3 ++ src/app_controller.py | 11 +++++-- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/conductor/tracks/text_viewer_rich_rendering_20260313/plan.md b/conductor/tracks/text_viewer_rich_rendering_20260313/plan.md index c83c057..f85bbcd 100644 --- a/conductor/tracks/text_viewer_rich_rendering_20260313/plan.md +++ b/conductor/tracks/text_viewer_rich_rendering_20260313/plan.md @@ -8,22 +8,22 @@ - [x] Task: Conductor - User Manual Verification 'Phase 1: State & Interface Update' (Protocol in workflow.md) e28af48 ## Phase 2: Core Rendering Logic (Code & MD) -- [ ] Task: Write Tests: Create a simulation test in `tests/test_gui_text_viewer.py` to verify the viewer opens and switches rendering paths based on `text_type`. -- [ ] Task: Implement: In `src/gui_2.py`, refactor the text viewer window loop to: - - Use `MarkdownRenderer.render` if `text_type == "markdown"`. - - Use a cached `ImGuiColorTextEdit.TextEditor` if `text_type` matches a code language. - - Fallback to `imgui.input_text_multiline` for plain text. -- [ ] Task: Implement: Ensure the `TextEditor` instance is properly cached using a unique key for the text viewer to maintain state. -- [ ] Task: Conductor - User Manual Verification 'Phase 2: Core Rendering Logic' (Protocol in workflow.md) +- [x] Task: Write Tests: Create a simulation test in `tests/test_gui_text_viewer.py` to verify the viewer opens and switches rendering paths based on `text_type`. a91b8dc +- [x] Task: Implement: In `src/gui_2.py`, refactor the text viewer window loop to: a91b8dc + - Use `MarkdownRenderer.render` if `text_type == "markdown"`. a91b8dc + - Use a cached `ImGuiColorTextEdit.TextEditor` if `text_type` matches a code language. a91b8dc + - Fallback to `imgui.input_text_multiline` for plain text. a91b8dc +- [x] Task: Implement: Ensure the `TextEditor` instance is properly cached using a unique key for the text viewer to maintain state. a91b8dc +- [x] Task: Conductor - User Manual Verification 'Phase 2: Core Rendering Logic' (Protocol in workflow.md) a91b8dc ## Phase 3: UI Features (Copy, Line Numbers, Wrap) -- [ ] Task: Write Tests: Update `tests/test_gui_text_viewer.py` to verify the copy-to-clipboard functionality and word wrap toggle. -- [ ] Task: Implement: Add a "Copy" button to the text viewer title bar or a small toolbar at the top of the window. -- [ ] Task: Implement: Add a "Word Wrap" checkbox inside the text viewer window. -- [ ] Task: Implement: Configure the `TextEditor` instance to show line numbers and be read-only. -- [ ] Task: Conductor - User Manual Verification 'Phase 3: UI Features' (Protocol in workflow.md) +- [x] Task: Write Tests: Update `tests/test_gui_text_viewer.py` to verify the copy-to-clipboard functionality and word wrap toggle. a91b8dc +- [x] Task: Implement: Add a "Copy" button to the text viewer title bar or a small toolbar at the top of the window. a91b8dc +- [x] Task: Implement: Add a "Word Wrap" checkbox inside the text viewer window. a91b8dc +- [x] Task: Implement: Configure the `TextEditor` instance to show line numbers and be read-only. a91b8dc +- [x] Task: Conductor - User Manual Verification 'Phase 3: UI Features' (Protocol in workflow.md) a91b8dc ## Phase 4: Integration & Rollout -- [ ] Task: Implement: Update all existing calls to `_render_text_viewer` in `src/gui_2.py` (e.g., in `_render_files_panel`, `_render_tool_calls_panel`) to pass the correct `text_type` based on file extension or content. -- [ ] Task: Implement: Add "Markdown Preview" support for system prompt presets using the new text viewer logic. -- [ ] Task: Conductor - User Manual Verification 'Phase 4: Integration & Rollout' (Protocol in workflow.md) +- [x] Task: Implement: Update all existing calls to `_render_text_viewer` in `src/gui_2.py` (e.g., in `_render_files_panel`, `_render_tool_calls_panel`) to pass the correct `text_type` based on file extension or content. 2826ad5 +- [x] Task: Implement: Add "Markdown Preview" support for system prompt presets using the new text viewer logic. 2826ad5 +- [x] Task: Conductor - User Manual Verification 'Phase 4: Integration & Rollout' (Protocol in workflow.md) 2826ad5 diff --git a/src/api_hooks.py b/src/api_hooks.py index f681678..864ae86 100644 --- a/src/api_hooks.py +++ b/src/api_hooks.py @@ -225,6 +225,9 @@ class HookHandler(BaseHTTPRequestHandler): for key, attr in gettable.items(): val = _get_app_attr(app, attr, None) result[key] = _serialize_for_api(val) + result['show_text_viewer'] = _get_app_attr(app, 'show_text_viewer', False) + result['text_viewer_title'] = _get_app_attr(app, 'text_viewer_title', '') + result['text_viewer_type'] = _get_app_attr(app, 'text_viewer_type', 'markdown') finally: event.set() lock = _get_app_attr(app, "_pending_gui_tasks_lock") tasks = _get_app_attr(app, "_pending_gui_tasks") diff --git a/src/app_controller.py b/src/app_controller.py index dc5cc8c..c5fa0c9 100644 --- a/src/app_controller.py +++ b/src/app_controller.py @@ -252,6 +252,7 @@ class AppController: self.show_text_viewer: bool = False self.text_viewer_title: str = '' self.text_viewer_content: str = '' + self.text_viewer_type: str = 'text' self._pending_comms: List[Dict[str, Any]] = [] self._pending_tool_calls: List[Dict[str, Any]] = [] self._pending_history_adds: List[Dict[str, Any]] = [] @@ -375,7 +376,10 @@ class AppController: 'ui_separate_tier1': 'ui_separate_tier1', 'ui_separate_tier2': 'ui_separate_tier2', 'ui_separate_tier3': 'ui_separate_tier3', - 'ui_separate_tier4': 'ui_separate_tier4' + 'ui_separate_tier4': 'ui_separate_tier4', + 'show_text_viewer': 'show_text_viewer', + 'text_viewer_title': 'text_viewer_title', + 'text_viewer_type': 'text_viewer_type' } self._gettable_fields = dict(self._settable_fields) self._gettable_fields.update({ @@ -422,7 +426,10 @@ class AppController: 'ui_separate_tier1': 'ui_separate_tier1', 'ui_separate_tier2': 'ui_separate_tier2', 'ui_separate_tier3': 'ui_separate_tier3', - 'ui_separate_tier4': 'ui_separate_tier4' + 'ui_separate_tier4': 'ui_separate_tier4', + 'show_text_viewer': 'show_text_viewer', + 'text_viewer_title': 'text_viewer_title', + 'text_viewer_type': 'text_viewer_type' }) self.perf_monitor = performance_monitor.get_monitor() self._perf_profiling_enabled = False