コード例 #1
0
    def __init__(self, ui, fileName=None):
        self.ui = ui

        if fileName is not None:
            self.fileName = fileName
            conf = configfile.readConfigFile(fileName)
            if 'protocol' not in conf:
                self.conf = conf
            else:
                self.conf = conf['protocol']
            if 'params' not in self.conf:
                self.conf['params'] = []

            if 'winState' in conf:
                self.conf['windowState'] = conf['winState']
            self.conf['windowState'] = Qt.QByteArray.fromPercentEncoding(
                self.conf['windowState'])

            self.devices = conf['devices']
            self.enabled = list(self.devices.keys())
        else:
            self.fileName = None
            self.enabled = []
            self.conf = {}
            self.devices = {}
            self.winState = None
コード例 #2
0
ファイル: TaskRunner.py プロジェクト: hiuwo/acq4
 def __init__(self, ui, fileName=None):
     self.ui = ui
     
     if fileName is not None:
         self.fileName = fileName
         conf = configfile.readConfigFile(fileName)
         if 'protocol' not in conf:
             self.conf = conf
         else:
             self.conf = conf['protocol']
         if 'params' not in self.conf:
             self.conf['params'] = []
             
         if 'winState' in conf:
             self.conf['windowState'] = conf['winState']
         self.conf['windowState'] = QtCore.QByteArray.fromPercentEncoding(self.conf['windowState'])
             
         #self.params = conf['params']
         self.devices = conf['devices']
         #self.winState = conf['winState']
         self.enabled = self.devices.keys()
     else:
         self.fileName = None
         #self.conf = {
             #'devices': {}, 
             #'duration': 0.2, 
             #'continuous': False, 
             #'cycleTime': 0.0
         #}
         self.enabled = []
         self.conf = {}
         self.devices = {}
         self.winState = None
コード例 #3
0
    def loadFile(self, f):
        """Load the file, f. f must be able to be read by configfile.py"""
        log = configfile.readConfigFile(f)
        self.entries = []
        self.entryArrayBuffer = np.zeros(len(log),
                                         dtype=[('index', 'int32'),
                                                ('importance', 'int32'),
                                                ('msgType', '|S10'),
                                                ('directory', '|S100'),
                                                ('entryId', 'int32')])
        self.entryArray = self.entryArrayBuffer[:]

        i = 0
        for k, v in log.items():
            v['id'] = k[
                9:]  ## record unique ID to facilitate HTML generation (javascript needs this ID)
            self.entries.append(v)
            self.entryArray[i] = np.array(
                [(i, v.get('importance', 5), v.get('msgType', 'status'),
                  v.get('currentDir', ''), v.get('entryId', v['id']))],
                dtype=[('index', 'int32'), ('importance', 'int32'),
                       ('msgType', '|S10'), ('directory', '|S100'),
                       ('entryId', 'int32')])
            i += 1

        self.filterEntries(
        )  ## puts all entries through current filters and displays the ones that pass
コード例 #4
0
ファイル: ColorMapper.py プロジェクト: outofculture/acq4
 def load(self, ind):
     #print "Index changed to:", ind
     if ind == 0:
         return
     name = str(self.ui.fileCombo.currentText())
     file = os.path.join(self.filePath, name)
     if not os.path.isfile(file):
         return
     state = configfile.readConfigFile(file)
     self.restoreState(state)
     self.loadedFile = name
コード例 #5
0
ファイル: ColorMapper.py プロジェクト: hiuwo/acq4
 def load(self, ind):
     # print "Index changed to:", ind
     if ind == 0:
         return
     name = str(self.ui.fileCombo.currentText())
     file = os.path.join(self.filePath, name)
     if not os.path.isfile(file):
         return
     state = configfile.readConfigFile(file)
     self.restoreState(state)
     self.loadedFile = name
