class MoveCmd(CustomedCmd): def __init__(self, controlPanel): CustomedCmd.__init__(self, controlPanel=controlPanel, buttonLabel='MOVE') self.comboMotors = ComboBox() self.comboMotors.addItems(['piston', 'a', 'b', 'c']) self.distance = DoubleSpinBoxGB('Dist', -350, 350, 3) self.microns = CheckBox('microns') self.abs = CheckBox('abs') self.microns.setChecked(True) self.abs.setChecked(True) self.addWidget(self.comboMotors, 0, 1) self.addWidget(self.distance, 0, 2) self.addWidget(self.microns, 0, 3) self.addWidget(self.abs, 0, 4) def buildCmd(self): microns = 'microns' if self.microns.isChecked() else '' abs = 'abs' if self.abs.isChecked() else '' cmdStr = '%s motors move %s=%.3f %s %s' % ( self.controlPanel.actorName, self.comboMotors.currentText(), self.distance.getValue(), microns, abs) return cmdStr
class InitCmd(CustomedCmd): def __init__(self, controlPanel): CustomedCmd.__init__(self, controlPanel=controlPanel, buttonLabel='INIT') self.skipHoming = CheckBox('skipHoming') self.skipHoming.setChecked(False) self.addWidget(self.skipHoming, 0, 1) def buildCmd(self): skipHoming = 'skipHoming' if self.skipHoming.isChecked() else '' return '%s rexm init %s' % (self.controlPanel.actorName, skipHoming)
class OpenCmd(CustomedCmd): def __init__(self, controlPanel): CustomedCmd.__init__(self, controlPanel=controlPanel, buttonLabel='OPEN', safetyCheck=True) self.atAtmosphere = CheckBox('atAtmosphere') self.underVacuum = CheckBox('underVacuum') self.dryRun = CheckBox('dryRun') self.atAtmosphere.setChecked(True) self.underVacuum.setChecked(False) self.dryRun.setChecked(False) self.atAtmosphere.stateChanged.connect( partial(self.stateChanged, self.underVacuum)) self.underVacuum.stateChanged.connect( partial(self.stateChanged, self.atAtmosphere)) self.addWidget(self.atAtmosphere, 0, 1) self.addWidget(self.underVacuum, 0, 2) self.addWidget(self.dryRun, 0, 3) def stateChanged(self, other, state): state = 2 if not state else 0 other.blockSignals(True) other.setChecked(state) other.blockSignals(False) def buildCmd(self): atAtmosphere = 'atAtmosphere' if self.atAtmosphere.isChecked() else '' underVacuum = 'underVacuum' if self.underVacuum.isChecked() else '' dryRun = 'dryRun' if self.dryRun.isChecked() else '' return '%s gatevalve open %s %s %s' % ( self.controlPanel.actorName, atAtmosphere, underVacuum, dryRun)