-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Fix selection of custom label colors for napari 0.5.0 #1138
Conversation
WalkthroughThe updates introduce conditional handling for colormap properties in the Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
🧙 Sourcery has finished reviewing your pull request! Tips
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've reviewed this pull request using the Sourcery rules engine. If you would also like our AI-powered code review then let us know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- package/PartSeg/common_gui/napari_image_view.py (3 hunks)
Additional comments not posted (3)
package/PartSeg/common_gui/napari_image_view.py (3)
Line range hint
485-493
: LGTM! Consider adding comments for better clarity.The code changes are approved. Adding comments to explain the version-specific logic can enhance readability.
# Check Napari version and assign colormap properties accordingly if _napari_ge_5: image_info.roi.colormap = self.get_roi_view_parameters(image_info) return if _napari_ge_4_13: image_info.roi.color = self.get_roi_view_parameters(image_info) return
589-594
: LGTM! Consider adding comments for better clarity.The code changes are approved. Adding comments to explain the version-specific logic can enhance readability.
# Check Napari version and assign colormap properties accordingly if _napari_ge_5: image_info.mask.colormap = self.mask_color() else: image_info.mask.color = self.mask_color()
611-616
: LGTM! Consider adding comments for better clarity.The code changes are approved. Adding comments to explain the version-specific logic can enhance readability.
# Check Napari version and assign colormap properties accordingly if _napari_ge_5: image_info.mask.colormap = colormap else: image_info.mask.color = colormap
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #1138 +/- ##
===========================================
+ Coverage 93.00% 93.02% +0.01%
===========================================
Files 207 207
Lines 32645 32656 +11
===========================================
+ Hits 30363 30379 +16
+ Misses 2282 2277 -5 ☔ View full report in Codecov by Sentry. |
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- package/tests/test_PartSeg/test_napari_image_view.py (2 hunks)
Additional comments not posted (3)
package/tests/test_PartSeg/test_napari_image_view.py (3)
36-38
: Functionget_color_dict
looks good!The function correctly retrieves
color_dict
fromcolormap
whenNAPARI_GE_5_0
is true.
42-44
: Functionget_color_dict
looks good!The function correctly retrieves the
color
attribute of the layer whenNAPARI_GE_5_0
is false.
169-173
: Usage ofget_color_dict
in test cases looks good!The function is correctly used to assert color properties of the mask based on the Napari version.
Summary by CodeRabbit
New Features
Tests
get_color_dict
to retrieve color information in test cases, ensuring compatibility across Napari versions.