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 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 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 changedParams(self, val=0): _infoer.function = str(self.changedParams) _infoer.write("") param = self._key2Params[self._currentKey] param.name = str( self.widget().NameLE.text() ) param.timeout = self.widget().TimeoutSpinBox.value() param.index = self._key2ListBoxItemIdx[self._currentKey] self.setParams( self._currentKey, param ) theGuiMsgHandler().setParams( self._currentKey, self._key2Params[self._currentKey] )
def applyParams(self, val=0): #store current params if self.__callerKey==None: return self.setParams( self.__currentKey, self.__getParams() ) ObjectMgr().setParams(self.__currentKey, self.__getParams()) theGuiMsgHandler().setParams( self.__currentKey, self.__getParams()) if self.vrpCheckBoxShow.isChecked(): theGuiMsgHandler().runObject( self.__currentKey )
def applyParams(self, val=0): #store current params if self.__callerKey == None: return self.setParams(self.__currentKey, self.__getParams()) ObjectMgr().setParams(self.__currentKey, self.__getParams()) theGuiMsgHandler().setParams(self.__currentKey, self.__getParams()) if self.vrpCheckBoxShow.isChecked(): theGuiMsgHandler().runObject(self.__currentKey)
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 emitDataChanged(self): if not self.__key==-1: #childKey = Application.App.guiKey2visuKey[self.__key] #params = self.__getParams() #Application.vrpApp.key2params[childKey] = params #ObjectMgr().setParams( childKey, params ) #theGuiMsgHandler().runObject( childKey ) #params = self.__getParams() Application.vrpApp.key2params[self.__key] = self.__getParams()#params ObjectMgr().setParams(self.__key, self.__getParams())#params) theGuiMsgHandler().runObject(self.__key)
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 change(self): _infoer.function = str(self.change) _infoer.write("") # add asker msgBox = QtWidgets.QMessageBox(Application.vrpApp.mw) msgBox.setWindowTitle(self.__tr("Save changes of presentation step")) msgBox.setText(self.__tr("Do you want to save your changes for this presentation step?")) msgBox.setStandardButtons(QtWidgets.QMessageBox.Save | QtWidgets.QMessageBox.Cancel) msgBox.setDefaultButton(QtWidgets.QMessageBox.Save) acceptedOrRejected = msgBox.exec_() if acceptedOrRejected == QtWidgets.QMessageBox.Save: # comunication with negotiator theGuiMsgHandler().sendKeyWord("changePresentationStep")
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 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 emitVariableChanged(self): _infoer.function = str(self.emitVariableChanged) _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 = [] for i in range(0, len(self.__keys)): childKeys.append(Application.vrpApp.guiKey2visuKey[self.__keys[i]]) params = self.__getParams() if len(self.__keys)==1 : Application.vrpApp.key2params[childKeys[0]] = self.__getParams() ObjectMgr().setParams( childKeys[0], params ) reqId = theGuiMsgHandler().setParams( childKeys[0], params ) theGuiMsgHandler().waitforAnswer(reqId) theGuiMsgHandler().runObject( childKeys[0] ) self.__setParams( self.__getParams() )#necessary for allVariablesList # 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 ) reqId = theGuiMsgHandler().setParams( childKeys[i], childKeyParams ) theGuiMsgHandler().waitforAnswer(reqId) theGuiMsgHandler().runObject( childKeys[i] ) #necessary for allVariablesList self.__setParams( self.__getParams() ) #save params for multi selection self.oldPanelParams = self.__getParams()
def emitRadioBttnsTracerApply(self): _infoer.function = str(self.emitRadioBttnsTracerApply) _infoer.write("") if not self.__key==-1: # send message to cover if self.xAxisRadioButton.isChecked(): theGuiMsgHandler().sendKeyWord("xAxis") if self.yAxisRadioButton.isChecked(): theGuiMsgHandler().sendKeyWord("yAxis") if self.zAxisRadioButton.isChecked(): theGuiMsgHandler().sendKeyWord("zAxis") self.emitTraceParametersApply()
def initHandlers(coverWidgetId=None): """Connect the theGuiMsgHandler and theNegMsgHandler.""" g = theGuiMsgHandler() n = theNegMsgHandler(coverWidgetId) n.sigInit.connect(g.recvInit) n.sigDelObj.connect(g.recvDelete) n.sigParam.connect(g.recvParam) n.sigNegOk.connect(g.recvOk) n.sigNegError.connect(g.recvError) n.sigChangePath.connect(g.recvChangePath) n.sigBbox.connect(g.recvBbox) n.sigKeyWord.connect(g.recvKeyWord) n.sigFinishLoading.connect(g.recvFinishLoading) n.sigIsTransient.connect(g.recvIsTransient) n.sigAskTimestepReduction.connect(g.recvAskTimestepReduction) n.sigSetPresentationPoint.connect(g.recvSetPresentationPointID) n.sigVarNotFound.connect(g.recvVarNotFound) n.sigSelectObj.connect(g.recvSelect) n.sigDelFromCoverObj.connect(g.recvDeleteFromCOVER) g.sigRequestObj.connect(n.requestObject) g.sigRequestDelObj.connect(n.requestDelObject) g.sigDuplicateObj.connect(n.requestDuplicateObject) g.sigRunObj.connect(n.runObject) g.sigLoadObject.connect(n.loadObject) g.sigSaveObject.connect(n.saveObject) g.sigRequestParams.connect(n.requestParams) g.sigGuiParam.connect(n.recvParams) g.sigTmpParam.connect(n.recvTempParams) g.sigGuiError.connect(n.recvError) g.sigGuiExit.connect(n.recvExit) g.sigKeyWord.connect(n.keyWord) g.sigGuiChangedPath.connect(n.recvChangedPath) g.sigGuiRestartRenderer.connect(n.restartRenderer) g.sigSetReductionFactor.connect(n.recvReductionFactor) g.sigSetCropMinMax.connect(n.recvCropMinMax) g.sigSetSelectionString.connect(n.recvSelectionString) g.sigGuiAskedTimestepReduction.connect(n.recvAskedReductionFactor) g.sigMoveObj.connect(n.moveObj)
def __init__(self, parent ): _infoer.function = str(self.__init__) _infoer.write("") ListManager.__init__(self, parent) self.setWidget( PresenterManagerBase() ) self.setWindowTitle(self.__tr("Presentation Manager")) #connection of the DockWidget visibilityChanged self.visibilityChanged.connect(self.visibilityChangedx) #connections of the buttons self.widget().NameLE.returnPressed.connect(self.changedParams) self.widget().TimeoutSpinBox.valueChanged.connect(self.changedParams) self.widget().listBox2.itemClicked.connect(self.listViewClick) self.widget().UpButton.clicked.connect(self.up) self.widget().DownButton.clicked.connect(self.down) self.widget().BackButton.clicked.connect(self.backward) self.widget().ForwardButton.clicked.connect(self.forward) self.widget().ToEndButton.clicked.connect(self.goToEnd) self.widget().ToStartButton.clicked.connect(self.goToStart) self.widget().StopButton.clicked.connect(self.stop) self.widget().PlayButton.clicked.connect(self.play) self.widget().NewButton.clicked.connect(self.new) self.widget().DeleteButton.clicked.connect(self.delete) self.widget().ChangeButton.clicked.connect(self.change) self.widget().LogitechButton.clicked.connect(self.startLogitech) #connect to cover theGuiMsgHandler().registerKeyWordCallback('PRESENTATION_PLAY', self.play) theGuiMsgHandler().registerKeyWordCallback('PRESENTATION_STOP', self.stop) theGuiMsgHandler().registerKeyWordCallback('PRESENTATION_RELOAD', self.reload) theGuiMsgHandler().registerKeyWordCallback('PRESENTATION_BACKWARD', self.backward) theGuiMsgHandler().registerKeyWordCallback('PRESENTATION_FORWARD', self.forward) theGuiMsgHandler().registerKeyWordCallback('PRESENTATION_GO_TO_END', self.goToEnd) theGuiMsgHandler().registerKeyWordCallback('PRESENTATION_GO_TO_START', self.goToStart) theGuiMsgHandler().registerKeyWordCallback('PRESENTATION_SET_ID', self.goToPresentationPoint) #default settings #disable the name, timouot - no step is selected or even created self.widget().NameLE.setEnabled(False) self.widget().TimeoutSpinBox.setEnabled(False) self._enablePresenter(False) self.widget().textRunning.hide() # flags if new viewpoint should be created every time new step is created self._decisionSaved = False self._decision = True # param changed signal from object manager ObjectMgr().sigGuiParamChanged.connect( self.paramChangedFromNeg)
def rotateLeft(self): theGuiMsgHandler().sendMoveObj("rotate", 1, 0 ,0)
def requestPresentationStep(self): reqid = theGuiMsgHandler().requestObject( TYPE_PRESENTATION_STEP, None, self._key) theGuiMsgHandler().waitforAnswer(reqid)
def rotateRight(self): theGuiMsgHandler().sendMoveObj("rotate", -1, 0 ,0)
def copy( self ): params = self.__getParams() reqid = theGuiMsgHandler().requestObject( TYPE_COLOR_TABLE, self.__colorMgrKey ) theGuiMsgHandler().waitforAnswer(reqid) oldname = params.name params.name = self.__tr('Copy of ') + params.name self.setParams( self.__newkey, params ) theGuiMsgHandler().setParams( self.__newkey, params ) for key in self.__dependantKeys[self.__currentKey]: if not key==self.__callerKey: reqid = theGuiMsgHandler().requestParams( key ) theGuiMsgHandler().waitforAnswer(reqid) reqid = theGuiMsgHandler().requestParams( self.__callerKey ) theGuiMsgHandler().waitforAnswer(reqid) self.emitSelectColormap( self.__newkey )
def translateRight(self): theGuiMsgHandler().sendMoveObj("translate", 1, 0 ,0)
def emitValueChange(self, val=False): if not self.__key==-1: Application.vrpApp.key2params[self.__key] = self.__getParams() ObjectMgr().setParams( self.__key, self.__getParams() ) theGuiMsgHandler().runObject( self.__key )
def rotateUp(self): theGuiMsgHandler().sendMoveObj("rotate", 0, 0 ,1)
def scalePlus(self): theGuiMsgHandler().sendMoveObj("scale", 1, 0, 0)
def rotateDown(self): theGuiMsgHandler().sendMoveObj("rotate", 0, 0 ,-1)
def scaleMinus(self): theGuiMsgHandler().sendMoveObj("scale", -1, 0, 0)
def translateDown(self): theGuiMsgHandler().sendMoveObj("translate", 0, 0 ,-1)
def translateUp(self): theGuiMsgHandler().sendMoveObj("translate", 0, 0 ,1)
def forward(self, key, isOn): aux = VisItemParams() aux.isVisible = isOn theGuiMsgHandler().setParams(key, aux)
def rotateBack(self): theGuiMsgHandler().sendMoveObj("rotate", 0, -1 ,0)
def rotateFront(self): theGuiMsgHandler().sendMoveObj("rotate", 0, 1 ,0)
def translateBack(self): theGuiMsgHandler().sendMoveObj("translate", 0, 1 ,0)
def translateFront(self): theGuiMsgHandler().sendMoveObj("translate", 0, -1 ,0)