Commit 8adad9b7 authored by Pierre-Antoine Rouby's avatar Pierre-Antoine Rouby
Browse files

network: Add timers.

Showing with 7 additions and 0 deletions
+7 -0
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
import math import math
from tools import timer
from PyQt5.QtCore import ( from PyQt5.QtCore import (
Qt, QPoint, QPointF, QSizeF, QLineF, QRectF, Qt, QPoint, QPointF, QSizeF, QLineF, QRectF,
pyqtSlot, pyqtSignal, pyqtSlot, pyqtSignal,
...@@ -47,6 +49,7 @@ class NodeItem(QGraphicsItem): ...@@ -47,6 +49,7 @@ class NodeItem(QGraphicsItem):
path.addEllipse(-10, -10, 20, 20) path.addEllipse(-10, -10, 20, 20)
return path return path
@timer
def paint(self, painter, option, widget): def paint(self, painter, option, widget):
painter.setPen(Qt.NoPen) painter.setPen(Qt.NoPen)
...@@ -127,6 +130,7 @@ class EdgeItem(QGraphicsItem): ...@@ -127,6 +130,7 @@ class EdgeItem(QGraphicsItem):
return result return result
@timer
def paint(self, painter, option, widget): def paint(self, painter, option, widget):
# Draw shape of the edge # Draw shape of the edge
# color = QColor(Qt.white) # color = QColor(Qt.white)
...@@ -198,6 +202,7 @@ class NodeText(QGraphicsTextItem): ...@@ -198,6 +202,7 @@ class NodeText(QGraphicsTextItem):
self.setPos(QPointF(x,y)) self.setPos(QPointF(x,y))
@timer
def paint(self, painter, option, widget): def paint(self, painter, option, widget):
color = QColor(Qt.white) color = QColor(Qt.white)
color.setAlpha(128) color.setAlpha(128)
...@@ -232,6 +237,7 @@ class NewEdgeLine(QGraphicsItem): ...@@ -232,6 +237,7 @@ class NewEdgeLine(QGraphicsItem):
) )
).normalized().adjusted(-extra, -extra, extra, extra) ).normalized().adjusted(-extra, -extra, extra, extra)
@timer
def paint(self, painter, option, widget): def paint(self, painter, option, widget):
line = QLineF(self.src, self.dest) line = QLineF(self.src, self.dest)
if line.length() == 0.0: if line.length() == 0.0:
...@@ -284,6 +290,7 @@ class GraphWidget(QGraphicsView): ...@@ -284,6 +290,7 @@ class GraphWidget(QGraphicsView):
self.create_items() self.create_items()
@timer
def create_items(self): def create_items(self):
"""Create all items and draw its """Create all items and draw its
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment