diff --git a/conductor/tracks.md b/conductor/tracks.md index dcc88521..648b6861 100644 --- a/conductor/tracks.md +++ b/conductor/tracks.md @@ -273,5 +273,5 @@ This file tracks all major tracks for the project. Each track has its own detail --- -- [ ] **Track: Fix `keys_down` AttributeError in ImGui IO** +- [x] **Track: Fix `keys_down` AttributeError in ImGui IO** *Link: [./tracks/fix_imgui_keys_down_20260601/](./tracks/fix_imgui_keys_down_20260601/)* diff --git a/conductor/tracks/fix_imgui_keys_down_20260601/plan.md b/conductor/tracks/fix_imgui_keys_down_20260601/plan.md index 852665d4..b73d144e 100644 --- a/conductor/tracks/fix_imgui_keys_down_20260601/plan.md +++ b/conductor/tracks/fix_imgui_keys_down_20260601/plan.md @@ -1,13 +1,13 @@ # Implementation Plan: Fix `keys_down` AttributeError ## Phase 1: Investigation and Implementation -- [ ] Task: Investigate ImGui API - - [ ] Identify the correct `imgui-bundle` equivalent for `io.keys_down` (e.g., `imgui.is_key_pressed(imgui.Key.r, False)`). - - [ ] Search the codebase for any other instances of `io.keys_down` that need updating. -- [ ] Task: Apply Fixes - - [ ] Modify `src/gui_2.py` (around line 695) to replace `io.keys_down[ord('R')]` with the modern API call. - - [ ] Apply the same fix to any other locations found during the codebase search. -- [ ] Task: Verification - - [ ] Start the application locally and trigger the `Ctrl+Alt+R` shortcut to confirm it no longer crashes. - - [ ] Ensure general application stability. -- [ ] Task: Conductor - User Manual Verification 'Phase 1: Investigation and Implementation' (Protocol in workflow.md) +- [x] Task: Investigate ImGui API + - [x] Identify the correct `imgui-bundle` equivalent for `io.keys_down` (e.g., `imgui.is_key_pressed(imgui.Key.r, False)`). + - [x] Search the codebase for any other instances of `io.keys_down` that need updating. +- [x] Task: Apply Fixes + - [x] Modify `src/gui_2.py` (around line 695) to replace `io.keys_down[ord('R')]` with the modern API call. + - [x] Apply the same fix to any other locations found during the codebase search. +- [x] Task: Verification + - [x] Start the application locally and trigger the `Ctrl+Alt+R` shortcut to confirm it no longer crashes. + - [x] Ensure general application stability. +- [x] Task: Conductor - User Manual Verification 'Phase 1: Investigation and Implementation' (Protocol in workflow.md) diff --git a/src/gui_2.py b/src/gui_2.py index b22af62a..5947bf94 100644 --- a/src/gui_2.py +++ b/src/gui_2.py @@ -692,7 +692,7 @@ class App: def _gui_func(self) -> None: io = imgui.get_io() - if io.key_ctrl and io.key_alt and io.keys_down[ord('R')]: + if io.key_ctrl and io.key_alt and imgui.is_key_down(imgui.Key.r): self._trigger_hot_reload() render_custom_title_bar(self) diff --git a/tests/test_hot_reload_integration.py b/tests/test_hot_reload_integration.py index aecdc2f6..a484e2b1 100644 --- a/tests/test_hot_reload_integration.py +++ b/tests/test_hot_reload_integration.py @@ -124,8 +124,10 @@ class TestHotReloadTriggerIntegration: mock_io = MagicMock() mock_io.key_ctrl = True mock_io.key_alt = True - mock_io.keys_down = {ord('R'): True} mock_imgui.get_io.return_value = mock_io + mock_imgui.Key = MagicMock() + mock_imgui.Key.r = 'mock_r_key' + mock_imgui.is_key_down.side_effect = lambda k: k == 'mock_r_key' mock_app = MagicMock() mock_app._trigger_hot_reload = MagicMock(return_value=True) mock_app.perf_profiling_enabled = False