Esempio n. 1
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
Esempio n. 2
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
Esempio n. 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
Esempio n. 4
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
Esempio n. 5
0
    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)
Esempio n. 6
0
    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)
Esempio n. 7
0
    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)
Esempio n. 8
0
    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)
Esempio n. 9
0
    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)
Esempio n. 10
0
    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)
Esempio n. 11
0
    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)
Esempio n. 12
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
Esempio n. 13
0
    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)
Esempio n. 14
0
    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)
Esempio n. 15
0
    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)
Esempio n. 16
0
    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)
Esempio n. 17
0
    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)
Esempio n. 18
0
    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)
Esempio n. 19
0
    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)
Esempio n. 20
0
    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)
Esempio n. 21
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
Esempio n. 22
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()}'
Esempio n. 23
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
Esempio n. 24
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
Esempio n. 25
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
Esempio n. 26
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')
Esempio n. 27
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')
Esempio n. 28
0
    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)
Esempio n. 29
0
    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)
Esempio n. 30
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()}'