Better wording of comments and strings

topo-mov
LEdoian 1 year ago
parent 391a6c9078
commit 62feed9caf

@ -20,8 +20,9 @@ Also, this is the project for my Bachelor thesis.
Run `pip install -e .`. You can use a virtualenv if you wish (recommended). Run `pip install -e .`. You can use a virtualenv if you wish (recommended).
A demo is located in `./poor_mans_visualisation.py`, if that runs, everything Birdvisu can then be run just as `visu`. Other ways include running `python -m
should be working. birdvisu` or `./visu.py` from this directory, all of them are functionally
equivalent.
## Documentation ## Documentation

@ -12,8 +12,15 @@ def _addrs_as_str(addrs):
if isinstance(addrs, IPv4Network) or isinstance(addrs, IPv6Network): return str(addrs) if isinstance(addrs, IPv4Network) or isinstance(addrs, IPv6Network): return str(addrs)
return '\n'.join(str(a) for a in addrs) return '\n'.join(str(a) for a in addrs)
"""Z-value guide:
- Vertices at Z=200
- Edges at Z=100
- Highlights at Z reduced by 10.
"""
# TODO: we MAY WISH TO use QGraphicsItemGroup. # TODO: we MAY WISH TO use QGraphicsItemGroup.
# TODO: Do not duplicate so much code! # TODO: Do not duplicate so much code! (But it is only two times, so it counts :-))
# TODO: tooltips? # TODO: tooltips?
class RouterGraphicsItem(QGraphicsItem): class RouterGraphicsItem(QGraphicsItem):
default_style = { default_style = {
@ -25,7 +32,7 @@ class RouterGraphicsItem(QGraphicsItem):
self.window = window self.window = window
size = 30 size = 30
self.icon = QGraphicsRectItem(-size/2, -size/2, size, size, parent=self) self.icon = QGraphicsRectItem(-size/2, -size/2, size, size, parent=self) # Should use Cisco icon for router…
self.icon.setZValue(200) self.icon.setZValue(200)
self.icon.setBrush(QBrush(QColor('yellow'))) self.icon.setBrush(QBrush(QColor('yellow')))
self.label = QGraphicsSimpleTextItem(parent=self.icon) self.label = QGraphicsSimpleTextItem(parent=self.icon)
@ -74,7 +81,7 @@ class RouterGraphicsItem(QGraphicsItem):
def contextMenuEvent(self, evt): def contextMenuEvent(self, evt):
menu = QMenu(self.window) menu = QMenu(self.window)
tree_act = QAction('Show routing tree', self.window) tree_act = QAction('Show routing DAG', self.window)
menu.addAction(tree_act) menu.addAction(tree_act)
path_act = object() path_act = object()
if self.window.mode == self.window.Mode.ShortestPathDAG: if self.window.mode == self.window.Mode.ShortestPathDAG:
@ -103,7 +110,7 @@ class NetworkGraphicsItem(QGraphicsItem):
self.window = window self.window = window
size = 40 size = 40
self.icon = QGraphicsRectItem(-size/2, -size/2, size, size, parent=self) self.icon = QGraphicsRectItem(-size/2, -size/2, size, size, parent=self) # TODO: Cisco cloud
self.icon.setZValue(200) self.icon.setZValue(200)
self.icon.setBrush(QBrush(QColor('gray'))) self.icon.setBrush(QBrush(QColor('gray')))
self.label = QGraphicsSimpleTextItem(parent=self.icon) self.label = QGraphicsSimpleTextItem(parent=self.icon)
@ -153,7 +160,7 @@ class NetworkGraphicsItem(QGraphicsItem):
def contextMenuEvent(self, evt): def contextMenuEvent(self, evt):
menu = QMenu(self.window) menu = QMenu(self.window)
tree_act = QAction('Show routing tree', self.window) tree_act = QAction('Show routing DAG', self.window)
menu.addAction(tree_act) menu.addAction(tree_act)
path_act = object() path_act = object()
if self.window.mode == self.window.Mode.ShortestPathDAG: if self.window.mode == self.window.Mode.ShortestPathDAG:

Loading…
Cancel
Save