This commit is contained in:
2026-03-09 00:27:43 -04:00
parent 5446a2407c
commit 80eaf740da
8 changed files with 131 additions and 98 deletions

View File

@@ -32,7 +32,7 @@ from src import aggregate
from src import orchestrator_pm
from src import conductor_tech_lead
from src import multi_agent_conductor
from src import theme
from src import theme_2 as theme
def hide_tk_root() -> Tk:
root = Tk()
@@ -744,6 +744,7 @@ class AppController:
def init_state(self):
"""Initializes the application state from configurations."""
self.config = models.load_config()
theme.load_from_config(self.config)
ai_cfg = self.config.get("ai", {})
self._current_provider = ai_cfg.get("provider", "gemini")
self._current_model = ai_cfg.get("model", "gemini-2.5-flash-lite")
@@ -2085,14 +2086,18 @@ class AppController:
self.config["ai"]["system_prompt"] = self.ui_global_system_prompt
self.config["projects"] = {"paths": self.project_paths, "active": self.active_project_path}
from src import bg_shader
self.config["gui"] = {
# Update gui section while preserving other keys like bg_shader_enabled
gui_cfg = self.config.get("gui", {})
gui_cfg.update({
"show_windows": self.show_windows,
"separate_message_panel": getattr(self, "ui_separate_message_panel", False),
"separate_response_panel": getattr(self, "ui_separate_response_panel", False),
"separate_tool_calls_panel": getattr(self, "ui_separate_tool_calls_panel", False),
"bg_shader_enabled": bg_shader.get_bg().enabled
}
# Explicitly call theme save to ensure self.config is updated
})
self.config["gui"] = gui_cfg
# Explicitly save theme state into the config dict
theme.save_to_config(self.config)
def _do_generate(self) -> tuple[str, Path, list[dict[str, Any]], str, str]:

View File

@@ -52,6 +52,9 @@ def load_config() -> dict[str, Any]:
def save_config(config: dict[str, Any]) -> None:
import tomli_w
import sys
sys.stderr.write(f"[DEBUG] Saving config. Theme: {config.get('theme')}\n")
sys.stderr.flush()
with open(CONFIG_PATH, "wb") as f:
tomli_w.dump(config, f)

View File

@@ -334,6 +334,7 @@ def set_scale(factor: float) -> None:
def save_to_config(config: dict) -> None:
"""Persist theme settings into the config dict under [theme]."""
import sys
config.setdefault("theme", {})
config["theme"]["palette"] = _current_palette
config["theme"]["font_path"] = _current_font_path
@@ -341,11 +342,16 @@ def save_to_config(config: dict) -> None:
config["theme"]["scale"] = _current_scale
config["theme"]["transparency"] = _transparency
config["theme"]["child_transparency"] = _child_transparency
sys.stderr.write(f"[DEBUG theme_2] save_to_config: palette={_current_palette}, transparency={_transparency}\n")
sys.stderr.flush()
def load_from_config(config: dict) -> None:
"""Read [theme] from config. Font is handled separately at startup."""
import sys
global _current_font_path, _current_font_size, _current_scale, _current_palette, _transparency, _child_transparency
t = config.get("theme", {})
sys.stderr.write(f"[DEBUG theme_2] load_from_config raw: {t}\n")
sys.stderr.flush()
_current_palette = t.get("palette", "10x Dark")
if _current_palette in ("", "DPG Default"):
_current_palette = "10x Dark"
@@ -355,6 +361,8 @@ def load_from_config(config: dict) -> None:
_current_scale = float(t.get("scale", 1.0))
_transparency = float(t.get("transparency", 1.0))
_child_transparency = float(t.get("child_transparency", 1.0))
sys.stderr.write(f"[DEBUG theme_2] load_from_config effective: palette={_current_palette}, transparency={_transparency}\n")
sys.stderr.flush()
def apply_current() -> None:
"""Apply the loaded palette and scale. Call after imgui context exists."""