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()}'
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
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
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()}'
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