示例#1
0
class SetRepCmd(CustomedCmd):
    def __init__(self, controlPanel):
        CustomedCmd.__init__(self,
                             controlPanel=controlPanel,
                             buttonLabel='SET')

        self.combo = ComboBox()
        self.combo.addItems(['REPOBJ', 'REPUTIL'])
        self.combo.currentIndexChanged.connect(self.resetCoords)

        self.addWidget(self.combo, 0, 1)

    def resetCoords(self, ind):
        for spinbox in self.spinboxes:
            spinbox.setValue(0)

    @property
    def spinboxes(self):
        return self.controlPanel.commands.coordBoxes.widgets

    def buildCmd(self):
        labels = ['x', 'y', 'z', 'rx', 'ry', 'rz']
        values = [spinbox.getValue() for spinbox in self.spinboxes]

        cmdStr = 'breva set %s ' % self.combo.currentText().lower()
        cmdStr += (" ".join([
            '%s=%.4f' % (label, value) for label, value in zip(labels, values)
        ]))

        return cmdStr
示例#2
0
class MaskCmd(CustomedCmd):
    def __init__(self, controlPanel):
        CustomedCmd.__init__(self,
                             controlPanel=controlPanel,
                             buttonLabel='MASK')

        self.comboCmd = ComboBox()
        self.comboCmd.addItems(['GET', 'SET'])
        self.comboCmd.currentIndexChanged.connect(self.showLineEdit)

        self.combo = ComboBox()
        self.combo.addItems(['powerOn', 'lowVoltage'])

        self.linedit = LineEdit()
        self.linedit.setVisible(False)

        self.addWidget(self.comboCmd, 0, 1)
        self.addWidget(self.combo, 0, 2)
        self.addWidget(self.linedit, 0, 3)

    def buildCmd(self):
        mask = 'mask=%s' % self.linedit.text() if self.linedit.isVisible(
        ) else ''
        cmdStr = '%s pcm %sMask %s %s' % (self.controlPanel.actorName,
                                          self.comboCmd.currentText().lower(),
                                          self.combo.currentText(), mask)
        return cmdStr

    def showLineEdit(self):
        self.linedit.setVisible(self.comboCmd.currentText() == 'SET')
示例#3
0
class ConnectCmd(CustomedCmd):
    def __init__(self, controlDialog, controllers):
        GridLayout.__init__(self)
        self.keyvar = controlDialog.moduleRow.keyVarDict['controllers']
        self.keyvar.addCallback(self.setButtonLabel, callNow=False)
        self.controlDialog = controlDialog
        self.button = ConnectButton(self, label='CONNECT')

        self.combo = ComboBox()
        self.combo.addItems(controllers)
        self.combo.currentTextChanged.connect(self.setButtonLabel)

        self.addWidget(self.button, 0, 0)
        self.addWidget(self.combo, 0, 1)

    def setButtonLabel(self, keyvar):
        keyvar = self.keyvar if isinstance(keyvar, str) else keyvar
        controllers = keyvar.getValue(doRaise=False)
        label = 'DISCONNECT' if self.combo.currentText(
        ) in controllers else 'CONNECT'
        self.button.setText(label)

    def buildCmd(self):
        cmdStr = '%s %s controller=%s ' % (
            self.controlDialog.moduleRow.actorName, self.button.text().lower(),
            self.combo.currentText())
        return cmdStr
示例#4
0
class ThreshCmd(CustomedCmd):
    def __init__(self, controlPanel):
        CustomedCmd.__init__(self,
                             controlPanel=controlPanel,
                             buttonLabel='THRESHOLD')

        self.comboCmd = ComboBox()
        self.comboCmd.addItems(['GET', 'SET'])
        self.comboCmd.currentIndexChanged.connect(self.showLineEdit)

        self.combo = ComboBox()
        self.combo.addItems(['upsBattery', 'upsLow', 'auxLow'])

        self.linedit = LineEdit()
        self.linedit.setVisible(False)

        self.addWidget(self.comboCmd, 0, 1)
        self.addWidget(self.combo, 0, 2)
        self.addWidget(self.linedit, 0, 3)

    def buildCmd(self):
        thresh = 'v=%s' % self.linedit.text() if self.linedit.isVisible(
        ) else ''
        cmdStr = '%s pcm %sThreshold %s %s' % (
            self.controlPanel.actorName, self.comboCmd.currentText().lower(),
            self.combo.currentText(), thresh)
        return cmdStr

    def showLineEdit(self):
        self.linedit.setVisible(self.comboCmd.currentText() == 'SET')
