Fix render_paths_panel scoping bug and nest render_path_field

This commit is contained in:
ed
2026-06-12 21:51:42 -04:00
parent b521b4523c
commit 6f33d57750
2 changed files with 41 additions and 34 deletions
+1 -1
View File
@@ -9,5 +9,5 @@ active = "main"
[discussions.main] [discussions.main]
git_commit = "" git_commit = ""
last_updated = "2026-06-12T06:55:16" last_updated = "2026-06-12T21:51:33"
history = [] history = []
+22 -15
View File
@@ -23,7 +23,6 @@ if _thirdparty not in sys.path:
sys.path.insert(0, _thirdparty) sys.path.insert(0, _thirdparty)
from contextlib import ExitStack, nullcontext from contextlib import ExitStack, nullcontext
# from defer import defer
from pathlib import Path from pathlib import Path
from typing import Optional, Any from typing import Optional, Any
from imgui_bundle import imgui, hello_imgui, immapp, imgui_node_editor as ed, imgui_color_text_edit as ced from imgui_bundle import imgui, hello_imgui, immapp, imgui_node_editor as ed, imgui_color_text_edit as ced
@@ -83,7 +82,6 @@ class _FiledialogStub:
`if p and p not in app.x: app.x.append(p)` treat a missing dialog as a `if p and p not in app.x: app.x.append(p)` treat a missing dialog as a
no-op. Exposes a `available` flag so the UI can detect the stub and no-op. Exposes a `available` flag so the UI can detect the stub and
offer an ImGui-based path input as an alternative. offer an ImGui-based path input as an alternative.
[C: src/gui_2.py:_LazyModule._resolve]
""" """
available: bool = False available: bool = False
def askopenfilename(self, *args: _Any, **kwargs: _Any) -> str: return "" def askopenfilename(self, *args: _Any, **kwargs: _Any) -> str: return ""
@@ -272,7 +270,6 @@ def _render_v2_capability_badges(caps: "VendorCapabilities") -> None:
the original 7 v1 fields (vision, tool_calling, caching, the original 7 v1 fields (vision, tool_calling, caching,
streaming, model_discovery, context_window, cost_tracking) streaming, model_discovery, context_window, cost_tracking)
which are already gated elsewhere in the GUI. which are already gated elsewhere in the GUI.
[C: src/gui_2.py:render_provider_panel]
""" """
badged_fields: list[tuple[str, str]] = [ badged_fields: list[tuple[str, str]] = [
("reasoning", "Reasoning"), ("reasoning", "Reasoning"),
@@ -1395,18 +1392,6 @@ class App:
self.save_config() self.save_config()
self.ai_status = f"Default editor set to: {editor_name}" self.ai_status = f"Default editor set to: {editor_name}"
_render_path_field("Logs Directory", "ui_logs_dir", "logs_dir", "Directory where session JSON-L logs and artifacts are stored.")
_render_path_field("Scripts Directory", "ui_scripts_dir", "scripts_dir", "Directory for AI-generated PowerShell scripts.")
imgui.separator()
if imgui.button("Apply", imgui.ImVec2(120, 0)): self._save_paths()
imgui.same_line()
if imgui.button("Reset", imgui.ImVec2(120, 0)):
self.init_state()
self.ai_status = "paths reset to defaults"
if self.perf_profiling_enabled: self.perf_monitor.end_component("_render_paths_panel")
def _save_paths(self) -> None: def _save_paths(self) -> None:
""" """
[C: tests/test_gui_paths.py:test_save_paths] [C: tests/test_gui_paths.py:test_save_paths]
@@ -2281,6 +2266,16 @@ def render_projects_panel(app: App) -> None:
if app.perf_profiling_enabled: app.perf_monitor.end_component("_render_projects_panel") if app.perf_profiling_enabled: app.perf_monitor.end_component("_render_projects_panel")
def render_paths_panel(app: App) -> None: def render_paths_panel(app: App) -> None:
"""
Renders the System Path Configuration panel, allowing editing of logs
and scripts directories. Updates the directories on user input.
State Mutations:
app.ui_logs_dir, app.ui_scripts_dir (via input text or file dialog select)
SSDL Shape:
`[I] -> [B:inputs] => [B:apply_reset]`
"""
if app.perf_profiling_enabled: app.perf_monitor.start_component("_render_paths_panel") if app.perf_profiling_enabled: app.perf_monitor.start_component("_render_paths_panel")
path_info = paths.get_full_path_info() path_info = paths.get_full_path_info()
@@ -2305,6 +2300,18 @@ def render_path_field(label: str, attr: str, key: str, tooltip: str):
r.destroy() r.destroy()
if d: setattr(app, attr, d) if d: setattr(app, attr, d)
render_path_field("Logs Directory", "ui_logs_dir", "logs_dir", "Directory where session JSON-L logs and artifacts are stored.")
render_path_field("Scripts Directory", "ui_scripts_dir", "scripts_dir", "Directory for AI-generated PowerShell scripts.")
imgui.separator()
if imgui.button("Apply", imgui.ImVec2(120, 0)): app._save_paths()
imgui.same_line()
if imgui.button("Reset", imgui.ImVec2(120, 0)):
app.init_state()
app.ai_status = "paths reset to defaults"
if app.perf_profiling_enabled: app.perf_monitor.end_component("_render_paths_panel")
#endregion: Project Management #endregion: Project Management
#region: AI Settings #region: AI Settings