Add menu even to networks

topo-mov
LEdoian 1 year ago
parent 74a4c5e3f0
commit 0a40ab55cb

@ -151,6 +151,21 @@ class NetworkGraphicsItem(QGraphicsItem):
self.window.graphicsitems[edge].update_line()
super().mouseMoveEvent(evt)
def contextMenuEvent(self, evt):
menu = QMenu(self.window)
tree_act = QAction('Show routing tree', self.window)
menu.addAction(tree_act)
path_act = object()
if self.window.mode == self.window.Mode.ShortestPathDAG:
path_act = QAction('Show path to here', self.window)
menu.addAction(path_act)
action = menu.exec(evt.screenPos())
if action == tree_act:
self.window.dagMode(self.vertex_id)
if action == path_act:
self.window.shortestPathMode(self.vertex_id)
# Admit we are basically only a wrapper of the icon.
def boundingRect(self):
return self.icon.boundingRect()

Loading…
Cancel
Save