def __getParams(self): data = ObjectMgr().getParamsOfObject(0) if data.numTimeSteps > 1: data.actTimeStep = self.widget().timestepSlider.getValue() data.animationSpeed = self.widget().sliderSpeed.getValue() return data
def emitDataChanged(self): _infoer.function = str(self.emitDataChanged) _infoer.write("") params = self.__getParams() if len(self.__keys)==1 : Application.vrpApp.key2params[self.__keys[0]] = params ObjectMgr().setParams( self.__keys[0], params ) # set params for multi selection if len(self.__keys)>1 : #find changed params originalParams = self.oldPanelParams realChange = ParamsDiff( originalParams, params ) # set params for remaining selected objects for i in range(0, len(self.__keys)): keyParams = ObjectMgr().getParamsOfObject(self.__keys[i]) # find the changed param in childKey and replace it with the # intended attribut for x in realChange : keyParams.__dict__[x] = params.__dict__[x] # set the params Application.vrpApp.key2params[self.__keys[i]] = keyParams ObjectMgr().setParams( self.__keys[i], keyParams ) #theGuiMsgHandler().runObject( childKeys[i] ) #save params for multi selection self.oldPanelParams = self.__getParams()
def updateForObject( self, keys ): """ called from MainWindow to update the content to the choosen object key Default params will be shown if there is more than 1 key""" _infoer.function = str(self.updateForObject) _infoer.write("") if isinstance( keys, int ) : self.__keys = [keys] elif isinstance( keys, list ) and len(keys)>0 : self.__keys = keys else : return if len(self.__keys) == 1 : params = ObjectMgr().getParamsOfObject(self.__keys[0]) if isinstance(params, int) or isinstance(params, coDNAItemParams): self.__setParams( params ) elif len(self.__keys) > 1 : # multi selection: show default params self.oldPanelParams = coDNAItemParams() params = CopyParams(self.oldPanelParams) params.name = "Multiselection" self.__setParams( params )
def emitDataChanged(self): _infoer.function = str(self.emitDataChanged) _infoer.write("") if len(self.__keys)>0 and not ObjectMgr().getTypeOfObject(self.__keys[0]) == TYPE_2D_COMPOSED_PART: ##all key types in self.keys should be the same # mapping of the keys for the object manager childKeys = [Application.vrpApp.guiKey2visuKey[k] for k in self.__keys] params = self.__getParams() if len(self.__keys)==1 : Application.vrpApp.key2params[childKeys[0]] = params ObjectMgr().setParams( childKeys[0], params ) #theGuiMsgHandler().runObject( childKey ) # set params for multi selection if len(self.__keys)>1 : #find changed params originalParams = self.oldPanelParams realChange = ParamsDiff( originalParams, params ) # set params for remaining selected objects for i in range(0, len(self.__keys)): childKeyParams = ObjectMgr().getParamsOfObject(childKeys[i]) # find the changed param in childKey and replace it with the # intended attribut for x in realChange : childKeyParams.__dict__[x] = params.__dict__[x] # set the params Application.vrpApp.key2params[childKeys[i]] = childKeyParams ObjectMgr().setParams( childKeys[i], childKeyParams ) #theGuiMsgHandler().runObject( childKeys[i] ) #save params for multi selection self.oldPanelParams = self.__getParams()
def emitDataChanged(self): _infoer.function = str(self.emitDataChanged) _infoer.write("") params = self.__getParams() if len(self.__keys) == 1: Application.vrpApp.key2params[self.__keys[0]] = params ObjectMgr().setParams(self.__keys[0], params) # set params for multi selection if len(self.__keys) > 1: #find changed params originalParams = self.oldPanelParams realChange = ParamsDiff(originalParams, params) # set params for remaining selected objects for i in range(0, len(self.__keys)): keyParams = ObjectMgr().getParamsOfObject(self.__keys[i]) # find the changed param in childKey and replace it with the # intended attribut for x in realChange: keyParams.__dict__[x] = params.__dict__[x] # set the params Application.vrpApp.key2params[self.__keys[i]] = keyParams ObjectMgr().setParams(self.__keys[i], keyParams) #theGuiMsgHandler().runObject( childKeys[i] ) #save params for multi selection self.oldPanelParams = self.__getParams()
def emitAnimationSpeed(self): params = ObjectMgr().getParamsOfObject(0) params.animationSpeed = self.widget().sliderSpeed.getValue() self.animSpeed = params.animationSpeed ObjectMgr().setParams(0, params) msg = coGRSetAnimationSpeedMsg( params.animationSpeed, params.animationSpeedMin, params.animationSpeedMax ) covise.sendRendMsg(msg.c_str())
def updateForObject( self, keys ): if isinstance( keys, int): self.__keys = [keys] else: self.__keys = keys # set the variables if len(self.__keys)==1 : # enable the visualization and the transform tab self.tabWidget.setTabEnabled(0, True) self.tabWidget.setTabEnabled(1, True) scalar = ObjectMgr().getPossibleScalarVariablesForType(self.__keys[0]) vector = ObjectMgr().getPossibleVectorVariablesForType(self.__keys[0]) if covise.coConfigIsOn("vr-prepare.UseComposedVelocity", False): myObject = globalKeyHandler().getObject(self.__keys[0]) if (myObject.typeNr == TYPE_3D_COMPOSED_PART): vector.append(COMPOSED_VELOCITY) self._setUnsetVariable(True) self._setScalarVariables(scalar) self._setVectorVariables(vector) self.setGridName(ObjectMgr().getNameOfType(self.__keys[0]) ) else : # multi selection # disable the visualization and the transform tab self.tabWidget.setTabEnabled(0, False) self.tabWidget.setTabEnabled(1, False) # apply params params = ObjectMgr().getParamsOfObject(self.__keys[0]) params.name = ObjectMgr().getNameOfType(self.__keys[0]) #if self.__key in Application.vrpApp.guiKey2visuKey: # params.isVisible = ObjectMgr().getParamsOfObject(Application.vrpApp.guiKey2visuKey[self.__key]).isVisible self.__setParams( params )
def updateForObject(self, key): """ called from MainWindow to update the content to the choosen object key """ self.__key = key params = ObjectMgr().getParamsOfObject(key) self.__set2ndVariable( ObjectMgr().getPossibleScalarVariablesForVisItem(key)) self.__setParams(params)
def updateForObject( self, keys ): """ called from MainWindow to update the content to the choosen object key Default params will be shown if there is more than 1 key""" _infoer.function = str(self.updateForObject) _infoer.write("") if isinstance( keys, int ) : self.__keys = [keys] elif isinstance( keys, list ) and len(keys)>0 : self.__keys = keys else : return if len(self.__keys) == 1 : params = ObjectMgr().getParamsOfObject(self.__keys[0]) if isinstance(params, int) or isinstance(params, SceneObjectVisParams): self.__setParams( params ) elif len(self.__keys) > 1 : # multi selection: show default params self.oldPanelParams = SceneObjectVisParams() params = CopyParams(self.oldPanelParams) params.name = "Multiselection" self.__setParams( params )
def emitTimeStep(self): params = ObjectMgr().getParamsOfObject(0) if params == None: return params.actTimeStep = int(self.widget().timestepSlider.getValue()) ObjectMgr().setParams(0, params) msg = coGRSetTimestepMsg(params.actTimeStep, params.numTimeSteps) covise.sendRendMsg(msg.c_str())
def emitLastAnimationStep(self): params = ObjectMgr().getParamsOfObject(0) if params == None: return params.actTimeStep = params.numTimeSteps - 1 ObjectMgr().setParams(0, params) msg = coGRSetTimestepMsg(params.actTimeStep, params.numTimeSteps) covise.sendRendMsg(msg.c_str())
def emitLastAnimationStep(self): params = ObjectMgr().getParamsOfObject(0) if params == None: return params.actTimeStep = params.numTimeSteps -1 ObjectMgr().setParams(0, params) msg = coGRSetTimestepMsg( params.actTimeStep, params.numTimeSteps) covise.sendRendMsg(msg.c_str())
def emitTimeStep(self): params = ObjectMgr().getParamsOfObject(0) if params == None: return params.actTimeStep = int (self.widget().timestepSlider.getValue()) ObjectMgr().setParams(0, params) msg = coGRSetTimestepMsg( params.actTimeStep, params.numTimeSteps) covise.sendRendMsg(msg.c_str())
def updateForObject( self, key ): """ called from MainWindow to update the content to the choosen object key """ _infoer.function = str(self.updateForObject) _infoer.write("") self.__key = key params = ObjectMgr().getParamsOfObject(key) self.__setStartDomainNamesList( ObjectMgr().getList2dPartsForVisItem(key) ) self.__set2ndVariable( ObjectMgr().getPossibleScalarVariablesForVisItem(key) ) self.__setParams( params )
def emitAnimationSpeed(self): params = ObjectMgr().getParamsOfObject(0) params.animationSpeed = self.widget().sliderSpeed.getValue() self.animSpeed = params.animationSpeed ObjectMgr().setParams(0, params) msg = coGRSetAnimationSpeedMsg(params.animationSpeed, params.animationSpeedMin, params.animationSpeedMax) covise.sendRendMsg(msg.c_str())
def emitCutChanged(self): _infoer.function = str(self.emitCutChanged) _infoer.write("") if len(self.__keys)>0 and ObjectMgr().getTypeOfObject(self.__keys[0]) == TYPE_2D_CUTGEOMETRY_PART: params = ObjectMgr().getRealParamsOfObject(self.__keys[0]) params.alignedRectangle = self.__rectangleManager.getParams() if len(self.__keys)==1 : Application.vrpApp.key2params[self.__keys[0]] = params ObjectMgr().setParams(self.__keys[0], params ) theGuiMsgHandler().runObject(self.__keys[0]) # set params for multi selection if len(self.__keys)>1 : #find changed params originalParams = self.oldPanelRealParams realChange = ParamsDiff( originalParams, params ) # set params for remaining selected objects for i in range(0, len(self.__keys)): childKeyParams = ObjectMgr().getRealParamsOfObject(self.__keys[i]) # find the changed param in childKey and replace it with the # intended attribut for x in realChange : childKeyParams.__dict__[x] = params.__dict__[x] # set the params Application.vrpApp.key2params[self.__keys[i]] = childKeyParams ObjectMgr().setParams( self.__keys[i], childKeyParams ) theGuiMsgHandler().runObject( self.__keys[i] ) #save params for multi selection self.oldPanelRealParams = CopyParams(params)
def changedReductionParams(self): rf = getIntInLineEdit(self.widget().ReductionLE) Application.vrpApp.mw.spawnPatienceDialog() reqId = theGuiMsgHandler().setReductionFactor(rf) theGuiMsgHandler().waitforAnswer(reqId) Application.vrpApp.mw.unSpawnPatienceDialog() # update params of project in ObjectMgr params = ObjectMgr().getParamsOfObject(0) params.reductionFactor = rf ObjectMgr().setParams(0, params)
def emitDataChangedTransform(self): _infoer.function = str(self.emitDataChangedTransform) _infoer.write("") #TODO multi selection if len(self.__keys)==1 : if ObjectMgr().getTypeOfObject(self.__keys[0]) == TYPE_2D_PART: childKey = Application.vrpApp.guiKey2visuKey[self.__keys[0]] params = self.__getParams() Application.vrpApp.key2params[childKey] = params ObjectMgr().setParams( childKey, params ) theGuiMsgHandler().runObject( childKey )
def emitAnimationModeOn(self): self.widget().ToStartButton.setEnabled(False) self.widget().BackButton.setEnabled(False) self.widget().PlayButton.setEnabled(False) self.widget().StopButton.setEnabled(True) self.widget().ForwardButton.setEnabled(False) self.widget().ToEndButton.setEnabled(False) params = ObjectMgr().getParamsOfObject(0) params.animateOn = True ObjectMgr().setParams(0, params) msg = coGRAnimationOnMsg(True) covise.sendRendMsg(msg.c_str())
def emitNameChange(self, aQString=None): _infoer.function = str(self.emitNameChange) _infoer.write("") # only for single selection if len(self.__keys) == 1: #MainWindow.globalAccessToTreeView.setItemData(self.__keys[0], str(self.nameWidget.text())) # set name of type_2d_part params = ObjectMgr().getParamsOfObject(self.__keys[0]) params.name = str(self.lineEditFilename.text()) Application.vrpApp.key2params[self.__keys[0]] = params ObjectMgr().setParams(self.__keys[0], params) self.emitDataChanged()
def applyTimestepSelection(self): selectionString = str(self.widget().lineEditSelectionString.text()) Application.vrpApp.mw.spawnPatienceDialog() reqId = theGuiMsgHandler().setSelectionString(selectionString) theGuiMsgHandler().waitforAnswer(reqId) Application.vrpApp.mw.unSpawnPatienceDialog() # update params of project in ObjectMgr params = ObjectMgr().getParamsOfObject(0) params.selectionString = selectionString ObjectMgr().setParams(0, params)
def emitNameChange(self, aQString = None): _infoer.function = str(self.emitNameChange) _infoer.write("") # only for single selection if len(self.__keys)==1 : #MainWindow.globalAccessToTreeView.setItemData(self.__keys[0], str(self.nameWidget.text())) # set name of type_2d_part params = ObjectMgr().getParamsOfObject(self.__keys[0]) params.name = str(self.nameWidget.text()) Application.vrpApp.key2params[self.__keys[0]] = params ObjectMgr().setParams(self.__keys[0], params) self.emitDataChanged()
def updateForObject( self, key): self.__key = key scalar = ObjectMgr().getPossibleScalarVariablesForType(self.__key) vector = ObjectMgr().getPossibleVectorVariablesForType(self.__key) if covise.coConfigIsOn("vr-prepare.UseComposedVelocity", False): myObject = globalKeyHandler().getObject(key) while (myObject.typeNr == TYPE_2D_CUTGEOMETRY_PART): myObject = globalKeyHandler().getObject(myObject.parentKey) if (myObject.typeNr == TYPE_2D_COMPOSED_PART): scalar.append(COMPOSED_VELOCITY) self._setScalarVariables(scalar) self._setVectorVariables(vector) self.setGridName(ObjectMgr().getNameOfType(self.__key))
def emitAnimationModeOff(self): self.widget().ToStartButton.setEnabled(True) self.widget().BackButton.setEnabled(True) self.widget().PlayButton.setEnabled(True) self.widget().StopButton.setEnabled(False) self.widget().ForwardButton.setEnabled(True) self.widget().ToEndButton.setEnabled(True) params = ObjectMgr().getParamsOfObject(0) params.animateOn = False # enhance timestep because renderer gets message in next frame params.actTimeStep = int (self.widget().timestepSlider.getValue()+1) self.widget().timestepSlider.setValue(params.actTimeStep) ObjectMgr().setParams(0, params) msg = coGRAnimationOnMsg( False) covise.sendRendMsg(msg.c_str())
def emitAnimationModeOff(self): self.widget().ToStartButton.setEnabled(True) self.widget().BackButton.setEnabled(True) self.widget().PlayButton.setEnabled(True) self.widget().StopButton.setEnabled(False) self.widget().ForwardButton.setEnabled(True) self.widget().ToEndButton.setEnabled(True) params = ObjectMgr().getParamsOfObject(0) params.animateOn = False # enhance timestep because renderer gets message in next frame params.actTimeStep = int(self.widget().timestepSlider.getValue() + 1) self.widget().timestepSlider.setValue(params.actTimeStep) ObjectMgr().setParams(0, params) msg = coGRAnimationOnMsg(False) covise.sendRendMsg(msg.c_str())
def changedRadioButtonGroup(self): if self.__callerKey == None: return oldParams = ObjectMgr().getParamsOfObject(self.__currentKey) currentParams = self.__getParams() # if clicked on same radio button if oldParams.mode == currentParams.mode: return # set params in negotiator, object manager and own panel self.setParams(self.__currentKey, currentParams) ObjectMgr().setParams(self.__currentKey, currentParams) theGuiMsgHandler().setParams(self.__currentKey, currentParams) oldMin = 0 oldMax = 0 currentMin = 0 currentMax = 0 if oldParams.mode == coColorTableParams.FREE: oldMin = oldParams.min oldMax = oldParams.max elif oldParams.mode == coColorTableParams.LOCAL: oldMin = oldParams.baseMin oldMax = oldParams.baseMax elif oldParams.mode == coColorTableParams.GLOBAL: oldMin = oldParams.globalMin oldMax = oldParams.globalMax else: print("Error: Unknown radio button in ColorManager!") if currentParams.mode == coColorTableParams.FREE: currentMin = currentParams.min currentMax = currentParams.max elif currentParams.mode == coColorTableParams.LOCAL: currentMin = currentParams.baseMin currentMax = currentParams.baseMax elif currentParams.mode == coColorTableParams.GLOBAL: currentMin = currentParams.globalMin currentMax = currentParams.globalMax else: print("Error: Unknown radio button in ColorManager!") # only execute in case of different min/max values if oldMin != currentMin or oldMax != currentMax: theGuiMsgHandler().runObject(self.__currentKey)
def emitTraceParametersApply(self): _infoer.function = str(self.emitTraceParametersApply) _infoer.write("") if not self.__key==-1: Application.vrpApp.key2params[self.__key] = self.__getParams() ObjectMgr().setParams( self.__key, self.__getParams() ) theGuiMsgHandler().runObject( self.__key )
def change(self): _infoer.function = str(self.change) _infoer.write("") # add asker msgBox = QtWidgets.QMessageBox(Application.vrpApp.mw) msgBox.setWindowTitle(self.__tr("Save changed viewpoint")) msgBox.setText( self.__tr("Do you want to save this view for the viewpoint?")) msgBox.setStandardButtons(QtWidgets.QMessageBox.Save | QtWidgets.QMessageBox.Cancel) msgBox.setDefaultButton(QtWidgets.QMessageBox.Save) acceptedOrRejected = msgBox.exec_() if acceptedOrRejected == QtWidgets.QMessageBox.Save: # take eighter current key or if selection in list is disabled use the latest key = -1 if self._currentKey != -1: key = self._currentKey elif self.lastKey != -1: key = self.lastKey if key > -1: # get COVER id id = ObjectMgr().getParamsOfObject(key).id msg = coGRChangeViewpointMsg(id) covise.sendRendMsg(msg.c_str())
def __getParams(self): data = coColorTableParams() data.name = str(self.vrpLineEditName.text()) data.species = self.__key2Species[self.__currentKey] data.min = getDoubleInLineEdit(self.vrpLineEditMin) data.max = getDoubleInLineEdit(self.vrpLineEditMax) data.steps = self.vrpSpinBoxSteps.value() data.colorMapIdx = self.vrpComboBoxMap.currentIndex() + 1 data.colorMapList = self.__colorMapList if self.radioButtonManual.isChecked(): data.mode = coColorTableParams.FREE elif self.radioButtonLocal.isChecked(): data.mode = coColorTableParams.LOCAL else: data.mode = coColorTableParams.GLOBAL data.baseObjectName = self.__baseObjectName data.baseMin = self.__baseMin data.baseMax = self.__baseMax data.globalMin = self.__globalMin data.globalMax = self.__globalMax data.dependantKeys = [] if self.__currentKey in self.__dependantKeys: for key in self.__dependantKeys[self.__currentKey]: if key not in data.dependantKeys: # ignore duplicates # check if the object still exists and uses this colormap params = ObjectMgr().getParamsOfObject(key) if params != None: if params.secondVariable != None: currentVariable = params.secondVariable else: currentVariable = params.variable if currentVariable in params.colorTableKey and params.colorTableKey[ currentVariable] == self.__currentKey: data.dependantKeys.append(key) return data
def paramChanged(self, key): """ params of object key changed""" if key == 0: params = ObjectMgr().getParamsOfObject(0) self.widget().NumStepsLabel_2.setText(str(params.numTimeSteps)) if params.reductionFactor != self._reductionFactor: self._reductionFactor = params.reductionFactor self.widget().ReductionLE.setText(str(params.reductionFactor)) if params.selectionString != self._selectionFactor: self._selectionFactor = params.selectionString self.widget().lineEditSelectionString.setText( str(params.selectionString)) if params.numTimeSteps > 1: self.widget().timestepSlider.setRange( [0, params.numTimeSteps - 1]) self.widget().timestepSlider.setValue(params.actTimeStep) if params.animationSpeed != self.animSpeed: self.animSpeed = params.animationSpeed self.widget().sliderSpeed.setRange( [params.animationSpeedMin, params.animationSpeedMax]) self.widget().sliderSpeed.setValue(params.animationSpeed) if params.animateOn: self.widget().ToStartButton.setEnabled(False) self.widget().BackButton.setEnabled(False) self.widget().PlayButton.setEnabled(False) self.widget().StopButton.setEnabled(True) self.widget().ForwardButton.setEnabled(False) self.widget().ToEndButton.setEnabled(False) else: self.widget().ToStartButton.setEnabled(True) self.widget().BackButton.setEnabled(True) self.widget().PlayButton.setEnabled(True) self.widget().StopButton.setEnabled(False) self.widget().ForwardButton.setEnabled(True) self.widget().ToEndButton.setEnabled(True) if params.filterChoice == REDUCTION_FACTOR: self.widget().radioButton15.setChecked(True) self.widget().radioButtonSelectionString.setChecked(False) if not self.widget().ReductionLE.isEnabled(): self.widget().ReductionLE.setEnabled(True) if not self.widget().lineEditSelectionString.isEnabled(): self.widget().lineEditSelectionString.setEnabled(False) self.widget().pushButtonEditSelectionString.setEnabled( False) self.widget().pushButtonApply.setEnabled(False) elif params.filterChoice == SELECTION_STRING: self.widget().radioButton15.setChecked(False) self.widget().radioButtonSelectionString.setChecked(True) if self.widget().ReductionLE.isEnabled(): self.widget().ReductionLE.setEnabled(False) if self.widget().lineEditSelectionString.isEnabled(): self.widget().lineEditSelectionString.setEnabled(True) self.widget().pushButtonEditSelectionString.setEnabled( True) self.widget().pushButtonApply.setEnabled(True)
def __init__(self, parent=None): QtWidgets.QWidget.__init__(self, parent) Ui_GenericObjectPanelBase.__init__(self) self.setupUi(self) self.__name2label = {} self.__name2input = {} self.__key = -1 # designer could not assign a layout to empty widgets self.dummyFrameLayout = QtWidgets.QVBoxLayout(self.dummyFrame) # add scroll view self.scrollView = QtWidgets.QScrollArea(self.dummyFrame) self.dummyFrameLayout.addWidget(self.scrollView) self.scrollView.setFrameShadow(QtWidgets.QFrame.Raised) self.scrollView.setFrameShape(QtWidgets.QFrame.StyledPanel) self.scrollView.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn) # add a box for the widgets in the scrollview. self.box = QtWidgets.QWidget(self.scrollView) self.box.resize(250,2000) self.scrollView.setWidget(self.box) self.boxLayout = QtWidgets.QGridLayout(self.box) ObjectMgr().sigGuiParamChanged.connect(self.paramChanged)
def emitActivateSensor(self): params = self.__getParams() params.clickedSensorID = self.__pressedSensorID Application.vrpApp.key2params[self.__keys[0]] = params ObjectMgr().setParams(self.__keys[0], params) self.__pressedSensorID = None
def setParams( self, key, params ): if params: p = CopyParams(params) if not hasattr(p, 'index') or p.index == -1: #save index form list p.index = self._key2ListBoxItemIdx[key] self._ListBoxItemIdx2Key[p.index] = key else: # Note: The following does not work properly if the key is already present in the list and the index changed. # However, this shouldn't be a problem since the index doesn't change outside the ListManager at the moment. #set the index in the list ... insert at this point # if key is allready in list, change the order if p.index in self._ListBoxItemIdx2Key and key!= self._ListBoxItemIdx2Key[p.index]: # remeber the old key of this index tmpKey = self._ListBoxItemIdx2Key[p.index] # set the new key self._ListBoxItemIdx2Key[p.index] = key self._key2ListBoxItemIdx[key] = p.index # go through the following and delete the old index of this key for i in range(p.index+1, self.widget().listBox2.count()+1): if i in self._ListBoxItemIdx2Key: tmp2Key = self._ListBoxItemIdx2Key[i] if tmp2Key == key: del self._ListBoxItemIdx2Key[i] break # key is not in list else: self._key2ListBoxItemIdx[key] = p.index self._ListBoxItemIdx2Key[p.index] = key self._key2Params[key] = p self._updateList() ObjectMgr().setParams( key, p )
def updateForObject( self, key ): """ called from MainWindow to update the content to the choosen object key """ _infoer.function = str(self.updateForObject) _infoer.write("key %d" %(key)) self.__key = key params = ObjectMgr().getParamsOfObject(key) self.__setParams( params )
def change(self): _infoer.function = str(self.change) _infoer.write("") # add asker msgBox = QtWidgets.QMessageBox(Application.vrpApp.mw) msgBox.setWindowTitle(self.__tr("Save changes of documents")) msgBox.setText(self.__tr("Do you want to save your changes for the documents?")) msgBox.setStandardButtons(QtWidgets.QMessageBox.Save | QtWidgets.QMessageBox.Cancel) msgBox.setDefaultButton(QtWidgets.QMessageBox.Save) acceptedOrRejected = msgBox.exec_() if acceptedOrRejected == QtWidgets.QMessageBox.Save: # comunication with negotiator params = ObjectMgr().getParamsOfObject(self.__key) params.changed = True ObjectMgr().setParams( self.__key, params )
def __init__(self, parent=None): _infoer.function = str(self.__init__) _infoer.write("") QtWidgets.QWidget.__init__(self, parent) Ui_DocumentViewerBase.__init__(self) self.setupUi(self) self.__key = -1 changeIndicatedLEs = [ self.floatX, self.floatY, self.floatZ, self.floatHsize, self.floatVsize, self.floatScaling ] for w in changeIndicatedLEs: w.returnPressed.connect(self.emitParamsChange) self.spinBoxPage.valueChanged.connect(self.emitParamsChange) self.ChangeButton.clicked.connect(self.change) ObjectMgr().sigGuiParamChanged.connect(self.paramChanged) #validators: # allow only double values for changeIndicatedLEs doubleValidator = QtGui.QDoubleValidator(self) self.floatX.setValidator(doubleValidator) self.floatY.setValidator(doubleValidator) self.floatZ.setValidator(doubleValidator) self.floatHsize.setValidator(doubleValidator) self.floatVsize.setValidator(doubleValidator) self.floatScaling.setValidator(doubleValidator) self.spinBoxPage.setMinimum(1) self.spinBoxPage.setMaximum(1) self.currentImage_ = None self.currentPixmap_ = None self.documentsInGUI_ = covise.coConfigIsOn("vr-prepare.DocumentsInGUI", False)
def __getParams(self): data = Part3DBoundingBoxVisParams() if not ObjectMgr().getTypeOfObject(self.__keys[0]) == TYPE_3D_COMPOSED_PART: #transform card self.TransformManagerGetParams(data) data.isVisible = self.__visible return data
def __init__(self, parent): QtWidgets.QDockWidget.__init__(self, self.__tr("Animation Manager"), parent) # default is prenseter manager self._key = -1 #self.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum,QtWidgets.QSizePolicy.Minimum)) #properties of QDockWindow #REM self.setCloseMode(QtWidgets.QDockWindow.Always) #REM self.setResizeEnabled(True) #REM self.setMovingEnabled(True) #allow to be outside the window #REM self.setHorizontallyStretchable(True) #REM self.setVerticallyStretchable(True) #REM self.setOrientation(Qt.Vertical) self.setWidget(AnimationManagerBase(self)) ObjectMgr().sigGuiParamChanged.connect(self.paramChanged) #connection of the DockWidget visibilityChanged self.visibilityChanged.connect(self.visibilityChangedS) #connections of the buttons self.widget().ReductionLE.returnPressed.connect( self.changedReductionParams) self.widget().pushButtonEditSelectionString.clicked.connect( self.openTimestepSelectorDialog) self.widget().pushButtonApply.clicked.connect( self.applyTimestepSelection) self.widget().radioButton15.clicked.connect(self.emitChangedRadioGroup) self.widget().radioButtonSelectionString.clicked.connect( self.emitChangedRadioGroup) self.widget().ToStartButton.clicked.connect( self.emitFirstAnimationStep) self.widget().BackButton.clicked.connect(self.emitAnimationStepBack) self.widget().StopButton.clicked.connect(self.emitAnimationModeOff) self.widget().PlayButton.clicked.connect(self.emitAnimationModeOn) self.widget().ForwardButton.clicked.connect( self.emitAnimationStepForward) self.widget().ToEndButton.clicked.connect(self.emitLastAnimationStep) self.widget().timestepSlider.sigSliderReleased.connect( self.emitTimeStep) self.widget().sliderSpeed.sigSliderReleased.connect( self.emitAnimationSpeed) #validators # allow only int values for changeIndicatedLEs intValidator = QtGui.QIntValidator(self) intValidator.setBottom(0) self.widget().ReductionLE.setValidator(intValidator) self.widget().timestepSlider.lineEdit.setValidator(intValidator) self.widget().timestepSlider.slider.setSingleStep(1) self.widget().timestepSlider.slider.setPageStep(1) #TODO: QRegExp einbinden #regExpValidator = QtGui.QRegExpValidator(QRegExp('\d+\s*\-\s*\d+|\d+'), self, "a QRegExpValidator") #self.widget().lineEditSelectionString.setValidator(regExpValidator) self.animSpeed = 0 self._reductionFactor = -1 self._selectionFactor = -1
def emitDataChanged(self): if not len(self.__keys)==0 and not ObjectMgr().getTypeOfObject(self.__keys[0]) == TYPE_3D_COMPOSED_PART: params = self.__getParams() # mapping of the keys for the object manager childKeys = [] for i in range(0, len(self.__keys)): childKeys.append(Application.vrpApp.guiKey2visuKey[self.__keys[i]]) # set params for first object if len(self.__keys)>0 : #save original params originalParams = ObjectMgr().getParamsOfObject( childKeys[0] ) ObjectMgr().setParams( childKeys[0], params ) theGuiMsgHandler().runObject( childKeys[0] ) # set params for multi selection if len(self.__keys)>1 : #find changed params realChange = ParamsDiff( originalParams, params ) # set params for remaining selected objects for i in range(1, len(self.__keys)): childKeyParams = ObjectMgr().getParamsOfObject(childKeys[i]) # find the changed param in childKey and replace it with the # intended attribut for x in realChange : childKeyParams.__dict__[x] = params.__dict__[x] # set the params ObjectMgr().setParams( childKeys[i], childKeyParams ) theGuiMsgHandler().runObject( childKeys[i] )
def _updateList( self ): _infoer.function = str(self._updateList) _infoer.write("%s " %str(self._ListBoxItemIdx2Key)) #clear the listbox self.widget().listBox2.clear() #put all steps into the listbox for index in self._ListBoxItemIdx2Key: key = self._ListBoxItemIdx2Key[index] #if not mgr if not key==self._key: params = self._key2Params[key] self._key2Params[key] = params #insert into listview self.widget().listBox2.addItem( params.name ) #select the added key if self._addedKey: # go to viewpoint params = ObjectMgr().getParamsOfObject(self._addedKey) params.isVisible = True if params.id: self._currentKey = self._addedKey self._addedKey = None self.setParams(self._currentKey, params) if self._fromPresentation: Application.vrpApp.mw.presenterManager.requestPresentationStep() self._fromPresentation = False #select the current step self.widget().NameLE.setEnabled(False) if self._currentKey in self._key2ListBoxItemIdx: self.selectItem( self._key2ListBoxItemIdx[self._currentKey] ) self.widget().NameLE.setEnabled(True) else: self.widget().NameLE.setText('') # if no point, disable all buttons if len(self._key2ListBoxItemIdx) == 0: self._enableViewpoints(False) Application.vrpApp.mw.enableViewpoint(False) else: self._enableViewpoints(True) Application.vrpApp.mw.enableViewpoint(True)
def emitChangedRadioGroup(self): if self.widget().radioButton15.isChecked(): self.widget().ReductionLE.setEnabled(True) self.widget().lineEditSelectionString.setEnabled(False) self.widget().pushButtonEditSelectionString.setEnabled(False) self.widget().pushButtonApply.setEnabled(False) filterChoice = REDUCTION_FACTOR elif self.widget().radioButtonSelectionString.isChecked(): self.widget().ReductionLE.setEnabled(False) self.widget().lineEditSelectionString.setEnabled(True) self.widget().pushButtonEditSelectionString.setEnabled(True) self.widget().pushButtonApply.setEnabled(True) filterChoice = SELECTION_STRING # update params of project in ObjectMgr params = ObjectMgr().getParamsOfObject(0) params.filterChoice = filterChoice ObjectMgr().setParams(0, params)
def updateForObject( self, keys ): """ called from MainWindow to update the content to the choosen object key Default params will be shown if there is more than 1 key""" _infoer.function = str(self.updateForObject) _infoer.write("") if isinstance( keys, int ) : self.__keys = [keys] elif isinstance( keys, list ) and len(keys)>0 : self.__keys = keys else : return # if a type_2d_composed_part disable the first two tabs (coloring and shader) if len(self.__keys)==1 : # enable the visualization and the transform tab self.TabWidgetGeneralAdvanced.setTabEnabled(0, True) self.TabWidgetGeneralAdvanced.setTabEnabled(1, True) self.TabWidgetGeneralAdvanced.setTabEnabled(2, True) self.TabWidgetGeneralAdvanced.setTabEnabled(3, True) if ObjectMgr().getTypeOfObject(self.__keys[0]) == TYPE_2D_COMPOSED_PART: self.TabWidgetGeneralAdvanced.setTabEnabled(0, False) self.TabWidgetGeneralAdvanced.setTabEnabled(1, False) # if not a type_2d_part disable the transform tab if ObjectMgr().getTypeOfObject(self.__keys[0]) != TYPE_2D_PART: self.TabWidgetGeneralAdvanced.setTabEnabled(3, False) # if not a type_2d_cutgeometry_part disable the cut tab if ObjectMgr().getTypeOfObject(self.__keys[0]) != TYPE_2D_CUTGEOMETRY_PART: self.TabWidgetGeneralAdvanced.setTabEnabled(4, False) elif len(self.__keys) > 1 : # multi selection # always show first tab self.TabWidgetGeneralAdvanced.setCurrentIndex(0) # disable the visualization and the transform tab self.TabWidgetGeneralAdvanced.setTabEnabled(2, False) self.TabWidgetGeneralAdvanced.setTabEnabled(3, False) # set the variables of first key self.__setScalarVariables(ObjectMgr().getPossibleScalarVariablesForType(self.__keys[0])) self.__setVectorVariables(ObjectMgr().getPossibleVectorVariablesForType(self.__keys[0])) # apply params if len(self.__keys) == 1 : realparams = ObjectMgr().getRealParamsOfObject(self.__keys[0]) params = ObjectMgr().getParamsOfObject(self.__keys[0]) params.name = realparams.name #params.boundingBox = realparams.boundingBox if isinstance(params, int) or isinstance(params, Part2DRawVisParams): self.__setParams( params ) self.__setRealParams( realparams ) # update Visualization2DPanel.updateForObject(self, self.__keys[0]) elif len(self.__keys) > 1 : # multi selection: show default params self.oldPanelParams = Part2DRawVisParams() params = CopyParams(self.oldPanelParams) self.__setParams( params ) if ObjectMgr().getTypeOfObject(self.__keys[0]) == TYPE_2D_PART: self.oldPanelRealParams = co2DPartMgrParams() if ObjectMgr().getTypeOfObject(self.__keys[0]) == TYPE_2D_COMPOSED_PART: self.oldPanelRealParams = co2DComposedPartMgrParams() if ObjectMgr().getTypeOfObject(self.__keys[0]) == TYPE_2D_CUTGEOMETRY_PART: self.oldPanelRealParams = co2DCutGeometryPartMgrParams() #self.oldPanelRealParams.name = coTranslate("Multiselection") self.oldPanelRealParams.name = "Multiselection" realparams = CopyParams(self.oldPanelRealParams) self.__setRealParams( realparams ) # set ComboBoxVariable on default value self.vrpComboBoxVariable_2.setCurrentIndex(0)