trying ot make files & media less shit
This commit is contained in:
+63
-14
@@ -876,20 +876,69 @@ class App:
|
|||||||
if opened:
|
if opened:
|
||||||
if exp:
|
if exp:
|
||||||
avail = imgui.get_content_region_avail().y
|
avail = imgui.get_content_region_avail().y
|
||||||
files_hdr = imgui.collapsing_header("Files")
|
if not hasattr(self, 'files_screenshots_split'):
|
||||||
shots_hdr = imgui.collapsing_header("Screenshots")
|
self.files_screenshots_split = 0.65
|
||||||
num_open = (1 if files_hdr else 0) + (1 if shots_hdr else 0)
|
split_y = int(avail * self.files_screenshots_split)
|
||||||
section_h = avail / max(num_open, 1) if num_open > 0 else avail
|
if imgui.collapsing_header("Files", imgui.TreeNodeFlags_.default_open):
|
||||||
section_h = max(section_h, 100)
|
imgui.begin_child("Files_child", imgui.ImVec2(-1, split_y), True)
|
||||||
# BEGIN Files section
|
if not hasattr(self, 'files_last_selected'):
|
||||||
if files_hdr:
|
self.files_last_selected = -1
|
||||||
self._render_files_panel(section_h - 80)
|
if imgui.begin_table("files_table", 4, imgui.TableFlags_.resizable | imgui.TableFlags_.borders):
|
||||||
# END Files section
|
imgui.table_setup_column("", imgui.TableColumnFlags_.width_fixed, 25)
|
||||||
# BEGIN Screenshots section
|
imgui.table_setup_column("Path", imgui.TableColumnFlags_.width_stretch)
|
||||||
if shots_hdr:
|
imgui.table_setup_column("Agg", imgui.TableColumnFlags_.width_fixed, 50)
|
||||||
self._render_screenshots_panel(section_h - 80)
|
imgui.table_setup_column("Full", imgui.TableColumnFlags_.width_fixed, 50)
|
||||||
# END Screenshots section
|
imgui.table_headers_row()
|
||||||
imgui.end()
|
self.files.sort(key=lambda f: f.path.lower() if hasattr(f, 'path') else str(f).lower())
|
||||||
|
for i, f_item in enumerate(self.files):
|
||||||
|
imgui.table_next_row()
|
||||||
|
imgui.table_set_column_index(0)
|
||||||
|
clicked, f_item.selected = imgui.checkbox(f"##{i}", f_item.selected)
|
||||||
|
if clicked:
|
||||||
|
if imgui.is_key_down(imgui.Key.shift) and self.files_last_selected >= 0:
|
||||||
|
start_i = min(self.files_last_selected, i)
|
||||||
|
end_i = max(self.files_last_selected, i)
|
||||||
|
for j in range(start_i, end_i + 1):
|
||||||
|
self.files[j].selected = True
|
||||||
|
self.files_last_selected = i
|
||||||
|
imgui.table_set_column_index(1)
|
||||||
|
imgui.text(f_item.path if hasattr(f_item, 'path') else str(f_item))
|
||||||
|
imgui.table_set_column_index(2)
|
||||||
|
if hasattr(f_item, 'auto_aggregate'):
|
||||||
|
changed_agg, f_item.auto_aggregate = imgui.checkbox(f"##agg{i}", f_item.auto_aggregate)
|
||||||
|
imgui.table_set_column_index(3)
|
||||||
|
if hasattr(f_item, 'force_full'):
|
||||||
|
changed_full, f_item.force_full = imgui.checkbox(f"##full{i}", f_item.force_full)
|
||||||
|
imgui.end_table()
|
||||||
|
if imgui.button("Add Files##addf"):
|
||||||
|
r = hide_tk_root()
|
||||||
|
paths = filedialog.askopenfilenames()
|
||||||
|
r.destroy()
|
||||||
|
for p in paths:
|
||||||
|
if p not in [f.path if hasattr(f, 'path') else f for f in self.files]:
|
||||||
|
self.files.append(models.FileItem(path=p))
|
||||||
|
imgui.same_line()
|
||||||
|
if imgui.button("Del Selected##dels"):
|
||||||
|
self.files = [f for f in self.files if not f.selected]
|
||||||
|
imgui.end_child()
|
||||||
|
imgui.separator()
|
||||||
|
if imgui.collapsing_header("Screenshots", imgui.TreeNodeFlags_.default_open):
|
||||||
|
imgui.begin_child("Shots_child", imgui.ImVec2(-1, -1), True)
|
||||||
|
for i, s in enumerate(self.screenshots):
|
||||||
|
if imgui.button(f"x##s{i}"):
|
||||||
|
self.screenshots.pop(i)
|
||||||
|
break
|
||||||
|
imgui.same_line()
|
||||||
|
imgui.text(s)
|
||||||
|
if imgui.button("Add Screenshots##adds"):
|
||||||
|
r = hide_tk_root()
|
||||||
|
paths = filedialog.askopenfilenames(filetypes=[("Images", "*.png *.jpg *.jpeg *.gif *.bmp *.webp"), ("All", "*.*")])
|
||||||
|
r.destroy()
|
||||||
|
for p in paths:
|
||||||
|
if p not in self.screenshots:
|
||||||
|
self.screenshots.append(p)
|
||||||
|
imgui.end_child()
|
||||||
|
imgui.end()
|
||||||
# END Files & Media window
|
# END Files & Media window
|
||||||
if self.show_windows.get("AI Settings", False):
|
if self.show_windows.get("AI Settings", False):
|
||||||
exp, opened = imgui.begin("AI Settings", self.show_windows["AI Settings"])
|
exp, opened = imgui.begin("AI Settings", self.show_windows["AI Settings"])
|
||||||
|
|||||||
@@ -495,6 +495,7 @@ class FileItem:
|
|||||||
path: str
|
path: str
|
||||||
auto_aggregate: bool = True
|
auto_aggregate: bool = True
|
||||||
force_full: bool = False
|
force_full: bool = False
|
||||||
|
selected: bool = False
|
||||||
ast_signatures: bool = False
|
ast_signatures: bool = False
|
||||||
ast_definitions: bool = False
|
ast_definitions: bool = False
|
||||||
ast_mask: dict[str, str] = field(default_factory=dict)
|
ast_mask: dict[str, str] = field(default_factory=dict)
|
||||||
|
|||||||
Reference in New Issue
Block a user