fix(gui): Resolve AttributeError in imscope.indent and stabilize render loop
- Add 'indent' context manager to src/imgui_scopes.py. - Refactor manual imgui.indent/unindent calls in src/gui_2.py to use imscope.indent. - Fix cascading ImGui assertion failures caused by Open/Close mismatches during exceptions. - Finalize 'Selectable Thinking Monologs' track.
This commit is contained in:
+12
-1
@@ -1,4 +1,5 @@
|
||||
from __future__ import annotations
|
||||
from typing import Any
|
||||
from imgui_bundle import imgui
|
||||
from imgui_bundle import imgui_node_editor
|
||||
|
||||
@@ -43,6 +44,16 @@ class _ScopeId:
|
||||
imgui.pop_id()
|
||||
return False
|
||||
|
||||
def indent(width: float = 0.0): return _ScopeIndent(width)
|
||||
class _ScopeIndent:
|
||||
def __init__(self, width: float):
|
||||
self._width = width
|
||||
def __enter__(self):
|
||||
imgui.indent(self._width)
|
||||
def __exit__(self, *args):
|
||||
imgui.unindent(self._width)
|
||||
return False
|
||||
|
||||
def menu(label: str): return _ScopeMenu(label)
|
||||
class _ScopeMenu:
|
||||
def __init__(self, label: str):
|
||||
@@ -256,4 +267,4 @@ class _ScopeWindow:
|
||||
return self._result
|
||||
def __exit__(self, *args):
|
||||
imgui.end()
|
||||
return False
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user