Skip to content

Commit 8a9e6b6

Browse files
committed
owtable: add 'select/deselect all' functionality
1 parent 044fb36 commit 8a9e6b6

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Orange/widgets/data/owtable.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,11 @@ def eventFilter(self, o, e):
619619
return True # eat event
620620
return False
621621
table.efc = efc()
622+
# disconnect default handler for clicks and connect a new one, which supports
623+
# both selection and deselection of all data
624+
btn.clicked.disconnect()
622625
btn.installEventFilter(table.efc)
626+
btn.clicked.connect(self._on_select_all)
623627
table.btn = btn
624628

625629
if sys.platform == "darwin":
@@ -643,6 +647,14 @@ def eventFilter(self, o, e):
643647
except Exception:
644648
pass
645649

650+
def _on_select_all(self, _):
651+
data_info = self.tabs.currentWidget()._input_slot.summary
652+
if len(self.selected_rows) == data_info.len \
653+
and len(self.selected_cols) == len(data_info.domain):
654+
self.tabs.currentWidget().clearSelection()
655+
else:
656+
self.tabs.currentWidget().selectAll()
657+
646658
def _on_current_tab_changed(self, index):
647659
"""Update the info box on current tab change"""
648660
view = self.tabs.widget(index)

0 commit comments

Comments
 (0)