diff --git a/__pycache__/custom_file_dialog.cpython-312.pyc b/__pycache__/custom_file_dialog.cpython-312.pyc index 55d119a..352f4d6 100644 Binary files a/__pycache__/custom_file_dialog.cpython-312.pyc and b/__pycache__/custom_file_dialog.cpython-312.pyc differ diff --git a/custom_file_dialog.py b/custom_file_dialog.py index f9b31dd..9da66b8 100644 --- a/custom_file_dialog.py +++ b/custom_file_dialog.py @@ -352,9 +352,15 @@ class CustomFileDialog(tk.Toplevel): btn = ttk.Button(mounted_devices_frame, text=f" {device_name}", image=icon, compound="left", command=lambda p=mount_point: self.navigate_to(p), style="Dark.TButton.Borderless") btn.pack(fill="x", pady=1) - self.device_bar = ttk.Progressbar( - mounted_devices_frame, orient="horizontal", length=100, mode="determinate", style='Small.Horizontal.TProgressbar') - self.device_bar.pack(fill="x", pady=(2, 5), padx=15) + try: + total, used, _ = shutil.disk_usage(mount_point) + progress_bar = ttk.Progressbar( + mounted_devices_frame, orient="horizontal", length=100, mode="determinate", style='Small.Horizontal.TProgressbar') + progress_bar.pack(fill="x", pady=(2, 8), padx=25) + progress_bar['value'] = (used / total) * 100 + except (FileNotFoundError, PermissionError): + # In case of errors (e.g., unreadable drive), just skip the progress bar + pass tk.Frame(sidebar_frame, height=1, bg=separator_color).grid( row=3, column=0, sticky="ew", padx=20, pady=15)