Skip to content

Commit 9d5d53d

Browse files
ui,stats: improved rules selection
Use the Time column to select rows when in detail view, and the Name column when listing app rules.
1 parent 320ec18 commit 9d5d53d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

ui/opensnitch/dialogs/stats.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2027,9 +2027,6 @@ def _cb_table_double_clicked(self, row):
20272027
self._set_active_widgets(cur_idx, True, rule_name)
20282028
r_name, node = self._set_rules_tab_active(row, cur_idx, self.COL_R_NAME, self.COL_R_NODE)
20292029
self.LAST_SELECTED_ITEM = row.model().index(row.row(), self.COL_R_NAME).data()
2030-
# Use COL_TIME as index when in detail view. Otherwise COL_R_NAME
2031-
# (col number 2) will be used, leading to incorrect selections.
2032-
self.TABLES[cur_idx]['view'].setTrackingColumn(self.COL_TIME)
20332030
self._set_rules_query(r_name, node)
20342031
self._restore_details_view_columns(
20352032
self.TABLES[cur_idx]['view'].horizontalHeader(),
@@ -2540,6 +2537,14 @@ def _set_active_widgets(self, prev_idx, state, label_txt=""):
25402537
self.nodeDeleteButton.setVisible(state)
25412538
self.nodeActionsButton.setVisible(state)
25422539

2540+
elif cur_idx == StatsDialog.TAB_RULES and self.rulesTable.isVisible():
2541+
# Use COL_TIME as index when in detail view. Otherwise COL_R_NAME
2542+
# (col number 2) will be used, leading to incorrect selections.
2543+
if state:
2544+
self.TABLES[cur_idx]['view'].setTrackingColumn(self.COL_TIME)
2545+
else:
2546+
self.TABLES[cur_idx]['view'].setTrackingColumn(self.COL_R_NAME)
2547+
25432548
header = self.TABLES[cur_idx]['view'].horizontalHeader()
25442549
if state == True:
25452550
# going to details state
@@ -2585,7 +2590,6 @@ def _restore_rules_tab_widgets(self, active):
25852590
self.editRuleButton.setVisible(not active)
25862591
self.nodeRuleLabel.setText("")
25872592
self.rulesTreePanel.setVisible(active)
2588-
self.TABLES[self.TAB_RULES]['view'].setTrackingColumn(self.COL_R_NAME)
25892593

25902594
if not active:
25912595
return

0 commit comments

Comments
 (0)