MCPcopy
hub / github.com/evilsocket/opensnitch / _table_menu_edit

Method _table_menu_edit

ui/opensnitch/dialogs/stats.py:1623–1644  ·  view source on GitHub ↗
(self, cur_idx, model, selection)

Source from the content-addressed store, hash-verified

1621 QtWidgets.QMessageBox.Icon.Warning)
1622
1623 def _table_menu_edit(self, cur_idx, model, selection):
1624 if cur_idx == self.TAB_RULES and self.rulesTable.isVisible():
1625 for row in selection:
1626 node = row[self.COL_R_NODE]
1627 name = row[self.COL_R_NAME]
1628 records = self._get_rule(name, node)
1629 if records == None or records == -1:
1630 Message.ok(QC.translate("stats", "New rule error"),
1631 QC.translate("stats", "Rule not found by that name and node"),
1632 QtWidgets.QMessageBox.Icon.Warning)
1633 return
1634 r = RulesEditorDialog(modal=False)
1635 r.edit_rule(records, node)
1636 break
1637
1638 elif cur_idx == self.TAB_RULES and self.fwTable.isVisible():
1639 for idx in selection:
1640 uuid = model.index(idx.row(), FirewallTableModel.COL_UUID).data()
1641 node = model.index(idx.row(), FirewallTableModel.COL_ADDR).data()
1642 self._fw_dialog.load_rule(node, uuid)
1643
1644 break
1645
1646 def _cb_fw_rules_updated(self):
1647 self._add_rulesTree_fw_chains()

Calls 6

_get_ruleMethod · 0.95
edit_ruleMethod · 0.95
RulesEditorDialogClass · 0.90
okMethod · 0.80
load_ruleMethod · 0.80
dataMethod · 0.45

Tested by

no test coverage detected