The `CustomFileDialog` class had become too large and complex, making it difficult to maintain.
This change refactors the monolithic class into several specialized manager classes, each responsible for a specific area of concern:
- `SettingsDialog`: Moved to its own file, `cfd_settings_dialog.py`.
- `FileOperationsManager`: Handles file/folder creation, deletion, and renaming.
- `SearchManager`: Encapsulates all search-related logic.
- `NavigationManager`: Manages directory navigation and history.
- `ViewManager`: Controls the rendering of file and folder views.
The main `CustomFileDialog` class has been streamlined and now acts as an orchestrator for these managers. This improves readability, separation of concerns, and the overall maintainability of the code.
Modified the button layout methods to place the primary action button (Open/Save) at the top and the Cancel button at the bottom of their respective containers.
This creates a more consistent and predictable user experience across all dialog modes and view settings.
Further refactored the _setup_sidebar method by breaking it down into smaller, more focused methods: _setup_sidebar_bookmarks, _setup_sidebar_devices, and _setup_sidebar_storage.
This completes the modularization of the UI setup, resulting in a highly organized and maintainable WidgetManager class.
Further refactored the _setup_sidebar method by breaking it down into smaller, more focused methods: _setup_sidebar_bookmarks, _setup_sidebar_devices, and _setup_sidebar_storage.
This completes the modularization of the UI setup, resulting in a highly organized and maintainable WidgetManager class.
Further refactored the WidgetManager class by extracting the setup logic for the top bar and the sidebar into their own dedicated methods: _setup_top_bar and _setup_sidebar.
This simplifies the main setup_widgets method into a high-level blueprint, significantly improving code organization and readability.
To improve readability and reduce the size of the main setup_widgets method, the logic for creating and laying out all widgets in the bottom bar has been extracted into a new _setup_bottom_bar method.
Extract the layout logic for the different dialog modes (save/open) and button positions (left/right) into dedicated methods within the WidgetManager class.
This improves readability and maintainability, making future changes easier and less error-prone.