def recordingEnabledDisabled(self): hasDevices = (self.cboInputDevice.count() != 0) if not hasDevices: self.recordingEnabled_button.setChecked(False) self.recordingEnabled_button.setEnabled(False) if self.recordingEnabled_button.isChecked(): p = QPixmap(":/icons/dialog-ok-apply.png") self.recordingEnabled_button.setText( self.tr("Recording enabled (click to disable)")) device = self.cboInputDevice.itemData( self.cboInputDevice.currentIndex()).toInt()[0] PluginAudioWorker.startAudio(device) self.cboInputDevice.setEnabled(False) else: p = QPixmap(":/icons/dialog-cancel.png") self.recordingEnabled_button.setText( self.tr("Recording disabled (click to enable)") if hasDevices else self.tr("No input devices available")) PluginAudioWorker.stopAudio() self.cboInputDevice.setEnabled(True) self.recordingEnabled_button.setIconSize(p.size()) self.recordingEnabled_button.setIcon(QIcon(p)) if self.enabledCheckBox != None: self.enabledCheckBox.setCheckState([Qt.Unchecked, Qt.Checked][int( self.recordingEnabled_button.isChecked())])
def recordingEnabledDisabled(self): hasDevices = (self.cboInputDevice.count() != 0) if not hasDevices: self.recordingEnabled_button.setChecked(False) self.recordingEnabled_button.setEnabled(False) if self.recordingEnabled_button.isChecked(): p = QPixmap(":/icons/dialog-ok-apply.png") self.recordingEnabled_button.setText(self.tr("Recording enabled (click to disable)")) device = self.cboInputDevice.itemData(self.cboInputDevice.currentIndex()).toInt()[0] PluginAudioWorker.startAudio(device) self.cboInputDevice.setEnabled(False) else: p = QPixmap(":/icons/dialog-cancel.png") self.recordingEnabled_button.setText(self.tr("Recording disabled (click to enable)") if hasDevices else self.tr("No input devices available")) PluginAudioWorker.stopAudio() self.cboInputDevice.setEnabled(True) self.recordingEnabled_button.setIconSize(p.size()) self.recordingEnabled_button.setIcon(QIcon(p)) if self.enabledCheckBox!=None: self.enabledCheckBox.setCheckState( [Qt.Unchecked, Qt.Checked][int(self.recordingEnabled_button.isChecked())] )