Beispiel #1
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')
Beispiel #2
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')