@@ -798,7 +798,8 @@ def add_checkbox(self, name, label='', text='', state=False, tab=None):
798798 self .view .add_widget (widget )
799799
800800 def add_input (self , name = 'input' , multi_input = False , display_name = True ,
801- color = None , data_type = 'NoneType' , painter_func = None ):
801+ color = None , data_type = 'NoneType' , locked = False ,
802+ painter_func = None ):
802803 """
803804 Add input :class:`Port` to node.
804805
@@ -808,6 +809,7 @@ def add_input(self, name='input', multi_input=False, display_name=True,
808809 display_name (bool): display the port name on the node.
809810 color (tuple): initial port color (r, g, b) ``0-255``.
810811 data_type (str): port data type name.
812+ locked (bool): locked state see :meth:`Port.set_locked`
811813 painter_func (function): custom function to override the drawing
812814 of the port shape see example: :ref:`Creating Custom Shapes`
813815
@@ -818,7 +820,7 @@ def add_input(self, name='input', multi_input=False, display_name=True,
818820 raise PortRegistrationError (
819821 'port name "{}" already registered.' .format (name ))
820822
821- port_args = [name , multi_input , display_name ]
823+ port_args = [name , multi_input , display_name , locked ]
822824 if painter_func and callable (painter_func ):
823825 port_args .append (painter_func )
824826 view = self .view .add_input (* port_args )
@@ -833,12 +835,14 @@ def add_input(self, name='input', multi_input=False, display_name=True,
833835 port .model .display_name = display_name
834836 port .model .multi_connection = multi_input
835837 port .model .data_type = data_type
838+ port .model .locked = locked
836839 self ._inputs .append (port )
837840 self .model .inputs [port .name ()] = port .model
838841 return port
839842
840843 def add_output (self , name = 'output' , multi_output = True , display_name = True ,
841- color = None , data_type = 'NoneType' , painter_func = None ):
844+ color = None , data_type = 'NoneType' , locked = False ,
845+ painter_func = None ):
842846 """
843847 Add output :class:`Port` to node.
844848
@@ -848,6 +852,7 @@ def add_output(self, name='output', multi_output=True, display_name=True,
848852 display_name (bool): display the port name on the node.
849853 color (tuple): initial port color (r, g, b) ``0-255``.
850854 data_type(str): port data type name.
855+ locked (bool): locked state see :meth:`Port.set_locked`
851856 painter_func (function): custom function to override the drawing
852857 of the port shape see example: :ref:`Creating Custom Shapes`
853858
@@ -858,7 +863,7 @@ def add_output(self, name='output', multi_output=True, display_name=True,
858863 raise PortRegistrationError (
859864 'port name "{}" already registered.' .format (name ))
860865
861- port_args = [name , multi_output , display_name ]
866+ port_args = [name , multi_output , display_name , locked ]
862867 if painter_func and callable (painter_func ):
863868 port_args .append (painter_func )
864869 view = self .view .add_output (* port_args )
@@ -872,6 +877,7 @@ def add_output(self, name='output', multi_output=True, display_name=True,
872877 port .model .display_name = display_name
873878 port .model .multi_connection = multi_output
874879 port .model .data_type = data_type
880+ port .model .locked = locked
875881 self ._outputs .append (port )
876882 self .model .outputs [port .name ()] = port .model
877883 return port
0 commit comments