Skip to content

fix: Fix setting status of delete button in multiple files widget - #1443

Merged
Czaki merged 6 commits into
developfrom
fix/partseg-10d
Aug 25, 2026
Merged

fix: Fix setting status of delete button in multiple files widget#1443
Czaki merged 6 commits into
developfrom
fix/partseg-10d

Conversation

@Czaki

@Czaki Czaki commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

fix PARTSEG-10D

Summary by Sourcery

Ensure the multiple-file widget keeps its delete action state synchronized with the current selection and file list.

Bug Fixes:

  • Correct the multiple-file widget’s delete button state when files are selected, removed, or cleared.
  • Support deleting all currently selected files from the multiple-file widget.

CI:

  • Enable GitHub Checks annotations in Codecov reporting.

Tests:

  • Add coverage verifying that deleting the final file disables the delete button.

Summary by CodeRabbit

  • Bug Fixes
    • Updated multiple-file deletion to remove all selected files at once.
    • Improved the delete control state based on the current selection and remaining files.
    • Prevented deletion when no files remain or the selection is cleared.
    • Ensured deleting the only selected file correctly disables the delete control.

@sourcery-ai

sourcery-ai Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adjusts 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 widget

stateDiagram-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
Loading

File-Level Changes

Change Details Files
Make the delete button enabled only when a file is selected and properly reset/guard it during deletions and cleanup.
  • Change file selection handler to enable the delete button only when there is a current selection index (not -1).
  • Guard delete logic by early-returning if no item is selected before accessing its properties or removing it from internal state.
  • Disable the delete button when the file list is fully cleared via the clean method to keep UI state consistent.
package/PartSeg/common_gui/select_multiple_files.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 0c8063e7-c7ae-4f05-be98-82b10653cb43

📥 Commits

Reviewing files that changed from the base of the PR and between f1164e5 and 6fc01f9.

📒 Files selected for processing (2)
  • package/PartSeg/common_gui/select_multiple_files.py
  • package/tests/test_PartSeg/test_common_gui.py

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The file selection widget now deletes all selected files and updates the delete-button state when files are selected or cleared. A regression test covers deletion of the only file. Codecov GitHub Checks annotations are enabled.

Changes

File selection controls

Layer / File(s) Summary
Deletion control state and safeguards
package/PartSeg/common_gui/select_multiple_files.py, package/tests/test_PartSeg/test_common_gui.py
delete_element removes all selected files. The delete button is disabled when no files remain or after clean clears the list. A regression test verifies the single-file case.

Codecov checks

Layer / File(s) Summary
GitHub Checks annotation configuration
codecov.yml
Codecov annotations are enabled in GitHub Checks.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 6fc01

This change keeps the multiple-file widget’s delete action synchronized with the current selection and file list, with focused test coverage for deleting the final file. No actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately identifies the main change: fixing delete button behavior in the multiple files widget. It is specific enough for repository history, although the repeated use of "Fix" is slightl…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title accurately identifies the main change: fixing delete button behavior in the multiple files widget. It is specific enough for repository history, although the repeated use of "Fix" is slightly redundant.

✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/partseg-10d

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 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).
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)`.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 800ff7f and 3242085.

📒 Files selected for processing (1)
  • package/PartSeg/common_gui/select_multiple_files.py

Comment thread package/PartSeg/common_gui/select_multiple_files.py Outdated
@Czaki Czaki added this to the 0.17.1 milestone Aug 3, 2026
@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.61%. Comparing base (65204a1) to head (6fc01f9).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #1443   +/-   ##
========================================
  Coverage    92.60%   92.61%           
========================================
  Files          211      211           
  Lines        33236    33248   +12     
========================================
+ Hits         30779    30792   +13     
+ Misses        2457     2456    -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3242085 and f1164e5.

📒 Files selected for processing (2)
  • codecov.yml
  • package/PartSeg/common_gui/select_multiple_files.py

Comment thread package/PartSeg/common_gui/select_multiple_files.py

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sourcery assessment

Approved.

@sonarqubecloud

Copy link
Copy Markdown

@Czaki
Czaki merged commit 3c0253d into develop Aug 25, 2026
55 checks passed
@Czaki
Czaki deleted the fix/partseg-10d branch August 25, 2026 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant