Exemplo n.º 1
0
 def icon(self, path=None):
     self._properties['icon'] = path
     path = path or ICON_NODE_BASE
     pixmap = QtGui.QPixmap(path)
     if pixmap.size().height() > NODE_ICON_SIZE:
         pixmap = pixmap.scaledToHeight(NODE_ICON_SIZE,
                                        QtCore.Qt.SmoothTransformation)
     self._icon_item.setPixmap(pixmap)
     if self.scene():
         self.post_init()
Exemplo n.º 2
0
 def __init__(self, name='node', parent=None):
     super(NodeItem, self).__init__(name, parent)
     pixmap = QtGui.QPixmap(ICON_NODE_BASE)
     if pixmap.size().height() > NODE_ICON_SIZE:
         pixmap = pixmap.scaledToHeight(NODE_ICON_SIZE,
                                        QtCore.Qt.SmoothTransformation)
     self._properties['icon'] = ICON_NODE_BASE
     self._icon_item = QtWidgets.QGraphicsPixmapItem(pixmap, self)
     self._icon_item.setTransformationMode(QtCore.Qt.SmoothTransformation)
     self._text_item = QtWidgets.QGraphicsTextItem(self.name, self)
     self._x_item = XDisabledItem(self, 'DISABLED')
     self._input_items = {}
     self._output_items = {}
     self._widgets = {}