fix(gui): properly handle AST Inspector popup state

- Add _show_ast_inspector flag to track when popup should open
- Use same pattern as other modals (_show_* flag + open_popup)
- Restructure if/else to properly handle end_popup paths
- This fixes the Inspect button not opening the modal
This commit is contained in:
2026-05-10 22:33:07 -04:00
parent fc2456506a
commit 6738e44e7a
3 changed files with 94 additions and 87 deletions
+1 -1
View File
@@ -56,7 +56,7 @@ Theme = true
Diagnostics = false
"External Tools" = false
"Shader Editor" = false
"Undo/Redo History" = true
"Undo/Redo History" = false
[theme]
palette = "Nord Dark"
+10 -10
View File
@@ -75,7 +75,7 @@ DockId=0xAFC85805,2
[Window][Theme]
Pos=0,28
Size=1109,1750
Size=1412,1729
Collapsed=0
DockId=0x00000005,3
@@ -102,26 +102,26 @@ Collapsed=0
DockId=0x0000000D,0
[Window][Discussion Hub]
Pos=1111,28
Size=1154,1750
Pos=1414,28
Size=1154,1729
Collapsed=0
DockId=0x00000006,0
[Window][Operations Hub]
Pos=0,28
Size=1109,1750
Size=1412,1729
Collapsed=0
DockId=0x00000005,2
[Window][Files & Media]
Pos=1111,28
Size=1154,1750
Pos=1414,28
Size=1154,1729
Collapsed=0
DockId=0x00000006,1
[Window][AI Settings]
Pos=0,28
Size=1109,1750
Size=1412,1729
Collapsed=0
DockId=0x00000005,0
@@ -407,7 +407,7 @@ DockId=0x00000006,1
[Window][Project Settings]
Pos=0,28
Size=1109,1750
Size=1412,1729
Collapsed=0
DockId=0x00000005,1
@@ -591,11 +591,11 @@ Column 4 Width=70
DockNode ID=0x00000008 Pos=3125,170 Size=593,1157 Split=Y
DockNode ID=0x00000009 Parent=0x00000008 SizeRef=1029,147 Selected=0x0469CA7A
DockNode ID=0x0000000A Parent=0x00000008 SizeRef=1029,145 Selected=0xDF822E02
DockSpace ID=0xAFC85805 Window=0x079D3A04 Pos=0,28 Size=2727,1750 Split=X
DockSpace ID=0xAFC85805 Window=0x079D3A04 Pos=0,28 Size=2568,1729 Split=X
DockNode ID=0x00000003 Parent=0xAFC85805 SizeRef=2254,1183 Split=X
DockNode ID=0x0000000B Parent=0x00000003 SizeRef=404,1186 Split=X Selected=0xF4139CA2
DockNode ID=0x00000007 Parent=0x0000000B SizeRef=1512,858 Split=X Selected=0x8CA2375C
DockNode ID=0x00000005 Parent=0x00000007 SizeRef=1109,1681 CentralNode=1 Selected=0x7BD57D6A
DockNode ID=0x00000005 Parent=0x00000007 SizeRef=1109,1681 CentralNode=1 Selected=0x418C7449
DockNode ID=0x00000006 Parent=0x00000007 SizeRef=1154,1681 Selected=0x6F2B5B04
DockNode ID=0x0000000E Parent=0x0000000B SizeRef=1777,858 Selected=0x1D56B311
DockNode ID=0x0000000D Parent=0x00000003 SizeRef=435,1186 Selected=0x363E93D6
+9 -2
View File
@@ -240,6 +240,7 @@ class App:
self.ui_new_context_preset_name = ""
self._focus_md_cache: dict[str, str] = {}
self.ui_inspecting_ast_file = None
self._show_ast_inspector = False
self._cached_ast_nodes = []
self._cached_ast_file_path = ''
self.ui_editing_slices_file = None
@@ -1663,11 +1664,16 @@ class App:
imgui.end_popup()
def _render_ast_inspector_modal(self) -> None:
if self._show_ast_inspector:
imgui.open_popup('AST Inspector')
self._show_ast_inspector = False
expanded, opened = imgui.begin_popup_modal('AST Inspector', True, imgui.WindowFlags_.always_auto_resize)
if expanded:
if not opened:
return
if self.ui_inspecting_ast_file is None:
imgui.close_current_popup()
else:
imgui.end_popup()
return
f_item = self.ui_inspecting_ast_file
f_path = f_item.path if hasattr(f_item, "path") else str(f_item)
@@ -2902,6 +2908,7 @@ class App:
imgui.same_line()
if imgui.button(f"[Inspect]##{i}"):
self.ui_inspecting_ast_file = f_item
self._show_ast_inspector = True
imgui.same_line()
if imgui.button(f"[Slices]##{i}"):