コード例 #6
0
    def setLogDir(self, dh):
        if self.fileName() == dh.name():
            return

        oldfName = self.fileName()
        if self.logFile is not None:
            self.logMsg(
                'Moving log storage to %s.' %
                (self.logFile.name(relativeTo=self.manager.baseDir))
            )  ## make this note before we change the log file, so when a log ends, you know where it went after.

        self.logMsg(
            'Moving log storage to %s.' %
            (dh.name(relativeTo=self.manager.baseDir))
        )  ## make this note before we change the log file, so when a log ends, you know where it went after.

        if oldfName == 'tempLog.txt':
            with self.lock:
                temp = configfile.readConfigFile(oldfName)
        else:
            temp = {}

        if dh.exists('log.txt'):
            self.logFile = dh['log.txt']
            with self.lock:
                self.msgCount = len(
                    configfile.readConfigFile(self.logFile.name()))
            newTemp = {}
            for v in temp.values():
                self.msgCount += 1
                newTemp['LogEntry_' + str(self.msgCount)] = v
            self.saveEntry(newTemp)
        else:
            self.logFile = dh.createFile('log.txt')
            self.saveEntry(temp)

        self.logMsg('Moved log storage from %s to %s.' %
                    (oldfName, self.fileName()))
        self.wid.ui.dirLabel.setText("Current Storage Directory: " +
                                     self.fileName())
        self.manager.sigLogDirChanged.emit(dh)
コード例 #7
0
ファイル: LogWindow.py プロジェクト: hiuwo/acq4
    def setLogDir(self, dh):
        if self.fileName() == dh.name():
            return

        oldfName = self.fileName()
        if self.logFile is not None:
            self.logMsg(
                "Moving log storage to %s." % (self.logFile.name(relativeTo=self.manager.baseDir))
            )  ## make this note before we change the log file, so when a log ends, you know where it went after.

        self.logMsg(
            "Moving log storage to %s." % (dh.name(relativeTo=self.manager.baseDir))
        )  ## make this note before we change the log file, so when a log ends, you know where it went after.

        if oldfName == "tempLog.txt":
            with self.lock:
                temp = configfile.readConfigFile(oldfName)
        else:
            temp = {}

        if dh.exists("log.txt"):
            self.logFile = dh["log.txt"]
            with self.lock:
                self.msgCount = len(configfile.readConfigFile(self.logFile.name()))
            newTemp = {}
            for v in temp.values():
                self.msgCount += 1
                newTemp["LogEntry_" + str(self.msgCount)] = v
            self.saveEntry(newTemp)
        else:
            self.logFile = dh.createFile("log.txt")
            self.saveEntry(temp)

        self.logMsg("Moved log storage from %s to %s." % (oldfName, self.fileName()))
        self.wid.ui.dirLabel.setText("Current Storage Directory: " + self.fileName())
        self.manager.sigLogDirChanged.emit(dh)
コード例 #8
0
ファイル: LogWindow.py プロジェクト: hiuwo/acq4
    def loadFile(self, f):
        """Load the file, f. f must be able to be read by configfile.py"""
        log = configfile.readConfigFile(f)
        self.entries = []
        self.entryArrayBuffer = np.zeros(
            len(log),
            dtype=[
                ("index", "int32"),
                ("importance", "int32"),
                ("msgType", "|S10"),
                ("directory", "|S100"),
                ("entryId", "int32"),
            ],
        )
        self.entryArray = self.entryArrayBuffer[:]

        i = 0
        for k, v in log.iteritems():
            v["id"] = k[9:]  ## record unique ID to facilitate HTML generation (javascript needs this ID)
            self.entries.append(v)
            self.entryArray[i] = np.array(
                [
                    (
                        i,
                        v.get("importance", 5),
                        v.get("msgType", "status"),
                        v.get("currentDir", ""),
                        v.get("entryId", v["id"]),
                    )
                ],
                dtype=[
                    ("index", "int32"),
                    ("importance", "int32"),
                    ("msgType", "|S10"),
                    ("directory", "|S100"),
                    ("entryId", "int32"),
                ],
            )
            i += 1

        self.filterEntries()  ## puts all entries through current filters and displays the ones that pass
コード例 #9
0
 def loadProtocol(self, handle):
     self.newProtocol()
     state = configfile.readConfigFile(handle.name())
     return self.restoreProtocol(state)
コード例 #10
0
ファイル: analyzer.py プロジェクト: ablot/acq4
 def loadProtocol(self, handle):
     self.newProtocol()
     state = configfile.readConfigFile(handle.name())
     return self.restoreProtocol(state)