def create_new_input(self, type_, label, widget_name=None, widget_pos='under', pos=-1, config=None): """Creates and adds a new input. Handy for subclasses.""" Debugger.debug('create_new_input called') pi = InputPortInstance(self, type_, label, config_data=config, widget_name=widget_name, widget_pos=widget_pos) if pos < -1: pos += len(self.inputs) if pos == -1: self.inputs.append(pi) self.add_input_to_layout(pi) else: self.inputs.insert(pos, pi) self.insert_input_into_layout(pos, pi) if not self.initializing: self.update_shape() self.update()
def setup_ports(self, inputs_config, outputs_config): for inp in inputs_config: pi = InputPortInstance( self, inp['type'], inp['label'], inp['widget data'] if inp['has widget'] else None) self.inputs.append(pi) for out in outputs_config: pi = OutputPortInstance(self, out['type'], out['label']) self.outputs.append(pi)
def create_new_input(self, type_, label, widget_type='', widget_name='', widget_pos='under', pos=-1): """Creates and adds a new input. Handy for subclasses.""" Debugger.debug('create_new_input called with widget pos:', widget_pos) pi = InputPortInstance(self, type_, label, widget_type=widget_type, widget_name=widget_name, widget_pos=widget_pos) if pos == -1: self.inputs.append(pi) self.add_input_to_layout(pi) else: self.inputs.insert(pos, pi) self.insert_input_into_layout(pos, pi) if not self.initializing: self.update_shape()
def create_new_input_from_config(self, input_config): """Called only at NI creation.""" pi = InputPortInstance(self, configuration=input_config) self.inputs.append(pi) self.add_input_to_layout(pi)