commit 14

This commit is contained in:
2025-07-28 00:00:34 +02:00
parent dbae4dbb88
commit 49a097c525
3 changed files with 33 additions and 19 deletions

View File

@@ -228,23 +228,33 @@ class CustomFileDialog(tk.Toplevel):
background=[('active', self.selection_color)],
)
style.configure("Toolbutton_right.TButton", padding=0,
relief="flat")
style.map("Toolbutton_right.TButton",
background=[('active', self.accent_color)],
)
def create_widgets(self):
main_frame = ttk.Frame(self, padding=(0, 0, 10, 0))
main_frame = ttk.Frame(self, padding=(
0, 0, 10, 0), style='Accent.TFrame')
main_frame.pack(fill="both", expand=True)
paned_window = ttk.PanedWindow(main_frame, orient=tk.HORIZONTAL)
paned_window = ttk.PanedWindow(
main_frame, orient=tk.HORIZONTAL, style='Accent.TFrame')
paned_window.pack(fill="both", expand=True)
sidebar_frame = ttk.Frame(paned_window, padding=(
15, 10, 15, 15), style="Sidebar.TFrame")
paned_window.add(sidebar_frame, weight=0)
paned_window.pane(0, weight=0)
sidebar_frame.grid_rowconfigure(2, weight=1)
sidebar_nav_frame = ttk.Frame(sidebar_frame, style="Sidebar.TFrame")
sidebar_nav_frame.grid(row=0, column=0, sticky="ew")
nav_buttons_container = ttk.Frame(sidebar_nav_frame, style="Sidebar.TFrame")
nav_buttons_container = ttk.Frame(
sidebar_nav_frame, style="Sidebar.TFrame")
nav_buttons_container.pack(expand=True)
self.back_button = ttk.Button(
@@ -267,16 +277,16 @@ class CustomFileDialog(tk.Toplevel):
sidebar_buttons_frame.grid(row=2, column=0, sticky="nsew")
sidebar_buttons_config = [
{'name': 'Computer',
'icon': self.icons['computer_large'], 'path': '/'},
{'name': 'Downloads', 'icon': self.icons['downloads_large'], 'path': get_xdg_user_dir(
'icon': self.icons['computer_small'], 'path': '/'},
{'name': 'Downloads', 'icon': self.icons['downloads_small'], 'path': get_xdg_user_dir(
"XDG_DOWNLOAD_DIR", "Downloads")},
{'name': 'Dokumente', 'icon': self.icons['documents_large'], 'path': get_xdg_user_dir(
{'name': 'Dokumente', 'icon': self.icons['documents_small'], 'path': get_xdg_user_dir(
"XDG_DOCUMENTS_DIR", "Documents")},
{'name': 'Bilder', 'icon': self.icons['pictures_large'], 'path': get_xdg_user_dir(
{'name': 'Bilder', 'icon': self.icons['pictures_small'], 'path': get_xdg_user_dir(
"XDG_PICTURES_DIR", "Pictures")},
{'name': 'Musik', 'icon': self.icons['music_large'], 'path': get_xdg_user_dir(
{'name': 'Musik', 'icon': self.icons['music_small'], 'path': get_xdg_user_dir(
"XDG_MUSIC_DIR", "Music")},
{'name': 'Videos', 'icon': self.icons['video_large_folder'], 'path': get_xdg_user_dir(
{'name': 'Videos', 'icon': self.icons['video_small'], 'path': get_xdg_user_dir(
"XDG_VIDEO_DIR", "Videos")},
]
for config in sidebar_buttons_config:
@@ -293,12 +303,13 @@ class CustomFileDialog(tk.Toplevel):
storage_frame, orient="horizontal", length=100, mode="determinate")
self.storage_bar.pack(fill="x", pady=(2, 5))
content_frame = ttk.Frame(paned_window, padding=(5, 0, 0, 0))
content_frame = ttk.Frame(paned_window, padding=(
5, 0, 0, 0), style='Accent.TFrame')
paned_window.add(content_frame, weight=1)
content_frame.grid_rowconfigure(2, weight=1)
content_frame.grid_columnconfigure(0, weight=1)
top_bar = ttk.Frame(content_frame)
top_bar = ttk.Frame(content_frame, style='Accent.TFrame')
top_bar.grid(row=0, column=0, sticky="ew", pady=(10, 0))
top_bar.grid_columnconfigure(0, weight=1)
self.path_entry = ttk.Entry(top_bar)
@@ -306,19 +317,19 @@ class CustomFileDialog(tk.Toplevel):
self.path_entry.bind(
"<Return>", lambda e: self.navigate_to(self.path_entry.get()))
view_switch = ttk.Frame(top_bar, padding=(5, 0))
view_switch = ttk.Frame(top_bar, padding=(5, 0), style='Accent.TFrame')
view_switch.grid(row=0, column=1)
self.icon_view_button = ttk.Button(view_switch, image=self.icons['icon_view'], command=lambda: (
self.view_mode.set("icons"), self.populate_files()), style="Toolbutton.TButton")
self.view_mode.set("icons"), self.populate_files()), style="Toolbutton_right.TButton")
self.icon_view_button.pack(side="left")
Tooltip(self.icon_view_button, "Kachelansicht")
self.list_view_button = ttk.Button(view_switch, image=self.icons['list_view'], command=lambda: (
self.view_mode.set("list"), self.populate_files()), style="Toolbutton.TButton")
self.view_mode.set("list"), self.populate_files()), style="Toolbutton_right.TButton")
self.list_view_button.pack(side="left")
Tooltip(self.list_view_button, "Listenansicht")
self.hidden_files_button = ttk.Button(
top_bar, image=self.icons['hide'], command=self.toggle_hidden_files, style="Toolbutton.TButton")
top_bar, image=self.icons['hide'], command=self.toggle_hidden_files, style="Toolbutton_right.TButton")
self.hidden_files_button.grid(row=0, column=2, padx=5)
Tooltip(self.hidden_files_button, "Versteckte Dateien anzeigen")
@@ -333,10 +344,12 @@ class CustomFileDialog(tk.Toplevel):
bottom_controls_frame.grid(row=3, column=0, sticky="ew", pady=(5, 0))
bottom_controls_frame.grid_columnconfigure(0, weight=1)
self.status_bar = ttk.Label(bottom_controls_frame, text="", anchor="w", style="Accent.TLabel")
self.status_bar = ttk.Label(
bottom_controls_frame, text="", anchor="w", style="Accent.TLabel")
self.status_bar.grid(row=0, column=0, sticky="ew")
right_side_buttons_frame = ttk.Frame(bottom_controls_frame, style="Accent.TFrame")
right_side_buttons_frame = ttk.Frame(
bottom_controls_frame, style="Accent.TFrame")
right_side_buttons_frame.grid(row=0, column=1, sticky="e")
self.filter_combobox = ttk.Combobox(
@@ -346,7 +359,8 @@ class CustomFileDialog(tk.Toplevel):
"<<ComboboxSelected>>", self.on_filter_change)
self.filter_combobox.set(self.filetypes[0][0])
action_buttons_frame = ttk.Frame(right_side_buttons_frame, style="Accent.TFrame")
action_buttons_frame = ttk.Frame(
right_side_buttons_frame, style="Accent.TFrame")
action_buttons_frame.pack(anchor="e", pady=(0, 10))
ttk.Button(action_buttons_frame, text="Öffnen",

View File

@@ -58,7 +58,7 @@ if __name__ == "__main__":
style = ttk.Style(root)
root.tk.call('source', f"{theme_path}/water.tcl")
try:
root.tk.call('set_theme', 'dark')
root.tk.call('set_theme', 'light')
except tk.TclError:
pass
root.mainloop()