feat(workspace): implement layout capture/restore and controller integration
This commit is contained in:
+19
-1
@@ -6,6 +6,7 @@ import os
|
||||
import re
|
||||
from typing import Any, List, Dict, Optional, Callable
|
||||
from pathlib import Path
|
||||
from src import workspace_manager
|
||||
import json
|
||||
import uuid
|
||||
import tomli_w
|
||||
@@ -635,7 +636,9 @@ class AppController:
|
||||
'_cb_save_tool_preset': self._cb_save_tool_preset,
|
||||
'_cb_delete_tool_preset': self._cb_delete_tool_preset,
|
||||
'_switch_project': self._switch_project,
|
||||
'_refresh_from_project': self._refresh_from_project
|
||||
'_refresh_from_project': self._refresh_from_project,
|
||||
'save_workspace_profile': self._cb_save_workspace_profile,
|
||||
'load_workspace_profile': self._cb_load_workspace_profile,
|
||||
}
|
||||
|
||||
def _update_gcli_adapter(self, path: str) -> None:
|
||||
@@ -1038,6 +1041,8 @@ class AppController:
|
||||
self.project_paths = list(projects_cfg.get("paths", []))
|
||||
self.active_project_path = projects_cfg.get("active", "")
|
||||
self._load_active_project()
|
||||
self.workspace_manager = workspace_manager.WorkspaceManager(project_root=Path(self.active_project_path).parent if self.active_project_path else None)
|
||||
self.workspace_profiles = self.workspace_manager.load_all_profiles()
|
||||
# Deserialize FileItems in files.paths
|
||||
raw_paths = self.project.get("files", {}).get("paths", [])
|
||||
self.files = []
|
||||
@@ -2250,6 +2255,19 @@ class AppController:
|
||||
if self.rag_config and self.rag_config.enabled:
|
||||
self._rebuild_rag_index()
|
||||
|
||||
def _cb_save_workspace_profile(self, name: str, scope: str = 'project') -> None:
|
||||
if not hasattr(self, '_app') or not self._app:
|
||||
return
|
||||
profile = self._app._capture_workspace_profile(name)
|
||||
self.workspace_manager.save_profile(profile, scope=scope)
|
||||
self.workspace_profiles = self.workspace_manager.load_all_profiles()
|
||||
|
||||
def _cb_load_workspace_profile(self, name: str) -> None:
|
||||
if name in self.workspace_profiles:
|
||||
profile = self.workspace_profiles[name]
|
||||
if hasattr(self, '_app') and self._app:
|
||||
self._app._apply_workspace_profile(profile)
|
||||
|
||||
def _apply_preset(self, name: str, scope: str) -> None:
|
||||
print(f"[DEBUG] _apply_preset: name={name}, scope={scope}")
|
||||
if name == "None":
|
||||
|
||||
Reference in New Issue
Block a user