Refactor: Apply auto raw edit only on raw by default#27
Conversation
…its automatically based on file type
…nd ensure automatic RAW processing is applied by default
…n and preview preloader methods
… ensure automatic RAW processing is applied by default
…ded JPEGs from RAW thumbnails and previews
There was a problem hiding this comment.
Pull Request Overview
This pull request refactors RAW image processing to be automatic and standardized throughout the codebase, eliminating the need for external apply_auto_edits parameters. The changes ensure that RAW images are always detected by file extension and receive appropriate brightness and contrast adjustments.
- Removes
apply_auto_editsparameters from public APIs and internal methods across the image pipeline, worker management, and UI components - Implements automatic RAW detection using
is_raw_extension()function throughout the codebase - Updates all test files to include required
import pyexiv2statement for Windows compatibility
Reviewed Changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
tests/test_worker_manager_automatic_raw.py |
New comprehensive test suite validating WorkerManager API changes and automatic RAW processing |
tests/test_file_scanner_automatic_raw.py |
New test suite for FileScanner automatic RAW detection functionality |
tests/test_automatic_raw_processing.py |
New test suite for core automatic RAW processing validation |
tests/test_similarity_controller.py |
Updated test methods to remove auto_edits parameter |
| Multiple test files | Added required import pyexiv2 statement for Windows compatibility |
src/ui/worker_manager.py |
Removed apply_auto_edits parameters from worker management methods |
src/ui/ui_components.py |
Updated worker classes to use automatic RAW detection |
src/ui/main_window.py |
Removed auto-edits toggle functionality and updated image processing calls |
src/core/image_pipeline.py |
Implemented automatic RAW detection using is_raw_extension() |
src/core/file_scanner.py |
Removed apply_auto_edits parameter from scanning methods |
| Configuration files | Removed deprecated auto-edit settings and updated documentation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| def test_async_scan_directory_blur_detection_signature(self): | ||
| """Test that async blur detection calls don't use apply_auto_edits_for_raw_preview.""" | ||
| # This test ensures that if the async method is used, it also doesn't pass the old parameter | ||
| scanner = FileScanner(None) | ||
|
|
||
| with ( | ||
| patch("src.core.file_scanner.BlurDetector.is_image_blurred") as mock_blur, | ||
| patch("src.core.file_scanner.SUPPORTED_EXTENSIONS", {".jpg"}), | ||
| ): | ||
| mock_blur.return_value = False | ||
| scanner.blur_detection_threshold = 100.0 | ||
|
|
||
| # Manually test the blur detection call pattern that would be used in async method | ||
| # This simulates what happens in _scan_directory_async | ||
| test_path = "/test/file.jpg" | ||
|
|
||
| # This is the pattern from the async method - it should not pass apply_auto_edits_for_raw_preview | ||
| scanner.__class__.__dict__["_scan_directory_async"].__code__.co_varnames | ||
|
|
||
| # The important thing is that the method signature was updated | ||
| # Let's verify by checking that we can call blur detection with just threshold | ||
| from src.core.image_features.blur_detector import BlurDetector | ||
|
|
||
| with patch.object(BlurDetector, "is_image_blurred") as mock_blur_method: | ||
| mock_blur_method.return_value = False | ||
|
|
||
| # This should work without apply_auto_edits_for_raw_preview parameter | ||
| BlurDetector.is_image_blurred(test_path, threshold=100.0) | ||
|
|
||
| # Verify the method was called correctly | ||
| mock_blur_method.assert_called_once_with(test_path, threshold=100.0) |
There was a problem hiding this comment.
Line 130 accesses scanner.__class__.__dict__[\"_scan_directory_async\"].__code__.co_varnames but never uses the result. This appears to be dead code that should be removed, or if it was meant to be an assertion, it should be completed.
| ".cr2", | ||
| ".cr3", | ||
| ".nef", | ||
| ".nrw", # Nikon RAW |
There was a problem hiding this comment.
[nitpick] The comment format is inconsistent. Other RAW extensions in the list don't have manufacturer comments. Either add comments to all extensions or remove this one for consistency.
| ".nrw", # Nikon RAW | |
| ".nrw", |
This pull request refactors RAW image processing to be automatic and standardized throughout the codebase, eliminating the need for external flags or parameters to trigger auto-edits. The changes ensure that RAW images are always detected by file extension and receive brightness and contrast adjustments during preview, thumbnail, and rotation detection. Documentation and testing guidelines are updated to reflect these changes, and related configuration and UI elements are simplified.
RAW Processing Refactor:
RAW image auto-editing is now always applied based on file extension detection (
is_raw_extension()) throughout the image pipeline, rotation detection, and thumbnail/preview generation. Manual flags such asapply_auto_editshave been removed from public APIs and internal methods. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]Documentation (
DEVELOPER_GUIDE.md) updated to clarify that RAW processing is automatic for supported extensions, and the relevant constant (RAW_AUTO_EDIT_BRIGHTNESS_STANDARD) is now mentioned as part of configuration. [1] [2]Configuration and UI Simplification:
app_settings.py. [1] [2] [3]README.mdto reflect the new automatic behavior.Testing and Guidelines Updates:
import pyexiv2to prevent native library crashes.Summary Statement Update: