pep8: Some modifications to respect pep8 standard code.

This commit is contained in:
Pierre-Antoine Rouby committed 2023-10-11 11:06:45 +02:00
1 parent 8544dd1144
commit fa2454d079
152 files changed
+1626 -1277

No files matched your search

+10 -7
View File
@@ -115,6 +115,7 @@ class NodeItem(QGraphicsItem):
if not self.graph._only_display:
super(NodeItem, self).mouseMoveEvent(event)
class EdgeItem(QGraphicsItem):
Type = QGraphicsItem.UserType + 2
@@ -216,6 +217,7 @@ class EdgeItem(QGraphicsItem):
painter.drawPolygon(poly)
painter.fillPath(path, brush)
class NodeText(QGraphicsTextItem):
def __init__(self, node_item):
super(NodeText, self).__init__()
@@ -228,9 +230,9 @@ class NodeText(QGraphicsTextItem):
def set_custom_pos(self, pos):
x = pos.x()
y = pos.y() - 42 # Dont panic! The answer is 42
y = pos.y() - 42 # Dont panic! The answer is 42
self.setPos(QPointF(x,y))
self.setPos(QPointF(x, y))
@timer
def paint(self, painter, option, widget):
@@ -248,6 +250,7 @@ class NodeText(QGraphicsTextItem):
# Update the node text
self.setPlainText(self.item.node.name)
class NewEdgeLine(QGraphicsItem):
def __init__(self, src, dest):
super(NewEdgeLine, self).__init__()
@@ -278,13 +281,14 @@ class NewEdgeLine(QGraphicsItem):
Qt.RoundJoin))
painter.drawLine(line)
class GraphWidget(QGraphicsView):
changeEdge = pyqtSignal(object)
changeNode = pyqtSignal(object)
def __init__(self, graph, parent=None,
min_size=(400, 400), max_size=None,
size=None, only_display=False, undo = None):
size=None, only_display=False, undo=None):
super(GraphWidget, self).__init__(parent=parent)
self.timerId = 0
@@ -522,7 +526,6 @@ class GraphWidget(QGraphicsView):
self.changeNode.emit(self.sender())
self.changeEdge.emit(self.sender())
def update_edges(self, node):
"""Update display of all edges linked with the node
@@ -791,7 +794,7 @@ class GraphWidget(QGraphicsView):
if self._state == "move":
# Move on scene
if (not self.selected_item() and
event.buttons() & Qt.LeftButton):
event.buttons() & Qt.LeftButton):
old_p = self.mapToScene(self.m_origin_x, self.m_origin_y)
new_p = self.mapToScene(event.pos())
translation = new_p - old_p
@@ -805,7 +808,6 @@ class GraphWidget(QGraphicsView):
self.update()
super(GraphWidget, self).mouseMoveEvent(event)
# Contextual menu
def _menu_default(self, event, pos, items, menu):
@@ -835,7 +837,8 @@ class GraphWidget(QGraphicsView):
enable = menu.addAction(_translate("Network", "Enable the reach"))
is_enable = False
reverse = menu.addAction(_translate("Network", "Reverse the reach orientation"))
reverse = menu.addAction(_translate(
"Network", "Reverse the reach orientation"))
action = menu.exec_(self.mapToGlobal(event.pos()))