コード例 #1
0
 def __init__(self, node=None):
     assert node, 'node cannot be None.'
     self._graph = None
     self._model = NodeModel()
     self._model.type_ = self.type_
     self._model.name = self.NODE_NAME
     self._view = node
     self._view.type_ = self.type_
     self._view.name = self.model.name
     self._view.id = self._model.id
コード例 #2
0
 def __init__(self, qgraphics_item=None):
     assert qgraphics_item, 'qgraphics item cannot be None.'
     self._graph = None
     self._model = NodeModel()
     self._model.type_ = self.type_
     self._model.name = self.NODE_NAME
     self._view = qgraphics_item
     self._view.type_ = self.type_
     self._view.name = self.model.name
     self._view.id = self._model.id
コード例 #3
0
ファイル: node.py プロジェクト: jchanvfx/NodeGraphQt
    def __init__(self, qgraphics_views=None):
        self._graph = None
        self._model = NodeModel()
        self._model.type_ = self.type_
        self._model.name = self.NODE_NAME

        _NodeItem = None
        if NODE_LAYOUT_DIRECTION is NODE_LAYOUT_VERTICAL:
            _NodeItem = qgraphics_views.get(NODE_LAYOUT_VERTICAL)
        elif NODE_LAYOUT_DIRECTION is NODE_LAYOUT_HORIZONTAL:
            _NodeItem = qgraphics_views.get(NODE_LAYOUT_HORIZONTAL)

        if _NodeItem is None:
            raise ValueError(
                'qgraphics item for the {} node layout can\'t be None!'.format(
                    {
                        NODE_LAYOUT_VERTICAL: 'vertical',
                        NODE_LAYOUT_HORIZONTAL: 'horizontal'
                    }[NODE_LAYOUT_DIRECTION]))

        self._view = _NodeItem()
        self._view.type_ = self.type_
        self._view.name = self.model.name
        self._view.id = self._model.id