示例#5
0
class SetRepCmd(CustomedCmd):
    def __init__(self, controlPanel):
        CustomedCmd.__init__(self,
                             controlPanel=controlPanel,
                             buttonLabel='SET')

        self.combo = ComboBox()
        self.combo.addItems(['work', 'tool'])
        self.combo.currentIndexChanged.connect(self.resetCoords)

        self.addWidget(self.combo, 0, 1)

    def resetCoords(self, ind):
        for spinbox in self.spinboxes:
            spinbox.setValue(0)

    @property
    def spinboxes(self):
        return self.controlPanel.commands.coordBoxes.widgets

    def buildCmd(self):
        labels = ['X', 'Y', 'Z', 'U', 'V', 'W']
        values = [spinbox.getValue() for spinbox in self.spinboxes]

        cmdStr = '%s slit set %s ' % (self.controlPanel.actorName,
                                      self.combo.currentText().lower())
        cmdStr += (" ".join([
            '%s=%.5f' % (label, value) for label, value in zip(labels, values)
        ]))

        return cmdStr
示例#6
0
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
示例#7
0
class GoCmd(CustomedCmd):
    def __init__(self, controlPanel):
        CustomedCmd.__init__(self,
                             controlPanel=controlPanel,
                             buttonLabel='GOTO')

        self.combo = ComboBox()
        self.combo.addItems(['low', 'med'])

        self.addWidget(self.combo, 0, 1)

    def buildCmd(self):
        cmdStr = '%s rexm %s ' % (self.controlPanel.actorName,
                                  self.combo.currentText())
        return cmdStr
示例#8
0
class InitFilterwheel(CustomedCmd):
    def __init__(self, controlPanel):
        CustomedCmd.__init__(self,
                             controlPanel=controlPanel,
                             buttonLabel='INIT')

        self.comboWheel = ComboBox()
        self.comboWheel.addItems(['default (both)', 'LINEWHEEL', 'QTHWHEEL'])

        self.addWidget(self.comboWheel, 0, 1)

    def buildCmd(self):
        if self.comboWheel.currentIndex() == 0:
            return f'{self.controlPanel.actorName} filterwheel init'
        else:
            return f'{self.controlPanel.actorName} init {self.comboWheel.currentText().lower()}'
示例#9
0
class SetCryoMode(CustomedCmd):
    validModes = ('offline', 'standby', 'pumpdown', 'cooldown', 'operation', 'warmup', 'bakeout')

    def __init__(self, controlDialog):
        GridLayout.__init__(self)
        self.controlDialog = controlDialog
        self.button = SetButton(self)

        self.combo = ComboBox()
        self.combo.addItems(list(SetCryoMode.validModes))

        self.addWidget(self.button, 0, 0)
        self.addWidget(self.combo, 0, 1)

    def buildCmd(self):
        cmdStr = '%s setCryoMode %s ' % (self.controlDialog.moduleRow.actorName, self.combo.currentText())
        return cmdStr
示例#10
0
class ExposeCmd(CustomedCmd):
    def __init__(self, controlPanel):
        CustomedCmd.__init__(self, controlPanel, buttonLabel='EXPOSE')

        self.combo = ComboBox()
        self.combo.addItems(['object', 'background'])

        self.exptime = DoubleSpinBoxGB('exptime', 0, 3000, 2)

        self.addWidget(self.combo, 0, 1)
        self.addWidget(self.exptime, 0, 2)

    def buildCmd(self):
        exptype = 'expose' if self.combo.currentText(
        ) == 'object' else 'background'
        cmdStr = 'sac ccd %s exptime=%.2f' % (exptype, self.exptime.getValue())
        return cmdStr
示例#11
0
class GotoCmd(CustomedCmd):
    def __init__(self, controlPanel):
        CustomedCmd.__init__(self,
                             controlPanel=controlPanel,
                             buttonLabel='GO TO')

        self.comboFiber = ComboBox()
        self.comboFiber.addItems([
            'center', 'engtopend', 'engtopmid', 'engbotmid', 'engbotend',
            'scitopend', 'scitopmid', 'scibotmid', 'scibotend'
        ])

        self.addWidget(self.comboFiber, 0, 1)

    def buildCmd(self):
        cmdStr = 'breva goto fiber=%s ' % self.comboFiber.currentText()
        return cmdStr
示例#12
0
class DeclareLightSourceCmd(CustomedCmd):
    known = ['dcb', 'dcb2', 'sunss', 'pfi']

    def __init__(self, controlPanel):
        CustomedCmd.__init__(self, controlPanel, buttonLabel='DECLARE')

        self.comboLight = ComboBox()
        self.comboLight.addItems(DeclareLightSourceCmd.known)

        self.comboSM = ComboBox()
        self.comboSM.addItems(['SM1', 'SM2', 'SM3', 'SM4', 'SPS'])

        self.addWidget(self.comboSM, 0, 1)
        self.addWidget(self.comboLight, 0, 2)

    def buildCmd(self):
        identifier = f'' if self.comboSM.currentText() =='SPS' else f'{self.comboSM.currentText().lower()}='
        return f'sps declareLightSource {identifier}{self.comboLight.currentText()}'
