Example #1
0
    def loadTestruns(self):
        thedir = str(".")
        filenames = QFileDialog.getOpenFileNames(
            self,
            caption=("%s - Load testruns" % QApplication.applicationName()),
            directory=thedir,
            filter=str("Testrun files (*.trn)"))
        if filenames:
            loadedtrs = 0
            notloadedtrs = 0
            for filename in filenames:
                try:
                    print(filename)
                    tr = TestRun.loadFromFile(str(filename))
                    try:
                        self.addTestrun(tr)
                    except Exception as e:
                        print(e)

                    loadedtrs += 1
                except Exception:
                    notloadedtrs += 1

            message = "Loaded %d/%d test runs" % (loadedtrs,
                                                  loadedtrs + notloadedtrs)
            self.updateStatus(message)

        pass
Example #2
0
    def saveParserAs(self):
        filename = str(
            QFileDialog.getSaveFileName(self,
                                        caption="%s - Save a parser" %
                                        QApplication.applicationName(),
                                        directory=str("."),
                                        filter=str("XML files (*.xml)")))
        if not filename:
            return

        misc.saveAsXML(self.parser, filename)
        self.filename = filename
        self.updateStatus("Saved parser to file %s" % filename)
Example #3
0
    def loadParser(self):
        thedir = str(".")
        filename = str(
            QFileDialog.getOpenFileName(self,
                                        caption="%s - Load a parser" %
                                        QApplication.applicationName(),
                                        directory=thedir,
                                        filter=str("XML files (*.xml)")))
        if filename:
            try:
                parser = ReaderManager.fromXMLFile(filename)
                message = "Loaded parser from %s" % filename
                self.setParser(parser)
            except Exception:
                message = "Error: Could not load parser from file %s" % filename

            self.updateStatus(message)
Example #4
0
 def setLogLevel( level, isDaemon):
     option = syslog.LOG_PID
     if not isDaemon:
         option |= syslog.LOG_PERROR
 
     syslog.openlog( str(QApplication.applicationName()),
                     option, syslog.LOG_USER)
     atexit.register(Application.cleanup)
     
     if level == 0:
         syslog.setlogmask(syslog.LOG_UPTO(syslog.LOG_WARNING))
     elif level == 1:
         syslog.setlogmask(syslog.LOG_UPTO( syslog.LOG_NOTICE))
     elif level == 2:
         syslog.setlogmask(syslog.LOG_UPTO(syslog.LOG_INFO))
     else:
         syslog.setlogmask(syslog.LOG_UPTO(syslog.LOG_DEBUG))
     syslog.syslog( syslog.LOG_INFO, "INFO   logging to syslog")
Example #5
0
    def loadOutputFiles(self):
        thedir = str(".")
        filenames = QFileDialog.getOpenFileNames(
            self,
            caption="%s - Load Output Files" % QApplication.applicationName(),
            directory=thedir,
            filter=str("All files (*.out)"))
        if filenames:
            loadedtrs = 0
            notloadedtrs = 0
            for filename in filenames:
                try:
                    ExperimentManagement.getExperiment().addOutputFile(
                        str(filename))

                    loadedtrs += 1
                except Exception as e:
                    self.updateStatus(e)
                    notloadedtrs += 1

            message = "Loaded %d/%d output files" % (loadedtrs,
                                                     loadedtrs + notloadedtrs)
            self.logfileview.updateExperimentData()
            self.updateStatus(message)