fix: Fix setting status of delete button in multiple files widget - #1443
fix: Fix setting status of delete button in multiple files widget#1443Czaki wants to merge 4 commits into
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdjusts the delete button enable/disable logic in the multiple files selection widget to depend on the current selection and safely handle deletion and reset states. State diagram for delete button enable/disable logic in multiple files widgetstateDiagram-v2
[*] --> Disabled
Disabled --> Enabled: file_chosen
note right of Enabled
condition: selected_files.currentRow() != -1
end note
Enabled --> Disabled: delete_element
note right of Disabled
condition: selected_files.count() == 0
end note
Enabled --> Disabled: clean
Disabled --> Disabled: clean
Enabled --> Enabled: file_chosen
note right of Enabled
condition: selected_files.currentRow() != -1
end note
Disabled --> Disabled: file_chosen
note right of Disabled
condition: selected_files.currentRow() == -1
end note
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Warning Review limit reached
Next review available in: 53 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe file selection widget now deletes all selected files and updates the delete-button state when files are selected or cleared. Codecov GitHub Checks annotations are enabled. ChangesFile selection controls
Codecov checks
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Consider centralizing the delete button enable/disable logic into a small helper (e.g.
_update_delete_button_state()) and calling it fromfile_chosen,delete_element, andcleanto keep the behavior consistent and easier to maintain. - For clarity and consistency with
setEnabled(...)usage elsewhere, you may want to replaceself.delete_button.setDisabled(True)incleanwithself.delete_button.setEnabled(False).
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider centralizing the delete button enable/disable logic into a small helper (e.g. `_update_delete_button_state()`) and calling it from `file_chosen`, `delete_element`, and `clean` to keep the behavior consistent and easier to maintain.
- For clarity and consistency with `setEnabled(...)` usage elsewhere, you may want to replace `self.delete_button.setDisabled(True)` in `clean` with `self.delete_button.setEnabled(False)`.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@package/PartSeg/common_gui/select_multiple_files.py`:
- Around line 231-236: Update delete_button enablement and delete_element to
require an actually selected item rather than relying on currentRow(). Use
selectedItems(), currentItem() with isSelected(), or equivalent selection
validation before enabling deletion and calling takeItem, while preserving the
existing no-item early return.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 4c2685fc-8a5d-4b86-99c1-527fa0712ff8
📒 Files selected for processing (1)
package/PartSeg/common_gui/select_multiple_files.py
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1443 +/- ##
========================================
Coverage 92.56% 92.56%
========================================
Files 211 211
Lines 33224 33226 +2
========================================
+ Hits 30755 30757 +2
Misses 2469 2469 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@package/PartSeg/common_gui/select_multiple_files.py`:
- Around line 233-239: Update delete_element to remove each deleted FileListItem
from selected_files using takeItem with the item’s current row before or
alongside removing its path from files_to_proceed. Set delete_button enabled
state from the remaining widget selection/count after deletion, and extend
test_delete_element to assert the widget count is updated.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 0bcc6364-173e-47cd-b2f0-97f8683b504e
📒 Files selected for processing (2)
codecov.ymlpackage/PartSeg/common_gui/select_multiple_files.py
|



fix PARTSEG-10D
Summary by Sourcery
Adjust delete button behavior in the multiple files selection widget to correctly reflect the current selection and handle edge cases.
Bug Fixes:
Summary by CodeRabbit