def doFacadeAdjusments(self): if self._facadeAdjustments == None: self._facadeAdjustments = facadeAdjustments() self._facadeAdjustments.setWindowTitle("Fit parameters") #connect signals for the buttons Qt.QObject.connect(self.getResetButton(), Qt.SIGNAL('clicked(bool)'),self.getFacadeValues2widgets) Qt.QObject.connect(self.getOkButton(), Qt.SIGNAL('clicked(bool)'),self.okFacade) Qt.QObject.connect(self.getApplyButton(), Qt.SIGNAL('clicked(bool)'),self.applyFacade) Qt.QObject.connect(self.getCancelButton(), Qt.SIGNAL('clicked(bool)'),self.cancelFacade) Qt.QObject.connect(self.getSaveButton(), Qt.SIGNAL('clicked(bool)'),self.saveFormValues) Qt.QObject.connect(self.getLoadButton(), Qt.SIGNAL('clicked(bool)'),self.loadFormValues) #connect signals for the QLineEdits and the QSpinBoxes #to apply when press enter listOfLineEdits = [self._facadeAdjustments._ui.ShuntImpedanceValue, self._facadeAdjustments._ui.cavityVolts_kV_Formula, self._facadeAdjustments._ui.FwCavFormula, self._facadeAdjustments._ui.RvCavFormula, self._facadeAdjustments._ui.FwLoadFormula, self._facadeAdjustments._ui.cavityVolts_kV_MValue, self._facadeAdjustments._ui.cavityVolts_kV_NValue, self._facadeAdjustments._ui.FwCavCValue, self._facadeAdjustments._ui.FwCavOValue, self._facadeAdjustments._ui.RvCavCValue, self._facadeAdjustments._ui.RvCavOValue, self._facadeAdjustments._ui.FwLoadCValue, self._facadeAdjustments._ui.FwLoadOValue] for widget in listOfLineEdits: Qt.QObject.connect(widget,\ Qt.SIGNAL('returnPressed()'),self.applyFacade) # listOfSpinBoxes = [#self._facadeAdjustments._ui.cavityVolts_kV_MValue, # self._facadeAdjustments._ui.cavityVolts_kV_NValue, # self._facadeAdjustments._ui.FwCavCValue, # self._facadeAdjustments._ui.FwCavOValue, # self._facadeAdjustments._ui.RvCavCValue, # self._facadeAdjustments._ui.RvCavOValue, # self._facadeAdjustments._ui.FwLoadCValue, # self._facadeAdjustments._ui.FwLoadOValue] # for widget in listOfSpinBoxes: # Qt.QObject.connect(widget,\ # Qt.SIGNAL('editingFinished()'),self.applyFacade) self.getFacadeValues2widgets() self._facadeAdjustments.show()
def __init__(self,facadeInstanceName,beamCurrent=100, shuntImpedance='2*3.3*1e6'): FdlLogger.__init__(self) try:#normal way Qt.QWidget.__init__(self, parent=None) #Qt.QObject.__init__(self, parent=None) except:#backward compatibility to pyqt 4.4.3 Qt.QWidget.__init__(self) #Qt.QObject.__init__(self) self.updated._parent = self self._facadeInstanceName = facadeInstanceName self._facadeAdjustments = facadeAdjustments() self._beamCurrent = beamCurrent#mA self._shuntImpedance = shuntImpedance#an string representation #like '2*3.3*1e6' self._facadeAttrWidgets = \ {'CavVolt_kV': {SLOPE_: self._facadeAdjustments._ui.cavityVolts_kV_MValue, OFFSET_:self._facadeAdjustments._ui.cavityVolts_kV_NValue, FORMULA_:self._facadeAdjustments._ui.cavityVolts_kV_Formula}, 'FwCav_kW': {COUPLE_:self._facadeAdjustments._ui.FwCavCValue, OFFSET_:self._facadeAdjustments._ui.FwCavOValue, FORMULA_:self._facadeAdjustments._ui.FwCavFormula}, 'RvCav_kW': {COUPLE_:self._facadeAdjustments._ui.RvCavCValue, OFFSET_:self._facadeAdjustments._ui.RvCavOValue, FORMULA_:self._facadeAdjustments._ui.RvCavFormula}, 'FwLoad_kW': {COUPLE_:self._facadeAdjustments._ui.FwLoadCValue, OFFSET_:self._facadeAdjustments._ui.FwLoadOValue, FORMULA_:self._facadeAdjustments._ui.FwLoadFormula}, } #self._prepareFacadeWidgets() try: dServerName = str('dserver/'+\ FACADES_SERVERNAME+'/'+\ facadeInstanceName) self.debug("Facade's device server name: %s"%(dServerName)) dServer = taurus.Device(dServerName) facadeDevName = dServer.QueryDevice()[0].split('::')[1] self.debug("Facade's device name: %s"%(facadeDevName)) self.facadeDev = taurus.Device(facadeDevName) except Exception,e: self.error("Cannot prepare the facade information due to an "\ "exception: %s"%(e)) self.facadeDev = None