-
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
refactor: Fix Qt flags #1041
refactor: Fix Qt flags #1041
Conversation
WalkthroughThe changes across various Python files in the package primarily involve updating method calls and enum references to use fully qualified names, adding Changes
TipsChat with CodeRabbit Bot (
|
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.
Review Status
Actionable comments generated: 1
Configuration used: CodeRabbit UI
Files selected for processing (19)
- package/PartSeg/common_gui/about_dialog.py (2 hunks)
- package/PartSeg/common_gui/advanced_tabs.py (4 hunks)
- package/PartSeg/common_gui/algorithms_description.py (3 hunks)
- package/PartSeg/common_gui/collapse_checkbox.py (2 hunks)
- package/PartSeg/common_gui/colormap_creator.py (2 hunks)
- package/PartSeg/common_gui/custom_load_dialog.py (1 hunks)
- package/PartSeg/common_gui/custom_save_dialog.py (3 hunks)
- package/PartSeg/common_gui/error_report.py (2 hunks)
- package/PartSeg/common_gui/flow_layout.py (1 hunks)
- package/PartSeg/common_gui/image_adjustment.py (1 hunks)
- package/PartSeg/common_gui/multiple_file_widget.py (6 hunks)
- package/PartSeg/common_gui/napari_image_view.py (1 hunks)
- package/PartSeg/common_gui/numpy_qimage.py (1 hunks)
- package/PartSeg/common_gui/qt_modal.py (3 hunks)
- package/PartSeg/common_gui/searchable_combo_box.py (1 hunks)
- package/PartSeg/common_gui/searchable_list_widget.py (1 hunks)
- package/PartSeg/common_gui/select_multiple_files.py (4 hunks)
- package/PartSeg/common_gui/show_directory_dialog.py (1 hunks)
- package/PartSeg/common_gui/universal_gui_part.py (5 hunks)
Files skipped from review due to trivial changes (2)
- package/PartSeg/common_gui/flow_layout.py
- package/PartSeg/common_gui/show_directory_dialog.py
Additional comments: 46
package/PartSeg/common_gui/about_dialog.py (3)
13-14: The addition of the
parent
parameter to theAboutDialog
constructor is consistent with the PR's objective to improve widget management and maintainability.50-50: The
QGridLayout
constructor is correctly initialized withself
as the parent widget, which is a good practice for ensuring proper ownership and cleanup of the layout.46-53: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [13-53]
The summary mentions updates to method calls and layout initialization to use the
parent
argument, but theparent
argument is not used in the hunk provided. Please verify if the summary is accurate or if additional changes are expected in the code.package/PartSeg/common_gui/advanced_tabs.py (4)
236-238: The summary indicates a change in the
AdvancedWindow
class constructor'ssettings
parameter type fromViewSettings
toBaseSettings
, but the provided hunk already usesBaseSettings
. This might be an outdated summary or the change was made prior to this hunk.86-86: The summary suggests that the
MaskControl
class constructor should accept aBaseSettings
object, but the hunk shows it still accepts aViewSettings
object. If the PR objective includes this change, the constructor needs to be updated.54-54: The addition of the
parent
parameter to theDevelopTab
class constructor aligns with the PR objectives to improve widget management.90-92: Direct manipulation of UI elements in the
MaskControl
constructor is acceptable, but ensure it aligns with the PR objectives and UI consistency across the application.package/PartSeg/common_gui/algorithms_description.py (3)
74-77: The addition of the
parent
parameter to theProfileSelect
class constructor is consistent with the PR objective to improve widget management.191-193: The explicit specification of the
parent
parameter asNone
when instantiatingChannelComboBox
aligns with the PR objective to enhance code clarity.207-208: The explicit specification of the
parent
parameter asNone
when instantiatingQComboBox
objects aligns with the PR objective to enhance code clarity.package/PartSeg/common_gui/collapse_checkbox.py (2)
28-28: The change from
Qt.TextSingleLine
toQt.TextFlag.TextSingleLine
is consistent with the PR's objective to use fully qualified enum names for clarity.13-20: The addition of periods at the end of sentences in the comments improves readability and consistency in documentation style.
package/PartSeg/common_gui/colormap_creator.py (3)
88-96: The use of
Qt.GlobalColor
constants for brush colors in thepaintEvent
method is consistent with the PR's objective to improve enum referencing.498-498: The inclusion of the
self
parameter in thecentral_widget
initialization is correct and follows best practices for PyQt widget hierarchy.495-501: The changes in the
ColormapList
class constructor seem to be related to layout initialization and widget setup, which is not directly mentioned in the summary. However, these changes do not appear to alter the enum usage and are likely part of the general codebase improvements.package/PartSeg/common_gui/custom_load_dialog.py (1)
- 150-155: The change from
QFileDialog.Accepted
toQFileDialog.DialogCode.Accepted
aligns with the PR's objective to use fully qualified enum names, enhancing code clarity and maintainability.package/PartSeg/common_gui/custom_save_dialog.py (3)
59-70: The changes to the enum references in the
CustomSaveDialog
constructor align with the PR's objective to use fully qualified enum names, which should improve code clarity and maintainability.161-167: The changes to the enum references in the
PSaveDialog
constructor align with the PR's objective to use fully qualified enum names, which should improve code clarity and maintainability.183-189: The changes to the
accept
method inPSaveDialog
are consistent with the PR's objective to use fully qualified enum names, and the logic for updating the settings with the directory and filter path is maintained.package/PartSeg/common_gui/error_report.py (2)
259-267: The change from
QListWidgetItem.UserType
toQListWidgetItem.ItemType.UserType
aligns with the PR's objective to use fully qualified enum names for clarity and maintainability.360-363: The change from
QMessageBox.Ok
toQMessageBox.StandardButton.Ok
aligns with the PR's objective to use fully qualified enum names for clarity and maintainability.package/PartSeg/common_gui/image_adjustment.py (1)
- 22-26: The change to call
get_fields_per_dimension
withlist(image.get_dimension_letters())
ensures that the method receives the correct data type. This is a good practice to avoid potential issues if the method expects a list and not another iterable type.package/PartSeg/common_gui/multiple_file_widget.py (6)
42-48: The update to use fully qualified enum
Qt.ContextMenuPolicy.CustomContextMenu
is consistent with the PR's objective to improve enum referencing.69-71: The update to use fully qualified enum
Qt.CursorShape.ArrowCursor
is consistent with the PR's objective to improve enum referencing.79-86: The update to use fully qualified enum
QAbstractItemView.SelectionMode.ExtendedSelection
andQt.ItemDataRole.UserRole
is consistent with the PR's objective to improve enum referencing.107-111: The usage of fully qualified enum
Qt.ItemDataRole.UserRole
in theget_files
method is consistent with the PR's objective to improve enum referencing.281-287: The update to use fully qualified enum
Qt.TextElideMode.ElideLeft
in thesave_state_action
method is consistent with the PR's objective to improve enum referencing.382-388: The update to use fully qualified enum
QFileDialog.FileMode.ExistingFiles
in theMultipleLoadDialog
constructor is consistent with the PR's objective to improve enum referencing.package/PartSeg/common_gui/napari_image_view.py (1)
- 171-177: The change from
Qt.CustomContextMenu
toQt.ContextMenuPolicy.CustomContextMenu
for setting the context menu policy ofroll_dim_button
aligns with the PR's objective to use fully qualified enum names for clarity and maintainability.package/PartSeg/common_gui/numpy_qimage.py (1)
- 19-24: The change from
QImage.Format_RGBA8888
toQImage.Format.Format_RGBA8888
correctly uses the fully qualified enum name, which is consistent with the PR's objective to improve enum referencing.package/PartSeg/common_gui/qt_modal.py (5)
3-3: The import statement has been updated to include
QKeyEvent
, which is consistent with the PR objective to use fully qualified names.37-37: The addition of the
parent
parameter to theQtPopup
class constructor is consistent with the PR objective and improves widget management.40-40: The
setWindowFlags
method call has been updated to use theWindowType
enum, which is consistent with the PR objective and enhances code clarity.124-124: The
keyPressEvent
method signature has been updated to include type hinting, which is consistent with the PR objective and improves code readability and maintainability.132-132: The comparison of key codes in the
keyPressEvent
method has been updated to use theKey
enum fromQt.Key
, which is consistent with the PR objective and enhances code clarity.package/PartSeg/common_gui/searchable_combo_box.py (1)
- 16-26: The changes to the enum values in the
SearchComboBox
class constructor are correct and align with the PR's objective to use fully qualified enum names for clarity and maintainability.package/PartSeg/common_gui/searchable_list_widget.py (1)
- 24-28: The update to use
Qt.MatchFlag.MatchContains
in thefindItems
method call is consistent with the PR's objective to use fully qualified enum names for clarity and maintainability.package/PartSeg/common_gui/select_multiple_files.py (4)
41-41: The change to use the fully qualified name for the enum
SelectionMode.ExtendedSelection
is consistent with the PR's objective to improve enum referencing.81-81: The change to use the fully qualified name for the enum
ContextMenuPolicy.CustomContextMenu
is consistent with the PR's objective to improve enum referencing.198-198: The change to use the fully qualified name for the enum
StandardButton.Ok
in theQMessageBox
call is consistent with the PR's objective to improve enum referencing.212-212: The change to use the fully qualified name for the enum
FileMode.ExistingFiles
in theQFileDialog
call is consistent with the PR's objective to improve enum referencing.package/PartSeg/common_gui/universal_gui_part.py (5)
141-153: The changes to use fully qualified enum names in the
Spacing
class align with the PR's objective and enhance code clarity.173-176: The update to use fully qualified enum names in the
right_label
function is consistent with the PR's objective and improves code readability.191-195: The update to use a fully qualified enum name in the
CustomSpinBox
class is consistent with the PR's objective and improves code readability.210-214: The update to use a fully qualified enum name in the
CustomDoubleSpinBox
class is consistent with the PR's objective and improves code readability.352-356: The update to use a fully qualified enum name in the
TextShow
class is consistent with the PR's objective and improves code readability.
|
||
# noinspection PyArgumentList | ||
self.reload_btn = QPushButton("Reload algorithms", clicked=self.reload_algorithm_action) | ||
layout = QGridLayout() | ||
layout = QGridLayout(self) | ||
layout.addWidget(self.reload_btn, 0, 0) | ||
layout.setColumnStretch(1, 1) | ||
layout.setRowStretch(1, 1) |
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.
Consider removing or redirecting the debug print statements from sys.stderr
to a logging framework for better control over the output in the reload_algorithm_action
method.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1041 +/- ##
===========================================
+ Coverage 92.25% 92.29% +0.04%
===========================================
Files 206 206
Lines 32318 32321 +3
===========================================
+ Hits 29814 29831 +17
+ Misses 2504 2490 -14 ☔ View full report in Codecov by Sentry. |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- package/tests/test_PartSeg/test_colormap_create.py (2 hunks)
Additional comments: 3
package/tests/test_PartSeg/test_colormap_create.py (3)
36-36: The addition of the
qapp
parameter to thetest_click
method is consistent with the PR objectives to improve code clarity and maintainability.38-38: The call to
widget.show()
beforeqtbot.addWidget(widget)
ensures that the widget is properly initialized for the test.51-52: The calls to
qapp.processEvents()
andwidget.hide()
at the end of the test ensure that any pending events are processed and the widget is hidden after the test, which is good for test isolation and cleanup.
Instead of using global
Qt
or Widget namespaces for enum selection point, enum directly.Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Refactor
Style
Please note that these changes are aimed at improving the user experience and ensuring compatibility with the latest standards and practices in application development.