network: Add timers.

mesh
Pierre-Antoine Rouby 2023-04-25 15:54:07 +02:00
parent 632e092619
commit 8adad9b7ad
1 changed files with 7 additions and 0 deletions

View File

@ -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):
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):
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):
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):
) )
).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):
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