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 capture(self): if self.mode == 2: # free capturing if not self.freeCapture: # start capture and rename button to stop capture self.freeCapture = True self.widget().buttonCapture.setText(coTranslate("Stop Free Capturing")) msg = coGRSnapshotMsg(self.filename, "startCapturing") covise.sendRendMsg(msg.c_str()) else: # stop capturing self.freeCapture = False self.widget().buttonCapture.setText(coTranslate("Start Free Capturing")) msg = coGRSnapshotMsg(self.filename, "stopCapturing") covise.sendRendMsg(msg.c_str()) elif self.mode == 0: # turntable animation 10 sec if self.freeCapture: self.freeCapture = False msg = coGRSnapshotMsg(self.filename, "stopCapturing") covise.sendRendMsg(msg.c_str()) msg = coGRSnapshotMsg(self.filename, "startCapturing") covise.sendRendMsg(msg.c_str()) msg = coGRTurnTableAnimationMsg(10.0) covise.sendRendMsg(msg.c_str()) else: # turntable animation 20 sec if self.freeCapture: self.freeCapture = False msg = coGRSnapshotMsg(self.filename, "stopCapturing") covise.sendRendMsg(msg.c_str()) msg = coGRSnapshotMsg(self.filename, "startCapturing") covise.sendRendMsg(msg.c_str()) msg = coGRTurnTableAnimationMsg(20.0) covise.sendRendMsg(msg.c_str())
def __init__(self, parent=None): Ui_SceneObjectListWindowBase.__init__(self, parent) self.saveButton.clicked.connect(self._save) self.setupUi(self) objects = [] tempObjects = ObjectMgr.ObjectMgr().getAllElementsOfType( VIS_SCENE_OBJECT) for so in tempObjects: if (so.params.product_line == u"Lights") or (so.params.product_line == u"Ceiling Pendants"): objects.append(so) text = unicode(coTranslate("List of objects\n")) text = text + u"==============================================\n" text = text + u"\n" for so in objects: text = text + so.params.name + u"\n" text = text + u"\n" text = text + u"\n" text = text + unicode(coTranslate("Details\n")) text = text + u"==============================================\n" for so in objects: text = text + u"\n" text = text + so.params.name + u"\n" text = text + so.params.description + u"\n" text = text + u"----------------------------------------------\n" self.textBrowser.setPlainText(text)
def capture(self): if self.mode == 2: # free capturing if not self.freeCapture: # start capture and rename button to stop capture self.freeCapture = True self.widget().buttonCapture.setText( coTranslate("Stop Free Capturing")) msg = coGRSnapshotMsg(self.filename, "startCapturing") covise.sendRendMsg(msg.c_str()) else: # stop capturing self.freeCapture = False self.widget().buttonCapture.setText( coTranslate("Start Free Capturing")) msg = coGRSnapshotMsg(self.filename, "stopCapturing") covise.sendRendMsg(msg.c_str()) elif self.mode == 0: # turntable animation 10 sec if self.freeCapture: self.freeCapture = False msg = coGRSnapshotMsg(self.filename, "stopCapturing") covise.sendRendMsg(msg.c_str()) msg = coGRSnapshotMsg(self.filename, "startCapturing") covise.sendRendMsg(msg.c_str()) msg = coGRTurnTableAnimationMsg(10.0) covise.sendRendMsg(msg.c_str()) else: # turntable animation 20 sec if self.freeCapture: self.freeCapture = False msg = coGRSnapshotMsg(self.filename, "stopCapturing") covise.sendRendMsg(msg.c_str()) msg = coGRSnapshotMsg(self.filename, "startCapturing") covise.sendRendMsg(msg.c_str()) msg = coGRTurnTableAnimationMsg(20.0) covise.sendRendMsg(msg.c_str())
def __init__(self, parent=None): Ui_SceneObjectListWindowBase.__init__(self, parent) self.saveButton.clicked.connect(self._save) self.setupUi(self) objects = [] tempObjects = ObjectMgr.ObjectMgr().getAllElementsOfType(VIS_SCENE_OBJECT) for so in tempObjects: if (so.params.product_line == u"Lights") or (so.params.product_line == u"Ceiling Pendants"): objects.append(so) text = unicode(coTranslate("List of objects\n")) text = text + u"==============================================\n" text = text + u"\n" for so in objects: text = text + so.params.name + u"\n" text = text + u"\n" text = text + u"\n" text = text + unicode(coTranslate("Details\n")) text = text + u"==============================================\n" for so in objects: text = text + u"\n" text = text + so.params.name + u"\n" text = text + so.params.description + u"\n" text = text + u"----------------------------------------------\n" self.textBrowser.setPlainText(text)
def __init__(self, parent=None): QtWidgets.QWidget.__init__(self, parent) Ui_DatasetInformationPanelBase.__init__(self) self.setupUi(self) TransformManager.__init__(self, self.emitDataChanged, True) self.__key = -1 self.lineEditNameDataset.setText( coTranslate('<ds-filename not set yet>')) self.__dsNumberGeometryObjects = 0 self.__dsNumberOfGrids = 0 self.__dsConversionDate = coTranslate('<ds-date not set yet>') self.__inUseNumberGeometryObjects = 0 self.__inUseNumberOfGrids = 0 self.__updateFromIntern() # hide dummy information for "content" self.vrpFrameInformation.hide() #validators: # allow only double values for transform lineEdits doubleValidator = QtGui.QDoubleValidator(self) self.floatX.setValidator(doubleValidator) self.floatY.setValidator(doubleValidator) self.floatZ.setValidator(doubleValidator)
def selectMode(self): self.mode = self.widget().comboBox.currentIndex() if self.mode == 2: # free capturing, disable preview, rename the capture button self.widget().buttonCapture.setText(coTranslate("Start Free Capturing")) self.widget().buttonPreview.setVisible(False) else: self.widget().buttonPreview.setVisible(True) self.widget().buttonCapture.setText(coTranslate("Capture Animation")) if self.freeCapture: # stop capturing msg = coGRSnapshotMsg(self.filename, "stopCapturing") covise.sendRendMsg(msg.c_str())
def selectMode(self): self.mode = self.widget().comboBox.currentIndex() if self.mode == 2: # free capturing, disable preview, rename the capture button self.widget().buttonCapture.setText( coTranslate("Start Free Capturing")) self.widget().buttonPreview.setVisible(False) else: self.widget().buttonPreview.setVisible(True) self.widget().buttonCapture.setText( coTranslate("Capture Animation")) if self.freeCapture: # stop capturing msg = coGRSnapshotMsg(self.filename, "stopCapturing") covise.sendRendMsg(msg.c_str())
def __init__(self, parent): QtWidgets.QDockWidget.__init__(self, coTranslate("Video Capture Manager"), parent) self.setWidget(VideoCaptureManagerBase(self)) #connection of the DockWidget visibilityChanged self.visibilityChanged.connect(self.visibilityChangedS) # connection of buttons self.widget().buttonCapture.clicked.connect(self.capture) self.widget().buttonPreview.clicked.connect(self.startPreview) self.widget().comboBox.activated.connect(self.selectMode) # connect open self.widget().pushButton.clicked.connect(self.openFile) # connect filename self.widget().lineEdit.returnPressed.connect(self.setFilename) self.widget().lineEdit.editingFinished.connect(self.checkFilename) self.widget().groupSettings.setVisible(True) self.widget().groupCapturing.setVisible(True) #self.recording = False; self.filename = "C:\capture.wmv" if covise.coConfigIsOn("COVER.Plugin.Video", False): filename = covise.getCoConfigEntry("COVER.Plugin.Video.Filename") if filename: self.filename = filename self.widget().lineEdit.setText(self.filename) self.oldFilename = self.filename self.freeCapture = False self.mode=0
def __updateFromIntern(self): casefileInfoFmtString = coTranslate('''Format: "COVISE casefile". Converted from EnSight 6.0 to COVISE. Conversion date: %ss.''') newText = casefileInfoFmtString % self.__dsConversionDate self.textEditInformation.setText(newText) caseUseInfoFmtString = coTranslate('''All available Objects: %(numAllGeoObjects)6d Geometry Objects %(numAllGridObjects)6d Grids Selected Objects for COVISE Project: %(numInUseGeoObjects)6d Geometry Objects %(numInUseGridObjects)6d Grids''') self.textEditContent.setText(caseUseInfoFmtString % { 'numAllGeoObjects': self.__dsNumberGeometryObjects, 'numAllGridObjects': self.__dsNumberOfGrids, 'numInUseGeoObjects': self.__inUseNumberGeometryObjects, 'numInUseGridObjects': self.__inUseNumberOfGrids, })
def __updateFromIntern(self): casefileInfoFmtString = coTranslate('''Format: "COVISE casefile". Converted from EnSight 6.0 to COVISE. Conversion date: %ss.''') newText = casefileInfoFmtString % self.__dsConversionDate self.textEditInformation.setText(newText) caseUseInfoFmtString = coTranslate('''All available Objects: %(numAllGeoObjects)6d Geometry Objects %(numAllGridObjects)6d Grids Selected Objects for COVISE Project: %(numInUseGeoObjects)6d Geometry Objects %(numInUseGridObjects)6d Grids''') self.textEditContent.setText( caseUseInfoFmtString % { 'numAllGeoObjects': self.__dsNumberGeometryObjects, 'numAllGridObjects': self.__dsNumberOfGrids, 'numInUseGeoObjects': self.__inUseNumberGeometryObjects, 'numInUseGridObjects': self.__inUseNumberOfGrids, })
def openFile(self): fd = QtWidgets.QFileDialog(self) fd.setMinimumWidth(654) fd.setMinimumHeight(488) fd.setNameFilter(coTranslate("Windows Media Video (*.wmv)")) fd.setWindowTitle(coTranslate('Save As...')) fd.setAcceptMode(QtWidgets.QFileDialog.AcceptSave) fd.setConfirmOverwrite(False) tmpFileName = unicode(self.widget().lineEdit.text()).encode('utf-8') if path.exists(tmpFileName): fd.setDirectory(tmpFileName) else: fd.setDirectory(getenv("COVISEDIR")) acceptedOrRejected = fd.exec_() if acceptedOrRejected != QtWidgets.QDialog.Accepted or fd.selectedFiles().isEmpty(): return tmpFileName = unicode(fd.selectedFiles()[0]).encode('utf-8') if not tmpFileName == "": if not tmpFileName.endswith(".wmv"): tmpFileName += ".wmv" self.widget().lineEdit.setText(tmpFileName) self.setFilename()
def openFile(self): fd = QtWidgets.QFileDialog(self) fd.setMinimumWidth(654) fd.setMinimumHeight(488) fd.setNameFilter(coTranslate("Windows Media Video (*.wmv)")) fd.setWindowTitle(coTranslate('Save As...')) fd.setAcceptMode(QtWidgets.QFileDialog.AcceptSave) fd.setConfirmOverwrite(False) tmpFileName = unicode(self.widget().lineEdit.text()).encode('utf-8') if path.exists(tmpFileName): fd.setDirectory(tmpFileName) else: fd.setDirectory(getenv("COVISEDIR")) acceptedOrRejected = fd.exec_() if acceptedOrRejected != QtWidgets.QDialog.Accepted or fd.selectedFiles( ).isEmpty(): return tmpFileName = unicode(fd.selectedFiles()[0]).encode('utf-8') if not tmpFileName == "": if not tmpFileName.endswith(".wmv"): tmpFileName += ".wmv" self.widget().lineEdit.setText(tmpFileName) self.setFilename()
def __init__(self, parent=None): QtWidgets.QWidget.__init__(self, parent) Ui_DatasetInformationPanelBase.__init__(self) self.setupUi(self) TransformManager.__init__(self, self.emitDataChanged, True) self.__key = -1 self.lineEditNameDataset.setText(coTranslate('<ds-filename not set yet>')) self.__dsNumberGeometryObjects = 0 self.__dsNumberOfGrids = 0 self.__dsConversionDate = coTranslate('<ds-date not set yet>') self.__inUseNumberGeometryObjects = 0 self.__inUseNumberOfGrids = 0 self.__updateFromIntern() # hide dummy information for "content" self.vrpFrameInformation.hide() #validators: # allow only double values for transform lineEdits doubleValidator = QtGui.QDoubleValidator(self) self.floatX.setValidator(doubleValidator) self.floatY.setValidator(doubleValidator) self.floatZ.setValidator(doubleValidator)
def addSensorWidget(self, parent, sensorID, autoActive): button = QtWidgets.QPushButton(str(sensorID), parent) checkBox = QtWidgets.QCheckBox(coTranslate("Auto-activate in Presentation"), parent) checkBox.setChecked(autoActive) self.__sensorButton[sensorID] = button self.__sensorCheckBox[sensorID] = checkBox # add widgets to layout self.__dummySensorsLayout.addWidget(button) self.__dummySensorsLayout.addWidget(checkBox) # make signal-slot connections checkBox.toggled.connect(self.emitDataChanged) button.clicked.connect(self.emitActivateSensor) button.pressed.connect(self.__sensorButtonPressed) # explicitly show created widgets (doesnt happen automatically) button.show() checkBox.show()
def addSensorWidget(self, parent, sensorID, autoActive): button = QtWidgets.QPushButton(str(sensorID), parent) checkBox = QtWidgets.QCheckBox( coTranslate("Auto-activate in Presentation"), parent) checkBox.setChecked(autoActive) self.__sensorButton[sensorID] = button self.__sensorCheckBox[sensorID] = checkBox # add widgets to layout self.__dummySensorsLayout.addWidget(button) self.__dummySensorsLayout.addWidget(checkBox) # make signal-slot connections checkBox.toggled.connect(self.emitDataChanged) button.clicked.connect(self.emitActivateSensor) button.pressed.connect(self.__sensorButtonPressed) # explicitly show created widgets (doesnt happen automatically) button.show() checkBox.show()
def __init__(self, parent): QtWidgets.QDockWidget.__init__(self, coTranslate("Video Capture Manager"), parent) self.setWidget(VideoCaptureManagerBase(self)) #connection of the DockWidget visibilityChanged self.visibilityChanged.connect(self.visibilityChangedS) # connection of buttons self.widget().buttonCapture.clicked.connect(self.capture) self.widget().buttonPreview.clicked.connect(self.startPreview) self.widget().comboBox.activated.connect(self.selectMode) # connect open self.widget().pushButton.clicked.connect(self.openFile) # connect filename self.widget().lineEdit.returnPressed.connect(self.setFilename) self.widget().lineEdit.editingFinished.connect(self.checkFilename) self.widget().groupSettings.setVisible(True) self.widget().groupCapturing.setVisible(True) #self.recording = False; self.filename = "C:\capture.wmv" if covise.coConfigIsOn("COVER.Plugin.Video", False): filename = covise.getCoConfigEntry("COVER.Plugin.Video.Filename") if filename: self.filename = filename self.widget().lineEdit.setText(self.filename) self.oldFilename = self.filename self.freeCapture = False self.mode = 0
def __tr(self,s,c = None): return coTranslate(s)
def __tr(self,s,c = None): _infoer.function = str(self.__tr) _infoer.write("") return coTranslate(s)