def itemChange(self, change, value): if change == QGraphicsItem.ItemPositionChange and self.scene(): for e in self.edges_in: e.update() for e in self.edges_out: e.update() return QGraphicsItem.itemChange(self, change, value)
def __init__(self, conditional_to=False, two_way=False, conditional_from=False): QGraphicsItem.__init__(self) self.node_from = None self.node_to = None self.conditional_to = conditional_to self.conditional_from = conditional_from if conditional_to: self.pen = QPen(CONDITIONAL_TRANSITION_COLOR) self.brush = QBrush(CONDITIONAL_TRANSITION_COLOR) else: self.pen = QPen(NON_CONDITIONAL_TRANSITION_COLOR) self.brush = QBrush(NON_CONDITIONAL_TRANSITION_COLOR) self.arrow_length = 10 self.two_way = two_way
def __init__(self, parent, xAttribute, yAttribute, vectors=None): QGraphicsItem.__init__(self) self.parent = parent self.xAttribute = xAttribute self.yAttribute = yAttribute self.vectors = vectors self.xmin = None self.xmax = None self.ymin = None self.ymax = None self.isTop = False self.isLeft = False self.isRight = False self.isBottom = False self.width = parametricPulseGraph.FULL_SIZE self.height = parametricPulseGraph.FULL_SIZE if self.vectors == None: return for vlist in self.vectors.itervalues(): for x0,y0,t0,x1,y1,t1 in vlist: if self.xmin == None: self.xmin = min(x0,x1) self.xmax = max(x0,x1) self.ymin = min(y0,y1) self.ymax = max(y0,y1) else: self.xmin = min(self.xmin,x0,x1) self.xmax = max(self.xmax,x0,x1) self.ymin = min(self.ymin,y0,y1) self.ymax = max(self.ymax,y0,y1) if self.xmin == None or self.xmax == None or self.ymin == None or self.ymax == None: self.xmin = None self.xmax = None self.ymin = None self.ymax = None self.vectors = None
def __init__(self, name): QGraphicsItem.__init__(self) self.label = name self.edges_in = [] self.edges_out = [] self.metrics = QFontMetrics(nodes_font) self._b_width = 0 self._b_height = 0 self._x = 0 self._y = 0 self.margin = 5 self.node_pen = QPen(QColor(30, 30, 30)) self.selected_pen = QPen(QColor(200, 200, 30)) self.node_brush = QBrush(QColor(120, 120, 30)) self._update_size() self.setFlags(QGraphicsItem.ItemIsMovable | QGraphicsItem.ItemIsSelectable)
def __init__(self): QGraphicsItem.__init__(self) self.setFlag(self.ItemIgnoresTransformations)
def itemChange(self, change, value): """Warning view it will soon have to correct pos.""" if change == QGraphicsItem.ItemPositionHasChanged: # Restart till we stop moving. self.scene().views()[0].timer.start() return QGraphicsItem.itemChange(self, change, value)