more organization
This commit is contained in:
+16
-24
@@ -1,13 +1,19 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING, Callable
|
||||
import webbrowser
|
||||
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING, Callable
|
||||
|
||||
from src import models
|
||||
from src import theme_2
|
||||
|
||||
from src.command_palette import CommandRegistry
|
||||
from src.hot_reloader import HotReloader
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from src.gui_2 import App
|
||||
|
||||
|
||||
registry = CommandRegistry()
|
||||
|
||||
|
||||
@@ -38,14 +44,10 @@ def reset_session(app: "App") -> None:
|
||||
"""Reset Session — Reset the AI session, clear comms and tool logs."""
|
||||
from src import ai_client
|
||||
ai_client.reset_session()
|
||||
if hasattr(app, "_handle_reset_session"):
|
||||
app._handle_reset_session()
|
||||
if hasattr(app, "_comms_log"):
|
||||
app._comms_log.clear()
|
||||
if hasattr(app, "_tool_log"):
|
||||
app._tool_log.clear()
|
||||
if hasattr(app, "ai_response"):
|
||||
app.ai_response = ""
|
||||
if hasattr(app, "_handle_reset_session"): app._handle_reset_session()
|
||||
if hasattr(app, "_comms_log"): app._comms_log.clear()
|
||||
if hasattr(app, "_tool_log"): app._tool_log.clear()
|
||||
if hasattr(app, "ai_response"): app.ai_response = ""
|
||||
|
||||
|
||||
@registry.register
|
||||
@@ -67,8 +69,8 @@ def generate_md_only(app: "App") -> None:
|
||||
"""Generate MD Only — Run the AI to produce a markdown file without sending to the chat."""
|
||||
if hasattr(app, "_do_generate"):
|
||||
try:
|
||||
md, path, *_ = app._do_generate()
|
||||
app.last_md = md
|
||||
md, path, *_ = app._do_generate()
|
||||
app.last_md = md
|
||||
app.last_md_path = path
|
||||
if hasattr(app, "ai_status"):
|
||||
app.ai_status = f"md written: {path.name}"
|
||||
@@ -98,11 +100,8 @@ def save_project(app: "App") -> None:
|
||||
@registry.register
|
||||
def save_all(app: "App") -> None:
|
||||
"""Save All — Flush to project, flush to config, save global config."""
|
||||
from src import models
|
||||
if hasattr(app, "_flush_to_project"):
|
||||
app._flush_to_project()
|
||||
if hasattr(app, "_flush_to_config"):
|
||||
app._flush_to_config()
|
||||
if hasattr(app, "_flush_to_project"): app._flush_to_project()
|
||||
if hasattr(app, "_flush_to_config"): app._flush_to_config()
|
||||
if hasattr(app, "config"):
|
||||
try:
|
||||
models.save_config(app.config)
|
||||
@@ -229,7 +228,6 @@ def show_workspace_manager(app: "App") -> None:
|
||||
@registry.register
|
||||
def trigger_hot_reload(app: "App") -> None:
|
||||
"""Hot Reload — Reload the GUI module to pick up code changes."""
|
||||
from src.hot_reloader import HotReloader
|
||||
HotReloader.reload("src.gui_2", app)
|
||||
|
||||
|
||||
@@ -254,28 +252,24 @@ def redo(app: "App") -> None:
|
||||
@registry.register
|
||||
def switch_to_dark_theme(app: "App") -> None:
|
||||
"""Switch to Dark Theme (10x Dark palette)."""
|
||||
from src import theme_2
|
||||
theme_2.apply("10x Dark")
|
||||
|
||||
|
||||
@registry.register
|
||||
def switch_to_light_theme(app: "App") -> None:
|
||||
"""Switch to Light Theme (ImGui Light palette)."""
|
||||
from src import theme_2
|
||||
theme_2.apply("ImGui Light")
|
||||
|
||||
|
||||
@registry.register
|
||||
def switch_to_nerv_theme(app: "App") -> None:
|
||||
"""Switch to NERV Theme (Tactical Console aesthetic)."""
|
||||
from src import theme_2
|
||||
theme_2.apply("NERV")
|
||||
|
||||
|
||||
@registry.register
|
||||
def cycle_theme(app: "App") -> None:
|
||||
"""Cycle Theme — Switch to the next theme in the cycle (Dark → Light → NERV → Dark)."""
|
||||
from src import theme_2
|
||||
order = ["10x Dark", "ImGui Light", "NERV"]
|
||||
current = theme_2.get_current_palette()
|
||||
if current in order:
|
||||
@@ -292,14 +286,12 @@ def cycle_theme(app: "App") -> None:
|
||||
@registry.register
|
||||
def show_documentation(app: "App") -> None:
|
||||
"""Show Documentation — Open the project URL in the browser."""
|
||||
import webbrowser
|
||||
webbrowser.open("https://git.cozyair.dev/ed/manual_slop/")
|
||||
|
||||
|
||||
@registry.register
|
||||
def show_command_palette_help(app: "App") -> None:
|
||||
"""Show Command Palette Help — Open the docs/Readme.md in the Text Viewer."""
|
||||
from pathlib import Path
|
||||
if hasattr(app, "readme_text"):
|
||||
docs_readme = Path("docs/Readme.md")
|
||||
if docs_readme.exists():
|
||||
|
||||
Reference in New Issue
Block a user