示例#13
0
class ExposeCmd(CustomedCmd):
    def __init__(self, controlPanel):
        CustomedCmd.__init__(self,
                             controlPanel=controlPanel,
                             buttonLabel='EXPOSE')

        self.exptime = DoubleSpinBoxGB('Exptime', 1, 10000, 1)

        self.comboShut = ComboBox()
        self.comboShut.addItems(['', 'blue', 'red'])

        self.addWidget(self.exptime, 0, 1)
        self.addWidget(self.comboShut, 0, 2)

    def buildCmd(self):
        cmdStr = '%s shutters expose exptime=%.1f %s' % (
            self.controlPanel.actorName, self.exptime.getValue(),
            self.comboShut.currentText())
        return cmdStr
示例#14
0
class ShutterCmd(CustomedCmd):
    def __init__(self, controlPanel):
        CustomedCmd.__init__(self,
                             controlPanel=controlPanel,
                             buttonLabel='SHUTTERS')

        self.comboMove = ComboBox()
        self.comboMove.addItems(['open', 'close'])

        self.comboShut = ComboBox()
        self.comboShut.addItems(['', 'blue', 'red'])

        self.addWidget(self.comboMove, 0, 1)
        self.addWidget(self.comboShut, 0, 2)

    def buildCmd(self):
        cmdStr = '%s shutters %s %s' % (self.controlPanel.actorName,
                                        self.comboMove.currentText(),
                                        self.comboShut.currentText())
        return cmdStr
示例#15
0
class RawCmd(CustomedCmd):
    cmdLogic = {0: 'raw', 1: 'getRaw', 2: 'setRaw'}

    def __init__(self, controlPanel):
        CustomedCmd.__init__(self,
                             controlPanel=controlPanel,
                             buttonLabel='RAW')

        self.comboCmd = ComboBox()
        self.comboCmd.addItems(['', 'get', 'set'])
        self.rawCmd = LineEdit()

        self.addWidget(self.comboCmd, 0, 1)
        self.addWidget(self.rawCmd, 0, 2)

    def buildCmd(self):
        cmdStr = '%s gauge %s=%s' % (
            self.controlPanel.actorName,
            self.cmdLogic[self.comboCmd.currentIndex()], self.rawCmd.text())
        return cmdStr
示例#16
0
class HomeCmd(CustomedCmd):
    def __init__(self, controlPanel):
        CustomedCmd.__init__(self,
                             controlPanel=controlPanel,
                             buttonLabel='HOME')

        self.comboMotors = ComboBox()
        self.comboMotors.addItems(['All', 'Motor A', 'Motor B', 'Motor C'])

        self.addWidget(self.comboMotors, 0, 1)

    def buildCmd(self):
        motor = self.comboMotors.currentText()
        motor = 'a,b,c' if motor == 'All' else self.comboMotors.currentText(
        )[-1].lower()

        cmdStr = '%s motors home axes=%s' % (self.controlPanel.actorName,
                                             motor)

        return cmdStr
示例#17
0
class RawCmd(CustomedCmd):
    cmdLogic = {0: 'ionpump', 1: 'ionpumpRead', 2: 'ionpumpWrite'}

    def __init__(self, controlPanel):
        CustomedCmd.__init__(self,
                             controlPanel=controlPanel,
                             buttonLabel='RAW')

        self.comboCmd = ComboBox()
        self.comboCmd.addItems(['', 'read', 'write'])
        self.rawCmd = LineEdit()

        self.addWidget(self.comboCmd, 0, 1)
        self.addWidget(self.rawCmd, 0, 2)

    def buildCmd(self):
        cmdStr = '%s %s raw=%s' % (self.controlPanel.actorName,
                                   self.cmdLogic[self.comboCmd.currentIndex()],
                                   self.rawCmd.text())
        return cmdStr
示例#18
0
class ToSwitchCmd(CustomedCmd):
    def __init__(self, controlPanel):
        CustomedCmd.__init__(self,
                             controlPanel=controlPanel,
                             buttonLabel='TO SWITCH')

        self.comboMotors = ComboBox()
        self.comboMotors.addItems(['a', 'b', 'c'])

        self.comboSide = ComboBox()
        self.comboSide.addItems(['home', 'far'])

        self.comboCmd = ComboBox()
        self.comboCmd.addItems(['set', 'clear'])

        self.addWidget(self.comboMotors, 0, 1)
        self.addWidget(self.comboSide, 0, 2)
        self.addWidget(self.comboCmd, 0, 3)

    def buildCmd(self):
        cmdStr = '%s motors toSwitch %s %s %s' % (
            self.controlPanel.actorName, self.comboMotors.currentText(),
            self.comboSide.currentText(), self.comboCmd.currentText())

        return cmdStr
