more fixes
This commit is contained in:
@@ -1812,7 +1812,6 @@ class AppController:
|
|||||||
|
|
||||||
def _cb_project_save(self) -> None:
|
def _cb_project_save(self) -> None:
|
||||||
self._flush_to_project()
|
self._flush_to_project()
|
||||||
self._save_active_project()
|
|
||||||
self._flush_to_config()
|
self._flush_to_config()
|
||||||
models.save_config(self.config)
|
models.save_config(self.config)
|
||||||
self._set_status("config saved")
|
self._set_status("config saved")
|
||||||
@@ -1828,7 +1827,6 @@ class AppController:
|
|||||||
self._set_status(f"project file not found: {path}")
|
self._set_status(f"project file not found: {path}")
|
||||||
return
|
return
|
||||||
self._flush_to_project()
|
self._flush_to_project()
|
||||||
self._save_active_project()
|
|
||||||
try:
|
try:
|
||||||
self.project = project_manager.load_project(path)
|
self.project = project_manager.load_project(path)
|
||||||
self.active_project_path = path
|
self.active_project_path = path
|
||||||
@@ -2006,7 +2004,8 @@ class AppController:
|
|||||||
def _save_active_project(self) -> None:
|
def _save_active_project(self) -> None:
|
||||||
if self.active_project_path:
|
if self.active_project_path:
|
||||||
try:
|
try:
|
||||||
project_manager.save_project(self.project, self.active_project_path)
|
cleaned = project_manager.clean_nones(self.project)
|
||||||
|
project_manager.save_project(cleaned, self.active_project_path)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self._set_status(f"save error: {e}")
|
self._set_status(f"save error: {e}")
|
||||||
|
|
||||||
@@ -2324,6 +2323,9 @@ class AppController:
|
|||||||
else:
|
else:
|
||||||
mma_sec["active_track"] = None
|
mma_sec["active_track"] = None
|
||||||
|
|
||||||
|
cleaned_proj = project_manager.clean_nones(proj)
|
||||||
|
project_manager.save_project(cleaned_proj, self.active_project_path)
|
||||||
|
|
||||||
def _flush_to_config(self) -> None:
|
def _flush_to_config(self) -> None:
|
||||||
self.config["ai"] = {
|
self.config["ai"] = {
|
||||||
"provider": self.current_provider,
|
"provider": self.current_provider,
|
||||||
@@ -2360,7 +2362,6 @@ class AppController:
|
|||||||
def _do_generate(self) -> tuple[str, Path, list[dict[str, Any]], str, str]:
|
def _do_generate(self) -> tuple[str, Path, list[dict[str, Any]], str, str]:
|
||||||
"""Returns (full_md, output_path, file_items, stable_md, discussion_text)."""
|
"""Returns (full_md, output_path, file_items, stable_md, discussion_text)."""
|
||||||
self._flush_to_project()
|
self._flush_to_project()
|
||||||
self._save_active_project()
|
|
||||||
self._flush_to_config()
|
self._flush_to_config()
|
||||||
models.save_config(self.config)
|
models.save_config(self.config)
|
||||||
track_id = self.active_track.id if self.active_track else None
|
track_id = self.active_track.id if self.active_track else None
|
||||||
|
|||||||
@@ -344,7 +344,6 @@ class App:
|
|||||||
if imgui.begin_menu("Project"):
|
if imgui.begin_menu("Project"):
|
||||||
if imgui.menu_item("Save All", "", False)[0]:
|
if imgui.menu_item("Save All", "", False)[0]:
|
||||||
self._flush_to_project()
|
self._flush_to_project()
|
||||||
self._save_active_project()
|
|
||||||
self._flush_to_config()
|
self._flush_to_config()
|
||||||
models.save_config(self.config)
|
models.save_config(self.config)
|
||||||
self.ai_status = "config saved"
|
self.ai_status = "config saved"
|
||||||
@@ -409,7 +408,6 @@ class App:
|
|||||||
self._last_autosave = now
|
self._last_autosave = now
|
||||||
try:
|
try:
|
||||||
self._flush_to_project()
|
self._flush_to_project()
|
||||||
self._save_active_project()
|
|
||||||
self._flush_to_config()
|
self._flush_to_config()
|
||||||
models.save_config(self.config)
|
models.save_config(self.config)
|
||||||
except Exception:
|
except Exception:
|
||||||
@@ -1470,7 +1468,6 @@ class App:
|
|||||||
imgui.same_line()
|
imgui.same_line()
|
||||||
if imgui.button("Save All"):
|
if imgui.button("Save All"):
|
||||||
self._flush_to_project()
|
self._flush_to_project()
|
||||||
self._save_active_project()
|
|
||||||
self._flush_to_config()
|
self._flush_to_config()
|
||||||
models.save_config(self.config)
|
models.save_config(self.config)
|
||||||
self.ai_status = "config saved"
|
self.ai_status = "config saved"
|
||||||
@@ -2085,7 +2082,6 @@ def hello():
|
|||||||
imgui.same_line()
|
imgui.same_line()
|
||||||
if imgui.button("Save"):
|
if imgui.button("Save"):
|
||||||
self._flush_to_project()
|
self._flush_to_project()
|
||||||
self._save_active_project()
|
|
||||||
self._flush_to_config()
|
self._flush_to_config()
|
||||||
models.save_config(self.config)
|
models.save_config(self.config)
|
||||||
self.ai_status = "discussion saved"
|
self.ai_status = "discussion saved"
|
||||||
|
|||||||
@@ -196,6 +196,7 @@ def save_project(proj: dict[str, Any], path: Union[str, Path], disc_data: Option
|
|||||||
disc_data = proj["discussion"]
|
disc_data = proj["discussion"]
|
||||||
proj = dict(proj)
|
proj = dict(proj)
|
||||||
del proj["discussion"]
|
del proj["discussion"]
|
||||||
|
proj = clean_nones(proj)
|
||||||
with open(path, "wb") as f:
|
with open(path, "wb") as f:
|
||||||
tomli_w.dump(proj, f)
|
tomli_w.dump(proj, f)
|
||||||
if disc_data:
|
if disc_data:
|
||||||
|
|||||||
Reference in New Issue
Block a user