def __init__(self, name, x, y, num_labels, color): dbg2("Create {0}", name) self._boundingRect = None self._wdgRect = None self._base_color = color self._color = color self.in_fields = list() self.out_fields = list() self.clickPos = QtCore.QPointF(0, 0) self._selected = False self._over = False super(PWidget, self).__init__() self.setAcceptsHoverEvents(True) self.setCacheMode(full_cache) self.setFlag(QtGui.QGraphicsItem.ItemIsFocusable, False) self.setObjectName(name) self.ui = datas_root + "/nodes/std/default/default.ui" widget = UiFactory.widget(self.ui) self.setWidget(widget) self.leftLayout = self.getLayout('inputsLayout') self.rightLayout = self.getLayout('outputsLayout') for _ in range(num_labels): self.addLabel() self.setPos(QtCore.QPoint(x, y)) self.setZValue(Z.NODE)
def __init__(self, node, name, layout, ui, left): super(FWidget, self).__init__() self.node = node self.name = name self.plugRect = None self.labelRect = None self.links = WeakList() self.linked = WeakList() self._over = False self._base_color = QtCore.Qt.cyan self._color = self._base_color widget = UiFactory.widget(ui) self.widget = widget if left: widget.setLayoutDirection(QtCore.Qt.RightToLeft) widget.setStyleSheet("background: green") else: widget.setLayoutDirection(QtCore.Qt.LeftToRight) widget.setStyleSheet("background: red") widget.setMouseTracking(True) widget.setFocusPolicy(QtCore.Qt.NoFocus) widget.installEventFilter(self) layout.addWidget(widget)