示例#19
0
class MoveCmd(CustomedCmd):
    def __init__(self, controlPanel):
        CustomedCmd.__init__(self,
                             controlPanel=controlPanel,
                             buttonLabel='MOVE')

        self.combo = ComboBox()
        self.combo.addItems(['absolute', 'relative'])
        self.combo.currentIndexChanged.connect(self.resetCoords)

        self.addWidget(self.combo, 0, 1)

    @property
    def spinboxes(self):
        return self.controlPanel.commands.coordBoxes.widgets

    def resetCoords(self, ind):
        if ind == 0:
            vals = [
                float(valueGB.value.text())
                for valueGB in self.controlPanel.coordinates.widgets
            ]
        else:
            vals = 6 * [0]

        for spinbox, val in zip(self.spinboxes, vals):
            spinbox.setValue(val)

    def buildCmd(self):
        labels = ['X', 'Y', 'Z', 'U', 'V', 'W']
        values = [spinbox.getValue() for spinbox in self.spinboxes]

        cmdStr = '%s slit move %s ' % (self.controlPanel.actorName,
                                       self.combo.currentText())
        cmdStr += (" ".join([
            '%s=%.5f' % (label, value) for label, value in zip(labels, values)
        ]))

        return cmdStr
示例#20
0
class MoveCmd(CustomedCmd):
    limits = dict(penta=(-450, 450), detector=(0, 12))

    def __init__(self, controlPanel, stage):
        CustomedCmd.__init__(self, controlPanel, buttonLabel='MOVE')

        self.stage = stage
        l_bound, u_bound = MoveCmd.limits[stage]

        self.combo = ComboBox()
        self.combo.addItems(['abs', 'rel'])

        self.distSpinbox = DoubleSpinBoxGB('Dist', l_bound, u_bound, 3)

        self.addWidget(self.combo, 0, 1)
        self.addWidget(self.distSpinbox, 0, 2)

    def buildCmd(self):
        reference = '' if self.combo.currentText(
        ) == 'rel' else self.combo.currentText()
        cmdStr = 'sac move %s=%.2f %s' % (
            self.stage, self.distSpinbox.getValue(), reference)
        return cmdStr
示例#21
0
class PumpCmd(CustomedCmd):
    pumpName = {0: '', 1: 'pump1', 2: 'pump2'}

    def __init__(self, controlPanel):
        CustomedCmd.__init__(self,
                             controlPanel=controlPanel,
                             buttonLabel='IONPUMP',
                             safetyCheck=True)

        self.comboSwitch = ComboBox()
        self.comboSwitch.addItems(['ON', 'OFF'])

        self.comboPump = ComboBox()
        self.comboPump.addItems(['default (1-2)', 'pump1', 'pump2'])

        self.addWidget(self.comboSwitch, 0, 1)
        self.addWidget(self.comboPump, 0, 2)

    def buildCmd(self):
        cmdStr = '%s ionpump %s %s' % (
            self.controlPanel.actorName,
            self.comboSwitch.currentText().lower(),
            self.pumpName[self.comboPump.currentIndex()])
        return cmdStr
示例#22
0
class SetFilterwheel(CustomedCmd):
    lineHoles = 0.5, 1.0, 2.0, 4.0, 12.7
    qthHoles = 'none', 0.7, 1.0, 2.0, 4.0

    def __init__(self, controlPanel):
        CustomedCmd.__init__(self,
                             controlPanel=controlPanel,
                             buttonLabel='SET')

        self.comboWheel = ComboBox()
        self.comboWheel.addItems(['LINEWHEEL', 'QTHWHEEL'])

        self.comboLinePosition = ComboBox()
        self.comboQthPosition = ComboBox()

        self.comboLinePosition.addItems(
            [f'{hole}' for hole in SetFilterwheel.lineHoles])
        self.comboQthPosition.addItems(
            [f'{hole}' for hole in SetFilterwheel.qthHoles])

        self.addWidget(self.comboWheel, 0, 1)
        self.addWidget(self.comboLinePosition, 0, 2)
        self.addWidget(self.comboQthPosition, 0, 2)

        self.comboWheel.currentIndexChanged.connect(self.displayComboPosition)
        self.comboWheel.setCurrentIndex(1)
        self.comboWheel.setCurrentIndex(0)

    @property
    def comboPosition(self):
        return self.comboLinePosition if self.comboWheel.currentIndex(
        ) == 0 else self.comboQthPosition

    def displayComboPosition(self, index):
        line, qth = (True, False) if index == 0 else (False, True)
        self.comboLinePosition.setVisible(line)
        self.comboQthPosition.setVisible(qth)

    def buildCmd(self):
        return f'{self.controlPanel.actorName} set {self.comboWheel.currentText().lower()}={self.comboPosition.currentText()}'