|
|
|
@ -87,10 +87,13 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
|
|
def create_menus(self):
|
|
|
|
|
print('Creating menus…')
|
|
|
|
|
self.menubar = self.menuBar()
|
|
|
|
|
mode_menu = self.menubar.addMenu('&Mode')
|
|
|
|
|
short_path_act = QtGui.QAction("Sh. path &DAG", self)
|
|
|
|
|
short_path_act.triggered.connect(self.shortestPathMode)
|
|
|
|
|
mode_menu.addAction(short_path_act)
|
|
|
|
|
mode_menu = self.menubar.addMenu('&Highlight')
|
|
|
|
|
edge_weight_act = QtGui.QAction("Edge costs", self)
|
|
|
|
|
edge_weight_act.triggered.connect(self.edgeWeightMode)
|
|
|
|
|
mode_menu.addAction(edge_weight_act)
|
|
|
|
|
topodiff_act = QtGui.QAction("Topology differences", self)
|
|
|
|
|
topodiff_act.triggered.connect(self.topoDiffMode)
|
|
|
|
|
mode_menu.addAction(topodiff_act)
|
|
|
|
|
|
|
|
|
|
# Hack!
|
|
|
|
|
autoload_act = QtGui.QAction("&Load automatically", self)
|
|
|
|
@ -149,7 +152,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
|
|
|
|
|
|
|
@Slot()
|
|
|
|
|
def load_positions(self):
|
|
|
|
|
filename = QtWidgets.QFileDialog.getOpenFileName(self, 'Open vertex positions', '.', 'OSPF files(*.visu);;All files(*)')[0]
|
|
|
|
|
filename = QtWidgets.QFileDialog.getOpenFileName(self, 'Open vertex positions', '.', 'OSPF visualisation files (*.visu);;All files(*)')[0]
|
|
|
|
|
if filename == '': return # Do nothing
|
|
|
|
|
self.positions_from_file(filename)
|
|
|
|
|
|
|
|
|
@ -190,15 +193,18 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
|
|
if oe.cost == 0 or oe.cost > e.cost:
|
|
|
|
|
for_edge[(a,b)] = (e, sty)
|
|
|
|
|
# Actually apply the style:
|
|
|
|
|
for v, sty in for_vertex.items():
|
|
|
|
|
for v in self.visu_graph[0].keys():
|
|
|
|
|
sty = for_vertex.get(v, {})
|
|
|
|
|
self.graphicsitems[v].apply_style(sty)
|
|
|
|
|
for e, tup in for_edge.items():
|
|
|
|
|
self.graphicsitems[e].apply_style(tup[1])
|
|
|
|
|
for e in self.visu_graph[1]:
|
|
|
|
|
sty = for_edge[e][1] if e in for_edge else {}
|
|
|
|
|
self.graphicsitems[e].apply_style(sty)
|
|
|
|
|
|
|
|
|
|
@Slot()
|
|
|
|
|
def dagMode(self):
|
|
|
|
|
def dagMode(self, vtxid):
|
|
|
|
|
self.mode = self.Mode.ShortestPathDAG
|
|
|
|
|
self.highlighter = HighlightSPDAG(...)
|
|
|
|
|
self.highlighter = HighlightSPDAG(vtxid)
|
|
|
|
|
self.start_vertex = vtxid
|
|
|
|
|
self.apply_styles()
|
|
|
|
|
|
|
|
|
|
@Slot()
|
|
|
|
@ -214,9 +220,11 @@ class MainWindow(QtWidgets.QMainWindow):
|
|
|
|
|
self.apply_styles()
|
|
|
|
|
|
|
|
|
|
@Slot()
|
|
|
|
|
def shortestPathMode(self):
|
|
|
|
|
def shortestPathMode(self, vtxid):
|
|
|
|
|
self.mode = self.Mode.ShortestPath
|
|
|
|
|
...
|
|
|
|
|
self.end_vertex = vtxid
|
|
|
|
|
self.highlighter = HighlightShortestPath((self.start_vertex, self.end_vertex))
|
|
|
|
|
self.apply_styles()
|
|
|
|
|
|
|
|
|
|
@Slot()
|
|
|
|
|
def openRefTopology(self):
|
|
|
|
|