def _save(self): filenameQt = QtWidgets.QFileDialog.getSaveFileName( self, coTranslate('Create List'), coTranslate("ObjectList.txt"), coTranslate('TextFiles (*.txt)'), None, QtWidgets.QFileDialog.DontConfirmOverwrite) if filenameQt == "": return filename = str(filenameQt) if not filename.lower().endswith(".txt"): filename += ".txt" if os.path.exists(filename): asker = ReallyWantToOverrideAsker(self, filename) decicion = asker.exec_() if decicion == QtWidgets.QDialog.Rejected: self.statusBar().showMessage( coTranslate('Cancelled overwrite of "%s"') % filename) return doc = open(filename, mode="w") doc.write(unicode(self.textBrowser.toPlainText()).encode('utf8')) doc.close()
def takeSnapshot(self): _infoer.function = str(self.takeSnapshot) _infoer.write("") filename = "" if covise.coConfigIsOn("vr-prepare.ShowSnapshotDialog", True): directory = covise.getCoConfigEntry( "COVER.Plugin.PBufferSnapShot.Directory") if (directory == None): directory = "snapshot.png" else: directory = directory + "/" + "snapshot.png" filenameQt = QtWidgets.QFileDialog.getSaveFileName( self, self.__tr('Snapshot'), directory, self.__tr('Image (*.png)'), None, QtWidgets.QFileDialog.DontConfirmOverwrite) if filenameQt == "": return #filenameQt is filename + extension touple filename = filenameQt[0] print(filename) if not filename.lower().endswith(".png"): filename += ".png" if os.path.exists(filename): asker = ReallyWantToOverrideAsker(self, filename) decicion = asker.exec_() if decicion == QtWidgets.QDialog.Rejected: self.statusBar().showMessage( self.__tr('Cancelled overwrite of "%s"') % filename) return msg = coGRSnapshotMsg(filename, "snapOnce") covise.sendRendMsg(msg.c_str())
def takeSnapshot(self): _infoer.function = str(self.takeSnapshot) _infoer.write("") filename = "" if covise.coConfigIsOn("vr-prepare.ShowSnapshotDialog", True): directory = covise.getCoConfigEntry("COVER.Plugin.PBufferSnapShot.Directory") if (directory == None): directory = "snapshot.png" else: directory = directory + "/" + "snapshot.png" filenameQt = QtWidgets.QFileDialog.getSaveFileName( self, self.__tr('Snapshot'), directory, self.__tr('Image (*.png)'), None, QtWidgets.QFileDialog.DontConfirmOverwrite) if filenameQt == "": return #filenameQt is filename + extension touple filename = filenameQt[0] print(filename) if not filename.lower().endswith(".png"): filename += ".png" if os.path.exists(filename): asker = ReallyWantToOverrideAsker(self, filename) decicion = asker.exec_() if decicion == QtWidgets.QDialog.Rejected: self.statusBar().showMessage( self.__tr('Cancelled overwrite of "%s"') % filename ) return msg = coGRSnapshotMsg( filename, "snapOnce" ) covise.sendRendMsg(msg.c_str())
def setFilename(self): if self.checkFilename(): tmpFileName = unicode(self.widget().lineEdit.text()).encode('utf-8') if path.abspath(tmpFileName) != path.abspath(self.filename) and path.isfile(tmpFileName): asker = ReallyWantToOverrideAsker(self, tmpFileName) decicion = asker.exec_() if decicion == QtWidgets.QDialog.Rejected: self.widget().lineEdit.setText(self.oldFilename) self.filename = tmpFileName self.oldFilename = self.filename
def setFilename(self): if self.checkFilename(): tmpFileName = unicode( self.widget().lineEdit.text()).encode('utf-8') if path.abspath(tmpFileName) != path.abspath( self.filename) and path.isfile(tmpFileName): asker = ReallyWantToOverrideAsker(self, tmpFileName) decicion = asker.exec_() if decicion == QtWidgets.QDialog.Rejected: self.widget().lineEdit.setText(self.oldFilename) self.filename = tmpFileName self.oldFilename = self.filename