Skip to content

Table: Add 'Clear Selection', disable 'Restore order' when order is original - #7125

Merged
VesnaT merged 1 commit into
biolab:masterfrom
janezd:table-restore-clear-selection
Nov 11, 2025
Merged

Table: Add 'Clear Selection', disable 'Restore order' when order is original#7125
VesnaT merged 1 commit into
biolab:masterfrom
janezd:table-restore-clear-selection

Conversation

@janezd

@janezd janezd commented Jul 12, 2025

Copy link
Copy Markdown
Contributor
Issue

Closes #6969.

Description of changes

I think we agreed (in the core group meeting) that the title of the box stays Variables, because it is about variables. We also said that the behaviour of the output button is consistent with other widgets in Orange and that selection behaviour is consistent with common GUIs.

I thus fixed the second point, disabling of reorder button.

As a bonus, I added a button to clear selection (which is also disabled when there's no selection). We have enough space, but its placement doesn't look nice. Perhaps move it to next to "Restore Original Order"?

Screenshot 2025-07-12 at 17 25 19
Includes
  • Code changes
  • Tests
  • Documentation

@codecov

codecov Bot commented Jul 12, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.91%. Comparing base (c807a41) to head (17f295f).
⚠️ Report is 132 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #7125   +/-   ##
=======================================
  Coverage   88.91%   88.91%           
=======================================
  Files         335      335           
  Lines       73978    73988   +10     
=======================================
+ Hits        65779    65789   +10     
  Misses       8199     8199           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@janezd janezd self-assigned this Jul 18, 2025
@janezd

janezd commented Aug 29, 2025

Copy link
Copy Markdown
Contributor Author

Write tests.

@janezd
janezd force-pushed the table-restore-clear-selection branch from 245e3ca to c45dce8 Compare August 29, 2025 14:02
sort = self.__pending_sort
self.__pending_sort = None
if sort is None:
if not sort:

@janezd janezd Aug 29, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Here, it coud happen that sort was [], not None. The remaining code had no effect (as far as I see), but caused the button to be enabled. I could use self.restore_button.setEnabled(bool(sort)) below, but I think this is a better fix.

@janezd janezd removed their assignment Aug 29, 2025
@janezd
janezd requested a review from Copilot August 29, 2025 14:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the Table widget by adding a "Clear Selection" button and properly disabling the "Restore Original Order" button when the table is in its original order. The changes improve user experience by providing clear visual feedback about available actions and adding convenient selection management functionality.

Key changes:

  • Added a "Clear Selection" button that is enabled only when there is an active selection
  • Modified the "Restore Original Order" button to be disabled when the table is already in its original order
  • Updated button state management to reflect current table state accurately

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
Orange/widgets/data/owtable.py Implements clear selection functionality and proper restore button state management
Orange/widgets/data/tests/test_owtable.py Adds comprehensive tests for the new clear selection feature and restore button state behavior

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread Orange/widgets/data/owtable.py
Comment thread Orange/widgets/data/owtable.py
@janezd
janezd force-pushed the table-restore-clear-selection branch from c45dce8 to aaf3e8f Compare August 29, 2025 14:26
@janezd janezd assigned janezd and unassigned janezd Oct 24, 2025
@janezd

janezd commented Oct 24, 2025

Copy link
Copy Markdown
Contributor Author

Apparently, we decided it's OK and that I should "Write tests" (as I wrote on Friday, Aug 29).

Tests are written and this is ready for review. I am volunteering @VesnaT. :)

Comment thread Orange/widgets/data/owtable.py Outdated
self.buttonsArea, self, "Restore Original Order",
callback=self.restore_order,
tooltip="Show rows in the original order",
autoDefault=False,

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.

I'd add enabled=False to obtain consistent initial state.

box = gui.vBox(self.controlArea, "Selection")

self.clear_button = gui.button(
box, self, "Clear Selection", callback=self.clear_selection,

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.

I'd add enabled=False to obtain consistent initial state.

@janezd
janezd force-pushed the table-restore-clear-selection branch from aaf3e8f to a15f782 Compare November 10, 2025 12:56
@janezd
janezd force-pushed the table-restore-clear-selection branch from a15f782 to 17f295f Compare November 10, 2025 15:08
@VesnaT
VesnaT merged commit 53d6384 into biolab:master Nov 11, 2025
25 of 30 checks passed
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.

Data Table modifications

3 participants