def AddBlockInstance(self, context, *args):
        specific_values_tuple, specific_values_translation = \
            _SpecificValuesTuples.get(args[0][0], _BlockSpecificValues)

        if args[0][0] == "step" and len(self.SpecificValues) < 3 or \
           args[0][0] == "transition" and len(self.SpecificValues) < 4:
            self.SpecificValues.append([None])
        elif args[0][0] == "actionBlock" and len(self.SpecificValues) < 1:
            self.SpecificValues.append([[]])
        specific_values = specific_values_tuple(
            *_translate_args(specific_values_translation, self.SpecificValues))
        self.SpecificValues = None

        self.CurrentInstance = _BlockInstanceInfos(
            *(_translate_args([_StringValue, int] + [float] * 4, args) +
              [specific_values, [], []]))

        self.BlockInstances[self.CurrentInstance.id] = self.CurrentInstance
    def AddInstanceConnection(self, context, *args):
        connection_args = _translate_args(
            [_StringValue] * 2 + [_BoolValue, _StringValue] + [float] * 2,
            args)

        self.CurrentConnection = _InstanceConnectionInfos(
            *(connection_args[1:4] + [_Point(*connection_args[4:6]), []]))

        if self.CurrentInstance is not None:
            if connection_args[0] == "input":
                self.CurrentInstance.inputs.append(self.CurrentConnection)
            else:
                self.CurrentInstance.outputs.append(self.CurrentConnection)
        else:
            self.SpecificValues.append([self.CurrentConnection])
 def AddAction(self, context, *args):
     if len(self.SpecificValues) == 0:
         self.SpecificValues.append([[]])
     translated_args = _translate_args([_StringValue] * 5, args)
     self.SpecificValues[0][0].append(_ActionInfos(*translated_args))
 def AddLinkPoint(self, context, *args):
     self.CurrentLink.points.append(
         _Point(*_translate_args([float] * 2, args)))
 def AddConnectionLink(self, context, *args):
     self.CurrentLink = _ConnectionLinkInfos(
         *(_translate_args([int, _StringValue], args) + [[]]))
     self.CurrentConnection.links.append(self.CurrentLink)
 def AddVariable(self, context, *args):
     if self.Root is not None:
         self.Root.variables.append(
             _VariablesTreeItemInfos(*(_translate_args(
                 [_StringValue, class_extraction, _StringValue] +
                 [_BoolValue] * 2, args) + [[]])))
 def SetRoot(self, context, *args):
     self.Root = _VariablesTreeItemInfos(
         *([''] + _translate_args([class_extraction, _StringValue] +
                                  [_BoolValue] * 2, args) + [[]]))
示例#8
0
 def AddVariable(self, context, *args):
     self.Variables.append(
         _VariableInfos(
             *(_translate_args([_StringValue] * 5 + [_BoolValue] +
                               [_StringValue], args) +
               [self.GetType(), self.GetTree()])))
示例#9
0
 def AddDimension(self, context, *args):
     self.Dimensions.append(tuple(_translate_args([_StringValue] * 2,
                                                  args)))