fixing bugs in gui_2.py
This commit is contained in:
+23
-12
@@ -8,6 +8,7 @@ import sys
|
|||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import copy
|
import copy
|
||||||
|
import threading
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from tkinter import filedialog, Tk
|
from tkinter import filedialog, Tk
|
||||||
from typing import Optional, Any
|
from typing import Optional, Any
|
||||||
@@ -1769,13 +1770,14 @@ class App:
|
|||||||
if self._show_ast_inspector:
|
if self._show_ast_inspector:
|
||||||
imgui.open_popup('AST Inspector')
|
imgui.open_popup('AST Inspector')
|
||||||
self._show_ast_inspector = False
|
self._show_ast_inspector = False
|
||||||
|
|
||||||
|
#region: AST Inspector
|
||||||
expanded, opened = imgui.begin_popup_modal('AST Inspector', True, imgui.WindowFlags_.always_auto_resize)
|
expanded, opened = imgui.begin_popup_modal('AST Inspector', True, imgui.WindowFlags_.always_auto_resize)
|
||||||
if not opened:
|
if opened:
|
||||||
return
|
if expanded:
|
||||||
if self.ui_inspecting_ast_file is None:
|
if self.ui_inspecting_ast_file is None:
|
||||||
imgui.close_current_popup()
|
imgui.close_current_popup()
|
||||||
imgui.end_popup()
|
else:
|
||||||
return
|
|
||||||
f_item = self.ui_inspecting_ast_file
|
f_item = self.ui_inspecting_ast_file
|
||||||
f_path = f_item.path if hasattr(f_item, "path") else str(f_item)
|
f_path = f_item.path if hasattr(f_item, "path") else str(f_item)
|
||||||
|
|
||||||
@@ -1822,11 +1824,12 @@ class App:
|
|||||||
imgui.text(f"Inspecting AST: {f_path}")
|
imgui.text(f"Inspecting AST: {f_path}")
|
||||||
imgui.separator()
|
imgui.separator()
|
||||||
|
|
||||||
|
#region: ast_dual_pane
|
||||||
if imgui.begin_table('ast_dual_pane', 2, imgui.TableFlags_.resizable | imgui.TableFlags_.borders_inner_v):
|
if imgui.begin_table('ast_dual_pane', 2, imgui.TableFlags_.resizable | imgui.TableFlags_.borders_inner_v):
|
||||||
imgui.table_next_column()
|
imgui.table_next_column()
|
||||||
|
|
||||||
# --- LEFT COLUMN (Tree) ---
|
#region: LEFT COLUMN (Tree) ---
|
||||||
imgui.begin_child("ast_tree_scroll", imgui.ImVec2(0, 600), True)
|
if imgui.begin_child("ast_tree_scroll", imgui.ImVec2(0, 600), True):
|
||||||
if not self._cached_ast_nodes:
|
if not self._cached_ast_nodes:
|
||||||
imgui.text("No AST nodes found or error fetching outline.")
|
imgui.text("No AST nodes found or error fetching outline.")
|
||||||
else:
|
else:
|
||||||
@@ -1854,11 +1857,12 @@ class App:
|
|||||||
f_item.ast_mask[full_path] = 'hide'
|
f_item.ast_mask[full_path] = 'hide'
|
||||||
imgui.pop_id()
|
imgui.pop_id()
|
||||||
imgui.end_child()
|
imgui.end_child()
|
||||||
|
#endregion: LEFT COLUMN (Tree)
|
||||||
|
|
||||||
imgui.table_next_column()
|
imgui.table_next_column()
|
||||||
|
|
||||||
# --- RIGHT COLUMN (Content) ---
|
#region: RIGHT COLUMN (Content) ---
|
||||||
imgui.begin_child("ast_content_scroll", imgui.ImVec2(0, 600), True)
|
if imgui.begin_child("ast_content_scroll", imgui.ImVec2(0, 600), True):
|
||||||
if not hasattr(self, '_cached_ast_file_lines') or not self._cached_ast_file_lines:
|
if not hasattr(self, '_cached_ast_file_lines') or not self._cached_ast_file_lines:
|
||||||
imgui.text("No file content loaded.")
|
imgui.text("No file content loaded.")
|
||||||
else:
|
else:
|
||||||
@@ -1889,13 +1893,21 @@ class App:
|
|||||||
|
|
||||||
imgui.text(f"{line_num:4} | {line_text}")
|
imgui.text(f"{line_num:4} | {line_text}")
|
||||||
imgui.end_child()
|
imgui.end_child()
|
||||||
|
#endregion: RIGHT COLUMN (Content) ---
|
||||||
imgui.end_table()
|
imgui.end_table()
|
||||||
|
#endregion: ast_dual_pane
|
||||||
|
|
||||||
imgui.separator()
|
imgui.separator()
|
||||||
|
|
||||||
if imgui.button("Close", imgui.ImVec2(120, 0)):
|
if imgui.button("Close", imgui.ImVec2(120, 0)):
|
||||||
self.ui_inspecting_ast_file = None
|
self.ui_inspecting_ast_file = None
|
||||||
imgui.close_current_popup()
|
imgui.close_current_popup()
|
||||||
|
|
||||||
imgui.end_popup()
|
imgui.end_popup()
|
||||||
|
#endregion: AST Inspector
|
||||||
|
|
||||||
|
if not opened:
|
||||||
|
self.ui_inspecting_ast_file = None
|
||||||
|
|
||||||
def _render_save_workspace_profile_modal(self) -> None:
|
def _render_save_workspace_profile_modal(self) -> None:
|
||||||
if self._show_save_workspace_profile_modal:
|
if self._show_save_workspace_profile_modal:
|
||||||
@@ -1929,8 +1941,7 @@ class App:
|
|||||||
def _render_add_context_files_modal(self) -> None:
|
def _render_add_context_files_modal(self) -> None:
|
||||||
if imgui.begin_popup_modal("Select Context Files", None, imgui.WindowFlags_.always_auto_resize)[0]:
|
if imgui.begin_popup_modal("Select Context Files", None, imgui.WindowFlags_.always_auto_resize)[0]:
|
||||||
imgui.text("Select files from project to add to context:")
|
imgui.text("Select files from project to add to context:")
|
||||||
imgui.begin_child("ctx_picker_list", imgui.ImVec2(600, 300), True)
|
if imgui.begin_child("ctx_picker_list", imgui.ImVec2(600, 300), True):
|
||||||
|
|
||||||
from src import models
|
from src import models
|
||||||
# Create a temporary selection set if not initialized
|
# Create a temporary selection set if not initialized
|
||||||
if not hasattr(self, '_ui_picker_selected'):
|
if not hasattr(self, '_ui_picker_selected'):
|
||||||
@@ -3021,11 +3032,10 @@ class App:
|
|||||||
finally:
|
finally:
|
||||||
self._file_stats_worker_active = False
|
self._file_stats_worker_active = False
|
||||||
|
|
||||||
import threading
|
|
||||||
threading.Thread(target=_stats_worker, daemon=True).start()
|
threading.Thread(target=_stats_worker, daemon=True).start()
|
||||||
|
|
||||||
#region: Batch Action Bar imgui.text("Batch:")
|
#region: Batch Action Bar imgui.text("Batch:")
|
||||||
imgui.same_line()
|
# imgui.same_line()
|
||||||
for mode in ["full", "summary", "skeleton", "outline", "masked", "none"]:
|
for mode in ["full", "summary", "skeleton", "outline", "masked", "none"]:
|
||||||
if imgui.button(f"{mode.capitalize()}##batch"):
|
if imgui.button(f"{mode.capitalize()}##batch"):
|
||||||
for f in self.context_files:
|
for f in self.context_files:
|
||||||
@@ -3180,6 +3190,7 @@ class App:
|
|||||||
imgui.same_line()
|
imgui.same_line()
|
||||||
imgui.text_colored(imgui.ImVec4(1.0, 0.5, 0.0, 1.0), "[Slices Active]")
|
imgui.text_colored(imgui.ImVec4(1.0, 0.5, 0.0, 1.0), "[Slices Active]")
|
||||||
imgui.tree_pop()
|
imgui.tree_pop()
|
||||||
|
|
||||||
imgui.end_table()
|
imgui.end_table()
|
||||||
# Context Composition collasping header
|
# Context Composition collasping header
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user