This document outlines the technical implementation, architecture, and libraries powering File Manager. The application is built using Python 3 and the PyQt6 framework, employing a multi-threaded, event-driven architecture to maintain UI responsiveness during heavy file system operations.
The application relies heavily on Qt’s Model-View architecture to separate data handling from visual representation.
Custom Model (DetailedFileSystemModel): This class inherits from QFileSystemModel. It intercepts the standard data() calls to inject custom columns. While QFileSystemModel handles standard file attributes (Name, Size) via the OS file system API, our subclass injects extended metadata (EXIF, ID3) by querying a static MetadataLoader cache.
Dual Views: Each FilePane utilizes a QStackedWidget containing both a QTreeView (for detailed lists) and a QListView (for thumbnails). Both views share the same underlying model instance, ensuring synchronization—selection changes and file updates are instantly reflected across both views without redundant data fetches.
Unlike standard file explorers that crawl the disk strictly on-demand, Vibe maintains a persistent local index to enable millisecond-latency searches.
Persistence: A local SQLite database (file_index.db) stores paths, filenames, sizes, and timestamps.
Initial Scan: Upon launch, an IndexerWorker (a dedicated QThread) performs a non-blocking os.walk traversal of available drives to populate the database.
Real-Time Synchronization: The application integrates the watchdog library. A FileSystemEventHandler hooks into OS-level file system events. When a file is created, moved, or deleted, the handler immediately executes a lightweight SQL transaction to update the index, keeping the search database in sync with the physical disk without requiring full rescans.
To prevents the Main/GUI thread from freezing (blocking the event loop), Vibe employs two distinct threading strategies:
Long-Running Operations (QThread):
File I/O: Copy, Move, Delete, and Archive operations are encapsulated in a FileWorker thread. This thread emits signals (action_recorded, error_occurred, finished_all) to update the UI progress bar and populate the Undo stack.
Search: Queries against the SQLite database run in a SearchWorker thread, ensuring complex SQL queries do not stutter the UI.
Parallel Task Execution (QThreadPool & QRunnable):
Thumbnail Generation: The ThumbnailLoader runs as a QRunnable within the global QThreadPool. This allows multiple thumbnails to generate concurrently across CPU cores. The pool size is throttled (setMaxThreadCount(4)) to prevent I/O thrashing on mechanical drives.
Rendering images in a file manager is prone to "silent crashes" due to corrupt headers or thread-safety issues in underlying C++ libraries (QImageReader). Vibe mitigates this via a robust custom rendering pipeline:
Custom Delegate (ThumbnailDelegate): We override the paint() method of QStyledItemDelegate.
Icon Swapping Strategy: To prevent the default system icon from rendering on top of or underneath the custom thumbnail, the delegate intercepts the QStyleOptionViewItem. It explicitly clears the default QIcon and injects the cached QPixmap before passing the option to the generic style.drawControl method. This ensures native styling (selection look-and-feel) while strictly controlling the image content.
Safe Loading: The ThumbnailLoader prioritizes Pillow (PIL) for image decoding. Pillow processes the image into raw bytes in a background thread, which are then safely converted to a QImage. This isolates the Qt event loop from potential segfaults caused by malformed image headers in the native decoder.
Undo/Redo: The application maintains an in-memory stack of dictionaries recording the source, destination, and operation type of every action.
Recycle Bin Integration: Deletions utilize the send2trash library to interact with the OS Recycle Bin. If the library is unavailable or fails, the system falls back to a standard shutil deletion but routes files to a local "Trash Staging" folder within %APPDATA%, providing a fail-safe layer before permanent erasure.
PyQt6: Core GUI framework.
Pillow (PIL): Robust image processing and EXIF data extraction (Camera Model, ISO, etc.).
Mutagen: Audio metadata extraction (ID3 tags, bitrate, duration).
Watchdog: Cross-platform file system monitoring.
Send2Trash: Safe file deletion mechanisms.