From: <ki...@us...> - 2003-02-18 18:42:11
|
Update of /cvsroot/pymerase/pymerase/output In directory sc8-pr-cvs1:/tmp/cvs-serv26900 Modified Files: CreatePyTkWidgets.py Log Message: formatting clean up, docs Index: CreatePyTkWidgets.py =================================================================== RCS file: /cvsroot/pymerase/pymerase/output/CreatePyTkWidgets.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** CreatePyTkWidgets.py 12 Feb 2003 19:57:11 -0000 1.12 --- CreatePyTkWidgets.py 18 Feb 2003 18:42:08 -0000 1.13 *************** *** 88,98 **** def copyLib(destination, templateDict): ! path, file = os.path.split(HelperUtil.__file__) path = os.path.join(path, "lib") search = os.path.join(path, "*.py") ! TEMPLATE_FILES = [os.path.join(path, "dbSession.py")] ! filesToCopy = glob.glob(search) --- 88,103 ---- def copyLib(destination, templateDict): ! """ ! Copies lib files to destination directory and add ! required information to specific lib files. ! """ path, file = os.path.split(HelperUtil.__file__) path = os.path.join(path, "lib") search = os.path.join(path, "*.py") ! #List of files that need more inforation before copying ! template_files = [os.path.join(path, "dbSession.py")] ! ! #Retive files to copy filesToCopy = glob.glob(search) *************** *** 102,109 **** filePath, fileName = os.path.split(file) fileDest = os.path.join(destination, fileName) ! ! if file not in TEMPLATE_FILES: print '%s' % (fileName) shutil.copyfile(file, fileDest) else: print '%s' % (fileName) --- 107,116 ---- filePath, fileName = os.path.split(file) fileDest = os.path.join(destination, fileName) ! ! #If not a template file, copy ! if file not in template_files: print '%s' % (fileName) shutil.copyfile(file, fileDest) + #Else, add information, then copy else: print '%s' % (fileName) *************** *** 121,125 **** def getAssociationByName(assocList, name): ! for assoc in assocList: if assoc.getOppositeEnd().getAttributeName(DBAPI_TRANSLATOR) == name: --- 128,134 ---- def getAssociationByName(assocList, name): ! """ ! getAssociationByName->association or None ! """ for assoc in assocList: if assoc.getOppositeEnd().getAttributeName(DBAPI_TRANSLATOR) == name: *************** *** 136,139 **** --- 145,150 ---- """ + #Information required to copy all lib files + # (Needs more information) templateDict = {} *************** *** 143,151 **** print "" print "" ! checkDestination(destination) util = HelperUtil.HelperUtil() copyLib(destination, templateDict) --- 154,163 ---- print "" print "" ! checkDestination(destination) util = HelperUtil.HelperUtil() + #Copy lib files with additional information copyLib(destination, templateDict) *************** *** 172,175 **** --- 184,189 ---- type = attrib.getType().getSQLType() + #Check to see if an attribute is also an association, + # if so, change type to 'FK' if attrib.getName(DBAPI_TRANSLATOR) in assocAttribNameList: type = "FK" *************** *** 184,188 **** #Process Foreign Keys if type == "FK": ! assoc = getAssociationByName(assocList, attrib.getName(DBAPI_TRANSLATOR)) code = util.processFkVarElement(attrib, assoc.getOppositeEnd(), --- 198,203 ---- #Process Foreign Keys if type == "FK": ! assoc = getAssociationByName(assocList, ! attrib.getName(DBAPI_TRANSLATOR)) code = util.processFkVarElement(attrib, assoc.getOppositeEnd(), *************** *** 190,194 **** code) code = re.sub('%GET_FUNCTION%', ! util.makeGetLabelIntegerEntry(attrib.getName(DBAPI_TRANSLATOR)), code) code = re.sub('%GET_FUNCTION%', --- 205,209 ---- code) code = re.sub('%GET_FUNCTION%', ! util.makeGetLabelIntegerEntry(attrib.getName(DBAPI_TRANSLATOR)), code) code = re.sub('%GET_FUNCTION%', *************** *** 202,209 **** code) #code = re.sub('%SET_FUNCTION%', ! # util.makeSelectOptionMenuItem(attrib.getName(DBAPI_TRANSLATOR)), # code) #code = re.sub('%SET_FUNCTION%', ! # util.makeAppendOptionMenu(attrib.getName(DBAPI_TRANSLATOR)), # code) --- 217,224 ---- code) #code = re.sub('%SET_FUNCTION%', ! # util.makeSelectOptionMenuItem(attrib.getName(DBAPI_TRANSLATOR)), # code) #code = re.sub('%SET_FUNCTION%', ! # util.makeAppendOptionMenu(attrib.getName(DBAPI_TRANSLATOR)), # code) *************** *** 211,220 **** elif type == "integer": code = re.sub('%VAR_ELEMENT%', ! util.makeLabelIntegerEntry(attrib.getName(DBAPI_TRANSLATOR), ! attrib.getName(TRANSLATOR_NAME), ! attrib.isRequired()), code) code = re.sub('%GET_FUNCTION%', ! util.makeGetLabelIntegerEntry(attrib.getName(DBAPI_TRANSLATOR)), code) --- 226,235 ---- elif type == "integer": code = re.sub('%VAR_ELEMENT%', ! util.makeLabelIntegerEntry(attrib.getName(DBAPI_TRANSLATOR), ! attrib.getName(TRANSLATOR_NAME), ! attrib.isRequired()), code) code = re.sub('%GET_FUNCTION%', ! util.makeGetLabelIntegerEntry(attrib.getName(DBAPI_TRANSLATOR)), code) *************** *** 224,237 **** elif type == "double precision": code = re.sub('%VAR_ELEMENT%', ! util.makeLabelFloatEntry(attrib.getName(DBAPI_TRANSLATOR), ! attrib.getName(TRANSLATOR_NAME), ! attrib.isRequired()), code) code = re.sub('%GET_FUNCTION%', ! util.makeGetLabelFloatEntry(attrib.getName(DBAPI_TRANSLATOR)), code) code = re.sub('%SET_FUNCTION%', ! util.makeSetLabelEntry(attrib.getName(DBAPI_TRANSLATOR)), code) elif type == "name": --- 239,252 ---- elif type == "double precision": code = re.sub('%VAR_ELEMENT%', ! util.makeLabelFloatEntry(attrib.getName(DBAPI_TRANSLATOR), ! attrib.getName(TRANSLATOR_NAME), ! attrib.isRequired()), code) code = re.sub('%GET_FUNCTION%', ! util.makeGetLabelFloatEntry(attrib.getName(DBAPI_TRANSLATOR)), code) code = re.sub('%SET_FUNCTION%', ! util.makeSetLabelEntry(attrib.getName(DBAPI_TRANSLATOR)), code) elif type == "name": *************** *** 251,262 **** util.makeSetLabelText(attrib.getName(DBAPI_TRANSLATOR)), code) ! pass #Process Variable Characters elif PymeraseType.isVarchar(type): code = re.sub('%VAR_ELEMENT%', ! util.makeLabelMaxLengthEntry(attrib.getName(DBAPI_TRANSLATOR), ! attrib.getName(TRANSLATOR_NAME), ! int(PymeraseType.getVarcharLen(type)), ! attrib.isRequired()), code) code = re.sub('%GET_FUNCTION%', --- 266,277 ---- util.makeSetLabelText(attrib.getName(DBAPI_TRANSLATOR)), code) ! #Process Variable Characters elif PymeraseType.isVarchar(type): code = re.sub('%VAR_ELEMENT%', ! util.makeLabelMaxLengthEntry(attrib.getName(DBAPI_TRANSLATOR), ! attrib.getName(TRANSLATOR_NAME), ! int(PymeraseType.getVarcharLen(type)), ! attrib.isRequired()), code) code = re.sub('%GET_FUNCTION%', *************** *** 271,278 **** elif PymeraseType.isChar(type): code = re.sub('%VAR_ELEMENT%', ! util.makeLabelMaxLengthEntry(attrib.getName(DBAPI_TRANSLATOR), ! attrib.getName(TRANSLATOR_NAME), ! 1, ! attrib.isRequired()), code) code = re.sub('%GET_FUNCTION%', --- 286,293 ---- elif PymeraseType.isChar(type): code = re.sub('%VAR_ELEMENT%', ! util.makeLabelMaxLengthEntry(attrib.getName(DBAPI_TRANSLATOR), ! attrib.getName(TRANSLATOR_NAME), ! 1, ! attrib.isRequired()), code) code = re.sub('%GET_FUNCTION%', *************** *** 292,299 **** code) code = re.sub('%GET_FUNCTION%', ! util.makeGetRadioBoolean(attrib.getName(DBAPI_TRANSLATOR)), code) code = re.sub('%SET_FUNCTION%', ! util.makeSetRadioBoolean(attrib.getName(DBAPI_TRANSLATOR)), code) #Process Time Stamps --- 307,314 ---- code) code = re.sub('%GET_FUNCTION%', ! util.makeGetRadioBoolean(attrib.getName(DBAPI_TRANSLATOR)), code) code = re.sub('%SET_FUNCTION%', ! util.makeSetRadioBoolean(attrib.getName(DBAPI_TRANSLATOR)), code) #Process Time Stamps |