commit 27

This commit is contained in:
2025-07-30 15:09:49 +02:00
parent 0b7a85424a
commit e535a42d3e
3 changed files with 27 additions and 23 deletions

View File

@@ -53,7 +53,7 @@ class Tooltip:
def leave(self, event=None): self.unschedule(); self.hide_tooltip() def leave(self, event=None): self.unschedule(); self.hide_tooltip()
def schedule(self): self.unschedule( def schedule(self): self.unschedule(
); self.id = self.widget.after(500, self.show_tooltip) ); self.id = self.widget.after(250, self.show_tooltip)
def unschedule(self): def unschedule(self):
id = self.id id = self.id
@@ -192,12 +192,12 @@ class CustomFileDialog(tk.Toplevel):
self.icon_bg_color = base_bg # Main background for content self.icon_bg_color = base_bg # Main background for content
self.accent_color = "#e0e0e0" self.accent_color = "#e0e0e0"
# Light Color for Header and round buttons in Header # Light Color for Header and round buttons in Header
self.header = "#ffffff" self.header = "#d9d9d9"
# Hover Color for Buttons in header and Sidebar # Hover Color for Buttons in header and Sidebar
self.hover_extrastyle = "#f5f5f5" self.hover_extrastyle = "#f5f5f5"
self.hover_extrastyle2 = "#494949" # Hover Color for Buttons in Sidebar self.hover_extrastyle2 = "#494949" # Hover Color for Buttons in Sidebar
self.sidebar_color = "#e7e7e7" self.sidebar_color = "#e7e7e7"
self.bottom_color = "#d9d9d9" self.bottom_color = "#cecece"
self.freespace_background = self.sidebar_color self.freespace_background = self.sidebar_color
self.color_foreground = "#000000" self.color_foreground = "#000000"
@@ -301,7 +301,7 @@ class CustomFileDialog(tk.Toplevel):
Tooltip(self.hidden_files_button, "Versteckte Dateien anzeigen") Tooltip(self.hidden_files_button, "Versteckte Dateien anzeigen")
# Horizontal separator # Horizontal separator
separator_color = "#000000" if self.is_dark else "#d9d9d9" separator_color = "#000000" if self.is_dark else "#9c9c9c"
tk.Frame(main_frame, height=1, bg=separator_color).grid( tk.Frame(main_frame, height=1, bg=separator_color).grid(
row=1, column=0, columnspan=2, sticky="ew") row=1, column=0, columnspan=2, sticky="ew")
@@ -309,7 +309,8 @@ class CustomFileDialog(tk.Toplevel):
sidebar_frame = ttk.Frame( sidebar_frame = ttk.Frame(
main_frame, style="Sidebar.TFrame", padding=(0, 0, 0, 15)) main_frame, style="Sidebar.TFrame", padding=(0, 0, 0, 15))
sidebar_frame.grid(row=2, column=0, sticky="nsw") sidebar_frame.grid(row=2, column=0, sticky="nsw")
sidebar_frame.grid_rowconfigure(2, weight=1) # Only the devices frame row expands # Only the devices frame row expands
sidebar_frame.grid_rowconfigure(2, weight=1)
sidebar_buttons_frame = ttk.Frame( sidebar_buttons_frame = ttk.Frame(
sidebar_frame, style="Sidebar.TFrame", padding=(0, 15, 0, 0)) sidebar_frame, style="Sidebar.TFrame", padding=(0, 15, 0, 0))
@@ -334,8 +335,10 @@ class CustomFileDialog(tk.Toplevel):
compound="left", command=lambda p=config['path']: self.navigate_to(p), style="Dark.TButton.Borderless") compound="left", command=lambda p=config['path']: self.navigate_to(p), style="Dark.TButton.Borderless")
btn.pack(fill="x", pady=1) btn.pack(fill="x", pady=1)
ttk.Separator(sidebar_frame, orient='horizontal').grid( # Horizontal separator
row=1, column=0, sticky='ew', pady=10, padx=20) separator_color = "#a9a9a9" if self.is_dark else "#7c7c7c"
tk.Frame(sidebar_frame, height=1, bg=separator_color).grid(
row=1, column=0, sticky="ew", padx=20, pady=15)
# Mounted devices # Mounted devices
mounted_devices_frame = ttk.Frame( mounted_devices_frame = ttk.Frame(
@@ -350,8 +353,8 @@ class CustomFileDialog(tk.Toplevel):
compound="left", command=lambda p=mount_point: self.navigate_to(p), style="Dark.TButton.Borderless") compound="left", command=lambda p=mount_point: self.navigate_to(p), style="Dark.TButton.Borderless")
btn.pack(fill="x", pady=1) btn.pack(fill="x", pady=1)
ttk.Separator(sidebar_frame, orient='horizontal').grid( tk.Frame(sidebar_frame, height=1, bg=separator_color).grid(
row=3, column=0, sticky='ew', pady=10, padx=20) row=3, column=0, sticky="ew", padx=20, pady=15)
storage_frame = ttk.Frame(sidebar_frame, style="Sidebar.TFrame") storage_frame = ttk.Frame(sidebar_frame, style="Sidebar.TFrame")
storage_frame.grid(row=4, column=0, sticky="ew", padx=10) storage_frame.grid(row=4, column=0, sticky="ew", padx=10)
@@ -764,21 +767,21 @@ class CustomFileDialog(tk.Toplevel):
# Process main device if it has a mountpoint # Process main device if it has a mountpoint
if block_device.get('mountpoint') and \ if block_device.get('mountpoint') and \
block_device.get('type') not in ['loop', 'rom'] and \ block_device.get('type') not in ['loop', 'rom'] and \
block_device.get('mountpoint') != '/': # Exclude root mountpoint itself block_device.get('mountpoint') != '/': # Exclude root mountpoint itself
# Exclude non-removable partitions of the root disk # Exclude non-removable partitions of the root disk
if block_device.get('name').startswith(root_disk_name) and not block_device.get('rm', False): if block_device.get('name').startswith(root_disk_name) and not block_device.get('rm', False):
pass # Skip this device pass # Skip this device
else: else:
name = block_device.get('name') name = block_device.get('name')
mountpoint = block_device.get('mountpoint') mountpoint = block_device.get('mountpoint')
label = block_device.get('label') label = block_device.get('label')
size = block_device.get('size') # size = block_device.get('size')
removable = block_device.get('rm', False) removable = block_device.get('rm', False)
display_name = label if label else name display_name = label if label else name
if size: # if size:
display_name += f" ({size})" # display_name += f" ({size})"
devices.append((display_name, mountpoint, removable)) devices.append((display_name, mountpoint, removable))
# Process children (partitions) # Process children (partitions)
@@ -786,22 +789,23 @@ class CustomFileDialog(tk.Toplevel):
for child_device in block_device['children']: for child_device in block_device['children']:
if child_device.get('mountpoint') and \ if child_device.get('mountpoint') and \
child_device.get('type') not in ['loop', 'rom'] and \ child_device.get('type') not in ['loop', 'rom'] and \
child_device.get('mountpoint') != '/': # Exclude root mountpoint itself child_device.get('mountpoint') != '/': # Exclude root mountpoint itself
# Exclude non-removable partitions of the root disk # Exclude non-removable partitions of the root disk
if block_device.get('name') == root_disk_name and not child_device.get('rm', False): if block_device.get('name') == root_disk_name and not child_device.get('rm', False):
pass # Skip this partition pass # Skip this partition
else: else:
name = child_device.get('name') name = child_device.get('name')
mountpoint = child_device.get('mountpoint') mountpoint = child_device.get('mountpoint')
label = child_device.get('label') label = child_device.get('label')
size = child_device.get('size') # size = child_device.get('size')
removable = child_device.get('rm', False) removable = child_device.get('rm', False)
display_name = label if label else name display_name = label if label else name
if size: # if size:
display_name += f" ({size})" # display_name += f" ({size})"
devices.append((display_name, mountpoint, removable)) devices.append(
(display_name, mountpoint, removable))
except Exception as e: except Exception as e:
print(f"Error getting mounted devices: {e}") print(f"Error getting mounted devices: {e}")

View File

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