From f2c265ec69b4f45534712ba97013123a257c9d2f Mon Sep 17 00:00:00 2001 From: Ed_ Date: Thu, 14 May 2026 21:11:37 -0400 Subject: [PATCH] finally fixed leaking discussion collapsing header (_render_theme_panel had entropied code from agent changes) --- src/gui_2.py | 75 ++++++++++++++-------------------------------------- 1 file changed, 20 insertions(+), 55 deletions(-) diff --git a/src/gui_2.py b/src/gui_2.py index b721d20..6065187 100644 --- a/src/gui_2.py +++ b/src/gui_2.py @@ -1020,7 +1020,8 @@ class App: with imscope.window("Undo/Redo History", self.show_windows['Undo/Redo History']) as (exp, opened): self.show_windows['Undo/Redo History'] = bool(opened) if exp: - if imgui.button("Undo") and self.history.can_undo: self._handle_undo(); imgui.same_line() + if imgui.button("Undo") and self.history.can_undo: self._handle_undo() + imgui.same_line() if imgui.button("Redo") and self.history.can_redo: self._handle_redo() imgui.separator() with imscope.child("history_list", imgui.ImVec2(0, 0), True): @@ -1139,14 +1140,14 @@ class App: theme.set_scale(scale) self._flush_to_config() models.save_config(self.config) - + imgui.text("Panel Transparency") ch_t, trans = imgui.slider_float("##trans", theme.get_transparency(), 0.1, 1.0, "%.2f") if ch_t: theme.set_transparency(trans) self._flush_to_config() models.save_config(self.config) - + imgui.text("Panel Item Transparency") ch_ct, ctrans = imgui.slider_float("##ctrans", theme.get_child_transparency(), 0.1, 1.0, "%.2f") if ch_ct: @@ -1158,60 +1159,17 @@ class App: gui_cfg["bg_shader_enabled"] = bg.enabled self._flush_to_config() models.save_config(self.config) - + ch_crt, self.ui_crt_filter = imgui.checkbox("CRT Filter", self.ui_crt_filter) if ch_crt: gui_cfg = self.config.setdefault("gui", {}) gui_cfg["crt_filter_enabled"] = self.ui_crt_filter self._flush_to_config() models.save_config(self.config) - self._flush_to_config() - models.save_config(self.config) - imgui.end() + + imgui.end() if self.perf_profiling_enabled: self.perf_monitor.end_component("_render_theme_panel") - if not imgui.collapsing_header("Discussions", imgui.TreeNodeFlags_.default_open): return - names = self._get_discussion_names(); grouped = {} - for name in names: - base = name.split("_take_")[0]; grouped.setdefault(base, []).append(name) - active_base = self.active_discussion.split("_take_")[0] - if active_base not in grouped: active_base = names[0] if names else "" - base_names = sorted(grouped.keys()) - if imgui.begin_combo("##disc_sel", active_base): - for bname in base_names: - is_selected = (bname == active_base) - if imgui.selectable(bname, is_selected)[0]: - target = bname if bname in names else grouped[bname][0] - if target != self.active_discussion: self._switch_discussion(target) - if is_selected: imgui.set_item_default_focus() - imgui.end_combo() - active_base = self.active_discussion.split("_take_")[0]; current_takes = grouped.get(active_base, []) - if imgui.begin_tab_bar("discussion_takes_tabs"): - for take_name in current_takes: - label = "Original" if take_name == active_base else take_name.replace(f"{active_base}_", "").replace("_", " ").title() - flags = imgui.TabItemFlags_.set_selected if take_name == self.active_discussion else 0 - with imscope.tab_item(f"{label}###{take_name}", flags) as (exp, _): - if exp and take_name != self.active_discussion: self._switch_discussion(take_name) - with imscope.tab_item("Synthesis###Synthesis") as (exp, _): - if exp: self._render_synthesis_panel() - imgui.end_tab_bar() - if "_take_" in self.active_discussion: - if imgui.button("Promote Take"): - base_name = self.active_discussion.split("_take_")[0]; new_name = f"{base_name}_promoted"; counter = 1 - while new_name in names: new_name = f"{base_name}_promoted_{counter}"; counter += 1 - project_manager.promote_take(self.project, self.active_discussion, new_name); self._switch_discussion(new_name) - imgui.same_line() - if self.active_track: - imgui.same_line(); ch, self._track_discussion_active = imgui.checkbox("Track Discussion", self._track_discussion_active) - if ch: - if self._track_discussion_active: - self._flush_disc_entries_to_project() - history_strings = project_manager.load_track_history(self.active_track.id, self.active_project_root) - with self._disc_entries_lock: self.disc_entries = models.parse_history_entries(history_strings, self.disc_roles) - self.ai_status = f"track discussion: {self.active_track.id}" - else: self._flush_disc_entries_to_project(); self._switch_discussion(self.active_discussion); self.ai_status = "track discussion disabled" - self._render_discussion_metadata() - def _render_shader_live_editor(self) -> None: """ [C: tests/test_shader_live_editor.py:test_shader_live_editor_renders] @@ -3304,6 +3262,7 @@ class App: if exp: self._render_snapshot_tab() with imscope.tab_item("Takes") as (exp, opened): if exp: self._render_takes_panel() + return def _render_discussion_entries(self) -> None: with imscope.child("disc_scroll"): @@ -3459,20 +3418,21 @@ class App: """ if self.perf_profiling_enabled: self.perf_monitor.start_component("_render_discussion_panel") self._render_thinking_indicator() - + if self.is_viewing_prior_session: self._render_prior_session_view() if self.perf_profiling_enabled: self.perf_monitor.end_component("_render_discussion_panel") return - + self._render_discussion_selector() - + if not self.is_viewing_prior_session: imgui.separator(); self._render_discussion_entry_controls() imgui.separator(); self._render_discussion_roles() imgui.separator(); self._render_discussion_entries() if self.perf_profiling_enabled: self.perf_monitor.end_component("_render_discussion_panel") + return def _render_discussion_roles(self) -> None: if imgui.collapsing_header("Roles"): @@ -3485,9 +3445,11 @@ class App: if imgui.button("Add"): r = self.ui_disc_new_role_input.strip() if r and r not in self.disc_roles: self.disc_roles.append(r); self.ui_disc_new_role_input = "" + return def _render_discussion_selector(self) -> None: - if not imgui.collapsing_header("Discussions", imgui.TreeNodeFlags_.default_open): return + if not imgui.collapsing_header("Discussions", imgui.TreeNodeFlags_.default_open): + return names = self._get_discussion_names(); grouped = {} for name in names: base = name.split("_take_")[0]; grouped.setdefault(base, []).append(name) @@ -3528,6 +3490,7 @@ class App: self.ai_status = f"track discussion: {self.active_track.id}" else: self._flush_disc_entries_to_project(); self._switch_discussion(self.active_discussion); self.ai_status = "track discussion disabled" self._render_discussion_metadata() + return def _render_discussion_tab(self) -> None: imgui.begin_child("HistoryChild", size=(0, -self.ui_discussion_split_h)) @@ -5040,9 +5003,10 @@ def hello(): if len(content) != self._tier_stream_last_len.get(stream_key, -1): imgui.set_scroll_here_y(1.0) self._tier_stream_last_len[stream_key] = len(content) + imgui.end_child() except (TypeError, AttributeError): + imgui.end_child() pass - imgui.end_child() else: tier3_keys = [k for k in self.mma_streams if "Tier 3" in k] if not tier3_keys: @@ -5066,9 +5030,10 @@ def hello(): if len(self.mma_streams[key]) != self._tier_stream_last_len.get(key, -1): imgui.set_scroll_here_y(1.0) self._tier_stream_last_len[key] = len(self.mma_streams[key]) + imgui.end_child() except (TypeError, AttributeError): + imgui.end_child() pass - imgui.end_child() if self.perf_profiling_enabled: self.perf_monitor.end_component("_render_tier_stream_panel") def _render_track_proposal_modal(self) -> None: