def __init__(self, manager): Qt.QMainWindow.__init__(self) self.setWindowTitle("Log") path = os.path.dirname(__file__) self.setWindowIcon(Qt.QIcon(os.path.join(path, 'logIcon.png'))) self.wid = LogWidget(self, manager) self.wid.ui.input = Qt.QLineEdit() self.wid.ui.gridLayout.addWidget(self.wid.ui.input, 2, 0, 1, 3) self.wid.ui.dirLabel.setText("Current Storage Directory: None") self.setCentralWidget(self.wid) self.resize(1000, 500) self.manager = manager #global WIN global WIN WIN = self self.msgCount = 0 self.logCount = 0 self.logFile = None configfile.writeConfigFile( '', self.fileName() ) ## start a new temp log file, destroying anything left over from the last session. self.buttons = [ ] ## weak references to all Log Buttons get added to this list, so it's easy to make them all do things, like flash red. self.lock = Mutex() self.errorDialog = ErrorDialog() self.wid.ui.input.returnPressed.connect(self.textEntered) self.sigLogMessage.connect(self.queuedLogMsg, Qt.Qt.QueuedConnection)
def write(self, fileName=None): ## Write this task to a file. Called by TaskRunner.saveTask() info = self.saveState() if fileName is None: if self.fileName is None: raise Exception("Can not write task--no file name specified") fileName = self.fileName self.fileName = fileName configfile.writeConfigFile(info, fileName)
def save(self): try: if self.ui.fileCombo.isEditable(): #self.ui.fileCombo.lineEdit().releaseKeyboard() self.ui.fileCombo.setEditable(False) #print 'save clicked' name = str(self.ui.fileCombo.currentText()) if name == 'Load...': self.saveAs() return file = os.path.join(self.filePath, name) #print "save:", file state = self.saveState() configfile.writeConfigFile(state, file) self.loadedFile = str(name) self.refreshFileList() return True except: self.ui.saveBtn.failure("Error.") raise
def saveProtocol(self, handle): state = self.dumpProtocol() configfile.writeConfigFile(state, handle.name()) return True