Table: Add 'Clear Selection', disable 'Restore order' when order is original - #7125
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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:
|
|
Write tests. |
245e3ca to
c45dce8
Compare
| sort = self.__pending_sort | ||
| self.__pending_sort = None | ||
| if sort is None: | ||
| if not sort: |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
c45dce8 to
aaf3e8f
Compare
|
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. :) |
| self.buttonsArea, self, "Restore Original Order", | ||
| callback=self.restore_order, | ||
| tooltip="Show rows in the original order", | ||
| autoDefault=False, |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
I'd add enabled=False to obtain consistent initial state.
aaf3e8f to
a15f782
Compare
a15f782 to
17f295f
Compare
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"?
Includes