Skip to content

Commit 2807baa

Browse files
ui: improved selecting rows while holding the Shift key
Now the list of selected rows grows/shrinks dynamically while the Shift key is pressed. See: #1485
1 parent f898b0a commit 2807baa

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ui/opensnitch/customwidgets/generictableview.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,8 @@ def setModel(self, model):
243243
self.horizontalHeader().sortIndicatorChanged.disconnect()
244244
self.setSortingEnabled(False)
245245

246+
# FIXME: some columns may have the same value on different nodes
247+
# like rule name zzz on nodes 1, 2 and 3.
246248
def setTrackingColumn(self, col):
247249
"""column used to track a selected row while scrolling on this table"""
248250
self.trackingCol = col
@@ -295,7 +297,7 @@ def mouseReleaseEvent(self, event):
295297
self.handleShiftPressed()
296298

297299
for idx in self.selectionModel().selectedRows(self.trackingCol):
298-
if idx.data() != None and idx.data() not in self._rows_selection.keys():
300+
if idx.data() is not None and idx.data() not in self._rows_selection.keys():
299301
self._rows_selection[idx.data()] = self.getRowCells(idx.row())
300302

301303
# TODO: handle selection ranges when Shift is pressed
@@ -394,6 +396,8 @@ def handleShiftPressed(self):
394396
first = self._last_row_selected
395397
self._last_row_selected = last
396398
self._first_row_selected = first
399+
self._rows_selection = {}
400+
self.selectionModel().clear()
397401
for row in range(self._first_row_selected, self._last_row_selected+1):
398402
idx = self.model().index(row, self.trackingCol)
399403
self._rows_selection[idx.data()] = self.getRowCells(row)

0 commit comments

Comments
 (0)