more gui_2.py

This commit is contained in:
ed
2026-06-13 12:00:33 -04:00
parent b61a2db01d
commit 9fc2c21e82
+36 -64
View File
@@ -3724,9 +3724,12 @@ def render_ast_inspector_modal(app: App) -> None:
slice_data = FuzzyAnchor.create_slice(app.text_viewer_content, s_line, e_line) slice_data = FuzzyAnchor.create_slice(app.text_viewer_content, s_line, e_line)
slice_data['tag'] = ""; slice_data['comment'] = "" slice_data['tag'] = ""; slice_data['comment'] = ""
f_item.custom_slices.append(slice_data) f_item.custom_slices.append(slice_data)
app._slice_sel_start = -1; app._slice_sel_end = -1 app._slice_sel_start = -1
app._slice_sel_end = -1
imgui.same_line() imgui.same_line()
if imgui.button("Clear Selection"): app._slice_sel_start = -1; app._slice_sel_end = -1 if imgui.button("Clear Selection"):
app._slice_sel_start = -1
app._slice_sel_end = -1
imgui.same_line() imgui.same_line()
if imgui.button("Auto-Populate"): app._populate_auto_slices(f_item) if imgui.button("Auto-Populate"): app._populate_auto_slices(f_item)
@@ -3769,10 +3772,8 @@ def render_ast_inspector_modal(app: App) -> None:
if deepest_node is None or node['indent'] > deepest_node['indent']: deepest_node = node if deepest_node is None or node['indent'] > deepest_node['indent']: deepest_node = node
mode = 'hide' mode = 'hide'
if deepest_node: mode = getattr(f_item, 'ast_mask', {}).get(deepest_node['full_path'], 'hide') if deepest_node: mode = getattr(f_item, 'ast_mask', {}).get(deepest_node['full_path'], 'hide')
if mode == 'def': if mode == 'def': draw_list.add_rect_filled(pos, imgui.ImVec2(pos.x + avail_width, pos.y + line_height), imgui.get_color_u32(theme.get_color("slice_auto", alpha=0.15)))
draw_list.add_rect_filled(pos, imgui.ImVec2(pos.x + avail_width, pos.y + line_height), imgui.get_color_u32(theme.get_color("slice_auto", alpha=0.15))) elif mode == 'sig': draw_list.add_rect_filled(pos, imgui.ImVec2(pos.x + avail_width, pos.y + line_height), imgui.get_color_u32(theme.get_color("slice_selection", alpha=0.15)))
elif mode == 'sig':
draw_list.add_rect_filled(pos, imgui.ImVec2(pos.x + avail_width, pos.y + line_height), imgui.get_color_u32(theme.get_color("slice_selection", alpha=0.15)))
elif deepest_node and deepest_node['full_path'] == getattr(app, '_hovered_ast_node', None): elif deepest_node and deepest_node['full_path'] == getattr(app, '_hovered_ast_node', None):
draw_list.add_rect_filled(pos, imgui.ImVec2(pos.x + avail_width, pos.y + line_height), imgui.get_color_u32(theme.get_color("status_warning", alpha=0.2))) draw_list.add_rect_filled(pos, imgui.ImVec2(pos.x + avail_width, pos.y + line_height), imgui.get_color_u32(theme.get_color("status_warning", alpha=0.2)))
@@ -3806,11 +3807,9 @@ def render_ast_inspector_modal(app: App) -> None:
app.ui_inspecting_ast_file = None app.ui_inspecting_ast_file = None
def render_save_workspace_profile_modal(app: App) -> None: def render_save_workspace_profile_modal(app: App) -> None:
""" """Renders a popup modal for saving the current workspace profile (projects, layout, configuration).
Renders a popup modal for saving the current workspace profile (projects, layout, configuration).
SSDL Shape: SSDL: `[I:name_input] -> [B:scope_radio] -> [B:save_button] => [B:cancel_button]`
`[I:name_input] -> [B:scope_radio] -> [B:save_button] => [B:cancel_button]`
ASCII Layout Map: ASCII Layout Map:
+---------------------------------------------------------+ +---------------------------------------------------------+
@@ -3848,12 +3847,10 @@ def render_save_workspace_profile_modal(app: App) -> None:
imgui.end_popup() imgui.end_popup()
def render_context_presets_panel(app: App) -> None: def render_context_presets_panel(app: App) -> None:
""" """Renders the Context Presets configuration panel. Enables naming, saving, loading,
Renders the Context Presets configuration panel. Enables naming, saving, loading,
and deleting context presets. and deleting context presets.
SSDL Shape: SSDL: `[I:presets_list] -> [B:save_new_preset] => [B:presets_action_buttons]`
`[I:presets_list] -> [B:save_new_preset] => [B:presets_action_buttons]`
ASCII Layout Map: ASCII Layout Map:
+---------------------------------------------------------+ +---------------------------------------------------------+
@@ -3885,11 +3882,9 @@ def render_context_presets_panel(app: App) -> None:
if imgui.button(f"Delete##{name}"): app.delete_context_preset(name) if imgui.button(f"Delete##{name}"): app.delete_context_preset(name)
def render_context_screenshots(app: App) -> None: def render_context_screenshots(app: App) -> None:
""" """Renders a list of the currently attached screenshot image files.
Renders a list of the currently attached screenshot image files.
SSDL Shape: SSDL: `[I:screenshots]`
`[I:screenshots]`
ASCII Layout Map: ASCII Layout Map:
+---------------------------------------------------------+ +---------------------------------------------------------+
@@ -3900,12 +3895,10 @@ def render_context_screenshots(app: App) -> None:
for i, s in enumerate(app.screenshots): imgui.text(s) for i, s in enumerate(app.screenshots): imgui.text(s)
def render_context_files_table(app: App) -> None: def render_context_files_table(app: App) -> None:
""" """Renders a two-column table mapping active context files to their AST view modes
Renders a two-column table mapping active context files to their AST view modes
(Definition, Signature, Hide) and slice indicators. Grouped by directories. (Definition, Signature, Hide) and slice indicators. Grouped by directories.
SSDL Shape: SSDL: `[I:group_by_dir] -> o-> [I:dir_node] -> o-> [I:file_row]`
`[I:group_by_dir] -> o-> [I:dir_node] -> o-> [I:file_row]`
ASCII Layout Map: ASCII Layout Map:
+-------------------------------------------------------------+ +-------------------------------------------------------------+
@@ -4017,11 +4010,9 @@ def render_context_files_table(app: App) -> None:
imgui.text_colored(theme.get_color("status_warning"), "[Slices Active]") imgui.text_colored(theme.get_color("status_warning"), "[Slices Active]")
def render_context_presets(app: App) -> None: def render_context_presets(app: App) -> None:
""" """Renders context preset management controls (combobox selector, update button, save-as, and delete active).
Renders context preset management controls (combobox selector, update button, save-as, and delete active).
SSDL Shape: SSDL: `[I:presets] -> [B:presets_combo] -> [B:save_as_button] => [B:delete_active]`
`[I:presets] -> [B:presets_combo] -> [B:save_as_button] => [B:delete_active]`
ASCII Layout Map: ASCII Layout Map:
+---------------------------------------------------------+ +---------------------------------------------------------+
@@ -4082,12 +4073,9 @@ def render_context_presets(app: App) -> None:
root = app.controller.active_project_root root = app.controller.active_project_root
for f in app.context_files: for f in app.context_files:
path = f.path if hasattr(f, "path") else str(f) path = f.path if hasattr(f, "path") else str(f)
if not os.path.isabs(path): if not os.path.isabs(path): full_path = os.path.join(root, path)
full_path = os.path.join(root, path) else: full_path = path
else: if not os.path.exists(full_path): missing.append(path)
full_path = path
if not os.path.exists(full_path):
missing.append(path)
if missing: if missing:
app.missing_context_files = missing app.missing_context_files = missing
@@ -4118,11 +4106,9 @@ def render_context_presets(app: App) -> None:
app.ui_active_context_preset = "" app.ui_active_context_preset = ""
def render_snapshot_tab(app: App) -> None: def render_snapshot_tab(app: App) -> None:
""" """Renders the Snapshot tab-bar, containing the resolved aggregate markdown and active system prompts.
Renders the Snapshot tab-bar, containing the resolved aggregate markdown and active system prompts.
SSDL Shape: SSDL: `[I:aggregate_text] -> [B:copy_buttons] => [I:preview_panes]`
`[I:aggregate_text] -> [B:copy_buttons] => [I:preview_panes]`
ASCII Layout Map: ASCII Layout Map:
+---------------------------------------------------------+ +---------------------------------------------------------+
@@ -4167,11 +4153,9 @@ def render_snapshot_tab(app: App) -> None:
markdown_helper.render(app.last_resolved_system_prompt, context_id="snapshot_sys") markdown_helper.render(app.last_resolved_system_prompt, context_id="snapshot_sys")
def render_empty_context_modal(app: App) -> None: def render_empty_context_modal(app: App) -> None:
""" """Renders a popup modal warning the user when the context composition is empty.
Renders a popup modal warning the user when the context composition is empty.
SSDL Shape: SSDL: `[I:warning_text] -> [B:proceed_button] => [B:cancel_button]`
`[I:warning_text] -> [B:proceed_button] => [B:cancel_button]`
ASCII Layout Map: ASCII Layout Map:
+---------------------------------------------------------+ +---------------------------------------------------------+
@@ -4202,12 +4186,10 @@ def render_empty_context_modal(app: App) -> None:
imgui.end_popup() imgui.end_popup()
def render_context_modals(app: App) -> None: def render_context_modals(app: App) -> None:
""" """Dispatches rendering calls to sub-modals relating to context management
Dispatches rendering calls to sub-modals relating to context management
(empty context warning, file picker, missing files warning, and AST inspector). (empty context warning, file picker, missing files warning, and AST inspector).
SSDL Shape: SSDL: `[I] -> [I:modals_dispatch]`
`[I] -> [I:modals_dispatch]`
ASCII Layout Map: ASCII Layout Map:
Conditionally opens (in order): Conditionally opens (in order):
@@ -4303,12 +4285,10 @@ def _check_auto_refresh_context_preview(app: App) -> None:
app.controller.submit_io(worker) app.controller.submit_io(worker)
def render_context_preview_window(app: App) -> None: def render_context_preview_window(app: App) -> None:
""" """Renders the Context Preview window. Automatically refreshes aggregated context previews in the background
Renders the Context Preview window. Automatically refreshes aggregated context previews in the background
and renders formatted markdown text. and renders formatted markdown text.
SSDL Shape: SSDL: `[I:preview_text] -> [B:clipboard_button] => [I:preview_box]`
`[I:preview_text] -> [B:clipboard_button] => [I:preview_box]`
ASCII Layout Map: ASCII Layout Map:
+---------------------------------------------------------+ +---------------------------------------------------------+
@@ -4342,12 +4322,10 @@ def render_context_preview_window(app: App) -> None:
#region: Discussions #region: Discussions
def render_discussion_hub(app: App) -> None: def render_discussion_hub(app: App) -> None:
""" """Top-level hub for the Discussion panel. Houses tabs for Discussion, Context Composition,
Top-level hub for the Discussion panel. Houses tabs for Discussion, Context Composition,
Context Preview (inline or detached), Snapshot, and Takes. Context Preview (inline or detached), Snapshot, and Takes.
SSDL Shape: SSDL: `[B:pop_out_toggle] -> [I:tab_bar] => [I:active_tab_content]`
`[B:pop_out_toggle] -> [I:tab_bar] => [I:active_tab_content]`
ASCII Layout Map: ASCII Layout Map:
+---------------------------------------------------------+ +---------------------------------------------------------+
@@ -4383,12 +4361,10 @@ def render_discussion_hub(app: App) -> None:
return return
def render_thinking_trace(app: App, entry: dict, segments: list[dict], entry_index: int, is_standalone: bool = False) -> None: def render_thinking_trace(app: App, entry: dict, segments: list[dict], entry_index: int, is_standalone: bool = False) -> None:
""" """Renders a collapsible thinking-trace section within a discussion entry bubble.
Renders a collapsible thinking-trace section within a discussion entry bubble.
Displays each reasoning segment labeled by its marker tag (e.g. [thinking]). Displays each reasoning segment labeled by its marker tag (e.g. [thinking]).
SSDL Shape: SSDL: `[I:segment_list] -> [B:read_pure_toggle] => [I:trace_child]`
`[I:segment_list] -> [B:read_pure_toggle] => [I:trace_child]`
ASCII Layout Map: ASCII Layout Map:
+----------------------------------------------------------+ +----------------------------------------------------------+
@@ -4426,22 +4402,18 @@ def render_thinking_trace(app: App, entry: dict, segments: list[dict], entry_ind
imgui.text_colored(C_TC(), f"[{marker}]") imgui.text_colored(C_TC(), f"[{marker}]")
if thinking_read_mode: if thinking_read_mode:
if app.ui_word_wrap: if app.ui_word_wrap:
with imscope.text_wrap(imgui.get_content_region_avail().x): with imscope.text_wrap(imgui.get_content_region_avail().x): imgui.text(content)
imgui.text(content) else: imgui.text(content)
else:
imgui.text(content)
else: else:
render_selectable_label(app, f"think_text_{entry_index}_{idx}", content, multiline=True, height=-1) render_selectable_label(app, f"think_text_{entry_index}_{idx}", content, multiline=True, height=-1)
imgui.separator() imgui.separator()
def render_discussion_entry(app: App, entry: dict, index: int) -> None: def render_discussion_entry(app: App, entry: dict, index: int) -> None:
""" """Renders a single discussion message entry as a colored visual bubble.
Renders a single discussion message entry as a colored visual bubble.
Supports collapsible states, read/edit mode toggles, role selection, Supports collapsible states, read/edit mode toggles, role selection,
input/output token metrics, and action footers. input/output token metrics, and action footers.
SSDL Shape: SSDL: `[I:header] -> [B:collapsed] => [I:preview] | [I:body] -> [I:footer]`
`[I:header] -> [B:collapsed] => [I:preview] | [I:body] -> [I:footer]`
ASCII Layout Map: ASCII Layout Map:
+-------------------------------------------------------------+ +-------------------------------------------------------------+