You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* refactor: Add rotation and status bar utilities, refactor main window navigation
- Implemented `compute_next_after_rotation` in `rotation_utils.py` to determine the next path after rotations.
- Created `StatusBarInfo` class and `build_status_bar_info` function in `statusbar_utils.py` for structured status messages.
- Refactored `_group_images_by_cluster` in `main_window.py` to use `ClusterUtils`.
- Updated navigation methods in `main_window.py` to utilize new `navigate_group_cyclic` and `navigate_linear` functions.
- Removed obsolete navigation methods `_index_below` and `_index_above` from `main_window.py`.
- Added tests for rotation utilities, status bar utilities, cluster utilities, and navigation utilities.
- Ensured proper handling of file paths and metadata in the new utility functions.
* refactor: Ruff check and format
* fix: Update system dependencies for headless PyQt6 usage and ensure Qt runs without an X server
* fix: Update pytest artifact upload step to ignore missing files
* Add comprehensive tests for file deletion, filtering, navigation, and similarity controllers
- Implement tests for FileDeletionController to verify single and multi-selection deletion behavior, including header pruning.
- Create tests for FilterController to ensure search and cluster filtering functionality works as expected.
- Add deferred initialization tests for FilterController to check behavior when proxy models are set after controller creation.
- Update tests for finding proxy indices to avoid pytest collection warnings by renaming test classes.
- Introduce integration tests for HotkeyController to validate skip_deleted flag propagation.
- Develop tests for MetadataController to confirm refresh behavior on selection changes.
- Implement navigation controller tests to validate group and linear navigation, including handling of deleted images.
- Add tests for PreviewController to ensure correct preload behavior and status messaging.
- Create tests for RotationController to verify acceptance and refusal of rotation paths.
- Implement selection controller tests to confirm correct retrieval of selected file paths.
- Add similarity controller tests to validate clustering and embedding functionality.
- Introduce tests for smart navigation to ensure correct cycling behavior within groups.
* Add tests for selection visibility and navigation in file system model
- Implemented tests for finding first and last visible items in both list and tree contexts.
- Created a new test suite for smart down navigation, ensuring sequential navigation through image items.
- Added tests for smart up navigation, verifying sequential behavior and preventing wrap-around within groups.
- Introduced simple and fixed test cases for both down and up navigation scenarios.
- Refactored navigation logic to work without proxy models, simplifying the selection process.
* refactor: Enhance file deletion and navigation tests with improved state management and selection preservation
* Add comprehensive tests for image rotation and metadata processing
- Introduced `test_image_rotator.py` to validate the functionality of the ImageRotator class, including rotation support, orientation calculations, and error handling.
- Enhanced `test_metadata_controller.py` with parameterized tests to ensure metadata refresh behavior on selection changes and sidebar visibility.
- Created `test_metadata_processor_constants.py` to verify the integrity of metadata-related constants.
- Developed `test_metadata_processor_core.py` for extensive testing of the MetadataProcessor class, covering batch metadata extraction, caching, and error handling.
- Added `test_metadata_processor_helpers.py` to validate helper functions used in metadata processing.
- Implemented `test_metadata_processor_rotation.py` to test rotation methods and their integration with caching.
- Updated `test_navigation_controller.py` to improve navigation tests, ensuring correct behavior with deleted items.
- Introduced `test_rotation_integration.py` to validate the complete rotation system through integration tests.
* style: Format code for consistency and readability in test files
* style: Clean up import statements for consistency across caching and UI modules
Copy file name to clipboardExpand all lines: DEVELOPER_GUIDE.md
+35Lines changed: 35 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,6 +27,30 @@ The application is structured into two main packages: `core` and `ui`.
27
27
-**`app_controller.py`**: The controller that mediates between the UI and the `core` logic. It handles user actions, calls the appropriate `core` services, and updates the UI.
28
28
-**`app_state.py`**: Holds the application's runtime state, including caches and loaded data. This object is shared across the application.
29
29
-**`worker_manager.py`**: Manages all background threads and workers, decoupling the UI from long-running tasks.
30
+
-**Controller Layer (Encapsulation Refactor)**: Non-trivial UI behaviors previously embedded in `MainWindow` have been extracted into focused controllers under `src/ui/controllers/`:
31
+
-`navigation_controller.py`: Linear & group-aware navigation (honors skip-deleted logic, smart up/down traversal). Consumes a minimal protocol for selection & model interrogation.
32
+
-`hotkey_controller.py`: Central mapping of key events to actions (allows headless tests to exercise hotkey dispatch logic).
33
+
-`similarity_controller.py`: Orchestrates similarity analysis workflow (start, embeddings, clustering) AND (post-refactor) prepares cluster structures via `prepare_clusters()` returning pure data used by the view. Sorting strategies (Default / Time / Similarity then Time) live here; PCA fallback rationale documented inline. Uses only a protocol subset of `AppState` (see `AppStateSimilarityView`) for loose coupling.
-`deletion_mark_controller.py`: Non-destructive mark/unmark & presentation (text color/blur). Distinguished from actual deletion for clarity & test isolation.
1. Identify a cohesive behavior cluster in `MainWindow` (heuristics, branching logic, side-effect orchestration).
43
+
2. Define a minimal Protocol capturing only what the controller needs (attributes + methods). Avoid passing full MainWindow if possible.
44
+
3. Implement controller with pure helpers; return data structures instead of mutating widgets directly where feasible.
45
+
4. Add targeted tests for new controller focusing on logic not easily covered via GUI.
46
+
5. Replace in-place logic with controller delegation. Remove obsolete helpers after tests pass.
47
+
6. Document rationale (fallbacks, sentinels like `date_obj.max`) inline for future maintainers.
48
+
49
+
Benefits:
50
+
- Smaller `main_window.py` surface area.
51
+
- Faster unit tests (controllers testable without QApplication event loop).
52
+
- Clear separation of destructive vs non-destructive operations (mark vs delete).
53
+
- Easier future feature toggles or re-use in alternate front-ends.
30
54
-**`dialog_manager.py`**: Manages the creation and display of all dialog boxes. `show_about_dialog(block: bool = True)` supports a non-blocking mode (`block=False`) used by tests; prefer blocking mode in production UI code.
31
55
-**`menu_manager.py`**: Manages the main menu bar and its actions.
0 commit comments