@@ -125,6 +125,9 @@ def model(self):
125125 """
126126 return self ._model
127127
128+ def set_graph (self , graph ):
129+ self ._graph = graph
130+
128131 def set_model (self , model ):
129132 """
130133 Set the node model.
@@ -234,7 +237,7 @@ def set_selected(self, selected=True):
234237 self .set_property ('selected' , selected )
235238
236239 def create_property (self , name , value , items = None , range = None ,
237- widget_type = NODE_PROP , tab = None ):
240+ widget_type = NODE_PROP , tab = None , ext = None ):
238241 """
239242 Creates a custom property to the node.
240243
@@ -247,7 +250,13 @@ def create_property(self, name, value, items=None, range=None,
247250 - :attr:`NodeGraphQt.constants.NODE_PROP_QCHECKBOX`
248251 - :attr:`NodeGraphQt.constants.NODE_PROP_QSPINBOX`
249252 - :attr:`NodeGraphQt.constants.NODE_PROP_COLORPICKER`
250- - :attr:`NodeGraphQt.constants.NODE_PROP_SLIDER`
253+ - :attr:`NodeGraphQt.constants.NODE_PROP_FILE`
254+ - :attr:`NodeGraphQt.constants.NODE_PROP_VECTOR2`
255+ - :attr:`NodeGraphQt.constants.NODE_PROP_VECTOR3`
256+ - :attr:`NodeGraphQt.constants.NODE_PROP_VECTOR4`
257+ - :attr:`NodeGraphQt.constants.NODE_PROP_FLOAT`
258+ - :attr:`NodeGraphQt.constants.NODE_PROP_INT`
259+ - :attr:`NodeGraphQt.constants.NODE_PROP_BUTTON`
251260
252261 See Also:
253262 :class:`NodeGraphQt.PropertiesBinWidget`
@@ -259,8 +268,9 @@ def create_property(self, name, value, items=None, range=None,
259268 range (tuple)): ``(min, max)`` values used by ``NODE_PROP_SLIDER``
260269 widget_type (int): widget flag to display in the ``PropertiesBinWidget``
261270 tab (str): name of the widget tab to display in the properties bin.
271+ ext (str): file ext of ``NODE_PROP_FILE``
262272 """
263- self .model .add_property (name , value , items , range , widget_type , tab )
273+ self .model .add_property (name , value , items , range , widget_type , tab , ext )
264274
265275 def properties (self ):
266276 """
@@ -557,9 +567,12 @@ def add_file_input(self, name, label='', text='', tab=None, ext="*"):
557567 tab (str): name of the widget tab to display in.
558568 ext (str): file ext
559569 """
560- self .create_property (
561- name , text , widget_type = NODE_PROP_FILE , tab = tab )
562- widget = NodeFilePath (self .view , name , label , text ,ext )
570+ self .model .add_property (name , text , None , None , NODE_PROP_FILE , tab , ext )
571+ # use create_property will cause strange error
572+ # self.create_property(
573+ # name, text, widget_type=NODE_PROP_FILE, tab=tab, ext=None)
574+
575+ widget = NodeFilePath (self .view , name , label , text , ext )
563576 widget .value_changed .connect (lambda k , v : self .set_property (k , v ))
564577 self .view .add_widget (widget )
565578
0 commit comments