feat(gui): Add Path Configuration panel to Context Hub

This commit is contained in:
2026-03-12 16:44:22 -04:00
parent 7924d65438
commit d237d3b94d
4 changed files with 156 additions and 7 deletions

View File

@@ -6,6 +6,7 @@ import math
import json
import sys
import os
import shutil
import copy
from pathlib import Path
from tkinter import filedialog, Tk
@@ -451,7 +452,14 @@ class App:
exp, opened = imgui.begin("Context Hub", self.show_windows["Context Hub"])
self.show_windows["Context Hub"] = bool(opened)
if exp:
self._render_projects_panel()
if imgui.begin_tab_bar('context_hub_tabs'):
if imgui.begin_tab_item('Projects')[0]:
self._render_projects_panel()
imgui.end_tab_item()
if imgui.begin_tab_item('Paths')[0]:
self._render_paths_panel()
imgui.end_tab_item()
imgui.end_tab_bar()
imgui.end()
if self.show_windows.get("Files & Media", False):
exp, opened = imgui.begin("Files & Media", self.show_windows["Files & Media"])
@@ -1462,6 +1470,62 @@ class App:
ch, self.ui_auto_scroll_comms = imgui.checkbox("Auto-scroll Comms History", self.ui_auto_scroll_comms)
ch, self.ui_auto_scroll_tool_calls = imgui.checkbox("Auto-scroll Tool History", self.ui_auto_scroll_tool_calls)
if self.perf_profiling_enabled: self.perf_monitor.end_component("_render_projects_panel")
def _save_paths(self):
self.config["paths"] = {
"conductor_dir": self.ui_conductor_dir,
"logs_dir": self.ui_logs_dir,
"scripts_dir": self.ui_scripts_dir
}
cfg_path = paths.get_config_path()
if cfg_path.exists():
shutil.copy(cfg_path, str(cfg_path) + ".bak")
models.save_config(self.config)
paths.reset_resolved()
self.ai_status = "paths saved - restart required"
def _render_paths_panel(self) -> None:
if self.perf_profiling_enabled: self.perf_monitor.start_component("_render_paths_panel")
path_info = paths.get_full_path_info()
imgui.text_colored(C_IN, "System Path Configuration")
imgui.separator()
if self.ai_status == "paths saved - restart required":
imgui.text_colored(vec4(255, 50, 50), "Restart required for path changes to take effect.")
imgui.separator()
def render_path_field(label: str, attr: str, key: str, tooltip: str):
info = path_info.get(key, {'source': 'unknown'})
imgui.text(label)
if imgui.is_item_hovered(): imgui.set_tooltip(tooltip)
imgui.same_line()
imgui.text_disabled(f"(Source: {info['source']})")
val = getattr(self, attr)
changed, new_val = imgui.input_text(f"##{key}", val)
if imgui.is_item_hovered(): imgui.set_tooltip(tooltip)
if changed: setattr(self, attr, new_val)
imgui.same_line()
if imgui.button(f"Browse##{key}"):
r = hide_tk_root()
d = filedialog.askdirectory(title=f"Select {label}")
r.destroy()
if d: setattr(self, attr, d)
render_path_field("Conductor Directory", "ui_conductor_dir", "conductor_dir", "Base directory for implementation tracks and project state.")
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 _render_track_proposal_modal(self) -> None:
if self._show_track_proposal_modal:
imgui.open_popup("Track Proposal")