diff --git a/src/gui_2.py b/src/gui_2.py index 565432c..cfd5750 100644 --- a/src/gui_2.py +++ b/src/gui_2.py @@ -317,7 +317,7 @@ class App: markdown_helper.render_code(content, context_id=ctx_id) if is_nerv: imgui.pop_style_color() - if is_nerv: imgui.pop_style_color() + # ---------------------------------------------------------------- gui def _render_thinking_trace(self, segments: list[dict], entry_index: int) -> None: if not segments: @@ -340,15 +340,19 @@ class App: imgui.end_child() imgui.unindent() imgui.pop_style_color(2) + + def _render_selectable_label(self, label: str, value: str, width: float = 0.0, multiline: bool = False, height: float = 0.0, color: Optional[imgui.ImVec4] = None) -> None: + imgui.push_id(label + str(hash(value))) pops = 4 imgui.push_style_color(imgui.Col_.frame_bg, vec4(0, 0, 0, 0)) imgui.push_style_color(imgui.Col_.frame_bg_hovered, vec4(0, 0, 0, 0)) imgui.push_style_color(imgui.Col_.frame_bg_active, vec4(0, 0, 0, 0)) imgui.push_style_color(imgui.Col_.border, vec4(0, 0, 0, 0)) - def _render_selectable_label(self, label: str, value: str, width: float = 0.0, multiline: bool = False, height: float = 0.0, color: Optional[imgui.ImVec4] = None) -> None: - imgui.push_id(label) - pops = 4 + if color: + imgui.push_style_color(imgui.Col_.text, color) + pops += 1 + imgui.push_style_var(imgui.StyleVar_.frame_border_size, 0.0) imgui.push_style_var(imgui.StyleVar_.frame_padding, imgui.ImVec2(0, 0)) if multiline: imgui.input_text_multiline("##" + label, value, imgui.ImVec2(width, height), imgui.InputTextFlags_.read_only) @@ -2315,11 +2319,13 @@ def hello(): imgui.end_child() else: ch, entry["content"] = imgui.input_text_multiline("##content", entry["content"], imgui.ImVec2(-1, 150)) + imgui.separator() thinking_segments = entry.get("thinking_segments", []) if thinking_segments: self._render_thinking_trace(thinking_segments, i) - imgui.separator() imgui.pop_id() + if self._scroll_disc_to_bottom: + imgui.set_scroll_here_y(1.0) self._scroll_disc_to_bottom = False imgui.end_child()