Esempio n. 1
0
    def __compileSelectedInterfaces(self):
        """
        Private method to compile selected interfaces to python.
        """
        if self.omniidl is not None:
            items = self.getSelectedItems()

            files = [self.project.getRelativePath(unicode(itm.fileName())) for itm in items]
            numIDLs = len(files)
            progress = KQProgressDialog(self.trUtf8("Compiling interfaces..."), self.trUtf8("Abort"), 0, numIDLs, self)
            progress.setModal(True)
            progress.setMinimumDuration(0)
            i = 0

            for fn in files:
                progress.setValue(i)
                if progress.wasCanceled():
                    break
                proc = self.__compileIDL(fn, True, progress)
                if proc is not None:
                    while proc.state() == QProcess.Running:
                        QApplication.processEvents()
                        QThread.msleep(300)
                        QApplication.processEvents()
                else:
                    break
                i += 1

            progress.setValue(numIDLs)
Esempio n. 2
0
    def __compileAllInterfaces(self):
        """
        Private method to compile all interfaces to python.
        """
        if self.omniidl is not None:
            numIDLs = len(self.project.pdata["INTERFACES"])
            progress = KQProgressDialog(self.trUtf8("Compiling interfaces..."), self.trUtf8("Abort"), 0, numIDLs, self)
            progress.setModal(True)
            progress.setMinimumDuration(0)
            i = 0

            for fn in self.project.pdata["INTERFACES"]:
                progress.setValue(i)
                if progress.wasCanceled():
                    break
                proc = self.__compileIDL(fn, True, progress)
                if proc is not None:
                    while proc.state() == QProcess.Running:
                        QApplication.processEvents()
                        QThread.msleep(300)
                        QApplication.processEvents()
                else:
                    break
                i += 1

            progress.setValue(numIDLs)
 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
Esempio n. 4
0
 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
 def __annotateAll(self):
     """
     Private slot to handle the annotate all context menu action.
     
     This method produce an annotated coverage file of every
     file listed in the listview.
     """
     amount = self.resultList.topLevelItemCount()
     if amount == 0:
         return
     
     # get list of all filenames
     files = []
     for index in range(amount):
         itm = self.resultList.topLevelItem(index)
         files.append(unicode(itm.text(0)))
     
     cover = coverage(data_file = self.cfn)
     cover.use_cache(True)
     cover.exclude(unicode(self.excludeList[0]))
     cover.load()
     
     # now process them
     progress = KQProgressDialog(self.trUtf8("Annotating files..."), 
         self.trUtf8("Abort"), 0, len(files), self)
     progress.setMinimumDuration(0)
     count = 0
     
     for file in files:
         progress.setValue(count)
         if progress.wasCanceled():
             break
         cover.annotate([file], None)#, True)
         count += 1
     
     progress.setValue(len(files))
 def __regenerateProjectTasks(self):
     """
     Private slot to handle the "Regenerated projet tasks" context menu entry.
     """
     todoMarkers = unicode(Preferences.getTasks("TasksMarkers")).split()
     bugfixMarkers = unicode(Preferences.getTasks("TasksMarkersBugfix")).split()
     files = self.project.pdata["SOURCES"]
     
     # remove all project tasks
     self.clearProjectTasks(fileOnly=True)
     
     # now process them
     progress = KQProgressDialog(self.trUtf8("Extracting project tasks..."), 
         self.trUtf8("Abort"), 0, len(files))
     progress.setMinimumDuration(0)
     count = 0
     
     for file in files:
         progress.setLabelText(\
             self.trUtf8("Extracting project tasks...\n%1").arg(file))
         progress.setValue(count)
         QApplication.processEvents()
         if progress.wasCanceled():
             break
         
         fn = os.path.join(self.project.ppath, file)
         # read the file and split it into textlines
         try:
             f = open(fn, 'rb')
             text, encoding = Utilities.decode(f.read())
             lines = text.splitlines()
             f.close()
         except IOError:
             count += 1
             self.progress.setValue(count)
             continue
         
         # now search tasks and record them
         lineIndex = 0
         for line in lines:
             lineIndex += 1
             shouldContinue = False
             # normal tasks first
             for tasksMarker in todoMarkers:
                 index = line.find(tasksMarker)
                 if index > -1:
                     task = line[index:]
                     self.addFileTask(task, fn, lineIndex, False)
                     shouldContinue = True
                     break
             if shouldContinue:
                 continue
             
             # bugfix tasks second
             for tasksMarker in bugfixMarkers:
                 index = line.find(tasksMarker)
                 if index > -1:
                     task = line[index:]
                     self.addFileTask(task, fn, lineIndex, True)
                     shouldContinue = True
                     break
         
         count += 1
         
     progress.setValue(len(files))