def __buildModulesDict(self): """ Private method to build a dictionary of modules contained in the package. @return dictionary of modules contained in the package. """ moduleDict = {} modules = glob.glob(Utilities.normjoinpath(self.packagePath,'*.py')) + \ glob.glob(Utilities.normjoinpath(self.packagePath,'*.pyw')) + \ glob.glob(Utilities.normjoinpath(self.packagePath,'*.ptl')) tot = len(modules) progress = KQProgressDialog(self.trUtf8("Parsing modules..."), QString(), 0, tot, self) try: prog = 0 progress.show() QApplication.processEvents() for module in modules: progress.setValue(prog) QApplication.processEvents() prog = prog + 1 try: mod = Utilities.ModuleParser.readModule(module, caching = False) except ImportError: continue else: name = mod.name if name.startswith(self.package): name = name[len(self.package) + 1:] moduleDict[name] = mod finally: progress.setValue(tot) return moduleDict
def __buildModulesDict(self): """ Private method to build a dictionary of modules contained in the application. @return dictionary of modules contained in the application. """ moduleDict = {} mods = self.project.pdata["SOURCES"] modules = [] for module in mods: modules.append(Utilities.normabsjoinpath(self.project.ppath, module)) tot = len(modules) progress = KQProgressDialog(self.trUtf8("Parsing modules..."), QString(), 0, tot, self) try: prog = 0 progress.show() QApplication.processEvents() for module in modules: progress.setValue(prog) QApplication.processEvents() prog += 1 if module.endswith("__init__.py"): continue try: mod = Utilities.ModuleParser.readModule(module) except ImportError: continue else: name = mod.name moduleDict[name] = mod finally: progress.setValue(tot) return moduleDict