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')
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')
class RawCmd(CustomedCmd): def __init__(self, controlPanel): CustomedCmd.__init__(self, controlPanel=controlPanel, buttonLabel='RAW') self.rawCmd = LineEdit() self.addWidget(self.rawCmd, 0, 1) def buildCmd(self): cmdStr = '%s temps raw=%s' % (self.controlPanel.actorName, self.rawCmd.text()) return cmdStr
class FiberConfig(ValueGB): def __init__(self, controlDialog, key='fiberConfig', title='fiberConfig', fmt='{:s}', fontSize=styles.smallFont): self.controlDialog = controlDialog ValueGB.__init__(self, controlDialog.moduleRow, key=key, title=title, ind=0, fmt=fmt, fontSize=fontSize) self.fibers = LineEdit() #self.fibers.editingFinished.connect(self.newConfig) self.grid.removeWidget(self.value) self.grid.addWidget(self.fibers, 0, 0) def setText(self, txt): txt = ','.join(txt.split(';')) self.fibers.setText(txt) def newConfig(self): cmdStr = 'config fibers=%s' % ','.join([fib.strip() for fib in self.fibers.text().split(',')]) self.controlDialog.moduleRow.mwindow.sendCommand(actor=self.controlDialog.moduleRow.actorName, cmdStr=cmdStr, callFunc=self.controlDialog.cmdLog.printResponse)
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