From 5cf17c52ea8332f2ca7585d92fe386e8b2ecad11 Mon Sep 17 00:00:00 2001 From: falkTX Date: Wed, 3 Oct 2012 14:11:31 +0100 Subject: [PATCH] Cadence: Disable a2j+pulse start actions when jack is stopped --- src/cadence.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/cadence.py b/src/cadence.py index eb1aa17..dc2517e 100755 --- a/src/cadence.py +++ b/src/cadence.py @@ -1043,37 +1043,46 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): self.checkPulseAudio() def a2jStarted(self): - self.label_bridge_a2j.setText(self.tr("ALSA MIDI Bridge is running")) self.b_a2j_start.setEnabled(False) self.b_a2j_stop.setEnabled(True) self.b_a2j_export_hw.setEnabled(False) self.systray.setActionEnabled("a2j_start", False) self.systray.setActionEnabled("a2j_stop", True) self.systray.setActionEnabled("a2j_export_hw", False) + self.label_bridge_a2j.setText(self.tr("ALSA MIDI Bridge is running")) def a2jStopped(self): - self.label_bridge_a2j.setText(self.tr("ALSA MIDI Bridge is stopped")) - self.b_a2j_start.setEnabled(True) + jackRunning = bool(DBus.jack and DBus.jack.IsStarted()) + self.b_a2j_start.setEnabled(jackRunning) self.b_a2j_stop.setEnabled(False) self.b_a2j_export_hw.setEnabled(True) - self.systray.setActionEnabled("a2j_start", True) + self.systray.setActionEnabled("a2j_start", jackRunning) self.systray.setActionEnabled("a2j_stop", False) self.systray.setActionEnabled("a2j_export_hw", True) + self.label_bridge_a2j.setText(self.tr("ALSA MIDI Bridge is stopped")) def checkPulseAudio(self): if PA_is_started(): global PA_clientId if PA_clientId != -1: - self.label_bridge_pulse.setText(self.tr("PulseAudio is started and bridged to JACK")) self.b_pulse_start.setEnabled(False) self.b_pulse_stop.setEnabled(True) + self.systray.setActionEnabled("pulse_start", False) + self.systray.setActionEnabled("pulse_stop", True) + self.label_bridge_pulse.setText(self.tr("PulseAudio is started and bridged to JACK")) else: - self.label_bridge_pulse.setText(self.tr("PulseAudio is started but not bridged")) + jackRunning = bool(DBus.jack and DBus.jack.IsStarted()) self.b_pulse_start.setEnabled(DBus.jack and DBus.jack.IsStarted()) self.b_pulse_stop.setEnabled(False) + self.systray.setActionEnabled("pulse_start", jackRunning) + self.systray.setActionEnabled("pulse_stop", False) + self.label_bridge_pulse.setText(self.tr("PulseAudio is started but not bridged")) else: - self.b_pulse_start.setEnabled(DBus.jack and DBus.jack.IsStarted()) + jackRunning = bool(DBus.jack and DBus.jack.IsStarted()) + self.b_pulse_start.setEnabled(jackRunning) self.b_pulse_stop.setEnabled(False) + self.systray.setActionEnabled("pulse_start", jackRunning) + self.systray.setActionEnabled("pulse_stop", False) self.label_bridge_pulse.setText(self.tr("PulseAudio is not started")) def setAppDetails(self, desktop):