Antigravity is dog shit.
This commit is contained in:
+49
-3
@@ -190,6 +190,7 @@ class App:
|
||||
self.show_windows.setdefault('Undo/Redo History', False)
|
||||
# --- Preset & Profile Management State ---
|
||||
self.context_preview_text = ""
|
||||
self.ui_separate_context_preview = False
|
||||
self.ui_active_context_preset = ""
|
||||
self.ui_new_context_preset_name = ""
|
||||
self._pending_save_ctx_click = False
|
||||
@@ -302,6 +303,7 @@ class App:
|
||||
def _set_context_files(self, paths: list[str]) -> None:
|
||||
from src import models
|
||||
self.context_files = [models.FileItem(path=p) for p in paths]
|
||||
self.controller.context_files = self.context_files
|
||||
|
||||
def _simulate_save_preset(self, name: str) -> None:
|
||||
from src import models
|
||||
@@ -551,6 +553,7 @@ class App:
|
||||
def _capture_workspace_profile(self, name: str) -> models.WorkspaceProfile:
|
||||
ini = imgui.save_ini_settings_to_memory()
|
||||
panel_states = {
|
||||
"ui_separate_context_preview": getattr(self, "ui_separate_context_preview", False),
|
||||
"ui_separate_message_panel": getattr(self, "ui_separate_message_panel", False),
|
||||
"ui_separate_response_panel": getattr(self, "ui_separate_response_panel", False),
|
||||
"ui_separate_tool_calls_panel": getattr(self, "ui_separate_tool_calls_panel", False),
|
||||
@@ -3026,9 +3029,13 @@ def render_ast_inspector_modal(app: App) -> None:
|
||||
if imgui.is_item_hovered():
|
||||
app._hovered_ast_node = full_path
|
||||
|
||||
btn_width = 150 # Estimated width of the 3 radio buttons
|
||||
btn_width = 150
|
||||
avail_width = imgui.get_content_region_avail().x
|
||||
if avail_width > btn_width:
|
||||
try:
|
||||
do_align = avail_width > btn_width
|
||||
except TypeError:
|
||||
do_align = False
|
||||
if do_align:
|
||||
imgui.same_line(imgui.get_window_width() - btn_width)
|
||||
else:
|
||||
imgui.same_line()
|
||||
@@ -3391,11 +3398,24 @@ def render_snapshot_tab(app: App) -> None:
|
||||
#region: Discussions
|
||||
|
||||
def render_discussion_hub(app: App) -> None:
|
||||
_check_auto_refresh_context_preview(app)
|
||||
ch, popped = imgui.checkbox("Pop Out Context Preview", getattr(app, "ui_separate_context_preview", False))
|
||||
if ch:
|
||||
app.ui_separate_context_preview = popped
|
||||
app.show_windows["Context Preview"] = popped
|
||||
with imscope.tab_bar("discussion_hub_tabs"):
|
||||
with imscope.tab_item("Discussion") as (exp, opened):
|
||||
if exp: render_discussion_tab(app)
|
||||
with imscope.tab_item("Context Composition") as (exp, opened):
|
||||
if exp: render_context_composition_panel(app)
|
||||
if not getattr(app, "ui_separate_context_preview", False):
|
||||
with imscope.tab_item("Context Preview") as (exp, opened):
|
||||
if exp:
|
||||
if imgui.button("Copy to Clipboard"):
|
||||
imgui.set_clipboard_text(app.context_preview_text)
|
||||
imgui.begin_child("ctx_preview_scroll_tab", imgui.ImVec2(0, 0), True)
|
||||
markdown_helper.render(app.context_preview_text, context_id="ctx_preview_tab")
|
||||
imgui.end_child()
|
||||
with imscope.tab_item("Snapshot") as (exp, opened):
|
||||
if exp: render_snapshot_tab(app)
|
||||
with imscope.tab_item("Takes") as (exp, opened):
|
||||
@@ -5446,16 +5466,42 @@ def render_context_modals(app: App) -> None:
|
||||
|
||||
render_ast_inspector_modal(app)
|
||||
|
||||
def _get_context_composition_state(app: App) -> tuple:
|
||||
files_state = []
|
||||
for f in app.context_files:
|
||||
p = f.path if hasattr(f, 'path') else str(f)
|
||||
vm = f.view_mode if hasattr(f, 'view_mode') else 'summary'
|
||||
sel = f.selected if hasattr(f, 'selected') else False
|
||||
slc = tuple((s.get('start_line'), s.get('end_line'), s.get('tag'), s.get('comment')) for s in getattr(f, 'custom_slices', []))
|
||||
mask = tuple(sorted(getattr(f, 'ast_mask', {}).items()))
|
||||
files_state.append((p, vm, sel, slc, mask))
|
||||
screenshots_state = tuple(app.screenshots)
|
||||
return (tuple(files_state), screenshots_state)
|
||||
|
||||
def _check_auto_refresh_context_preview(app: App) -> None:
|
||||
current_state = _get_context_composition_state(app)
|
||||
if not hasattr(app, "_last_context_preview_state") or app._last_context_preview_state != current_state:
|
||||
app._last_context_preview_state = current_state
|
||||
try:
|
||||
app.controller.context_files = app.context_files
|
||||
res = app.controller._do_generate()
|
||||
app.context_preview_text = res[0]
|
||||
except Exception:
|
||||
app.context_preview_text = "Error generating context preview."
|
||||
|
||||
def render_context_preview_window(app: App) -> None:
|
||||
_check_auto_refresh_context_preview(app)
|
||||
with imscope.window("Context Preview", app.show_windows["Context Preview"]) as (exp, opened):
|
||||
app.show_windows["Context Preview"] = bool(opened)
|
||||
if not opened:
|
||||
app.ui_separate_context_preview = False
|
||||
if exp:
|
||||
if imgui.button("Close"):
|
||||
app.show_windows["Context Preview"] = False
|
||||
app.ui_separate_context_preview = False
|
||||
imgui.same_line()
|
||||
if imgui.button("Copy to Clipboard"):
|
||||
imgui.set_clipboard_text(app.context_preview_text)
|
||||
|
||||
imgui.begin_child("ctx_preview_scroll", imgui.ImVec2(0, 0), True)
|
||||
markdown_helper.render(app.context_preview_text, context_id="ctx_preview")
|
||||
imgui.end_child()
|
||||
|
||||
Reference in New Issue
Block a user