Exemple #1
0
def convert_operation_list(ops):
    for op in ops:
        if op.vtType == 'add':
            AddOp.convert(op)
        elif op.vtType == 'change':
            ChangeOp.convert(op)
        elif op.vtType == 'delete':
            DeleteOp.convert(op)
        else:
            raise TypeError("Unknown operation type '%s'" % op.vtType)
Exemple #2
0
 def convert(_action):
     if _action.__class__ == Action:
         return
     _action.__class__ = Action
     for _annotation in _action.annotations:
         Annotation.convert(_annotation)
     for _operation in _action.operations:
         if _operation.vtType == 'add':
             AddOp.convert(_operation)
         elif _operation.vtType == 'change':
             ChangeOp.convert(_operation)
         elif _operation.vtType == 'delete':
             DeleteOp.convert(_operation)
         else:
             raise TypeError("Unknown operation type '%s'" %
                             _operation.vtType)
 def convert(_action):
     if _action.__class__ == Action:
         return
     _action.__class__ = Action
     for _annotation in _action.annotations:
         Annotation.convert(_annotation)
     for _operation in _action.operations:
         if _operation.vtType == 'add':
             AddOp.convert(_operation)
         elif _operation.vtType == 'change':
             ChangeOp.convert(_operation)
         elif _operation.vtType == 'delete':
             DeleteOp.convert(_operation)
         else:
             raise TypeError("Unknown operation type '%s'" %
                             _operation.vtType)
Exemple #4
0
    def create_vistrail(self):
        vistrail = Vistrail()

        m = Module(id=vistrail.idScope.getNewId(Module.vtType),
                   name='Float',
                   package=get_vistrails_basic_pkg_id())
        add_op = AddOp(id=vistrail.idScope.getNewId(AddOp.vtType),
                       what=Module.vtType,
                       objectId=m.id,
                       data=m)
        function_id = vistrail.idScope.getNewId(ModuleFunction.vtType)
        function = ModuleFunction(id=function_id, name='value')
        change_op = ChangeOp(id=vistrail.idScope.getNewId(ChangeOp.vtType),
                             what=ModuleFunction.vtType,
                             oldObjId=2,
                             newObjId=function.real_id,
                             parentObjId=m.id,
                             parentObjType=Module.vtType,
                             data=function)
        param = ModuleParam(id=vistrail.idScope.getNewId(ModuleParam.vtType),
                            type='Integer',
                            val='1')
        delete_op = DeleteOp(id=vistrail.idScope.getNewId(DeleteOp.vtType),
                             what=ModuleParam.vtType,
                             objectId=param.real_id,
                             parentObjId=function.real_id,
                             parentObjType=ModuleFunction.vtType)

        action1 = Action(id=vistrail.idScope.getNewId(Action.vtType),
                         operations=[add_op])
        action2 = Action(id=vistrail.idScope.getNewId(Action.vtType),
                         operations=[change_op, delete_op])

        vistrail.add_action(action1, 0)
        vistrail.add_action(action2, action1.id)
        vistrail.addTag('first action', action1.id)
        vistrail.addTag('second action', action2.id)
        return vistrail