| @@ -26,7 +26,7 @@ all: UI RES CPP | |||
| UI: cadence catarina catia claudia carla tools | |||
| cadence: src/ui_cadence.py | |||
| cadence: src/ui_cadence.py src/ui_cadence_tb_jack.py src/ui_cadence_rwait.py | |||
| catarina: src/ui_catarina.py \ | |||
| src/ui_catarina_addgroup.py src/ui_catarina_removegroup.py src/ui_catarina_renamegroup.py \ | |||
| @@ -51,6 +51,12 @@ tools: \ | |||
| src/ui_cadence.py: src/ui/cadence.ui | |||
| $(PYUIC) $< -o $@ | |||
| src/ui_cadence_tb_jack.py: src/ui/cadence_tb_jack.ui | |||
| $(PYUIC) $< -o $@ | |||
| src/ui_cadence_rwait.py: src/ui/cadence_rwait.ui | |||
| $(PYUIC) $< -o $@ | |||
| src/ui_catarina.py: src/ui/catarina.ui | |||
| $(PYUIC) $< -o $@ | |||
| @@ -24,10 +24,12 @@ except: | |||
| # Imports (Global) | |||
| from platform import architecture | |||
| from PyQt4.QtCore import QThread | |||
| from PyQt4.QtGui import QApplication, QLabel, QMainWindow, QSizePolicy | |||
| # Imports (Custom Stuff) | |||
| import ui_cadence | |||
| import ui_cadence_tb_jack, ui_cadence_rwait | |||
| import systray | |||
| from shared_cadence import * | |||
| from shared_jack import * | |||
| @@ -319,6 +321,140 @@ def initSystemChecks(): | |||
| # --------------------------------------------------------------------- | |||
| # Wait while JACK restarts | |||
| class ForceRestartThread(QThread): | |||
| def __init__(self, parent): | |||
| QThread.__init__(self, parent) | |||
| self.m_wasStarted = False | |||
| def wasJackStarted(self): | |||
| return self.m_wasStarted | |||
| def run(self): | |||
| # Not started yet | |||
| self.m_wasStarted = False | |||
| self.emit(SIGNAL("progressChanged(int)"), 0) | |||
| # Kill All | |||
| stopAllAudioProcesses() | |||
| self.emit(SIGNAL("progressChanged(int)"), 30) | |||
| # Connect to jackdbus | |||
| self.parent().DBusReconnect() | |||
| if not DBus.jack: | |||
| return | |||
| for x in range(30): | |||
| self.emit(SIGNAL("progressChanged(int)"), 30+x*2) | |||
| procsList = getProcList() | |||
| if "jackdbus" in procsList: | |||
| break | |||
| else: | |||
| sleep(0.1) | |||
| self.emit(SIGNAL("progressChanged(int)"), 90) | |||
| # Start it | |||
| DBus.jack.StartServer() | |||
| self.emit(SIGNAL("progressChanged(int)"), 95) | |||
| # If we made it this far, then JACK is started | |||
| self.m_wasStarted = True | |||
| # Start A2J and Pulse according to user settings | |||
| if GlobalSettings.value("A2J/AutoStart", True, type=bool) and DBus.a2j and not bool(DBus.a2j.is_started()): | |||
| a2jExportHW = GlobalSettings.value("A2J/ExportHW", True, type=bool) | |||
| DBus.a2j.set_hw_export(a2jExportHW) | |||
| DBus.a2j.start() | |||
| self.emit(SIGNAL("progressChanged(int)"), 100) | |||
| # TODO | |||
| #if GlobalSettings.value("Pulse2JACK/AutoStart", True, type=bool) and not PA_is_bridged(): | |||
| #if GlobalSettings.value("Pulse2JACK/PlaybackModeOnly", False, type=bool): | |||
| #os.system("cadence-pulse2jack -p") | |||
| #else: | |||
| #os.system("cadence-pulse2jack") | |||
| # Force Restart Dialog | |||
| class ForceWaitDialog(QDialog, ui_cadence_rwait.Ui_Dialog): | |||
| def __init__(self, parent): | |||
| QDialog.__init__(self, parent) | |||
| self.setupUi(self) | |||
| self.setWindowFlags(Qt.Dialog|Qt.WindowCloseButtonHint) | |||
| self.rThread = ForceRestartThread(self) | |||
| self.rThread.start() | |||
| self.connect(self.rThread, SIGNAL("progressChanged(int)"), self.progressBar, SLOT("setValue(int)")) | |||
| self.connect(self.rThread, SIGNAL("finished()"), SLOT("slot_rThreadFinished()")) | |||
| def DBusReconnect(self): | |||
| self.parent().DBusReconnect() | |||
| @pyqtSlot() | |||
| def slot_rThreadFinished(self): | |||
| self.close() | |||
| if self.rThread.wasJackStarted(): | |||
| QMessageBox.information(self, self.tr("Info"), self.tr("JACK was re-started sucessfully")) | |||
| else: | |||
| QMessageBox.critical(self, self.tr("Error"), self.tr("Could not start JACK!")) | |||
| # Additional JACK options | |||
| class ToolBarJackDialog(QDialog, ui_cadence_tb_jack.Ui_Dialog): | |||
| def __init__(self, parent): | |||
| QDialog.__init__(self, parent) | |||
| self.setupUi(self) | |||
| self.m_ladishLoaded = False | |||
| if haveDBus: | |||
| if GlobalSettings.value("JACK/AutoLoadLadishStudio", False, type=bool): | |||
| self.rb_ladish.setChecked(True) | |||
| self.m_ladishLoaded = True | |||
| elif "org.ladish" in DBus.bus.list_names(): | |||
| self.m_ladishLoaded = True | |||
| else: | |||
| self.rb_ladish.setEnabled(False) | |||
| self.rb_jack.setChecked(True) | |||
| if self.m_ladishLoaded: | |||
| self.fillStudioNames() | |||
| self.connect(self, SIGNAL("accepted()"), SLOT("slot_setOptions()")) | |||
| self.connect(self.rb_ladish, SIGNAL("clicked()"), SLOT("slot_maybeFillStudioNames()")) | |||
| def fillStudioNames(self): | |||
| DBus.ladish_control = DBus.bus.get_object("org.ladish", "/org/ladish/Control") | |||
| ladishStudioName = dbus.String(GlobalSettings.value("JACK/LadishStudioName", "", type=str)) | |||
| ladishStudioListDump = DBus.ladish_control.GetStudioList() | |||
| if len(ladishStudioListDump) == 0: | |||
| self.rb_ladish.setEnabled(False) | |||
| self.rb_jack.setChecked(True) | |||
| else: | |||
| i=0 | |||
| for thisStudioName, thisStudioDict in ladishStudioListDump: | |||
| self.cb_studio_name.addItem(thisStudioName) | |||
| if ladishStudioName and thisStudioName == ladishStudioName: | |||
| self.cb_studio_name.setCurrentIndex(i) | |||
| i += 1 | |||
| @pyqtSlot() | |||
| def slot_maybeFillStudioNames(self): | |||
| if not self.m_ladishLoaded: | |||
| self.fillStudioNames() | |||
| self.m_ladishLoaded = True | |||
| @pyqtSlot() | |||
| def slot_setOptions(self): | |||
| GlobalSettings.setValue("JACK/AutoLoadLadishStudio", self.rb_ladish.isChecked()) | |||
| GlobalSettings.setValue("JACK/LadishStudioName", self.cb_studio_name.currentText()) | |||
| # Main Window | |||
| class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): | |||
| def __init__(self, parent=None): | |||
| @@ -328,9 +464,6 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): | |||
| self.settings = QSettings("Cadence", "Cadence") | |||
| self.loadSettings(True) | |||
| # TODO | |||
| self.b_jack_restart.setEnabled(False) | |||
| self.pix_apply = QIcon(getIcon("dialog-ok-apply", 16)).pixmap(16, 16) | |||
| self.pix_cancel = QIcon(getIcon("dialog-cancel", 16)).pixmap(16, 16) | |||
| self.pix_error = QIcon(getIcon("dialog-error", 16)).pixmap(16, 16) | |||
| @@ -584,6 +717,7 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): | |||
| self.connect(self.b_jack_stop, SIGNAL("clicked()"), SLOT("slot_JackServerStop()")) | |||
| self.connect(self.b_jack_restart, SIGNAL("clicked()"), SLOT("slot_JackServerForceRestart()")) | |||
| self.connect(self.b_jack_configure, SIGNAL("clicked()"), SLOT("slot_JackServerConfigure()")) | |||
| self.connect(self.tb_jack_options, SIGNAL("clicked()"), SLOT("slot_JackOptions()")) | |||
| self.connect(self.act_tools_catarina, SIGNAL("triggered()"), lambda tool="catarina": self.func_start_tool(tool)) | |||
| self.connect(self.act_tools_catia, SIGNAL("triggered()"), lambda tool="catia": self.func_start_tool(tool)) | |||
| @@ -793,7 +927,19 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): | |||
| @pyqtSlot() | |||
| def slot_JackServerForceRestart(self): | |||
| pass | |||
| if DBus.jack.IsStarted(): | |||
| ask = CustomMessageBox(self, QMessageBox.Warning, self.tr("Warning"), | |||
| self.tr("This will force kill all JACK applications!<br>Make sure to save your projects before continue."), | |||
| self.tr("Are you sure you want to force the restart of JACK?")) | |||
| if ask != QMessageBox.Yes: | |||
| return | |||
| if self.m_timer250: | |||
| self.killTimer(self.m_timer250) | |||
| self.m_timer250 = None | |||
| ForceWaitDialog(self).exec_() | |||
| @pyqtSlot() | |||
| def slot_JackServerConfigure(self): | |||
| @@ -801,6 +947,10 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): | |||
| jacksettingsW.exec_() | |||
| del jacksettingsW | |||
| @pyqtSlot() | |||
| def slot_JackOptions(self): | |||
| ToolBarJackDialog(self).exec_() | |||
| @pyqtSlot() | |||
| def slot_JackClearXruns(self): | |||
| if DBus.jack: | |||
| @@ -48,7 +48,7 @@ try: | |||
| TrayEngine = "AppIndicator" | |||
| elif getenv("KDE_FULL_SESSION"): | |||
| elif getenv("KDE_FULL_SESSION") or getenv("DESKTOP_SESSION") == "kde-plasma": | |||
| from PyKDE4.kdeui import KAction, KIcon, KMenu, KStatusNotifierItem | |||
| TrayEngine = "KDE" | |||
| @@ -455,7 +455,7 @@ | |||
| </widget> | |||
| </item> | |||
| <item> | |||
| <widget class="QToolButton" name="toolButton"> | |||
| <widget class="QToolButton" name="tb_jack_options"> | |||
| <property name="text"> | |||
| <string>...</string> | |||
| </property> | |||
| @@ -474,7 +474,15 @@ | |||
| <layout class="QGridLayout" name="gridLayout_5"> | |||
| <item row="0" column="0"> | |||
| <widget class="QToolBox" name="toolBox_2"> | |||
| <widget class="QWidget" name="toolBox_alsaaudio" native="true"> | |||
| <widget class="QWidget" name="toolBox_alsaaudio"> | |||
| <property name="geometry"> | |||
| <rect> | |||
| <x>0</x> | |||
| <y>0</y> | |||
| <width>343</width> | |||
| <height>89</height> | |||
| </rect> | |||
| </property> | |||
| <attribute name="label"> | |||
| <string>ALSA Audio</string> | |||
| </attribute> | |||
| @@ -586,7 +594,15 @@ | |||
| </item> | |||
| </layout> | |||
| </widget> | |||
| <widget class="QWidget" name="toolBox_alsamidi" native="true"> | |||
| <widget class="QWidget" name="toolBox_alsamidi"> | |||
| <property name="geometry"> | |||
| <rect> | |||
| <x>0</x> | |||
| <y>0</y> | |||
| <width>298</width> | |||
| <height>81</height> | |||
| </rect> | |||
| </property> | |||
| <attribute name="label"> | |||
| <string>ALSA MIDI</string> | |||
| </attribute> | |||
| @@ -691,7 +707,15 @@ | |||
| </item> | |||
| </layout> | |||
| </widget> | |||
| <widget class="QWidget" name="toolBox_pulseaudio" native="true"> | |||
| <widget class="QWidget" name="toolBox_pulseaudio"> | |||
| <property name="geometry"> | |||
| <rect> | |||
| <x>0</x> | |||
| <y>0</y> | |||
| <width>212</width> | |||
| <height>81</height> | |||
| </rect> | |||
| </property> | |||
| <attribute name="label"> | |||
| <string>PulseAudio</string> | |||
| </attribute> | |||
| @@ -1382,7 +1406,7 @@ | |||
| <rect> | |||
| <x>0</x> | |||
| <y>0</y> | |||
| <width>76</width> | |||
| <width>94</width> | |||
| <height>76</height> | |||
| </rect> | |||
| </property> | |||
| @@ -1400,7 +1424,7 @@ | |||
| <rect> | |||
| <x>0</x> | |||
| <y>0</y> | |||
| <width>89</width> | |||
| <width>94</width> | |||
| <height>76</height> | |||
| </rect> | |||
| </property> | |||
| @@ -1418,7 +1442,7 @@ | |||
| <rect> | |||
| <x>0</x> | |||
| <y>0</y> | |||
| <width>89</width> | |||
| <width>94</width> | |||
| <height>76</height> | |||
| </rect> | |||
| </property> | |||
| @@ -1436,7 +1460,7 @@ | |||
| <rect> | |||
| <x>0</x> | |||
| <y>0</y> | |||
| <width>89</width> | |||
| <width>94</width> | |||
| <height>76</height> | |||
| </rect> | |||
| </property> | |||
| @@ -0,0 +1,43 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <ui version="4.0"> | |||
| <class>Dialog</class> | |||
| <widget class="QDialog" name="Dialog"> | |||
| <property name="geometry"> | |||
| <rect> | |||
| <x>0</x> | |||
| <y>0</y> | |||
| <width>315</width> | |||
| <height>120</height> | |||
| </rect> | |||
| </property> | |||
| <property name="windowTitle"> | |||
| <string>Restarting JACK</string> | |||
| </property> | |||
| <layout class="QVBoxLayout" name="verticalLayout"> | |||
| <item> | |||
| <widget class="QLabel" name="label"> | |||
| <property name="font"> | |||
| <font> | |||
| <pointsize>12</pointsize> | |||
| </font> | |||
| </property> | |||
| <property name="text"> | |||
| <string>Please wait...</string> | |||
| </property> | |||
| <property name="alignment"> | |||
| <set>Qt::AlignCenter</set> | |||
| </property> | |||
| </widget> | |||
| </item> | |||
| <item> | |||
| <widget class="QProgressBar" name="progressBar"> | |||
| <property name="value"> | |||
| <number>0</number> | |||
| </property> | |||
| </widget> | |||
| </item> | |||
| </layout> | |||
| </widget> | |||
| <resources/> | |||
| <connections/> | |||
| </ui> | |||
| @@ -0,0 +1,169 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <ui version="4.0"> | |||
| <class>Dialog</class> | |||
| <widget class="QDialog" name="Dialog"> | |||
| <property name="geometry"> | |||
| <rect> | |||
| <x>0</x> | |||
| <y>0</y> | |||
| <width>389</width> | |||
| <height>118</height> | |||
| </rect> | |||
| </property> | |||
| <property name="windowTitle"> | |||
| <string>JACK Options</string> | |||
| </property> | |||
| <layout class="QVBoxLayout" name="verticalLayout"> | |||
| <item> | |||
| <widget class="QRadioButton" name="rb_jack"> | |||
| <property name="text"> | |||
| <string>Load JACK Default Settings</string> | |||
| </property> | |||
| <property name="checked"> | |||
| <bool>true</bool> | |||
| </property> | |||
| </widget> | |||
| </item> | |||
| <item> | |||
| <widget class="QRadioButton" name="rb_ladish"> | |||
| <property name="text"> | |||
| <string>Load LADISH Studio</string> | |||
| </property> | |||
| </widget> | |||
| </item> | |||
| <item> | |||
| <layout class="QHBoxLayout" name="horizontalLayout"> | |||
| <item> | |||
| <spacer name="horizontalSpacer"> | |||
| <property name="orientation"> | |||
| <enum>Qt::Horizontal</enum> | |||
| </property> | |||
| <property name="sizeType"> | |||
| <enum>QSizePolicy::Fixed</enum> | |||
| </property> | |||
| <property name="sizeHint" stdset="0"> | |||
| <size> | |||
| <width>20</width> | |||
| <height>20</height> | |||
| </size> | |||
| </property> | |||
| </spacer> | |||
| </item> | |||
| <item> | |||
| <widget class="QLabel" name="label"> | |||
| <property name="enabled"> | |||
| <bool>false</bool> | |||
| </property> | |||
| <property name="text"> | |||
| <string>Studio Name:</string> | |||
| </property> | |||
| </widget> | |||
| </item> | |||
| <item> | |||
| <widget class="QComboBox" name="cb_studio_name"> | |||
| <property name="enabled"> | |||
| <bool>false</bool> | |||
| </property> | |||
| <property name="sizePolicy"> | |||
| <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> | |||
| <horstretch>0</horstretch> | |||
| <verstretch>0</verstretch> | |||
| </sizepolicy> | |||
| </property> | |||
| </widget> | |||
| </item> | |||
| </layout> | |||
| </item> | |||
| <item> | |||
| <spacer name="verticalSpacer"> | |||
| <property name="orientation"> | |||
| <enum>Qt::Vertical</enum> | |||
| </property> | |||
| <property name="sizeHint" stdset="0"> | |||
| <size> | |||
| <width>20</width> | |||
| <height>40</height> | |||
| </size> | |||
| </property> | |||
| </spacer> | |||
| </item> | |||
| <item> | |||
| <widget class="QDialogButtonBox" name="buttonBox"> | |||
| <property name="orientation"> | |||
| <enum>Qt::Horizontal</enum> | |||
| </property> | |||
| <property name="standardButtons"> | |||
| <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> | |||
| </property> | |||
| </widget> | |||
| </item> | |||
| </layout> | |||
| </widget> | |||
| <resources/> | |||
| <connections> | |||
| <connection> | |||
| <sender>buttonBox</sender> | |||
| <signal>accepted()</signal> | |||
| <receiver>Dialog</receiver> | |||
| <slot>accept()</slot> | |||
| <hints> | |||
| <hint type="sourcelabel"> | |||
| <x>224</x> | |||
| <y>113</y> | |||
| </hint> | |||
| <hint type="destinationlabel"> | |||
| <x>157</x> | |||
| <y>129</y> | |||
| </hint> | |||
| </hints> | |||
| </connection> | |||
| <connection> | |||
| <sender>buttonBox</sender> | |||
| <signal>rejected()</signal> | |||
| <receiver>Dialog</receiver> | |||
| <slot>reject()</slot> | |||
| <hints> | |||
| <hint type="sourcelabel"> | |||
| <x>292</x> | |||
| <y>119</y> | |||
| </hint> | |||
| <hint type="destinationlabel"> | |||
| <x>286</x> | |||
| <y>129</y> | |||
| </hint> | |||
| </hints> | |||
| </connection> | |||
| <connection> | |||
| <sender>rb_ladish</sender> | |||
| <signal>toggled(bool)</signal> | |||
| <receiver>label</receiver> | |||
| <slot>setEnabled(bool)</slot> | |||
| <hints> | |||
| <hint type="sourcelabel"> | |||
| <x>83</x> | |||
| <y>38</y> | |||
| </hint> | |||
| <hint type="destinationlabel"> | |||
| <x>78</x> | |||
| <y>63</y> | |||
| </hint> | |||
| </hints> | |||
| </connection> | |||
| <connection> | |||
| <sender>rb_ladish</sender> | |||
| <signal>toggled(bool)</signal> | |||
| <receiver>cb_studio_name</receiver> | |||
| <slot>setEnabled(bool)</slot> | |||
| <hints> | |||
| <hint type="sourcelabel"> | |||
| <x>115</x> | |||
| <y>34</y> | |||
| </hint> | |||
| <hint type="destinationlabel"> | |||
| <x>163</x> | |||
| <y>67</y> | |||
| </hint> | |||
| </hints> | |||
| </connection> | |||
| </connections> | |||
| </ui> | |||