def translateAddConnectionAction(_action): operations = [] for _connection in _action.db_datas: source = DBPort(id=_connection.db_id, type='source', moduleId=_connection.db_sourceId, moduleName=_connection.db_sourceModule, sig=_connection.db_sourcePort) destination = DBPort(id=_connection.db_id, type='destination', moduleId=_connection.db_destinationId, moduleName=_connection.db_destinationModule, sig=_connection.db_destinationPort) connection = DBConnection(id=_connection.db_id, ports=[source, destination]) operation = DBAdd(id=_action.db_time, what='connection', objectId=_connection.db_id, data=connection) operations.append(operation) action = DBAction(id=_action.db_time, prevId=_action.db_parent, date=convertDate(_action.db_date), user=_action.db_user, operations=operations) return action
def translateChangeParameterAction(_action): operations = [] for _set in _action.db_datas: parameter = DBParameter(id=_set.db_parameterId, pos=_set.db_parameterId, name=_set.db_parameter, alias=_set.db_alias, val=_set.db_value, type=_set.db_type) function = DBFunction(id=_set.db_functionId, pos=_set.db_functionId, name=_set.db_function, parameters=[parameter]) operation = DBChange(id=_action.db_time, what='function', oldObjId=_set.db_functionId, parentObjId=_set.db_moduleId, parentObjType='module', data=function) operations.append(operation) action = DBAction(id=_action.db_time, prevId=_action.db_parent, date=convertDate(_action.db_date), user=_action.db_user, operations=operations) return action
def translateDeleteAnnotationAction(_action): operations = [] for _annotation in _action.db_datas: operation = DBDelete(id=_action.db_time, what='annotation', objectId=_annotation.db_key) operations.append(operation) action = DBAction(id=_action.db_time, prevId=_action.db_parent, date=convertDate(_action.db_date), user=_action.db_user, operations=operations) return action
def translateDeleteModuleAction(_action): operations = [] for _module in _action.db_datas: operation = DBDelete(id=_action.db_time, what='module', objectId=_module.db_moduleId) operations.append(operation) action = DBAction(id=_action.db_time, prevId=_action.db_parent, date=convertDate(_action.db_date), user=_action.db_user, operations=operations) return action
def translateDeleteFunctionAction(_action): operations = [] for _function in _action.db_datas: operation = DBDelete(id=_action.db_time, what='function', objectId=_function.db_functionId, parentObjId=_function.db_moduleId, parentObjType='module') operations.append(operation) action = DBAction(id=_action.db_time, prevId=_action.db_parent, date=convertDate(_action.db_date), user=_action.db_user, operations=operations) return action
def translateDeleteModulePortAction(_action): operations = [] for _portSpec in _action.db_datas: operation = DBDelete(id=_action.db_time, what='portSpec', objectId=(_portSpec.db_portName, _portSpec.db_portType), parentObjId=_portSpec.db_moduleId, parentObjType='module') operations.append(operation) action = DBAction(id=_action.db_time, prevId=_action.db_parent, date=convertDate(_action.db_date), user=_action.db_user, operations=operations) return action
def translateAddModuleAction(_action): operations = [] for _module in _action.db_datas: module = DBModule(id=_module.db_id, name=_module.db_name, cache=1, location=DBLocation(id=_module.db_id, x=_module.db_x, y=_module.db_y)) module.db_location.relative = False operation = DBAdd(id=_action.db_time, what='module', objectId=_module.db_id, data=module) operations.append(operation) action = DBAction(id=_action.db_time, prevId=_action.db_parent, date=convertDate(_action.db_date), user=_action.db_user, operations=operations) return action
def translateMoveModuleAction(_action): operations = [] for _location in _action.db_datas: location = DBLocation(id=_location.db_id, x=_location.db_dx, y=_location.db_dy) location.relative = True operation = DBChange(id=_action.db_time, what='location', oldObjId=_location.db_id, parentObjId=_location.db_id, parentObjType='module', data=location) operations.append(operation) action = DBAction(id=_action.db_time, prevId=_action.db_parent, date=convertDate(_action.db_date), user=_action.db_user, operations=operations) return action
def translateChangeAnnotationAction(_action): operations = [] for _annotation in _action.db_datas: if _annotation.db_key.strip() != '' or \ _annotation.db_value.strip() != '': annotation = DBAnnotation(id=-1, key=_annotation.db_key, value=_annotation.db_value) operation = DBChange(id=_action.db_time, what='annotation', oldObjId=_annotation.db_key, parentObjId=_annotation.db_moduleId, parentObjType='module', data=annotation) operations.append(operation) action = DBAction(id=_action.db_time, prevId=_action.db_parent, date=convertDate(_action.db_date), user=_action.db_user, operations=operations) return action
def translateAddModulePortAction(_action): operations = [] for _portSpec in _action.db_datas: # ids need to be checked portSpec = DBPortSpec(id=_portSpec.db_moduleId, name=_portSpec.db_portName, type=_portSpec.db_portType, spec=_portSpec.db_portSpec) operation = DBAdd(id=_action.db_time, what='portSpec', objectId=(_portSpec.db_portName, _portSpec.db_portType), parentObjId=_portSpec.db_moduleId, parentObjType='module', data=portSpec) operations.append(operation) action = DBAction(id=_action.db_time, prevId=_action.db_parent, date=convertDate(_action.db_date), user=_action.db_user, operations=operations) return action