script modal method
This commit is contained in:
@@ -1038,7 +1038,10 @@ class App:
|
||||
self.perf_monitor.end_frame()
|
||||
|
||||
# Modals / Popups
|
||||
self._render_approve_script_modal()
|
||||
|
||||
def _render_approve_script_modal(self) -> None:
|
||||
"""Renders the modal dialog for approving AI-generated PowerShell scripts."""
|
||||
with self._pending_dialog_lock:
|
||||
dlg = self._pending_dialog
|
||||
if dlg:
|
||||
@@ -1051,6 +1054,37 @@ class App:
|
||||
if imgui.begin_popup_modal("Approve PowerShell Command", None, imgui.WindowFlags_.always_auto_resize)[0]:
|
||||
if not dlg:
|
||||
imgui.close_current_popup()
|
||||
else:
|
||||
imgui.text("The AI wants to run the following PowerShell script:")
|
||||
imgui.text_colored(vec4(200, 200, 100), f"base_dir: {dlg._base_dir}")
|
||||
imgui.separator()
|
||||
# Checkbox to toggle full preview inside modal
|
||||
_, self.show_text_viewer = imgui.checkbox("Show Full Preview", self.show_text_viewer)
|
||||
if self.show_text_viewer:
|
||||
imgui.begin_child("preview_child", imgui.ImVec2(600, 300), True)
|
||||
imgui.text_unformatted(dlg._script)
|
||||
imgui.end_child()
|
||||
else:
|
||||
ch, dlg._script = imgui.input_text_multiline("##confirm_script", dlg._script, imgui.ImVec2(-1, 200))
|
||||
imgui.separator()
|
||||
if imgui.button("Approve & Run", imgui.ImVec2(120, 0)):
|
||||
with dlg._condition:
|
||||
dlg._approved = True
|
||||
dlg._done = True
|
||||
dlg._condition.notify_all()
|
||||
with self._pending_dialog_lock:
|
||||
self._pending_dialog = None
|
||||
imgui.close_current_popup()
|
||||
imgui.same_line()
|
||||
if imgui.button("Reject", imgui.ImVec2(120, 0)):
|
||||
with dlg._condition:
|
||||
dlg._approved = False
|
||||
dlg._done = True
|
||||
dlg._condition.notify_all()
|
||||
with self._pending_dialog_lock:
|
||||
self._pending_dialog = None
|
||||
imgui.close_current_popup()
|
||||
imgui.end_popup()
|
||||
|
||||
def _render_project_settings_hub(self) -> None:
|
||||
with imscope.tab_bar('context_hub_tabs'):
|
||||
|
||||
Reference in New Issue
Block a user