fix(gui): patch modal ImGui API fixes - use vec4() for colors, proper button calls
This commit is contained in:
26
fix_modal.py
26
fix_modal.py
@@ -1,26 +0,0 @@
|
||||
import re
|
||||
with open('src/gui_2.py', 'r', encoding='utf-8', newline='') as f:
|
||||
c = f.read()
|
||||
|
||||
# Fix the reject button handler - add timestamp reset
|
||||
old = ''' if imgui.button("Reject", imgui.ImVec2(150, 0)):
|
||||
self._show_patch_modal = False
|
||||
self._pending_patch_text = None
|
||||
self._pending_patch_files = []
|
||||
self._patch_error_message = None
|
||||
imgui.close_current_popup()'''
|
||||
|
||||
new = ''' if imgui.button("Reject", imgui.ImVec2(150, 0)):
|
||||
self._show_patch_modal = False
|
||||
self._pending_patch_text = None
|
||||
self._pending_patch_files = []
|
||||
self._patch_error_message = None
|
||||
if hasattr(self, '_patch_modal_open_time'):
|
||||
delattr(self, '_patch_modal_open_time')
|
||||
imgui.close_current_popup()'''
|
||||
|
||||
c = c.replace(old, new)
|
||||
|
||||
with open('src/gui_2.py', 'w', encoding='utf-8', newline='') as f:
|
||||
f.write(c)
|
||||
print('Done')
|
||||
22
src/gui_2.py
22
src/gui_2.py
@@ -877,15 +877,9 @@ class App:
|
||||
def _render_patch_modal(self) -> None:
|
||||
if not self._show_patch_modal:
|
||||
return
|
||||
import time
|
||||
if not hasattr(self, '_patch_modal_open_time'):
|
||||
self._patch_modal_open_time = time.time()
|
||||
elif time.time() - self._patch_modal_open_time < 5.0:
|
||||
return
|
||||
self._patch_modal_open_time = None
|
||||
imgui.open_popup("Apply Patch?")
|
||||
if imgui.begin_popup_modal("Apply Patch?", True, imgui.ImVec2(600, 500))[0]:
|
||||
imgui.text_colored(imgui.ImVec4(1, 0.9, 0.3, 1), "Tier 4 QA Generated a Patch")
|
||||
if imgui.begin_popup_modal("Apply Patch?", True, imgui.WindowFlags_.always_auto_resize)[0]:
|
||||
imgui.text_colored(vec4(255, 230, 77), "Tier 4 QA Generated a Patch")
|
||||
imgui.separator()
|
||||
if self._pending_patch_files:
|
||||
imgui.text("Files to modify:")
|
||||
@@ -893,7 +887,7 @@ class App:
|
||||
imgui.text(f" - {f}")
|
||||
imgui.separator()
|
||||
if self._patch_error_message:
|
||||
imgui.text_colored(imgui.ImVec4(1, 0.3, 0.3, 1), f"Error: {self._patch_error_message}")
|
||||
imgui.text_colored(vec4(255, 77, 77), f"Error: {self._patch_error_message}")
|
||||
imgui.separator()
|
||||
imgui.text("Diff Preview:")
|
||||
imgui.begin_child("patch_diff_scroll", imgui.ImVec2(-1, 280), True)
|
||||
@@ -901,19 +895,19 @@ class App:
|
||||
diff_lines = self._pending_patch_text.split("\n")
|
||||
for line in diff_lines:
|
||||
if line.startswith("+++") or line.startswith("---") or line.startswith("@@"):
|
||||
imgui.text_colored(imgui.ImVec4(0.3, 0.7, 1, 1), line)
|
||||
imgui.text_colored(vec4(77, 178, 255), line)
|
||||
elif line.startswith("+"):
|
||||
imgui.text_colored(imgui.ImVec4(0.2, 0.9, 0.2, 1), line)
|
||||
imgui.text_colored(vec4(51, 230, 51), line)
|
||||
elif line.startswith("-"):
|
||||
imgui.text_colored(imgui.ImVec4(0.9, 0.2, 0.2, 1), line)
|
||||
imgui.text_colored(vec4(230, 51, 51), line)
|
||||
else:
|
||||
imgui.text(line)
|
||||
imgui.end_child()
|
||||
imgui.separator()
|
||||
if imgui.button("Apply Patch", imgui.ImVec2(150, 0)):
|
||||
if imgui.button("Apply Patch"):
|
||||
self._apply_pending_patch()
|
||||
imgui.same_line()
|
||||
if imgui.button("Reject", imgui.ImVec2(150, 0)):
|
||||
if imgui.button("Reject"):
|
||||
self._show_patch_modal = False
|
||||
self._pending_patch_text = None
|
||||
self._pending_patch_files = []
|
||||
|
||||
Reference in New Issue
Block a user