feat(ui): add batch operations to context composition panel
This commit is contained in:
+72
-1
@@ -204,6 +204,7 @@ class App:
|
|||||||
self.node_editor_ctx = ed.create_editor(self.node_editor_config)
|
self.node_editor_ctx = ed.create_editor(self.node_editor_config)
|
||||||
self.ui_selected_ticket_id: Optional[str] = None
|
self.ui_selected_ticket_id: Optional[str] = None
|
||||||
self.ui_selected_tickets: set[str] = set()
|
self.ui_selected_tickets: set[str] = set()
|
||||||
|
self.ui_selected_context_files: set[str] = set()
|
||||||
self.ui_new_ticket_priority: str = 'medium'
|
self.ui_new_ticket_priority: str = 'medium'
|
||||||
self._autofocus_response_tab = False
|
self._autofocus_response_tab = False
|
||||||
gui_cfg = self.config.get("gui", {})
|
gui_cfg = self.config.get("gui", {})
|
||||||
@@ -2527,6 +2528,64 @@ class App:
|
|||||||
def _render_context_composition_panel(self) -> None:
|
def _render_context_composition_panel(self) -> None:
|
||||||
imgui.text("Context Composition")
|
imgui.text("Context Composition")
|
||||||
imgui.separator()
|
imgui.separator()
|
||||||
|
|
||||||
|
# Batch Action Bar
|
||||||
|
imgui.text("Batch:")
|
||||||
|
imgui.same_line()
|
||||||
|
if imgui.button("Full##batch"):
|
||||||
|
for f in self.files:
|
||||||
|
f_path = f.path if hasattr(f, "path") else str(f)
|
||||||
|
if f_path in self.ui_selected_context_files:
|
||||||
|
f.force_full = True
|
||||||
|
f.auto_aggregate = False
|
||||||
|
if hasattr(f, "ast_signatures"):
|
||||||
|
f.ast_signatures = False
|
||||||
|
f.ast_definitions = False
|
||||||
|
imgui.same_line()
|
||||||
|
if imgui.button("Agg##batch"):
|
||||||
|
for f in self.files:
|
||||||
|
f_path = f.path if hasattr(f, "path") else str(f)
|
||||||
|
if f_path in self.ui_selected_context_files:
|
||||||
|
f.auto_aggregate = True
|
||||||
|
f.force_full = False
|
||||||
|
if hasattr(f, "ast_signatures"):
|
||||||
|
f.ast_signatures = False
|
||||||
|
f.ast_definitions = False
|
||||||
|
imgui.same_line()
|
||||||
|
if imgui.button("Sig##batch"):
|
||||||
|
for f in self.files:
|
||||||
|
f_path = f.path if hasattr(f, "path") else str(f)
|
||||||
|
if f_path in self.ui_selected_context_files:
|
||||||
|
if hasattr(f, "ast_signatures"):
|
||||||
|
f.ast_signatures = True
|
||||||
|
f.force_full = False
|
||||||
|
f.auto_aggregate = False
|
||||||
|
f.ast_definitions = False
|
||||||
|
imgui.same_line()
|
||||||
|
if imgui.button("Def##batch"):
|
||||||
|
for f in self.files:
|
||||||
|
f_path = f.path if hasattr(f, "path") else str(f)
|
||||||
|
if f_path in self.ui_selected_context_files:
|
||||||
|
if hasattr(f, "ast_definitions"):
|
||||||
|
f.ast_definitions = True
|
||||||
|
f.force_full = False
|
||||||
|
f.auto_aggregate = False
|
||||||
|
f.ast_signatures = False
|
||||||
|
imgui.same_line()
|
||||||
|
if imgui.button("Remove##batch"):
|
||||||
|
new_files = []
|
||||||
|
for f in self.files:
|
||||||
|
f_path = f.path if hasattr(f, "path") else str(f)
|
||||||
|
if f_path not in self.ui_selected_context_files:
|
||||||
|
new_files.append(f)
|
||||||
|
self.files = new_files
|
||||||
|
self.ui_selected_context_files.clear()
|
||||||
|
imgui.same_line()
|
||||||
|
if imgui.button("Clear Selection"):
|
||||||
|
self.ui_selected_context_files.clear()
|
||||||
|
|
||||||
|
imgui.dummy(imgui.ImVec2(0, 4))
|
||||||
|
|
||||||
if imgui.begin_table("ctx_comp_table", 2, imgui.TableFlags_.resizable | imgui.TableFlags_.borders):
|
if imgui.begin_table("ctx_comp_table", 2, imgui.TableFlags_.resizable | imgui.TableFlags_.borders):
|
||||||
imgui.table_setup_column("File", imgui.TableColumnFlags_.width_stretch)
|
imgui.table_setup_column("File", imgui.TableColumnFlags_.width_stretch)
|
||||||
imgui.table_setup_column("Flags", imgui.TableColumnFlags_.width_fixed, 200)
|
imgui.table_setup_column("Flags", imgui.TableColumnFlags_.width_fixed, 200)
|
||||||
@@ -2534,7 +2593,19 @@ class App:
|
|||||||
for i, f_item in enumerate(self.files):
|
for i, f_item in enumerate(self.files):
|
||||||
imgui.table_next_row()
|
imgui.table_next_row()
|
||||||
imgui.table_set_column_index(0)
|
imgui.table_set_column_index(0)
|
||||||
imgui.text(f_item.path if hasattr(f_item, "path") else str(f_item))
|
|
||||||
|
# Checkbox for selection
|
||||||
|
f_path = f_item.path if hasattr(f_item, "path") else str(f_item)
|
||||||
|
is_sel = f_path in self.ui_selected_context_files
|
||||||
|
changed_sel, is_sel = imgui.checkbox(f"##sel{i}", is_sel)
|
||||||
|
if changed_sel:
|
||||||
|
if is_sel:
|
||||||
|
self.ui_selected_context_files.add(f_path)
|
||||||
|
else:
|
||||||
|
self.ui_selected_context_files.discard(f_path)
|
||||||
|
imgui.same_line()
|
||||||
|
imgui.text(f_path)
|
||||||
|
|
||||||
imgui.table_set_column_index(1)
|
imgui.table_set_column_index(1)
|
||||||
if hasattr(f_item, "auto_aggregate"):
|
if hasattr(f_item, "auto_aggregate"):
|
||||||
changed_agg, f_item.auto_aggregate = imgui.checkbox(f"Agg##cc{i}", f_item.auto_aggregate)
|
changed_agg, f_item.auto_aggregate = imgui.checkbox(f"Agg##cc{i}", f_item.auto_aggregate)
|
||||||
|
|||||||
Reference in New Issue
Block a user