def LoadDictionaries(path): dictionaries = {} dicts = listFiles(path, '*.xml', recurse=0) for dict in dicts: (name,choices) = LoadDictionary(dict) dictionaries[name] = choices return dictionaries
def LoadTransactions(path, fielddef, config): transDescs = [] cases = listFiles(path, '*.xml', recurse=0) for case in cases: transDesc = CreateTransDescObject(fielddef, case, config) transDescs.append(transDesc) return transDescs
def LoadPackageHeader(path, fielddef, config): transDescs = [] headers = listFiles(path, 'PackageHeader.xml', recurse=0) if len(headers) == 1: package = CreateTransDescObject(fielddef, headers[0], config) else: package = Package(fielddef, config) return package
def openProject(path): from ListFile import listFiles projects = listFiles(path, '*.prj', recurse=0) projects.sort() dlg = OpenProjectDialog(None, "Open Project", projects) dlg.CenterOnScreen() val = dlg.ShowModal() if (val == wx.ID_OK): pass dlg.Destroy() return dlg.theProject
def LoadCommandFuncsSuffix(suffix): func_hash = {} commands = listFiles('commands', 'command??'+suffix, recurse=0) for command in commands: # command = re.sub(r"commands\\", "", command) command = re.sub(r"commands\/", "", command) command = re.sub(suffix, "", command) module = __import__(command) for funcname in module.__dict__.keys(): m = re.match('^command_(..)$', funcname) if (m != None): if func_hash.has_key(m.group(1)): raise ValueError('command[' + m.group(1) + '] duplicated') func_hash[m.group(1)] = module.__dict__[funcname] return func_hash