Browse Source

Merge branch 'master' into allow-disabling-stripping

pull/159/head
Filipe Coelho GitHub 5 years ago
parent
commit
5bb06ec37d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 951 additions and 781 deletions
  1. +4
    -4
      INSTALL.md
  2. +6
    -6
      Makefile
  3. +1
    -1
      README.md
  4. +9
    -1
      c++/Makefile.mk
  5. +2
    -2
      c++/jackmeter/Makefile
  6. +4
    -8
      c++/jackmeter/jackmeter.cpp
  7. +1
    -1
      c++/widgets/digitalpeakmeter.hpp
  8. +1
    -1
      c++/widgets/pixmapdial.hpp
  9. +1
    -1
      c++/widgets/pixmapkeyboard.hpp
  10. +2
    -2
      c++/xycontroller/Makefile
  11. +6
    -6
      c++/xycontroller/xycontroller.cpp
  12. +3
    -1
      data/unity/cadence-unity-support
  13. +4
    -11
      resources/ui/cadence.ui
  14. +1
    -11
      resources/ui/catarina.ui
  15. +1
    -11
      resources/ui/catia.ui
  16. +1
    -11
      resources/ui/claudia.ui
  17. +230
    -178
      src/cadence.py
  18. +6
    -2
      src/cadence_aloop_daemon.py
  19. +5
    -2
      src/cadence_session_start.py
  20. +19
    -9
      src/canvaspreviewframe.py
  21. +85
    -79
      src/catarina.py
  22. +32
    -32
      src/catia.py
  23. +199
    -163
      src/claudia.py
  24. +1
    -1
      src/claudia_database.py
  25. +51
    -40
      src/claudia_launcher.py
  26. +14
    -6
      src/clickablelabel.py
  27. +50
    -34
      src/jacksettings.py
  28. +20
    -8
      src/logs.py
  29. +19
    -9
      src/patchcanvas.py
  30. +7
    -3
      src/patchcanvas_theme.py
  31. +19
    -14
      src/render.py
  32. +25
    -11
      src/shared.py
  33. +15
    -5
      src/shared_cadence.py
  34. +63
    -58
      src/shared_canvasjack.py
  35. +10
    -6
      src/shared_settings.py
  36. +34
    -43
      src/systray.py

+ 4
- 4
INSTALL.md View File

@@ -19,12 +19,12 @@ Packagers can make use of the 'PREFIX' and 'DESTDIR' variable during install, li
The required build dependencies are: <i>(devel packages of these)</i> The required build dependencies are: <i>(devel packages of these)</i>


- JACK - JACK
- Qt4
- PyQt4 (Py3 version)
- Qt5
- PyQt5 (Py3 version)


On Debian and Ubuntu, use these commands to install all build dependencies: <br/> On Debian and Ubuntu, use these commands to install all build dependencies: <br/>
`$ sudo apt-get install libjack-dev libqt4-dev qt4-dev-tools` <br/>
`$ sudo apt-get install python-qt4-dev python3-pyqt4 pyqt4-dev-tools`
`$ sudo apt-get install libjack-jackd2-dev qtbase5-dev, qtbase5-dev-tools` <br/>
`$ sudo apt-get install python3-pyqt5 python3-pyqt5.qtsvg pyqt5-dev-tools`


To run all the apps/tools, you'll additionally need: To run all the apps/tools, you'll additionally need:




+ 6
- 6
Makefile View File

@@ -8,14 +8,14 @@ PREFIX = /usr/local
DESTDIR = DESTDIR =


LINK = ln -s LINK = ln -s
PYUIC ?= pyuic4
PYRCC ?= pyrcc4 -py3
PYUIC ?= pyuic5
PYRCC ?= pyrcc5


# Detect X11 rules dir # Detect X11 rules dir
ifeq "$(wildcard /etc/X11/xinit/xinitrc.d/ )" ""
X11_RC_DIR = $(DESTDIR)/etc/X11/Xsession.d/
else
ifeq "$(wildcard /etc/X11/Xsession.d/ )" ""
X11_RC_DIR = $(DESTDIR)/etc/X11/xinit/xinitrc.d/ X11_RC_DIR = $(DESTDIR)/etc/X11/xinit/xinitrc.d/
else
X11_RC_DIR = $(DESTDIR)/etc/X11/Xsession.d/
endif endif


# ----------------------------------------------------------------------------------------------------------------------------------------- # -----------------------------------------------------------------------------------------------------------------------------------------
@@ -164,7 +164,7 @@ install:
# Install addtional stuff for Cadence # Install addtional stuff for Cadence
install -m 644 data/pulse2jack/* $(DESTDIR)$(PREFIX)/share/cadence/pulse2jack/ install -m 644 data/pulse2jack/* $(DESTDIR)$(PREFIX)/share/cadence/pulse2jack/
install -m 644 data/pulse2loopback/* $(DESTDIR)$(PREFIX)/share/cadence/pulse2loopback/ install -m 644 data/pulse2loopback/* $(DESTDIR)$(PREFIX)/share/cadence/pulse2loopback/
install -m 644 data/61cadence-session-inject $(X11_RC_DIR)
install -m 755 data/61cadence-session-inject $(X11_RC_DIR)


# Install addtional stuff for Claudia # Install addtional stuff for Claudia
cp -r data/icons/* $(DESTDIR)$(PREFIX)/share/cadence/icons/ cp -r data/icons/* $(DESTDIR)$(PREFIX)/share/cadence/icons/


+ 1
- 1
README.md View File

@@ -1,7 +1,7 @@
# --- README for Cadence --- # --- README for Cadence ---


Cadence is a set of tools useful for audio production. <br/> Cadence is a set of tools useful for audio production. <br/>
It's being developed by falkTX, using Python3 and Qt4 (and some C++ where needed).
It's being developed by falkTX, using Python3 and Qt5 (and some C++ where needed).


The tools share the same base source code, so most of them look quite similar (which is intentional). <br/> The tools share the same base source code, so most of them look quite similar (which is intentional). <br/>
Also, lots of custom widgets were coded when needed (like pixmapdial, pixmapkeyboard, patchcanvas and systray). <br/> Also, lots of custom widgets were coded when needed (like pixmapdial, pixmapkeyboard, patchcanvas and systray). <br/>


+ 9
- 1
c++/Makefile.mk View File

@@ -10,8 +10,14 @@ CXX ?= g++
MOC ?= $(shell pkg-config --variable=moc_location QtCore) MOC ?= $(shell pkg-config --variable=moc_location QtCore)
RCC ?= $(shell pkg-config --variable=rcc_location QtCore) RCC ?= $(shell pkg-config --variable=rcc_location QtCore)
UIC ?= $(shell pkg-config --variable=uic_location QtCore) UIC ?= $(shell pkg-config --variable=uic_location QtCore)
STRIP ?= strip
WINDRES ?= windres WINDRES ?= windres


HOSTBINS = $(shell pkg-config --variable=host_bins Qt5Core)
MOC ?= $(HOSTBINS)/moc
RCC ?= $(HOSTBINS)/rcc
UIC ?= $(HOSTBINS)/uic

# -------------------------------------------------------------- # --------------------------------------------------------------


DEBUG ?= false DEBUG ?= false
@@ -20,10 +26,12 @@ ifeq ($(DEBUG),true)
BASE_FLAGS = -O0 -g -Wall -Wextra BASE_FLAGS = -O0 -g -Wall -Wextra
BASE_FLAGS += -DDEBUG BASE_FLAGS += -DDEBUG
else else
BASE_FLAGS = -O2 -ffast-math -mtune=generic -msse -mfpmath=sse -Wall -Wextra
BASE_FLAGS = -O3 -ffast-math -Wall -Wextra
BASE_FLAGS += -DNDEBUG BASE_FLAGS += -DNDEBUG
endif endif


BASE_FLAGS += -fPIC

BUILD_C_FLAGS = $(BASE_FLAGS) -std=c99 $(CFLAGS) BUILD_C_FLAGS = $(BASE_FLAGS) -std=c99 $(CFLAGS)
BUILD_CXX_FLAGS = $(BASE_FLAGS) -std=c++0x $(CXXFLAGS) BUILD_CXX_FLAGS = $(BASE_FLAGS) -std=c++0x $(CXXFLAGS)
LINK_FLAGS = $(LDFLAGS) LINK_FLAGS = $(LDFLAGS)


+ 2
- 2
c++/jackmeter/Makefile View File

@@ -9,8 +9,8 @@ include ../Makefile.mk
# -------------------------------------------------------------- # --------------------------------------------------------------


BUILD_CXX_FLAGS += -I../widgets BUILD_CXX_FLAGS += -I../widgets
BUILD_CXX_FLAGS += $(shell pkg-config --cflags QtCore QtGui)
LINK_FLAGS += $(shell pkg-config --libs QtCore QtGui)
BUILD_CXX_FLAGS += $(shell pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets)
LINK_FLAGS += $(shell pkg-config --libs Qt5Core Qt5Gui Qt5Widgets)


ifeq ($(HAVE_JACKSESSION),true) ifeq ($(HAVE_JACKSESSION),true)
BUILD_CXX_FLAGS += -DHAVE_JACKSESSION BUILD_CXX_FLAGS += -DHAVE_JACKSESSION


+ 4
- 8
c++/jackmeter/jackmeter.cpp View File

@@ -27,9 +27,9 @@
#include "../widgets/digitalpeakmeter.hpp" #include "../widgets/digitalpeakmeter.hpp"


#include <cmath> #include <cmath>
#include <QtGui/QApplication>
#include <QtGui/QIcon> #include <QtGui/QIcon>
#include <QtGui/QMessageBox>
#include <QtWidgets/QApplication>
#include <QtWidgets/QMessageBox>


// ------------------------------- // -------------------------------


@@ -134,17 +134,13 @@ void reconnect_ports()
} }
else else
{ {
if (jack_port_t* const jRecPort1 = jackbridge_port_by_name(jClient, "system:capture_1"))
{
if (jackbridge_port_by_name(jClient, "system:capture_1") != nullptr)
if (! jackbridge_port_connected_to(jPort1, "system:capture_1")) if (! jackbridge_port_connected_to(jPort1, "system:capture_1"))
jackbridge_connect(jClient, "system:capture_1", nameIn1.toUtf8().constData()); jackbridge_connect(jClient, "system:capture_1", nameIn1.toUtf8().constData());
}


if (jack_port_t* const jRecPort2 = jackbridge_port_by_name(jClient, "system:capture_2"))
{
if (jackbridge_port_by_name(jClient, "system:capture_2") != nullptr)
if (! jackbridge_port_connected_to(jPort2, "system:capture_2")) if (! jackbridge_port_connected_to(jPort2, "system:capture_2"))
jackbridge_connect(jClient, "system:capture_2", nameIn2.toUtf8().constData()); jackbridge_connect(jClient, "system:capture_2", nameIn2.toUtf8().constData());
}
} }
} }




+ 1
- 1
c++/widgets/digitalpeakmeter.hpp View File

@@ -19,7 +19,7 @@
#define __DIGITALPEAKMETER_HPP__ #define __DIGITALPEAKMETER_HPP__


#include <QtCore/QTimer> #include <QtCore/QTimer>
#include <QtGui/QWidget>
#include <QtWidgets/QWidget>


class DigitalPeakMeter : public QWidget class DigitalPeakMeter : public QWidget
{ {


+ 1
- 1
c++/widgets/pixmapdial.hpp View File

@@ -19,7 +19,7 @@
#define __PIXMAPDIAL_HPP__ #define __PIXMAPDIAL_HPP__


#include <QtGui/QPixmap> #include <QtGui/QPixmap>
#include <QtGui/QDial>
#include <QtWidgets/QDial>


class PixmapDial : public QDial class PixmapDial : public QDial
{ {


+ 1
- 1
c++/widgets/pixmapkeyboard.hpp View File

@@ -20,7 +20,7 @@


#include <map> #include <map>
#include <QtGui/QPixmap> #include <QtGui/QPixmap>
#include <QtGui/QWidget>
#include <QtWidgets/QWidget>


class PixmapKeyboard : public QWidget class PixmapKeyboard : public QWidget
{ {


+ 2
- 2
c++/xycontroller/Makefile View File

@@ -9,8 +9,8 @@ include ../Makefile.mk
# -------------------------------------------------------------- # --------------------------------------------------------------


BUILD_CXX_FLAGS += -I../widgets BUILD_CXX_FLAGS += -I../widgets
BUILD_CXX_FLAGS += $(shell pkg-config --cflags QtCore QtGui)
LINK_FLAGS += $(shell pkg-config --libs QtCore QtGui)
BUILD_CXX_FLAGS += $(shell pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets)
LINK_FLAGS += $(shell pkg-config --libs Qt5Core Qt5Gui Qt5Widgets)


ifeq ($(HAVE_JACKSESSION),true) ifeq ($(HAVE_JACKSESSION),true)
BUILD_CXX_FLAGS += -DHAVE_JACKSESSION BUILD_CXX_FLAGS += -DHAVE_JACKSESSION


+ 6
- 6
c++/xycontroller/xycontroller.cpp View File

@@ -29,13 +29,13 @@


#include <QtCore/QSettings> #include <QtCore/QSettings>
#include <QtCore/QTimer> #include <QtCore/QTimer>
#include <QtGui/QApplication>
#include <QtGui/QGraphicsItem>
#include <QtGui/QGraphicsScene>
#include <QtGui/QGraphicsSceneEvent>
#include <QtGui/QKeyEvent> #include <QtGui/QKeyEvent>
#include <QtGui/QMainWindow>
#include <QtGui/QMessageBox>
#include <QtWidgets/QApplication>
#include <QtWidgets/QGraphicsItem>
#include <QtWidgets/QGraphicsScene>
#include <QtWidgets/QGraphicsSceneEvent>
#include <QtWidgets/QMainWindow>
#include <QtWidgets/QMessageBox>


// ------------------------------- // -------------------------------




+ 3
- 1
data/unity/cadence-unity-support View File

@@ -3,7 +3,7 @@


# Imports (Global) # Imports (Global)
import dbus, signal, sys import dbus, signal, sys
from PyQt4.QtCore import QCoreApplication, QObject
from PyQt5.QtCore import QCoreApplication, QObject


# DBus # DBus
class DBus(object): class DBus(object):
@@ -98,6 +98,8 @@ class CadenceUnityApp(QObject):
if __name__ == '__main__': if __name__ == '__main__':


# Imports (Unity) # Imports (Unity)
from gi import require_version as gi_require_version
gi_require_version('Unity', '7.0')
from gi.repository import Unity from gi.repository import Unity


# App initialization # App initialization


+ 4
- 11
resources/ui/cadence.ui View File

@@ -782,13 +782,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QPushButton" name="b_a2j_export_hw">
<property name="text">
<string>Export HW...</string>
</property>
</widget>
</item>
<item> <item>
<spacer name="horizontalSpacer_8"> <spacer name="horizontalSpacer_8">
<property name="orientation"> <property name="orientation">
@@ -823,16 +816,16 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="cb_a2j_autostart">
<widget class="QCheckBox" name="cb_a2j_autoexport">
<property name="text"> <property name="text">
<string>Auto-start at login</string>
<string>Export hardware ports</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QToolButton" name="tb_a2j_options">
<widget class="QCheckBox" name="cb_a2j_autostart">
<property name="text"> <property name="text">
<string>...</string>
<string>Start with Jack</string>
</property> </property>
</widget> </widget>
</item> </item>


+ 1
- 11
resources/ui/catarina.ui View File

@@ -419,7 +419,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>651</width> <width>651</width>
<height>19</height>
<height>20</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menu_File"> <widget class="QMenu" name="menu_File">
@@ -483,7 +483,6 @@
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="menu_Zoom"/> <addaction name="menu_Zoom"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="act_canvas_print"/>
<addaction name="act_canvas_save_image"/> <addaction name="act_canvas_save_image"/>
</widget> </widget>
<addaction name="menu_File"/> <addaction name="menu_File"/>
@@ -677,15 +676,6 @@
<string>Ctrl+G</string> <string>Ctrl+G</string>
</property> </property>
</action> </action>
<action name="act_canvas_print">
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/16x16/document-print.png</normaloff>:/16x16/document-print.png</iconset>
</property>
<property name="text">
<string>Print...</string>
</property>
</action>
<action name="act_canvas_save_image"> <action name="act_canvas_save_image">
<property name="text"> <property name="text">
<string>Save Image...</string> <string>Save Image...</string>


+ 1
- 11
resources/ui/catia.ui View File

@@ -458,7 +458,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>702</width> <width>702</width>
<height>19</height>
<height>20</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menu_File"> <widget class="QMenu" name="menu_File">
@@ -501,7 +501,6 @@
<addaction name="act_canvas_refresh"/> <addaction name="act_canvas_refresh"/>
<addaction name="menu_Canvas_Zoom"/> <addaction name="menu_Canvas_Zoom"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="act_canvas_print"/>
<addaction name="act_canvas_save_image"/> <addaction name="act_canvas_save_image"/>
</widget> </widget>
<widget class="QMenu" name="menu_Tools"> <widget class="QMenu" name="menu_Tools">
@@ -940,15 +939,6 @@
<string>Save As &amp;Template...</string> <string>Save As &amp;Template...</string>
</property> </property>
</action> </action>
<action name="act_canvas_print">
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/16x16/document-print.png</normaloff>:/16x16/document-print.png</iconset>
</property>
<property name="text">
<string>&amp;Print...</string>
</property>
</action>
<action name="act_canvas_save_image"> <action name="act_canvas_save_image">
<property name="text"> <property name="text">
<string>Save &amp;Image...</string> <string>Save &amp;Image...</string>


+ 1
- 11
resources/ui/claudia.ui View File

@@ -770,7 +770,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>877</width> <width>877</width>
<height>19</height>
<height>20</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menu_Studio"> <widget class="QMenu" name="menu_Studio">
@@ -916,7 +916,6 @@
<addaction name="act_canvas_refresh"/> <addaction name="act_canvas_refresh"/>
<addaction name="menu_Canvas_Zoom"/> <addaction name="menu_Canvas_Zoom"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="act_canvas_print"/>
<addaction name="act_canvas_save_image"/> <addaction name="act_canvas_save_image"/>
</widget> </widget>
<addaction name="menu_Studio"/> <addaction name="menu_Studio"/>
@@ -1346,15 +1345,6 @@
<string>Ctrl+1</string> <string>Ctrl+1</string>
</property> </property>
</action> </action>
<action name="act_canvas_print">
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/16x16/document-print.png</normaloff>:/16x16/document-print.png</iconset>
</property>
<property name="text">
<string>Print...</string>
</property>
</action>
<action name="act_canvas_save_image"> <action name="act_canvas_save_image">
<property name="text"> <property name="text">
<string>Save Image...</string> <string>Save Image...</string>


+ 230
- 178
src/cadence.py View File

@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-


# Cadence, JACK utilities # Cadence, JACK utilities
# Copyright (C) 2010-2013 Filipe Coelho <falktx@falktx.com>
# Copyright (C) 2010-2018 Filipe Coelho <falktx@falktx.com>
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -20,8 +20,13 @@
# Imports (Global) # Imports (Global)


from platform import architecture from platform import architecture
from PyQt4.QtCore import QFileSystemWatcher, QThread
from PyQt4.QtGui import QApplication, QDialogButtonBox, QLabel, QMainWindow, QSizePolicy

if True:
from PyQt5.QtCore import QFileSystemWatcher, QThread, QSemaphore
from PyQt5.QtWidgets import QApplication, QDialogButtonBox, QLabel, QMainWindow, QSizePolicy
else:
from PyQt4.QtCore import QFileSystemWatcher, QThread, QSemaphore
from PyQt4.QtGui import QApplication, QDialogButtonBox, QLabel, QMainWindow, QSizePolicy


# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Imports (Custom Stuff) # Imports (Custom Stuff)
@@ -38,19 +43,16 @@ from shared_canvasjack import *
from shared_settings import * from shared_settings import *


# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Safe import getoutput
# Import getoutput


if sys.version_info >= (3, 0):
from subprocess import getoutput
else:
from commands import getoutput
from subprocess import getoutput


# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Try Import DBus # Try Import DBus


try: try:
import dbus import dbus
from dbus.mainloop.qt import DBusQtMainLoop
from dbus.mainloop.pyqt5 import DBusQtMainLoop
haveDBus = True haveDBus = True
except: except:
haveDBus = False haveDBus = False
@@ -511,6 +513,8 @@ def initSystemChecks():


# Wait while JACK restarts # Wait while JACK restarts
class ForceRestartThread(QThread): class ForceRestartThread(QThread):
progressChanged = pyqtSignal(int)

def __init__(self, parent): def __init__(self, parent):
QThread.__init__(self, parent) QThread.__init__(self, parent)


@@ -519,34 +523,43 @@ class ForceRestartThread(QThread):
def wasJackStarted(self): def wasJackStarted(self):
return self.m_wasStarted return self.m_wasStarted


def startA2J(self):
if not gDBus.a2j.get_hw_export() and GlobalSettings.value("A2J/AutoExport", True, type=bool):
gDBus.a2j.set_hw_export(True)
gDBus.a2j.start()

def run(self): def run(self):
# Not started yet # Not started yet
self.m_wasStarted = False self.m_wasStarted = False
self.emit(SIGNAL("progressChanged(int)"), 0)
self.progressChanged.emit(0)

# Stop JACK safely first, if possible
runFunctionInMainThread(tryCloseJackDBus)
self.progressChanged.emit(20)


# Kill All # Kill All
stopAllAudioProcesses()
self.emit(SIGNAL("progressChanged(int)"), 30)
stopAllAudioProcesses(False)
self.progressChanged.emit(30)


# Connect to jackdbus # Connect to jackdbus
self.parent().DBusReconnect()
runFunctionInMainThread(self.parent().DBusReconnect)


if not gDBus.jack: if not gDBus.jack:
return return


for x in range(30): for x in range(30):
self.emit(SIGNAL("progressChanged(int)"), 30+x*2)
self.progressChanged.emit(30+x*2)
procsList = getProcList() procsList = getProcList()
if "jackdbus" in procsList: if "jackdbus" in procsList:
break break
else: else:
sleep(0.1) sleep(0.1)


self.emit(SIGNAL("progressChanged(int)"), 90)
self.progressChanged.emit(90)


# Start it # Start it
gDBus.jack.StartServer()
self.emit(SIGNAL("progressChanged(int)"), 93)
runFunctionInMainThread(gDBus.jack.StartServer)
self.progressChanged.emit(93)


# If we made it this far, then JACK is started # If we made it this far, then JACK is started
self.m_wasStarted = True self.m_wasStarted = True
@@ -558,15 +571,13 @@ class ForceRestartThread(QThread):
startAlsaAudioLoopBridge() startAlsaAudioLoopBridge()
sleep(0.5) sleep(0.5)


self.emit(SIGNAL("progressChanged(int)"), 94)
self.progressChanged.emit(94)


# ALSA-MIDI # ALSA-MIDI
if GlobalSettings.value("A2J/AutoStart", True, type=bool) and gDBus.a2j and not bool(gDBus.a2j.is_started()):
a2jExportHW = GlobalSettings.value("A2J/ExportHW", True, type=bool)
gDBus.a2j.set_hw_export(a2jExportHW)
gDBus.a2j.start()
if GlobalSettings.value("A2J/AutoStart", True, type=bool) and not bool(gDBus.a2j.is_started()):
runFunctionInMainThread(self.startA2J)


self.emit(SIGNAL("progressChanged(int)"), 96)
self.progressChanged.emit(96)


# PulseAudio # PulseAudio
if GlobalSettings.value("Pulse2JACK/AutoStart", True, type=bool) and not isPulseAudioBridged(): if GlobalSettings.value("Pulse2JACK/AutoStart", True, type=bool) and not isPulseAudioBridged():
@@ -575,7 +586,7 @@ class ForceRestartThread(QThread):
else: else:
os.system("cadence-pulse2jack") os.system("cadence-pulse2jack")


self.emit(SIGNAL("progressChanged(int)"), 100)
self.progressChanged.emit(100)


# Force Restart Dialog # Force Restart Dialog
class ForceWaitDialog(QDialog, ui_cadence_rwait.Ui_Dialog): class ForceWaitDialog(QDialog, ui_cadence_rwait.Ui_Dialog):
@@ -587,8 +598,8 @@ class ForceWaitDialog(QDialog, ui_cadence_rwait.Ui_Dialog):
self.rThread = ForceRestartThread(self) self.rThread = ForceRestartThread(self)
self.rThread.start() self.rThread.start()


self.connect(self.rThread, SIGNAL("progressChanged(int)"), self.progressBar, SLOT("setValue(int)"))
self.connect(self.rThread, SIGNAL("finished()"), SLOT("slot_rThreadFinished()"))
self.rThread.progressChanged.connect(self.progressBar.setValue)
self.rThread.finished.connect(self.slot_rThreadFinished)


def DBusReconnect(self): def DBusReconnect(self):
self.parent().DBusReconnect() self.parent().DBusReconnect()
@@ -627,8 +638,8 @@ class ToolBarJackDialog(QDialog, ui_cadence_tb_jack.Ui_Dialog):
if self.m_ladishLoaded: if self.m_ladishLoaded:
self.fillStudioNames() self.fillStudioNames()


self.connect(self, SIGNAL("accepted()"), SLOT("slot_setOptions()"))
self.connect(self.rb_ladish, SIGNAL("clicked()"), SLOT("slot_maybeFillStudioNames()"))
self.accepted.connect(self.slot_setOptions)
self.rb_ladish.clicked.connect(self.slot_maybeFillStudioNames)


def fillStudioNames(self): def fillStudioNames(self):
gDBus.ladish_control = gDBus.bus.get_object("org.ladish", "/org/ladish/Control") gDBus.ladish_control = gDBus.bus.get_object("org.ladish", "/org/ladish/Control")
@@ -690,7 +701,7 @@ class ToolBarAlsaAudioDialog(QDialog, ui_cadence_tb_alsa.Ui_Dialog):
else: else:
self.comboBox.setCurrentIndex(0) self.comboBox.setCurrentIndex(0)


self.connect(self, SIGNAL("accepted()"), SLOT("slot_setOptions()"))
self.accepted.connect(self.slot_setOptions)


@pyqtSlot() @pyqtSlot()
def slot_setOptions(self): def slot_setOptions(self):
@@ -706,24 +717,6 @@ class ToolBarAlsaAudioDialog(QDialog, ui_cadence_tb_alsa.Ui_Dialog):
QDialog.done(self, r) QDialog.done(self, r)
self.close() self.close()


# Additional ALSA MIDI options
class ToolBarA2JDialog(QDialog, ui_cadence_tb_a2j.Ui_Dialog):
def __init__(self, parent):
QDialog.__init__(self, parent)
self.setupUi(self)

self.cb_export_hw.setChecked(GlobalSettings.value("A2J/ExportHW", True, type=bool))

self.connect(self, SIGNAL("accepted()"), SLOT("slot_setOptions()"))

@pyqtSlot()
def slot_setOptions(self):
GlobalSettings.setValue("A2J/ExportHW", self.cb_export_hw.isChecked())

def done(self, r):
QDialog.done(self, r)
self.close()

# Additional PulseAudio options # Additional PulseAudio options
class ToolBarPADialog(QDialog, ui_cadence_tb_pa.Ui_Dialog): class ToolBarPADialog(QDialog, ui_cadence_tb_pa.Ui_Dialog):
def __init__(self, parent): def __init__(self, parent):
@@ -732,7 +725,7 @@ class ToolBarPADialog(QDialog, ui_cadence_tb_pa.Ui_Dialog):


self.cb_playback_only.setChecked(GlobalSettings.value("Pulse2JACK/PlaybackModeOnly", False, type=bool)) self.cb_playback_only.setChecked(GlobalSettings.value("Pulse2JACK/PlaybackModeOnly", False, type=bool))


self.connect(self, SIGNAL("accepted()"), SLOT("slot_setOptions()"))
self.accepted.connect(self.slot_setOptions)


@pyqtSlot() @pyqtSlot()
def slot_setOptions(self): def slot_setOptions(self):
@@ -744,6 +737,17 @@ class ToolBarPADialog(QDialog, ui_cadence_tb_pa.Ui_Dialog):


# Main Window # Main Window
class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW):
DBusJackServerStartedCallback = pyqtSignal()
DBusJackServerStoppedCallback = pyqtSignal()
DBusJackClientAppearedCallback = pyqtSignal(int, str)
DBusJackClientDisappearedCallback = pyqtSignal(int)
DBusA2JBridgeStartedCallback = pyqtSignal()
DBusA2JBridgeStoppedCallback = pyqtSignal()

SIGTERM = pyqtSignal()
SIGUSR1 = pyqtSignal()
SIGUSR2 = pyqtSignal()

def __init__(self, parent=None): def __init__(self, parent=None):
QMainWindow.__init__(self, parent) QMainWindow.__init__(self, parent)
self.setupUi(self) self.setupUi(self)
@@ -797,8 +801,8 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW):
if haveFreqSelector and os.path.exists(self.m_availGovPath) and os.path.exists(self.m_curGovPath): if haveFreqSelector and os.path.exists(self.m_availGovPath) and os.path.exists(self.m_curGovPath):
self.m_govWatcher = QFileSystemWatcher(self) self.m_govWatcher = QFileSystemWatcher(self)
self.m_govWatcher.addPath(self.m_curGovPath) self.m_govWatcher.addPath(self.m_curGovPath)
self.connect(self.m_govWatcher, SIGNAL("fileChanged(const QString&)"), SLOT("slot_governorFileChanged()"))
QTimer.singleShot(0, self, SLOT("slot_governorFileChanged()"))
self.m_govWatcher.fileChanged.connect(self.slot_governorFileChanged)
QTimer.singleShot(0, self.slot_governorFileChanged)


availGovFd = open(self.m_availGovPath, "r") availGovFd = open(self.m_availGovPath, "r")
availGovRead = availGovFd.read().strip() availGovRead = availGovFd.read().strip()
@@ -887,7 +891,7 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW):
self.frame_tweaks_settings.setVisible(False) self.frame_tweaks_settings.setVisible(False)


for i in range(self.tw_tweaks.rowCount()): for i in range(self.tw_tweaks.rowCount()):
self.tw_tweaks.item(0, i).setTextAlignment(Qt.AlignCenter)
self.tw_tweaks.item(i, 0).setTextAlignment(Qt.AlignCenter)


self.tw_tweaks.setCurrentCell(0, 0) self.tw_tweaks.setCurrentCell(0, 0)


@@ -1059,7 +1063,6 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW):
self.systray.addMenu("a2j", self.tr("ALSA MIDI Bridge")) self.systray.addMenu("a2j", self.tr("ALSA MIDI Bridge"))
self.systray.addMenuAction("a2j", "a2j_start", self.tr("Start")) self.systray.addMenuAction("a2j", "a2j_start", self.tr("Start"))
self.systray.addMenuAction("a2j", "a2j_stop", self.tr("Stop")) self.systray.addMenuAction("a2j", "a2j_stop", self.tr("Stop"))
self.systray.addMenuAction("a2j", "a2j_export_hw", self.tr("Export Hardware Ports..."))
self.systray.addMenu("pulse", self.tr("PulseAudio Bridge")) self.systray.addMenu("pulse", self.tr("PulseAudio Bridge"))
self.systray.addMenuAction("pulse", "pulse_start", self.tr("Start")) self.systray.addMenuAction("pulse", "pulse_start", self.tr("Start"))
self.systray.addMenuAction("pulse", "pulse_stop", self.tr("Stop")) self.systray.addMenuAction("pulse", "pulse_stop", self.tr("Stop"))
@@ -1081,7 +1084,6 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW):
self.systray.connect("alsa_stop", self.slot_AlsaBridgeStop) self.systray.connect("alsa_stop", self.slot_AlsaBridgeStop)
self.systray.connect("a2j_start", self.slot_A2JBridgeStart) self.systray.connect("a2j_start", self.slot_A2JBridgeStart)
self.systray.connect("a2j_stop", self.slot_A2JBridgeStop) self.systray.connect("a2j_stop", self.slot_A2JBridgeStop)
self.systray.connect("a2j_export_hw", self.slot_A2JBridgeExportHW)
self.systray.connect("pulse_start", self.slot_PulseAudioBridgeStart) self.systray.connect("pulse_start", self.slot_PulseAudioBridgeStart)
self.systray.connect("pulse_stop", self.slot_PulseAudioBridgeStop) self.systray.connect("pulse_stop", self.slot_PulseAudioBridgeStop)


@@ -1097,14 +1099,14 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW):
self.systray.addMenuAction("tools", "app_xy-controller", "XY-Controller") self.systray.addMenuAction("tools", "app_xy-controller", "XY-Controller")
self.systray.addSeparator("sep2") self.systray.addSeparator("sep2")


self.systray.connect("app_catarina", lambda tool="catarina": self.func_start_tool(tool))
self.systray.connect("app_catia", lambda tool="catia": self.func_start_tool(tool))
self.systray.connect("app_claudia", lambda tool="claudia": self.func_start_tool(tool))
self.systray.connect("app_logs", lambda tool="cadence-logs": self.func_start_tool(tool))
self.systray.connect("app_meter_in", lambda tool="cadence-jackmeter -in": self.func_start_tool(tool))
self.systray.connect("app_meter_out", lambda tool="cadence-jackmeter": self.func_start_tool(tool))
self.systray.connect("app_render", lambda tool="cadence-render": self.func_start_tool(tool))
self.systray.connect("app_xy-controller", lambda tool="cadence-xycontroller": self.func_start_tool(tool))
self.systray.connect("app_catarina", self.func_start_catarina)
self.systray.connect("app_catia", self.func_start_catia)
self.systray.connect("app_claudia", self.func_start_claudia)
self.systray.connect("app_logs", self.func_start_logs)
self.systray.connect("app_meter_in", self.func_start_jackmeter_in)
self.systray.connect("app_meter_out", self.func_start_jackmeter)
self.systray.connect("app_render", self.func_start_render)
self.systray.connect("app_xy-controller", self.func_start_xycontroller)


self.systray.setToolTip("Cadence") self.systray.setToolTip("Cadence")
self.systray.show() self.systray.show()
@@ -1112,81 +1114,79 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW):
# ------------------------------------------------------------- # -------------------------------------------------------------
# Set-up connections # Set-up connections


self.connect(self.b_jack_start, SIGNAL("clicked()"), SLOT("slot_JackServerStart()"))
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.b_jack_switchmaster, SIGNAL("clicked()"), SLOT("slot_JackServerSwitchMaster()"))
self.connect(self.tb_jack_options, SIGNAL("clicked()"), SLOT("slot_JackOptions()"))

self.connect(self.b_alsa_start, SIGNAL("clicked()"), SLOT("slot_AlsaBridgeStart()"))
self.connect(self.b_alsa_stop, SIGNAL("clicked()"), SLOT("slot_AlsaBridgeStop()"))
self.connect(self.cb_alsa_type, SIGNAL("currentIndexChanged(int)"), SLOT("slot_AlsaBridgeChanged(int)"))
self.connect(self.tb_alsa_options, SIGNAL("clicked()"), SLOT("slot_AlsaAudioBridgeOptions()"))

self.connect(self.b_a2j_start, SIGNAL("clicked()"), SLOT("slot_A2JBridgeStart()"))
self.connect(self.b_a2j_stop, SIGNAL("clicked()"), SLOT("slot_A2JBridgeStop()"))
self.connect(self.b_a2j_export_hw, SIGNAL("clicked()"), SLOT("slot_A2JBridgeExportHW()"))
self.connect(self.tb_a2j_options, SIGNAL("clicked()"), SLOT("slot_A2JBridgeOptions()"))

self.connect(self.b_pulse_start, SIGNAL("clicked()"), SLOT("slot_PulseAudioBridgeStart()"))
self.connect(self.b_pulse_stop, SIGNAL("clicked()"), SLOT("slot_PulseAudioBridgeStop()"))
self.connect(self.tb_pulse_options, SIGNAL("clicked()"), SLOT("slot_PulseAudioBridgeOptions()"))

self.connect(self.pic_catia, SIGNAL("clicked()"), lambda tool="catia": self.func_start_tool(tool))
self.connect(self.pic_claudia, SIGNAL("clicked()"), lambda tool="claudia": self.func_start_tool(tool))
self.connect(self.pic_meter_in, SIGNAL("clicked()"), lambda tool="cadence-jackmeter -in": self.func_start_tool(tool))
self.connect(self.pic_meter_out, SIGNAL("clicked()"), lambda tool="cadence-jackmeter": self.func_start_tool(tool))
self.connect(self.pic_logs, SIGNAL("clicked()"), lambda tool="cadence-logs": self.func_start_tool(tool))
self.connect(self.pic_render, SIGNAL("clicked()"), lambda tool="cadence-render": self.func_start_tool(tool))
self.connect(self.pic_xycontroller, SIGNAL("clicked()"), lambda tool="cadence-xycontroller": self.func_start_tool(tool))

self.connect(self.b_tweaks_apply_now, SIGNAL("clicked()"), SLOT("slot_tweaksApply()"))

self.connect(self.b_tweak_plugins_add, SIGNAL("clicked()"), SLOT("slot_tweakPluginAdd()"))
self.connect(self.b_tweak_plugins_change, SIGNAL("clicked()"), SLOT("slot_tweakPluginChange()"))
self.connect(self.b_tweak_plugins_remove, SIGNAL("clicked()"), SLOT("slot_tweakPluginRemove()"))
self.connect(self.b_tweak_plugins_reset, SIGNAL("clicked()"), SLOT("slot_tweakPluginReset()"))
self.connect(self.tb_tweak_plugins, SIGNAL("currentChanged(int)"), SLOT("slot_tweakPluginTypeChanged(int)"))
self.connect(self.list_LADSPA, SIGNAL("currentRowChanged(int)"), SLOT("slot_tweakPluginsLadspaRowChanged(int)"))
self.connect(self.list_DSSI, SIGNAL("currentRowChanged(int)"), SLOT("slot_tweakPluginsDssiRowChanged(int)"))
self.connect(self.list_LV2, SIGNAL("currentRowChanged(int)"), SLOT("slot_tweakPluginsLv2RowChanged(int)"))
self.connect(self.list_VST, SIGNAL("currentRowChanged(int)"), SLOT("slot_tweakPluginsVstRowChanged(int)"))

self.connect(self.ch_app_image, SIGNAL("clicked()"), SLOT("slot_tweaksSettingsChanged_apps()"))
self.connect(self.cb_app_image, SIGNAL("highlighted(int)"), SLOT("slot_tweakAppImageHighlighted(int)"))
self.connect(self.cb_app_image, SIGNAL("currentIndexChanged(int)"), SLOT("slot_tweakAppImageChanged(int)"))
self.connect(self.ch_app_music, SIGNAL("clicked()"), SLOT("slot_tweaksSettingsChanged_apps()"))
self.connect(self.cb_app_music, SIGNAL("highlighted(int)"), SLOT("slot_tweakAppMusicHighlighted(int)"))
self.connect(self.cb_app_music, SIGNAL("currentIndexChanged(int)"), SLOT("slot_tweakAppMusicChanged(int)"))
self.connect(self.ch_app_video, SIGNAL("clicked()"), SLOT("slot_tweaksSettingsChanged_apps()"))
self.connect(self.cb_app_video, SIGNAL("highlighted(int)"), SLOT("slot_tweakAppVideoHighlighted(int)"))
self.connect(self.cb_app_video, SIGNAL("currentIndexChanged(int)"), SLOT("slot_tweakAppVideoChanged(int)"))
self.connect(self.ch_app_text, SIGNAL("clicked()"), SLOT("slot_tweaksSettingsChanged_apps()"))
self.connect(self.cb_app_text, SIGNAL("highlighted(int)"), SLOT("slot_tweakAppTextHighlighted(int)"))
self.connect(self.cb_app_text, SIGNAL("currentIndexChanged(int)"), SLOT("slot_tweakAppTextChanged(int)"))
self.connect(self.ch_app_browser, SIGNAL("clicked()"), SLOT("slot_tweaksSettingsChanged_apps()"))
self.connect(self.cb_app_browser, SIGNAL("highlighted(int)"), SLOT("slot_tweakAppBrowserHighlighted(int)"))
self.connect(self.cb_app_browser, SIGNAL("currentIndexChanged(int)"),SLOT("slot_tweakAppBrowserChanged(int)"))

self.connect(self.sb_wineasio_ins, SIGNAL("valueChanged(int)"), SLOT("slot_tweaksSettingsChanged_wineasio()"))
self.connect(self.sb_wineasio_outs, SIGNAL("valueChanged(int)"), SLOT("slot_tweaksSettingsChanged_wineasio()"))
self.connect(self.cb_wineasio_hw, SIGNAL("clicked()"), SLOT("slot_tweaksSettingsChanged_wineasio()"))
self.connect(self.cb_wineasio_autostart, SIGNAL("clicked()"), SLOT("slot_tweaksSettingsChanged_wineasio()"))
self.connect(self.cb_wineasio_fixed_bsize, SIGNAL("clicked()"), SLOT("slot_tweaksSettingsChanged_wineasio()"))
self.connect(self.cb_wineasio_bsizes, SIGNAL("currentIndexChanged(int)"), SLOT("slot_tweaksSettingsChanged_wineasio()"))
self.b_jack_start.clicked.connect(self.slot_JackServerStart)
self.b_jack_stop.clicked.connect(self.slot_JackServerStop)
self.b_jack_restart.clicked.connect(self.slot_JackServerForceRestart)
self.b_jack_configure.clicked.connect(self.slot_JackServerConfigure)
self.b_jack_switchmaster.clicked.connect(self.slot_JackServerSwitchMaster)
self.tb_jack_options.clicked.connect(self.slot_JackOptions)

self.b_alsa_start.clicked.connect(self.slot_AlsaBridgeStart)
self.b_alsa_stop.clicked.connect(self.slot_AlsaBridgeStop)
self.cb_alsa_type.currentIndexChanged[int].connect(self.slot_AlsaBridgeChanged)
self.tb_alsa_options.clicked.connect(self.slot_AlsaAudioBridgeOptions)

self.b_a2j_start.clicked.connect(self.slot_A2JBridgeStart)
self.b_a2j_stop.clicked.connect(self.slot_A2JBridgeStop)
self.b_pulse_start.clicked.connect(self.slot_PulseAudioBridgeStart)
self.b_pulse_stop.clicked.connect(self.slot_PulseAudioBridgeStop)
self.tb_pulse_options.clicked.connect(self.slot_PulseAudioBridgeOptions)

self.pic_catia.clicked.connect(self.func_start_catia)
self.pic_claudia.clicked.connect(self.func_start_claudia)
self.pic_meter_in.clicked.connect(self.func_start_jackmeter_in)
self.pic_meter_out.clicked.connect(self.func_start_jackmeter)
self.pic_logs.clicked.connect(self.func_start_logs)
self.pic_render.clicked.connect(self.func_start_render)
self.pic_xycontroller.clicked.connect(self.func_start_xycontroller)

self.b_tweaks_apply_now.clicked.connect(self.slot_tweaksApply)

self.b_tweak_plugins_add.clicked.connect(self.slot_tweakPluginAdd)
self.b_tweak_plugins_change.clicked.connect(self.slot_tweakPluginChange)
self.b_tweak_plugins_remove.clicked.connect(self.slot_tweakPluginRemove)
self.b_tweak_plugins_reset.clicked.connect(self.slot_tweakPluginReset)
self.tb_tweak_plugins.currentChanged.connect(self.slot_tweakPluginTypeChanged)
self.list_LADSPA.currentRowChanged.connect(self.slot_tweakPluginsLadspaRowChanged)
self.list_DSSI.currentRowChanged.connect(self.slot_tweakPluginsDssiRowChanged)
self.list_LV2.currentRowChanged.connect(self.slot_tweakPluginsLv2RowChanged)
self.list_VST.currentRowChanged.connect(self.slot_tweakPluginsVstRowChanged)

self.ch_app_image.clicked.connect(self.slot_tweaksSettingsChanged_apps)
self.cb_app_image.highlighted.connect(self.slot_tweakAppImageHighlighted)
self.cb_app_image.currentIndexChanged[int].connect(self.slot_tweakAppImageChanged)
self.ch_app_music.clicked.connect(self.slot_tweaksSettingsChanged_apps)
self.cb_app_music.highlighted.connect(self.slot_tweakAppMusicHighlighted)
self.cb_app_music.currentIndexChanged[int].connect(self.slot_tweakAppMusicChanged)
self.ch_app_video.clicked.connect(self.slot_tweaksSettingsChanged_apps)
self.cb_app_video.highlighted.connect(self.slot_tweakAppVideoHighlighted)
self.cb_app_video.currentIndexChanged[int].connect(self.slot_tweakAppVideoChanged)
self.ch_app_text.clicked.connect(self.slot_tweaksSettingsChanged_apps)
self.cb_app_text.highlighted.connect(self.slot_tweakAppTextHighlighted)
self.cb_app_text.currentIndexChanged[int].connect(self.slot_tweakAppTextChanged)
self.ch_app_browser.clicked.connect(self.slot_tweaksSettingsChanged_apps)
self.cb_app_browser.highlighted.connect(self.slot_tweakAppBrowserHighlighted)
self.cb_app_browser.currentIndexChanged[int].connect(self.slot_tweakAppBrowserChanged)

self.sb_wineasio_ins.valueChanged.connect(self.slot_tweaksSettingsChanged_wineasio)
self.sb_wineasio_outs.valueChanged.connect(self.slot_tweaksSettingsChanged_wineasio)
self.cb_wineasio_hw.clicked.connect(self.slot_tweaksSettingsChanged_wineasio)
self.cb_wineasio_autostart.clicked.connect(self.slot_tweaksSettingsChanged_wineasio)
self.cb_wineasio_fixed_bsize.clicked.connect(self.slot_tweaksSettingsChanged_wineasio)
self.cb_wineasio_bsizes.currentIndexChanged[int].connect(self.slot_tweaksSettingsChanged_wineasio)


# org.jackaudio.JackControl # org.jackaudio.JackControl
self.connect(self, SIGNAL("DBusJackServerStartedCallback()"), SLOT("slot_DBusJackServerStartedCallback()"))
self.connect(self, SIGNAL("DBusJackServerStoppedCallback()"), SLOT("slot_DBusJackServerStoppedCallback()"))
self.DBusJackServerStartedCallback.connect(self.slot_DBusJackServerStartedCallback)
self.DBusJackServerStoppedCallback.connect(self.slot_DBusJackServerStoppedCallback)


# org.jackaudio.JackPatchbay # org.jackaudio.JackPatchbay
self.connect(self, SIGNAL("DBusJackClientAppearedCallback(int, QString)"), SLOT("slot_DBusJackClientAppearedCallback(int, QString)"))
self.connect(self, SIGNAL("DBusJackClientDisappearedCallback(int)"), SLOT("slot_DBusJackClientDisappearedCallback(int)"))
self.DBusJackClientAppearedCallback.connect(self.slot_DBusJackClientAppearedCallback)
self.DBusJackClientDisappearedCallback.connect(self.slot_DBusJackClientDisappearedCallback)


# org.gna.home.a2jmidid.control # org.gna.home.a2jmidid.control
self.connect(self, SIGNAL("DBusA2JBridgeStartedCallback()"), SLOT("slot_DBusA2JBridgeStartedCallback()"))
self.connect(self, SIGNAL("DBusA2JBridgeStoppedCallback()"), SLOT("slot_DBusA2JBridgeStoppedCallback()"))
self.DBusA2JBridgeStartedCallback.connect(self.slot_DBusA2JBridgeStartedCallback)
self.DBusA2JBridgeStoppedCallback.connect(self.slot_DBusA2JBridgeStoppedCallback)
self.cb_a2j_autoexport.stateChanged[int].connect(self.slot_A2JBridgeExportHW)


# ------------------------------------------------------------- # -------------------------------------------------------------


@@ -1267,6 +1267,7 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW):
else: else:
self.toolBox_alsamidi.setEnabled(False) self.toolBox_alsamidi.setEnabled(False)
self.cb_a2j_autostart.setChecked(False) self.cb_a2j_autostart.setChecked(False)
self.cb_a2j_autoexport.setChecked(False)
self.label_bridge_a2j.setText("ALSA MIDI Bridge is not installed") self.label_bridge_a2j.setText("ALSA MIDI Bridge is not installed")
self.settings.setValue("A2J/AutoStart", False) self.settings.setValue("A2J/AutoStart", False)


@@ -1279,35 +1280,35 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW):
if not newId: if not newId:
# Something crashed # Something crashed
if appInterface == "org.jackaudio.service": if appInterface == "org.jackaudio.service":
QTimer.singleShot(0, self, SLOT("slot_handleCrash_jack()"))
QTimer.singleShot(0, self.slot_handleCrash_jack)
elif appInterface == "org.gna.home.a2jmidid": elif appInterface == "org.gna.home.a2jmidid":
QTimer.singleShot(0, self, SLOT("slot_handleCrash_a2j()"))
QTimer.singleShot(0, self.slot_handleCrash_a2j)


elif kwds['interface'] == "org.jackaudio.JackControl": elif kwds['interface'] == "org.jackaudio.JackControl":
if DEBUG: print("org.jackaudio.JackControl", kwds['member']) if DEBUG: print("org.jackaudio.JackControl", kwds['member'])
if kwds['member'] == "ServerStarted": if kwds['member'] == "ServerStarted":
self.emit(SIGNAL("DBusJackServerStartedCallback()"))
self.DBusJackServerStartedCallback.emit()
elif kwds['member'] == "ServerStopped": elif kwds['member'] == "ServerStopped":
self.emit(SIGNAL("DBusJackServerStoppedCallback()"))
self.DBusJackServerStoppedCallback.emit()


elif kwds['interface'] == "org.jackaudio.JackPatchbay": elif kwds['interface'] == "org.jackaudio.JackPatchbay":
if gDBus.patchbay and kwds['path'] == gDBus.patchbay.object_path: if gDBus.patchbay and kwds['path'] == gDBus.patchbay.object_path:
if DEBUG: print("org.jackaudio.JackPatchbay,", kwds['member']) if DEBUG: print("org.jackaudio.JackPatchbay,", kwds['member'])
if kwds['member'] == "ClientAppeared": if kwds['member'] == "ClientAppeared":
self.emit(SIGNAL("DBusJackClientAppearedCallback(int, QString)"), args[iJackClientId], args[iJackClientName])
self.DBusJackClientAppearedCallback.emit(args[iJackClientId], args[iJackClientName])
elif kwds['member'] == "ClientDisappeared": elif kwds['member'] == "ClientDisappeared":
self.emit(SIGNAL("DBusJackClientDisappearedCallback(int)"), args[iJackClientId])
self.DBusJackClientDisappearedCallback.emit(args[iJackClientId])


elif kwds['interface'] == "org.gna.home.a2jmidid.control": elif kwds['interface'] == "org.gna.home.a2jmidid.control":
if DEBUG: print("org.gna.home.a2jmidid.control", kwds['member']) if DEBUG: print("org.gna.home.a2jmidid.control", kwds['member'])
if kwds['member'] == "bridge_started": if kwds['member'] == "bridge_started":
self.emit(SIGNAL("DBusA2JBridgeStartedCallback()"))
self.DBusA2JBridgeStartedCallback.emit()
elif kwds['member'] == "bridge_stopped": elif kwds['member'] == "bridge_stopped":
self.emit(SIGNAL("DBusA2JBridgeStoppedCallback()"))
self.DBusA2JBridgeStoppedCallback.emit()


def jackStarted(self): def jackStarted(self):
self.m_last_dsp_load = gDBus.jack.GetLoad() self.m_last_dsp_load = gDBus.jack.GetLoad()
self.m_last_xruns = gDBus.jack.GetXruns()
self.m_last_xruns = int(gDBus.jack.GetXruns())
self.m_last_buffer_size = gDBus.jack.GetBufferSize() self.m_last_buffer_size = gDBus.jack.GetBufferSize()


self.b_jack_start.setEnabled(False) self.b_jack_start.setEnabled(False)
@@ -1335,8 +1336,15 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW):
self.m_timer500 = self.startTimer(500) self.m_timer500 = self.startTimer(500)


if gDBus.a2j and not gDBus.a2j.is_started(): if gDBus.a2j and not gDBus.a2j.is_started():
self.b_a2j_start.setEnabled(True)
self.systray.setActionEnabled("a2j_start", True)
portsExported = bool(gDBus.a2j.get_hw_export())
if GlobalSettings.value("A2J/AutoStart", True, type=bool):
if not portsExported and GlobalSettings.value("A2J/AutoExport", True, type=bool):
gDBus.a2j.set_hw_export(True)
portsExported = True
gDBus.a2j.start()
else:
self.b_a2j_start.setEnabled(True)
self.systray.setActionEnabled("a2j_start", True)


self.checkAlsaAudio() self.checkAlsaAudio()
self.checkPulseAudio() self.checkPulseAudio()
@@ -1382,20 +1390,19 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW):
def a2jStarted(self): def a2jStarted(self):
self.b_a2j_start.setEnabled(False) self.b_a2j_start.setEnabled(False)
self.b_a2j_stop.setEnabled(True) self.b_a2j_stop.setEnabled(True)
self.b_a2j_export_hw.setEnabled(False)
self.systray.setActionEnabled("a2j_start", False) self.systray.setActionEnabled("a2j_start", False)
self.systray.setActionEnabled("a2j_stop", True) 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"))
if bool(gDBus.a2j.get_hw_export()):
self.label_bridge_a2j.setText(self.tr("ALSA MIDI Bridge is running, ports are exported"))
else :
self.label_bridge_a2j.setText(self.tr("ALSA MIDI Bridge is running"))


def a2jStopped(self): def a2jStopped(self):
jackRunning = bool(gDBus.jack and gDBus.jack.IsStarted()) jackRunning = bool(gDBus.jack and gDBus.jack.IsStarted())
self.b_a2j_start.setEnabled(jackRunning) self.b_a2j_start.setEnabled(jackRunning)
self.b_a2j_stop.setEnabled(False) self.b_a2j_stop.setEnabled(False)
self.b_a2j_export_hw.setEnabled(True)
self.systray.setActionEnabled("a2j_start", jackRunning) self.systray.setActionEnabled("a2j_start", jackRunning)
self.systray.setActionEnabled("a2j_stop", False) 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")) self.label_bridge_a2j.setText(self.tr("ALSA MIDI Bridge is stopped"))


def checkAlsaAudio(self): def checkAlsaAudio(self):
@@ -1511,24 +1518,54 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW):
self.label_app_comment.setText(comment) self.label_app_comment.setText(comment)


def updateSystrayTooltip(self): def updateSystrayTooltip(self):
systrayText = "<table>"
#systrayText += "<tr><td align='center' colspan='2'><h4>Cadence</h4></td></tr>"
systrayText += "<tr><td align='right'>%s:</td><td>%s</td></tr>" % (self.tr("JACK Status"), self.label_jack_status.text())
systrayText += "<tr><td align='right'>%s:</td><td>%s</td></tr>" % (self.tr("Realtime"), self.label_jack_realtime.text())
systrayText += "<tr><td align='right'>%s:</td><td>%s</td></tr>" % (self.tr("DSP Load"), self.label_jack_dsp.text())
systrayText += "<tr><td align='right'>%s:</td><td>%s</td></tr>" % (self.tr("Xruns"), self.label_jack_xruns.text())
systrayText += "<tr><td align='right'>%s:</td><td>%s</td></tr>" % (self.tr("Buffer Size"), self.label_jack_bfsize.text())
systrayText += "<tr><td align='right'>%s:</td><td>%s</td></tr>" % (self.tr("Sample Rate"), self.label_jack_srate.text())
systrayText += "<tr><td align='right'>%s:</td><td>%s</td></tr>" % (self.tr("Block Latency"), self.label_jack_latency.text())
systrayText += "</table>"
systrayText = "Cadence<br/>"
systrayText += "<font size=\"-1\">"
systrayText += "<b>%s:</b>&nbsp;%s<br/>" % (self.tr("JACK Status"), self.label_jack_status.text())
systrayText += "<b>%s:</b>&nbsp;%s<br/>" % (self.tr("Realtime"), self.label_jack_realtime.text())
systrayText += "<b>%s:</b>&nbsp;%s<br/>" % (self.tr("DSP Load"), self.label_jack_dsp.text())
systrayText += "<b>%s:</b>&nbsp;%s<br/>" % (self.tr("Xruns"), self.label_jack_xruns.text())
systrayText += "<b>%s:</b>&nbsp;%s<br/>" % (self.tr("Buffer Size"), self.label_jack_bfsize.text())
systrayText += "<b>%s:</b>&nbsp;%s<br/>" % (self.tr("Sample Rate"), self.label_jack_srate.text())
systrayText += "<b>%s:</b>&nbsp;%s" % (self.tr("Block Latency"), self.label_jack_latency.text())
systrayText += "</font><font size=\"-2\"><br/></font>"


self.systray.setToolTip(systrayText) self.systray.setToolTip(systrayText)


@pyqtSlot()
def func_start_catarina(self):
self.func_start_tool("catarina")

@pyqtSlot()
def func_start_catia(self):
self.func_start_tool("catia")

@pyqtSlot()
def func_start_claudia(self):
self.func_start_tool("claudia")

@pyqtSlot()
def func_start_logs(self):
self.func_start_tool("cadence-logs")

@pyqtSlot()
def func_start_jackmeter(self):
self.func_start_tool("cadence-jackmeter")

@pyqtSlot()
def func_start_jackmeter_in(self):
self.func_start_tool("cadence-jackmeter -in")

@pyqtSlot()
def func_start_render(self):
self.func_start_tool("cadence-render")

@pyqtSlot()
def func_start_xycontroller(self):
self.func_start_tool("cadence-xycontroller")

def func_start_tool(self, tool): def func_start_tool(self, tool):
if sys.argv[0].endswith(".py"): if sys.argv[0].endswith(".py"):
if tool == "cadence-jacksettings":
tool = "jacksettings"
elif tool == "cadence-logs":
if tool == "cadence-logs":
tool = "logs" tool = "logs"
elif tool == "cadence-render": elif tool == "cadence-render":
tool = "render" tool = "render"
@@ -1616,6 +1653,8 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW):


@pyqtSlot() @pyqtSlot()
def slot_JackServerStop(self): def slot_JackServerStop(self):
if gDBus.a2j and bool(gDBus.a2j.is_started()):
gDBus.a2j.stop()
try: try:
gDBus.jack.StopServer() gDBus.jack.StopServer()
except: except:
@@ -1735,18 +1774,17 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW):
def slot_A2JBridgeStop(self): def slot_A2JBridgeStop(self):
gDBus.a2j.stop() gDBus.a2j.stop()


@pyqtSlot()
def slot_A2JBridgeExportHW(self):
ask = QMessageBox.question(self, self.tr("ALSA MIDI Hardware Export"), self.tr("Enable Hardware Export on the ALSA MIDI Bridge?"), QMessageBox.Yes|QMessageBox.No|QMessageBox.Cancel, QMessageBox.Yes)
@pyqtSlot(int)
def slot_A2JBridgeExportHW(self, state):
a2jWasStarted = bool(gDBus.a2j.is_started())


if ask == QMessageBox.Yes:
gDBus.a2j.set_hw_export(True)
elif ask == QMessageBox.No:
gDBus.a2j.set_hw_export(False)
if a2jWasStarted:
gDBus.a2j.stop()


@pyqtSlot()
def slot_A2JBridgeOptions(self):
ToolBarA2JDialog(self).exec_()
gDBus.a2j.set_hw_export(bool(state))

if a2jWasStarted:
gDBus.a2j.start()


@pyqtSlot() @pyqtSlot()
def slot_PulseAudioBridgeStart(self): def slot_PulseAudioBridgeStart(self):
@@ -1789,7 +1827,7 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW):


if self.cb_cpufreq.currentIndex() == -1: if self.cb_cpufreq.currentIndex() == -1:
# First init # First init
self.connect(self.cb_cpufreq, SIGNAL("currentIndexChanged(QString)"), SLOT("slot_changeGovernorMode(QString)"))
self.cb_cpufreq.currentIndexChanged[str].connect(self.slot_changeGovernorMode)


self.cb_cpufreq.blockSignals(True) self.cb_cpufreq.blockSignals(True)


@@ -2077,7 +2115,7 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW):
self.setAppDetails(self.cb_app_image.itemText(index)) self.setAppDetails(self.cb_app_image.itemText(index))


@pyqtSlot(int) @pyqtSlot(int)
def slot_tweakAppImageChanged(self):
def slot_tweakAppImageChanged(self, ignored):
self.setAppDetails(self.cb_app_image.currentText()) self.setAppDetails(self.cb_app_image.currentText())
self.func_settings_changed("apps") self.func_settings_changed("apps")


@@ -2086,7 +2124,7 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW):
self.setAppDetails(self.cb_app_music.itemText(index)) self.setAppDetails(self.cb_app_music.itemText(index))


@pyqtSlot(int) @pyqtSlot(int)
def slot_tweakAppMusicChanged(self):
def slot_tweakAppMusicChanged(self, ignored):
self.setAppDetails(self.cb_app_music.currentText()) self.setAppDetails(self.cb_app_music.currentText())
self.func_settings_changed("apps") self.func_settings_changed("apps")


@@ -2095,7 +2133,7 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW):
self.setAppDetails(self.cb_app_video.itemText(index)) self.setAppDetails(self.cb_app_video.itemText(index))


@pyqtSlot(int) @pyqtSlot(int)
def slot_tweakAppVideoChanged(self):
def slot_tweakAppVideoChanged(self, ignored):
self.setAppDetails(self.cb_app_video.currentText()) self.setAppDetails(self.cb_app_video.currentText())
self.func_settings_changed("apps") self.func_settings_changed("apps")


@@ -2104,7 +2142,7 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW):
self.setAppDetails(self.cb_app_text.itemText(index)) self.setAppDetails(self.cb_app_text.itemText(index))


@pyqtSlot(int) @pyqtSlot(int)
def slot_tweakAppTextChanged(self):
def slot_tweakAppTextChanged(self, ignored):
self.setAppDetails(self.cb_app_text.currentText()) self.setAppDetails(self.cb_app_text.currentText())
self.func_settings_changed("apps") self.func_settings_changed("apps")


@@ -2113,7 +2151,7 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW):
self.setAppDetails(self.cb_app_browser.itemText(index)) self.setAppDetails(self.cb_app_browser.itemText(index))


@pyqtSlot(int) @pyqtSlot(int)
def slot_tweakAppBrowserChanged(self):
def slot_tweakAppBrowserChanged(self, ignored):
self.setAppDetails(self.cb_app_browser.currentText()) self.setAppDetails(self.cb_app_browser.currentText())
self.func_settings_changed("apps") self.func_settings_changed("apps")


@@ -2251,23 +2289,25 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW):
GlobalSettings.setValue("JACK/AutoStart", self.cb_jack_autostart.isChecked()) GlobalSettings.setValue("JACK/AutoStart", self.cb_jack_autostart.isChecked())
GlobalSettings.setValue("ALSA-Audio/BridgeIndexType", self.cb_alsa_type.currentIndex()) GlobalSettings.setValue("ALSA-Audio/BridgeIndexType", self.cb_alsa_type.currentIndex())
GlobalSettings.setValue("A2J/AutoStart", self.cb_a2j_autostart.isChecked()) GlobalSettings.setValue("A2J/AutoStart", self.cb_a2j_autostart.isChecked())
GlobalSettings.setValue("A2J/AutoExport", self.cb_a2j_autoexport.isChecked())
GlobalSettings.setValue("Pulse2JACK/AutoStart", (havePulseAudio and self.cb_pulse_autostart.isChecked())) GlobalSettings.setValue("Pulse2JACK/AutoStart", (havePulseAudio and self.cb_pulse_autostart.isChecked()))


def loadSettings(self, geometry): def loadSettings(self, geometry):
if geometry: if geometry:
self.restoreGeometry(self.settings.value("Geometry", ""))
self.restoreGeometry(self.settings.value("Geometry", b""))


usingAlsaLoop = bool(GlobalSettings.value("ALSA-Audio/BridgeIndexType", iAlsaFileNone, type=int) == iAlsaFileLoop) usingAlsaLoop = bool(GlobalSettings.value("ALSA-Audio/BridgeIndexType", iAlsaFileNone, type=int) == iAlsaFileLoop)


self.cb_jack_autostart.setChecked(GlobalSettings.value("JACK/AutoStart", False, type=bool))
self.cb_jack_autostart.setChecked(GlobalSettings.value("JACK/AutoStart", wantJackStart, type=bool))
self.cb_a2j_autostart.setChecked(GlobalSettings.value("A2J/AutoStart", True, type=bool)) self.cb_a2j_autostart.setChecked(GlobalSettings.value("A2J/AutoStart", True, type=bool))
self.cb_a2j_autoexport.setChecked(GlobalSettings.value("A2J/AutoExport", True, type=bool))
self.cb_pulse_autostart.setChecked(GlobalSettings.value("Pulse2JACK/AutoStart", havePulseAudio and not usingAlsaLoop, type=bool)) self.cb_pulse_autostart.setChecked(GlobalSettings.value("Pulse2JACK/AutoStart", havePulseAudio and not usingAlsaLoop, type=bool))


def timerEvent(self, event): def timerEvent(self, event):
if event.timerId() == self.m_timer500: if event.timerId() == self.m_timer500:
if gDBus.jack and self.m_last_dsp_load != None: if gDBus.jack and self.m_last_dsp_load != None:
next_dsp_load = gDBus.jack.GetLoad() next_dsp_load = gDBus.jack.GetLoad()
next_xruns = gDBus.jack.GetXruns()
next_xruns = int(gDBus.jack.GetXruns())
needUpdateTip = False needUpdateTip = False


if self.m_last_dsp_load != next_dsp_load: if self.m_last_dsp_load != next_dsp_load:
@@ -2301,6 +2341,18 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW):
self.saveSettings() self.saveSettings()
self.systray.handleQtCloseEvent(event) self.systray.handleQtCloseEvent(event)


# ------------------------------------------------------------------------------------------------------------

def runFunctionInMainThread(task):
waiter = QSemaphore(1)

def taskInMainThread():
task()
waiter.release()

QTimer.singleShot(0, taskInMainThread)
waiter.tryAcquire()

#--------------- main ------------------ #--------------- main ------------------
if __name__ == '__main__': if __name__ == '__main__':
# App initialization # App initialization


+ 6
- 2
src/cadence_aloop_daemon.py View File

@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-


# Cadence ALSA-Loop daemon # Cadence ALSA-Loop daemon
# Copyright (C) 2012-2013 Filipe Coelho <falktx@falktx.com>
# Copyright (C) 2012-2018 Filipe Coelho <falktx@falktx.com>
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -23,7 +23,11 @@ import os
import sys import sys
from signal import signal, SIGINT, SIGTERM from signal import signal, SIGINT, SIGTERM
from time import sleep from time import sleep
from PyQt4.QtCore import QProcess

if True:
from PyQt5.QtCore import QProcess
else:
from PyQt4.QtCore import QProcess


# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Imports (Custom Stuff) # Imports (Custom Stuff)


+ 5
- 2
src/cadence_session_start.py View File

@@ -3,7 +3,10 @@


# Imports (Global) # Imports (Global)
import dbus, sys import dbus, sys
from PyQt4.QtCore import QCoreApplication
if True:
from PyQt5.QtCore import QCoreApplication
else:
from PyQt4.QtCore import QCoreApplication


# Imports (Custom Stuff) # Imports (Custom Stuff)
from shared_cadence import * from shared_cadence import *
@@ -43,7 +46,7 @@ def forceReset():
# Start JACK, A2J and Pulse, according to user settings # Start JACK, A2J and Pulse, according to user settings
def startSession(systemStarted, secondSystemStartAttempt): def startSession(systemStarted, secondSystemStartAttempt):
# Check if JACK is set to auto-start # Check if JACK is set to auto-start
if systemStarted and not GlobalSettings.value("JACK/AutoStart", False, type=bool):
if systemStarted and not GlobalSettings.value("JACK/AutoStart", wantJackStart, type=bool):
print("JACK is set to NOT auto-start on login") print("JACK is set to NOT auto-start on login")
return True return True




+ 19
- 9
src/canvaspreviewframe.py View File

@@ -1,8 +1,8 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-


# Custom Mini Canvas Preview, a custom Qt4 widget
# Copyright (C) 2011-2013 Filipe Coelho <falktx@falktx.com>
# Custom Mini Canvas Preview, a custom Qt widget
# Copyright (C) 2011-2018 Filipe Coelho <falktx@falktx.com>
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as # modify it under the terms of the GNU General Public License as
@@ -19,8 +19,14 @@
# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Imports (Global) # Imports (Global)


from PyQt4.QtCore import Qt, QRectF, QTimer, SIGNAL, SLOT
from PyQt4.QtGui import QBrush, QColor, QCursor, QFrame, QPainter, QPen
if True:
from PyQt5.QtCore import pyqtSignal, Qt, QRectF, QTimer
from PyQt5.QtGui import QBrush, QColor, QCursor, QPainter, QPen
from PyQt5.QtWidgets import QFrame
else:
from PyQt4.QtCore import pyqtSignal, Qt, QRectF, QTimer
from PyQt4.QtGui import QBrush, QColor, QCursor, QPainter, QPen
from PyQt4.QtGui import QFrame


# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Static Variables # Static Variables
@@ -34,6 +40,8 @@ iHeight = 3
# Widget Class # Widget Class


class CanvasPreviewFrame(QFrame): class CanvasPreviewFrame(QFrame):
miniCanvasMoved = pyqtSignal(float, float)

def __init__(self, parent): def __init__(self, parent):
QFrame.__init__(self, parent) QFrame.__init__(self, parent)


@@ -97,7 +105,7 @@ class CanvasPreviewFrame(QFrame):


def setViewScale(self, scale): def setViewScale(self, scale):
self.fScale = scale self.fScale = scale
QTimer.singleShot(0, self.fRealParent, SLOT("slot_miniCanvasCheckAll()"))
QTimer.singleShot(0, self.fRealParent.slot_miniCanvasCheckAll)


def setViewSize(self, width, height): def setViewSize(self, width, height):
self.fViewRect[iWidth] = width * self.fFakeWidth self.fViewRect[iWidth] = width * self.fFakeWidth
@@ -137,7 +145,7 @@ class CanvasPreviewFrame(QFrame):
self.fViewRect[iY] = y + self.fRenderSource.y() self.fViewRect[iY] = y + self.fRenderSource.y()
self.update() self.update()


self.emit(SIGNAL("miniCanvasMoved(double, double)"), x * self.fScale / self.fFakeWidth, y * self.fScale / self.fFakeHeight)
self.miniCanvasMoved.emit(x * self.fScale / self.fFakeWidth, y * self.fScale / self.fFakeHeight)


def mousePressEvent(self, event): def mousePressEvent(self, event):
if event.button() == Qt.LeftButton: if event.button() == Qt.LeftButton:
@@ -176,7 +184,7 @@ class CanvasPreviewFrame(QFrame):
else: else:
painter.setBrush(self.fViewBg) painter.setBrush(self.fViewBg)
painter.setPen(self.fViewBg) painter.setPen(self.fViewBg)
painter.drawRoundRect(2, 2, self.width()-6, self.height()-6, 3, 3)
painter.drawRoundedRect(2, 2, self.width()-6, self.height()-6, 3, 3)


self.fScene.render(painter, self.fRenderSource, self.fRenderTarget, Qt.KeepAspectRatio) self.fScene.render(painter, self.fRenderSource, self.fRenderTarget, Qt.KeepAspectRatio)


@@ -199,6 +207,8 @@ class CanvasPreviewFrame(QFrame):


def resizeEvent(self, event): def resizeEvent(self, event):
self.fRenderSource = self.getRenderSource() self.fRenderSource = self.getRenderSource()
if self.fRealParent:
QTimer.singleShot(0, self.fRealParent, SLOT("slot_miniCanvasCheckAll()"))

if self.fRealParent is not None:
QTimer.singleShot(0, self.fRealParent.slot_miniCanvasCheckAll)

QFrame.resizeEvent(self, event) QFrame.resizeEvent(self, event)

+ 85
- 79
src/catarina.py View File

@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-


# PatchCanvas test application # PatchCanvas test application
# Copyright (C) 2010-2013 Filipe Coelho <falktx@falktx.com>
# Copyright (C) 2010-2018 Filipe Coelho <falktx@falktx.com>
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -19,9 +19,14 @@
# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Imports (Global) # Imports (Global)


from PyQt4.QtCore import pyqtSlot, QSettings
from PyQt4.QtGui import QApplication, QDialog, QDialogButtonBox, QTableWidgetItem
from PyQt4.QtXml import QDomDocument
if True:
from PyQt5.QtCore import pyqtSlot, QSettings
from PyQt5.QtWidgets import QApplication, QDialog, QDialogButtonBox, QTableWidgetItem
from PyQt5.QtXml import QDomDocument
else:
from PyQt4.QtCore import pyqtSlot, QSettings
from PyQt4.QtGui import QApplication, QDialog, QDialogButtonBox, QTableWidgetItem
from PyQt4.QtXml import QDomDocument


# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Imports (Custom Stuff) # Imports (Custom Stuff)
@@ -42,7 +47,7 @@ from shared_settings import *
# Try Import OpenGL # Try Import OpenGL


try: try:
from PyQt4.QtOpenGL import QGLWidget
from PyQt5.QtOpenGL import QGLWidget
hasGL = True hasGL = True
except: except:
hasGL = False hasGL = False
@@ -86,8 +91,8 @@ class CatarinaAddGroupW(QDialog, ui_catarina_addgroup.Ui_CatarinaAddGroupW):
for group in group_list: for group in group_list:
self.m_group_list_names.append(group[iGroupName]) self.m_group_list_names.append(group[iGroupName])


self.connect(self, SIGNAL("accepted()"), SLOT("slot_setReturn()"))
self.connect(self.le_group_name, SIGNAL("textChanged(QString)"), SLOT("slot_checkText(QString)"))
self.accepted.connect(self.slot_setReturn)
self.le_group_name.textChanged.connect(self.slot_checkText)


self.ret_group_name = "" self.ret_group_name = ""
self.ret_group_split = False self.ret_group_split = False
@@ -127,9 +132,9 @@ class CatarinaRemoveGroupW(QDialog, ui_catarina_removegroup.Ui_CatarinaRemoveGro
self.tw_group_list.setItem(index, 2, twi_group_split) self.tw_group_list.setItem(index, 2, twi_group_split)
index += 1 index += 1


self.connect(self, SIGNAL("accepted()"), SLOT("slot_setReturn()"))
self.connect(self.tw_group_list, SIGNAL("cellDoubleClicked(int, int)"), SLOT("accept()"))
self.connect(self.tw_group_list, SIGNAL("currentCellChanged(int, int, int, int)"), SLOT("slot_checkCell(int)"))
self.accepted.connect(self.slot_setReturn)
self.tw_group_list.cellDoubleClicked.connect(self.accept)
self.tw_group_list.currentCellChanged.connect(self.slot_checkCell)


self.ret_group_id = -1 self.ret_group_id = -1


@@ -163,15 +168,15 @@ class CatarinaRenameGroupW(QDialog, ui_catarina_renamegroup.Ui_CatarinaRenameGro
self.cb_group_to_rename.addItem("%i - %s" % (group[iGroupId], group[iGroupName])) self.cb_group_to_rename.addItem("%i - %s" % (group[iGroupId], group[iGroupName]))
self.m_group_list_names.append(group[iGroupName]) self.m_group_list_names.append(group[iGroupName])


self.connect(self, SIGNAL("accepted()"), SLOT("slot_setReturn()"))
self.connect(self.cb_group_to_rename, SIGNAL("currentIndexChanged(int)"), SLOT("slot_checkItem()"))
self.connect(self.le_new_group_name, SIGNAL("textChanged(QString)"), SLOT("slot_checkText(QString)"))
self.accepted.connect(self.slot_setReturn)
self.cb_group_to_rename.currentIndexChanged[int].connect(self.slot_checkItem)
self.le_new_group_name.textChanged.connect(self.slot_checkText)


self.ret_group_id = -1 self.ret_group_id = -1
self.ret_new_group_name = "" self.ret_new_group_name = ""


@pyqtSlot()
def slot_checkItem(self):
@pyqtSlot(int)
def slot_checkItem(self, ignored):
self.slot_checkText(self.le_new_group_name.text()) self.slot_checkText(self.le_new_group_name.text())


@pyqtSlot(str) @pyqtSlot(str)
@@ -204,8 +209,8 @@ class CatarinaAddPortW(QDialog, ui_catarina_addport.Ui_CatarinaAddPortW):
for group in group_list: for group in group_list:
self.cb_group.addItem("%i - %s" % (group[iGroupId], group[iGroupName])) self.cb_group.addItem("%i - %s" % (group[iGroupId], group[iGroupName]))


self.connect(self, SIGNAL("accepted()"), SLOT("slot_setReturn()"))
self.connect(self.le_port_name, SIGNAL("textChanged(QString)"), SLOT("slot_checkText(QString)"))
self.accepted.connect(self.slot_setReturn)
self.le_port_name.textChanged.connect(self.slot_checkText)


self.ret_group_id = -1 self.ret_group_id = -1
self.ret_port_name = "" self.ret_port_name = ""
@@ -243,15 +248,15 @@ class CatarinaRemovePortW(QDialog, ui_catarina_removeport.Ui_CatarinaRemovePortW
self.m_group_list = group_list self.m_group_list = group_list
self.m_port_list = port_list self.m_port_list = port_list


self.connect(self, SIGNAL("accepted()"), SLOT("slot_setReturn()"))
self.connect(self.tw_port_list, SIGNAL("cellDoubleClicked(int, int)"), SLOT("accept()"))
self.connect(self.tw_port_list, SIGNAL("currentCellChanged(int, int, int, int)"), SLOT("slot_checkCell(int)"))
self.connect(self.rb_input, SIGNAL("clicked()"), SLOT("slot_reAddPorts()"))
self.connect(self.rb_output, SIGNAL("clicked()"), SLOT("slot_reAddPorts()"))
self.connect(self.rb_audio_jack, SIGNAL("clicked()"), SLOT("slot_reAddPorts()"))
self.connect(self.rb_midi_jack, SIGNAL("clicked()"), SLOT("slot_reAddPorts()"))
self.connect(self.rb_midi_a2j, SIGNAL("clicked()"), SLOT("slot_reAddPorts()"))
self.connect(self.rb_midi_alsa, SIGNAL("clicked()"), SLOT("slot_reAddPorts()"))
self.accepted.connect(self.slot_setReturn)
self.tw_port_list.cellDoubleClicked.connect(self.accept)
self.tw_port_list.currentCellChanged.connect(self.slot_checkCell)
self.rb_input.clicked.connect(self.slot_reAddPorts)
self.rb_output.clicked.connect(self.slot_reAddPorts)
self.rb_audio_jack.clicked.connect(self.slot_reAddPorts)
self.rb_midi_jack.clicked.connect(self.slot_reAddPorts)
self.rb_midi_a2j.clicked.connect(self.slot_reAddPorts)
self.rb_midi_alsa.clicked.connect(self.slot_reAddPorts)


self.ret_port_id = -1 self.ret_port_id = -1
self.reAddPorts() self.reAddPorts()
@@ -325,16 +330,16 @@ class CatarinaRenamePortW(QDialog, ui_catarina_renameport.Ui_CatarinaRenamePortW
self.m_group_list = group_list self.m_group_list = group_list
self.m_port_list = port_list self.m_port_list = port_list


self.connect(self, SIGNAL("accepted()"), SLOT("slot_setReturn()"))
self.connect(self.tw_port_list, SIGNAL("currentCellChanged(int, int, int, int)"), SLOT("slot_checkCell()"))
self.connect(self.le_new_name, SIGNAL("textChanged(QString)"), SLOT("slot_checkText(QString)"))
self.accepted.connect(self.slot_setReturn)
self.tw_port_list.currentCellChanged.connect(self.slot_checkCell)
self.le_new_name.textChanged.connect(self.slot_checkText)


self.connect(self.rb_input, SIGNAL("clicked()"), SLOT("slot_reAddPorts()"))
self.connect(self.rb_output, SIGNAL("clicked()"), SLOT("slot_reAddPorts()"))
self.connect(self.rb_audio_jack, SIGNAL("clicked()"), SLOT("slot_reAddPorts()"))
self.connect(self.rb_midi_jack, SIGNAL("clicked()"), SLOT("slot_reAddPorts()"))
self.connect(self.rb_midi_a2j, SIGNAL("clicked()"), SLOT("slot_reAddPorts()"))
self.connect(self.rb_midi_alsa, SIGNAL("clicked()"), SLOT("slot_reAddPorts()"))
self.rb_input.clicked.connect(self.slot_reAddPorts)
self.rb_output.clicked.connect(self.slot_reAddPorts)
self.rb_audio_jack.clicked.connect(self.slot_reAddPorts)
self.rb_midi_jack.clicked.connect(self.slot_reAddPorts)
self.rb_midi_a2j.clicked.connect(self.slot_reAddPorts)
self.rb_midi_alsa.clicked.connect(self.slot_reAddPorts)


self.ret_port_id = -1 self.ret_port_id = -1
self.ret_new_port_name = "" self.ret_new_port_name = ""
@@ -429,13 +434,13 @@ class CatarinaConnectPortsW(QDialog, ui_catarina_connectports.Ui_CatarinaConnect
elif port[iPortType] == patchcanvas.PORT_TYPE_MIDI_ALSA: elif port[iPortType] == patchcanvas.PORT_TYPE_MIDI_ALSA:
self.m_ports_midi_alsa.append(port) self.m_ports_midi_alsa.append(port)


self.connect(self, SIGNAL("accepted()"), SLOT("slot_setReturn()"))
self.connect(self.rb_audio_jack, SIGNAL("clicked()"), SLOT("slot_portTypeChanged()"))
self.connect(self.rb_midi_jack, SIGNAL("clicked()"), SLOT("slot_portTypeChanged()"))
self.connect(self.rb_midi_a2j, SIGNAL("clicked()"), SLOT("slot_portTypeChanged()"))
self.connect(self.rb_midi_alsa, SIGNAL("clicked()"), SLOT("slot_portTypeChanged()"))
self.connect(self.lw_outputs, SIGNAL("currentRowChanged(int)"), SLOT("slot_checkOutSelection(int)"))
self.connect(self.lw_inputs, SIGNAL("currentRowChanged(int)"), SLOT("slot_checkInSelection(int)"))
self.accepted.connect(self.slot_setReturn)
self.rb_audio_jack.clicked.connect(self.slot_portTypeChanged)
self.rb_midi_jack.clicked.connect(self.slot_portTypeChanged)
self.rb_midi_a2j.clicked.connect(self.slot_portTypeChanged)
self.rb_midi_alsa.clicked.connect(self.slot_portTypeChanged)
self.lw_outputs.currentRowChanged.connect(self.slot_checkOutSelection)
self.lw_inputs.currentRowChanged.connect(self.slot_checkInSelection)


self.ret_port_out_id = -1 self.ret_port_out_id = -1
self.ret_port_in_id = -1 self.ret_port_in_id = -1
@@ -510,13 +515,13 @@ class CatarinaDisconnectPortsW(QDialog, ui_catarina_disconnectports.Ui_CatarinaD
self.m_port_list = port_list self.m_port_list = port_list
self.m_connection_list = connection_list self.m_connection_list = connection_list


self.connect(self, SIGNAL("accepted()"), SLOT("slot_setReturn()"))
self.connect(self.tw_connections, SIGNAL("cellDoubleClicked(int, int)"), SLOT("accept()"))
self.connect(self.tw_connections, SIGNAL("currentCellChanged(int, int, int, int)"), SLOT("slot_checkSelection(int)"))
self.connect(self.rb_audio_jack, SIGNAL("clicked()"), SLOT("slot_portTypeChanged()"))
self.connect(self.rb_midi_jack, SIGNAL("clicked()"), SLOT("slot_portTypeChanged()"))
self.connect(self.rb_midi_a2j, SIGNAL("clicked()"), SLOT("slot_portTypeChanged()"))
self.connect(self.rb_midi_alsa, SIGNAL("clicked()"), SLOT("slot_portTypeChanged()"))
self.accepted.connect(self.slot_setReturn)
self.tw_connections.cellDoubleClicked.connect(self.accept)
self.tw_connections.currentCellChanged.connect(self.slot_checkSelection)
self.rb_audio_jack.clicked.connect(self.slot_portTypeChanged)
self.rb_midi_jack.clicked.connect(self.slot_portTypeChanged)
self.rb_midi_a2j.clicked.connect(self.slot_portTypeChanged)
self.rb_midi_alsa.clicked.connect(self.slot_portTypeChanged)


self.ret_port_out_id = -1 self.ret_port_out_id = -1
self.ret_port_in_id = -1 self.ret_port_in_id = -1
@@ -659,39 +664,39 @@ class CatarinaMainW(AbstractCanvasJackClass):
patchcanvas.setFeatures(p_features) patchcanvas.setFeatures(p_features)
patchcanvas.init("Catarina", self.scene, self.canvasCallback, DEBUG) patchcanvas.init("Catarina", self.scene, self.canvasCallback, DEBUG)


self.connect(self.ui.act_project_new, SIGNAL("triggered()"), SLOT("slot_projectNew()"))
self.connect(self.ui.act_project_open, SIGNAL("triggered()"), SLOT("slot_projectOpen()"))
self.connect(self.ui.act_project_save, SIGNAL("triggered()"), SLOT("slot_projectSave()"))
self.connect(self.ui.act_project_save_as, SIGNAL("triggered()"), SLOT("slot_projectSaveAs()"))
self.connect(self.ui.b_project_new, SIGNAL("clicked()"), SLOT("slot_projectNew()"))
self.connect(self.ui.b_project_open, SIGNAL("clicked()"), SLOT("slot_projectOpen()"))
self.connect(self.ui.b_project_save, SIGNAL("clicked()"), SLOT("slot_projectSave()"))
self.connect(self.ui.b_project_save_as, SIGNAL("clicked()"), SLOT("slot_projectSaveAs()"))
self.connect(self.ui.act_patchbay_add_group, SIGNAL("triggered()"), SLOT("slot_groupAdd()"))
self.connect(self.ui.act_patchbay_remove_group, SIGNAL("triggered()"), SLOT("slot_groupRemove()"))
self.connect(self.ui.act_patchbay_rename_group, SIGNAL("triggered()"), SLOT("slot_groupRename()"))
self.connect(self.ui.act_patchbay_add_port, SIGNAL("triggered()"), SLOT("slot_portAdd()"))
self.connect(self.ui.act_patchbay_remove_port, SIGNAL("triggered()"), SLOT("slot_portRemove()"))
self.connect(self.ui.act_patchbay_rename_port, SIGNAL("triggered()"), SLOT("slot_portRename()"))
self.connect(self.ui.act_patchbay_connect_ports, SIGNAL("triggered()"), SLOT("slot_connectPorts()"))
self.connect(self.ui.act_patchbay_disconnect_ports, SIGNAL("triggered()"), SLOT("slot_disconnectPorts()"))
self.connect(self.ui.b_group_add, SIGNAL("clicked()"), SLOT("slot_groupAdd()"))
self.connect(self.ui.b_group_remove, SIGNAL("clicked()"), SLOT("slot_groupRemove()"))
self.connect(self.ui.b_group_rename, SIGNAL("clicked()"), SLOT("slot_groupRename()"))
self.connect(self.ui.b_port_add, SIGNAL("clicked()"), SLOT("slot_portAdd()"))
self.connect(self.ui.b_port_remove, SIGNAL("clicked()"), SLOT("slot_portRemove()"))
self.connect(self.ui.b_port_rename, SIGNAL("clicked()"), SLOT("slot_portRename()"))
self.connect(self.ui.b_ports_connect, SIGNAL("clicked()"), SLOT("slot_connectPorts()"))
self.connect(self.ui.b_ports_disconnect, SIGNAL("clicked()"), SLOT("slot_disconnectPorts()"))
self.ui.act_project_new.triggered.connect(self.slot_projectNew)
self.ui.act_project_open.triggered.connect(self.slot_projectOpen)
self.ui.act_project_save.triggered.connect(self.slot_projectSave)
self.ui.act_project_save_as.triggered.connect(self.slot_projectSaveAs)
self.ui.b_project_new.clicked.connect(self.slot_projectNew)
self.ui.b_project_open.clicked.connect(self.slot_projectOpen)
self.ui.b_project_save.clicked.connect(self.slot_projectSave)
self.ui.b_project_save_as.clicked.connect(self.slot_projectSaveAs)
self.ui.act_patchbay_add_group.triggered.connect(self.slot_groupAdd)
self.ui.act_patchbay_remove_group.triggered.connect(self.slot_groupRemove)
self.ui.act_patchbay_rename_group.triggered.connect(self.slot_groupRename)
self.ui.act_patchbay_add_port.triggered.connect(self.slot_portAdd)
self.ui.act_patchbay_remove_port.triggered.connect(self.slot_portRemove)
self.ui.act_patchbay_rename_port.triggered.connect(self.slot_portRename)
self.ui.act_patchbay_connect_ports.triggered.connect(self.slot_connectPorts)
self.ui.act_patchbay_disconnect_ports.triggered.connect(self.slot_disconnectPorts)
self.ui.b_group_add.clicked.connect(self.slot_groupAdd)
self.ui.b_group_remove.clicked.connect(self.slot_groupRemove)
self.ui.b_group_rename.clicked.connect(self.slot_groupRename)
self.ui.b_port_add.clicked.connect(self.slot_portAdd)
self.ui.b_port_remove.clicked.connect(self.slot_portRemove)
self.ui.b_port_rename.clicked.connect(self.slot_portRename)
self.ui.b_ports_connect.clicked.connect(self.slot_connectPorts)
self.ui.b_ports_disconnect.clicked.connect(self.slot_disconnectPorts)


self.setCanvasConnections() self.setCanvasConnections()


self.connect(self.ui.act_settings_configure, SIGNAL("triggered()"), SLOT("slot_configureCatarina()"))
self.ui.act_settings_configure.triggered.connect(self.slot_configureCatarina)


self.connect(self.ui.act_help_about, SIGNAL("triggered()"), SLOT("slot_aboutCatarina()"))
self.connect(self.ui.act_help_about_qt, SIGNAL("triggered()"), app, SLOT("aboutQt()"))
self.ui.act_help_about.triggered.connect(self.slot_aboutCatarina)
self.ui.act_help_about_qt.triggered.connect(app.aboutQt)


self.connect(self, SIGNAL("SIGUSR1()"), SLOT("slot_projectSave()"))
self.SIGUSR1.connect(self.slot_projectSave)


# Dummy timer to keep events active # Dummy timer to keep events active
self.fUpdateTimer = self.startTimer(1000) self.fUpdateTimer = self.startTimer(1000)
@@ -1035,6 +1040,7 @@ class CatarinaMainW(AbstractCanvasJackClass):
@pyqtSlot() @pyqtSlot()
def slot_projectSaveAs(self): def slot_projectSaveAs(self):
path = QFileDialog.getSaveFileName(self, self.tr("Save State"), filter=self.tr("Catarina XML Document (*.xml)")) path = QFileDialog.getSaveFileName(self, self.tr("Save State"), filter=self.tr("Catarina XML Document (*.xml)"))
path = path[0]
if path: if path:
self.m_save_path = path self.m_save_path = path
self.saveFile(path) self.saveFile(path)
@@ -1255,7 +1261,7 @@ class CatarinaMainW(AbstractCanvasJackClass):
QMessageBox.about(self, self.tr("About Catarina"), self.tr("<h3>Catarina</h3>" QMessageBox.about(self, self.tr("About Catarina"), self.tr("<h3>Catarina</h3>"
"<br>Version %s" "<br>Version %s"
"<br>Catarina is a testing ground for the 'PatchCanvas' module.<br>" "<br>Catarina is a testing ground for the 'PatchCanvas' module.<br>"
"<br>Copyright (C) 2010-2013 falkTX") % VERSION)
"<br>Copyright (C) 2010-2018 falkTX") % VERSION)


def saveSettings(self): def saveSettings(self):
settings = QSettings() settings = QSettings()
@@ -1267,7 +1273,7 @@ class CatarinaMainW(AbstractCanvasJackClass):
settings = QSettings() settings = QSettings()


if geometry: if geometry:
self.restoreGeometry(settings.value("Geometry", ""))
self.restoreGeometry(settings.value("Geometry", b""))


showToolbar = settings.value("ShowToolbar", True, type=bool) showToolbar = settings.value("ShowToolbar", True, type=bool)
self.ui.act_settings_show_toolbar.setChecked(showToolbar) self.ui.act_settings_show_toolbar.setChecked(showToolbar)


+ 32
- 32
src/catia.py View File

@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-


# JACK Patchbay # JACK Patchbay
# Copyright (C) 2010-2013 Filipe Coelho <falktx@falktx.com>
# Copyright (C) 2010-2018 Filipe Coelho <falktx@falktx.com>
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ from shared_settings import *


try: try:
import dbus import dbus
from dbus.mainloop.qt import DBusQtMainLoop
from dbus.mainloop.pyqt5 import DBusQtMainLoop
haveDBus = True haveDBus = True
except: except:
haveDBus = False haveDBus = False
@@ -37,7 +37,7 @@ except:
# Try Import OpenGL # Try Import OpenGL


try: try:
from PyQt4.QtOpenGL import QGLWidget
from PyQt5.QtOpenGL import QGLWidget
hasGL = True hasGL = True
except: except:
hasGL = False hasGL = False
@@ -215,26 +215,26 @@ class CatiaMainW(AbstractCanvasJackClass):
self.setCanvasConnections() self.setCanvasConnections()
self.setJackConnections(["jack", "buffer-size", "transport", "misc"]) self.setJackConnections(["jack", "buffer-size", "transport", "misc"])


self.connect(self.ui.act_tools_jack_start, SIGNAL("triggered()"), SLOT("slot_JackServerStart()"))
self.connect(self.ui.act_tools_jack_stop, SIGNAL("triggered()"), SLOT("slot_JackServerStop()"))
self.connect(self.ui.act_tools_a2j_start, SIGNAL("triggered()"), SLOT("slot_A2JBridgeStart()"))
self.connect(self.ui.act_tools_a2j_stop, SIGNAL("triggered()"), SLOT("slot_A2JBridgeStop()"))
self.connect(self.ui.act_tools_a2j_export_hw, SIGNAL("triggered()"), SLOT("slot_A2JBridgeExportHW()"))
self.ui.act_tools_jack_start.triggered.connect(self.slot_JackServerStart)
self.ui.act_tools_jack_stop.triggered.connect(self.slot_JackServerStop)
self.ui.act_tools_a2j_start.triggered.connect(self.slot_A2JBridgeStart)
self.ui.act_tools_a2j_stop.triggered.connect(self.slot_A2JBridgeStop)
self.ui.act_tools_a2j_export_hw.triggered.connect(self.slot_A2JBridgeExportHW)


self.connect(self.ui.act_settings_show_alsa, SIGNAL("triggered(bool)"), SLOT("slot_showAlsaMIDI(bool)"))
self.connect(self.ui.act_configure, SIGNAL("triggered()"), SLOT("slot_configureCatia()"))
self.ui.act_settings_show_alsa.triggered.connect(self.slot_showAlsaMIDI)
self.ui.act_configure.triggered.connect(self.slot_configureCatia)


self.connect(self.ui.act_help_about, SIGNAL("triggered()"), SLOT("slot_aboutCatia()"))
self.connect(self.ui.act_help_about_qt, SIGNAL("triggered()"), app, SLOT("aboutQt()"))
self.ui.act_help_about.triggered.connect(self.slot_aboutCatia)
self.ui.act_help_about_qt.triggered.connect(app.aboutQt)


self.connect(self, SIGNAL("XRunCallback()"), SLOT("slot_XRunCallback()"))
self.connect(self, SIGNAL("BufferSizeCallback(int)"), SLOT("slot_BufferSizeCallback(int)"))
self.connect(self, SIGNAL("SampleRateCallback(int)"), SLOT("slot_SampleRateCallback(int)"))
self.connect(self, SIGNAL("ClientRenameCallback(QString, QString)"), SLOT("slot_ClientRenameCallback(QString, QString)"))
self.connect(self, SIGNAL("PortRegistrationCallback(int, bool)"), SLOT("slot_PortRegistrationCallback(int, bool)"))
self.connect(self, SIGNAL("PortConnectCallback(int, int, bool)"), SLOT("slot_PortConnectCallback(int, int, bool)"))
self.connect(self, SIGNAL("PortRenameCallback(int, QString, QString)"), SLOT("slot_PortRenameCallback(int, QString, QString)"))
self.connect(self, SIGNAL("ShutdownCallback()"), SLOT("slot_ShutdownCallback()"))
self.XRunCallback.connect(self.slot_XRunCallback)
self.BufferSizeCallback.connect(self.slot_BufferSizeCallback)
self.SampleRateCallback.connect(self.slot_SampleRateCallback)
self.ClientRenameCallback.connect(self.slot_ClientRenameCallback)
self.PortRegistrationCallback.connect(self.slot_PortRegistrationCallback)
self.PortConnectCallback.connect(self.slot_PortConnectCallback)
self.PortRenameCallback.connect(self.slot_PortRenameCallback)
self.ShutdownCallback.connect(self.slot_ShutdownCallback)


# ------------------------------------------------------------- # -------------------------------------------------------------
# Set-up DBus # Set-up DBus
@@ -1022,9 +1022,9 @@ class CatiaMainW(AbstractCanvasJackClass):
if not newId: if not newId:
# Something crashed # Something crashed
if appInterface == "org.gna.home.a2jmidid": if appInterface == "org.gna.home.a2jmidid":
QTimer.singleShot(0, self, SLOT("slot_handleCrash_a2j()"))
QTimer.singleShot(0, self.slot_handleCrash_a2j)
elif appInterface == "org.jackaudio.service": elif appInterface == "org.jackaudio.service":
QTimer.singleShot(0, self, SLOT("slot_handleCrash_jack()"))
QTimer.singleShot(0, self.slot_handleCrash_jack)


elif kwds['interface'] == "org.jackaudio.JackControl": elif kwds['interface'] == "org.jackaudio.JackControl":
if kwds['member'] == "ServerStarted": if kwds['member'] == "ServerStarted":
@@ -1055,37 +1055,37 @@ class CatiaMainW(AbstractCanvasJackClass):


def JackXRunCallback(self, arg): def JackXRunCallback(self, arg):
if DEBUG: print("JackXRunCallback()") if DEBUG: print("JackXRunCallback()")
self.emit(SIGNAL("XRunCallback()"))
self.XRunCallback.emit()
return 0 return 0


def JackBufferSizeCallback(self, bufferSize, arg): def JackBufferSizeCallback(self, bufferSize, arg):
if DEBUG: print("JackBufferSizeCallback(%i)" % bufferSize) if DEBUG: print("JackBufferSizeCallback(%i)" % bufferSize)
self.emit(SIGNAL("BufferSizeCallback(int)"), bufferSize)
self.BufferSizeCallback.emit(bufferSize)
return 0 return 0


def JackSampleRateCallback(self, sampleRate, arg): def JackSampleRateCallback(self, sampleRate, arg):
if DEBUG: print("JackSampleRateCallback(%i)" % sampleRate) if DEBUG: print("JackSampleRateCallback(%i)" % sampleRate)
self.emit(SIGNAL("SampleRateCallback(int)"), sampleRate)
self.SampleRateCallback.emit(sampleRate)
return 0 return 0


def JackClientRenameCallback(self, oldName, newName, arg): def JackClientRenameCallback(self, oldName, newName, arg):
if DEBUG: print("JackClientRenameCallback(\"%s\", \"%s\")" % (oldName, newName)) if DEBUG: print("JackClientRenameCallback(\"%s\", \"%s\")" % (oldName, newName))
self.emit(SIGNAL("ClientRenameCallback(QString, QString)"), str(oldName, encoding="utf-8"), str(newName, encoding="utf-8"))
self.ClientRenameCallback.emit(str(oldName, encoding="utf-8"), str(newName, encoding="utf-8"))
return 0 return 0


def JackPortRegistrationCallback(self, portId, registerYesNo, arg): def JackPortRegistrationCallback(self, portId, registerYesNo, arg):
if DEBUG: print("JackPortRegistrationCallback(%i, %i)" % (portId, registerYesNo)) if DEBUG: print("JackPortRegistrationCallback(%i, %i)" % (portId, registerYesNo))
self.emit(SIGNAL("PortRegistrationCallback(int, bool)"), portId, bool(registerYesNo))
self.PortRegistrationCallback.emit(portId, bool(registerYesNo))
return 0 return 0


def JackPortConnectCallback(self, portA, portB, connectYesNo, arg): def JackPortConnectCallback(self, portA, portB, connectYesNo, arg):
if DEBUG: print("JackPortConnectCallback(%i, %i, %i)" % (portA, portB, connectYesNo)) if DEBUG: print("JackPortConnectCallback(%i, %i, %i)" % (portA, portB, connectYesNo))
self.emit(SIGNAL("PortConnectCallback(int, int, bool)"), portA, portB, bool(connectYesNo))
self.PortConnectCallback.emit(portA, portB, bool(connectYesNo))
return 0 return 0


def JackPortRenameCallback(self, portId, oldName, newName, arg): def JackPortRenameCallback(self, portId, oldName, newName, arg):
if DEBUG: print("JackPortRenameCallback(%i, \"%s\", \"%s\")" % (portId, oldName, newName)) if DEBUG: print("JackPortRenameCallback(%i, \"%s\", \"%s\")" % (portId, oldName, newName))
self.emit(SIGNAL("PortRenameCallback(int, QString, QString)"), portId, str(oldName, encoding="utf-8"), str(newName, encoding="utf-8"))
self.PortRenameCallback.emit(portId, str(oldName, encoding="utf-8"), str(newName, encoding="utf-8"))
return 0 return 0


def JackSessionCallback(self, event, arg): def JackSessionCallback(self, event, arg):
@@ -1107,7 +1107,7 @@ class CatiaMainW(AbstractCanvasJackClass):


def JackShutdownCallback(self, arg): def JackShutdownCallback(self, arg):
if DEBUG: print("JackShutdownCallback()") if DEBUG: print("JackShutdownCallback()")
self.emit(SIGNAL("ShutdownCallback()"))
self.ShutdownCallback.emit()
return 0 return 0


@pyqtSlot(bool) @pyqtSlot(bool)
@@ -1318,7 +1318,7 @@ class CatiaMainW(AbstractCanvasJackClass):
QMessageBox.about(self, self.tr("About Catia"), self.tr("<h3>Catia</h3>" QMessageBox.about(self, self.tr("About Catia"), self.tr("<h3>Catia</h3>"
"<br>Version %s" "<br>Version %s"
"<br>Catia is a nice JACK Patchbay with A2J Bridge integration.<br>" "<br>Catia is a nice JACK Patchbay with A2J Bridge integration.<br>"
"<br>Copyright (C) 2010-2013 falkTX" % VERSION))
"<br>Copyright (C) 2010-2018 falkTX" % VERSION))


def saveSettings(self): def saveSettings(self):
settings = QSettings() settings = QSettings()
@@ -1333,7 +1333,7 @@ class CatiaMainW(AbstractCanvasJackClass):
settings = QSettings() settings = QSettings()


if geometry: if geometry:
self.restoreGeometry(settings.value("Geometry", ""))
self.restoreGeometry(settings.value("Geometry", b""))


showAlsaMidi = settings.value("ShowAlsaMIDI", False, type=bool) showAlsaMidi = settings.value("ShowAlsaMIDI", False, type=bool)
self.ui.act_settings_show_alsa.setChecked(showAlsaMidi) self.ui.act_settings_show_alsa.setChecked(showAlsaMidi)


+ 199
- 163
src/claudia.py View File

@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-


# LADISH frontend # LADISH frontend
# Copyright (C) 2010-2013 Filipe Coelho <falktx@falktx.com>
# Copyright (C) 2010-2018 Filipe Coelho <falktx@falktx.com>
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -20,8 +20,13 @@
# Imports (Global) # Imports (Global)


from time import ctime from time import ctime
from PyQt4.QtCore import QPointF
from PyQt4.QtGui import QAction, QApplication, QCheckBox, QHBoxLayout, QVBoxLayout, QTableWidgetItem, QTreeWidgetItem

if True:
from PyQt5.QtCore import QPointF
from PyQt5.QtWidgets import QAction, QApplication, QCheckBox, QHBoxLayout, QVBoxLayout, QTableWidgetItem, QTreeWidgetItem
else:
from PyQt4.QtCore import QPointF
from PyQt4.QtGui import QAction, QApplication, QCheckBox, QHBoxLayout, QVBoxLayout, QTableWidgetItem, QTreeWidgetItem


# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Imports (Custom Stuff) # Imports (Custom Stuff)
@@ -43,7 +48,7 @@ from shared_settings import *


try: try:
import dbus import dbus
from dbus.mainloop.qt import DBusQtMainLoop
from dbus.mainloop.pyqt5 import DBusQtMainLoop
haveDBus = True haveDBus = True
except: except:
haveDBus = False haveDBus = False
@@ -52,7 +57,7 @@ except:
# Try Import OpenGL # Try Import OpenGL


try: try:
from PyQt4.QtOpenGL import QGLWidget
from PyQt5.QtOpenGL import QGLWidget
hasGL = True hasGL = True
except: except:
hasGL = False hasGL = False
@@ -207,8 +212,8 @@ class StudioNameW(QDialog):
for studio in studioList: for studio in studioList:
self.fStudioList.append(str(studio[iStudioListName])) self.fStudioList.append(str(studio[iStudioListName]))


self.connect(self, SIGNAL("accepted()"), SLOT("slot_setReturn()"))
self.connect(self.ui.le_name, SIGNAL("textChanged(QString)"), SLOT("slot_checkText(QString)"))
self.accepted.connect(self.slot_setReturn)
self.ui.le_name.textChanged.connect(self.slot_checkText)


self.fRetStudioName = "" self.fRetStudioName = ""


@@ -252,9 +257,9 @@ class StudioListW(QDialog, ui_claudia_studiolist.Ui_StudioListW):


index += 1 index += 1


self.connect(self, SIGNAL("accepted()"), SLOT("slot_setReturn()"))
self.connect(self.tableWidget, SIGNAL("cellDoubleClicked(int, int)"), SLOT("accept()"))
self.connect(self.tableWidget, SIGNAL("currentCellChanged(int, int, int, int)"), SLOT("slot_checkSelection(int)"))
self.accepted.connect(self.slot_setReturn)
self.tableWidget.cellDoubleClicked.connect(self.accept)
self.tableWidget.currentCellChanged.connect(self.slot_checkSelection)


if self.tableWidget.rowCount() > 0: if self.tableWidget.rowCount() > 0:
self.tableWidget.setCurrentCell(0, 0) self.tableWidget.setCurrentCell(0, 0)
@@ -287,8 +292,8 @@ class CreateRoomW(QDialog, ui_claudia_createroom.Ui_CreateRoomW):
for template_name, template_dict in templates_list: for template_name, template_dict in templates_list:
self.lw_templates.addItem(template_name) self.lw_templates.addItem(template_name)


self.connect(self, SIGNAL("accepted()"), SLOT("slot_setReturn()"))
self.connect(self.le_name, SIGNAL("textChanged(QString)"), SLOT("slot_checkText(QString)"))
self.accepted.connect(self.slot_setReturn)
self.le_name.textChanged.connect(self.slot_checkText)


if self.lw_templates.count() > 0: if self.lw_templates.count() > 0:
self.lw_templates.setCurrentRow(0) self.lw_templates.setCurrentRow(0)
@@ -332,10 +337,10 @@ class ProjectNameW(QDialog, ui_claudia_projectname.Ui_ProjectNameW):


self.m_proj_folder = proj_folder self.m_proj_folder = proj_folder


self.connect(self, SIGNAL("accepted()"), SLOT("slot_setReturn()"))
self.connect(self.b_open, SIGNAL("clicked()"), SLOT("slot_checkFolder()"))
self.connect(self.le_path, SIGNAL("textChanged(QString)"), SLOT("slot_checkText_path(QString)"))
self.connect(self.le_name, SIGNAL("textChanged(QString)"), SLOT("slot_checkText_name(QString)"))
self.accepted.connect(self.slot_setReturn)
self.b_open.clicked.connect(self.slot_checkFolder)
self.le_path.textChanged.connect(self.slot_checkText_path)
self.le_name.textChanged.connect(self.slot_checkText_name)


self.ret_project_name = "" self.ret_project_name = ""
self.ret_project_path = "" self.ret_project_path = ""
@@ -384,9 +389,9 @@ class ProjectPropertiesW(QDialog, ui_claudia_projectproperties.Ui_ProjectPropert
self.m_default_name = name self.m_default_name = name
self.m_last_name = name self.m_last_name = name


self.connect(self, SIGNAL("accepted()"), SLOT("slot_setReturn()"))
self.connect(self.le_name, SIGNAL("textChanged(QString)"), SLOT("slot_checkText_name(QString)"))
self.connect(self.cb_save_now, SIGNAL("clicked(bool)"), SLOT("slot_checkSaveNow(bool)"))
self.accepted.connect(self.slot_setReturn)
self.le_name.textChanged.connect(self.slot_checkText_name)
self.cb_save_now.clicked.connect(self.slot_checkSaveNow)


self.le_name.setText(name) self.le_name.setText(name)
self.le_description.setText(description) self.le_description.setText(description)
@@ -458,8 +463,8 @@ class RunCustomW(QDialog, ui_claudia_runcustom.Ui_RunCustomW):
self.rb_level_lash.setEnabled(False) self.rb_level_lash.setEnabled(False)
self.rb_level_js.setEnabled(False) self.rb_level_js.setEnabled(False)


self.connect(self, SIGNAL("accepted()"), SLOT("slot_setReturn()"))
self.connect(self.le_command, SIGNAL("textChanged(QString)"), SLOT("slot_checkText(QString)"))
self.accepted.connect(self.slot_setReturn)
self.le_command.textChanged.connect(self.slot_checkText)


self.ret_app_obj = None self.ret_app_obj = None


@@ -532,8 +537,8 @@ class ClaudiaLauncherW(QDialog):


self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)


self.connect(self.buttonBox.button(QDialogButtonBox.Ok), SIGNAL("clicked()"), SLOT("slot_addAppToLADISH()"))
self.connect(self.buttonBox.button(QDialogButtonBox.Close), SIGNAL("clicked()"), self, SLOT("reject()"))
self.buttonBox.button(QDialogButtonBox.Ok).clicked.connect(self.slot_addAppToLADISH)
self.buttonBox.button(QDialogButtonBox.Close).clicked.connect(self.reject)


# ---------------------------------------- # ----------------------------------------
# Callbacks # Callbacks
@@ -580,7 +585,7 @@ class ClaudiaLauncherW(QDialog):


def loadSettings(self): def loadSettings(self):
if self.settings.contains("Geometry"): if self.settings.contains("Geometry"):
self.restoreGeometry(self.settings.value("Geometry", ""))
self.restoreGeometry(self.settings.value("Geometry", b""))
else: else:
self.resize(850, 500) self.resize(850, 500)
self.launcher.loadSettings() self.launcher.loadSettings()
@@ -597,6 +602,33 @@ class ClaudiaLauncherW(QDialog):
# Claudia Main Window # Claudia Main Window


class ClaudiaMainW(AbstractCanvasJackClass): class ClaudiaMainW(AbstractCanvasJackClass):
DBusCrashCallback = pyqtSignal(str)
DBusServerStartedCallback = pyqtSignal()
DBusServerStoppedCallback = pyqtSignal()
DBusClientAppearedCallback = pyqtSignal(int, str)
DBusClientDisappearedCallback = pyqtSignal(int)
DBusClientRenamedCallback = pyqtSignal(int, str)
DBusPortAppearedCallback = pyqtSignal(int, int, str, int, int)
DBusPortDisppearedCallback = pyqtSignal(int)
DBusPortRenamedCallback = pyqtSignal(int, str)
DBusPortsConnectedCallback = pyqtSignal(int, int, int)
DBusPortsDisconnectedCallback = pyqtSignal(int)
DBusStudioAppearedCallback = pyqtSignal()
DBusStudioDisappearedCallback = pyqtSignal()
DBusQueueExecutionHaltedCallback = pyqtSignal()
DBusCleanExitCallback = pyqtSignal()
DBusStudioStartedCallback = pyqtSignal()
DBusStudioStoppedCallback = pyqtSignal()
DBusStudioRenamedCallback = pyqtSignal(str)
DBusStudioCrashedCallback = pyqtSignal()
DBusRoomAppearedCallback = pyqtSignal(str, str)
DBusRoomDisappearedCallback = pyqtSignal(str)
DBusRoomChangedCallback = pyqtSignal()
DBusProjectPropertiesChanged = pyqtSignal(str, str)
DBusAppAdded2Callback = pyqtSignal(str, int, str, bool, bool, str)
DBusAppRemovedCallback = pyqtSignal(str, int)
DBusAppStateChanged2Callback = pyqtSignal(str, int, str, bool, bool, str)

def __init__(self, parent=None): def __init__(self, parent=None):
AbstractCanvasJackClass.__init__(self, "Claudia", ui_claudia.Ui_ClaudiaMainW, parent) AbstractCanvasJackClass.__init__(self, "Claudia", ui_claudia.Ui_ClaudiaMainW, parent)


@@ -752,7 +784,7 @@ class ClaudiaMainW(AbstractCanvasJackClass):
self.ui.miniCanvasPreview.setRealParent(self) self.ui.miniCanvasPreview.setRealParent(self)
self.ui.miniCanvasPreview.setViewTheme(patchcanvas.canvas.theme.canvas_bg, patchcanvas.canvas.theme.rubberband_brush, patchcanvas.canvas.theme.rubberband_pen.color()) self.ui.miniCanvasPreview.setViewTheme(patchcanvas.canvas.theme.canvas_bg, patchcanvas.canvas.theme.rubberband_brush, patchcanvas.canvas.theme.rubberband_pen.color())
self.ui.miniCanvasPreview.init(self.scene, DEFAULT_CANVAS_WIDTH, DEFAULT_CANVAS_HEIGHT) self.ui.miniCanvasPreview.init(self.scene, DEFAULT_CANVAS_WIDTH, DEFAULT_CANVAS_HEIGHT)
QTimer.singleShot(100, self, SLOT("slot_miniCanvasInit()"))
QTimer.singleShot(100, self.slot_miniCanvasInit)


# ------------------------------------------------------------- # -------------------------------------------------------------
# Check DBus # Check DBus
@@ -795,104 +827,104 @@ class ClaudiaMainW(AbstractCanvasJackClass):
self.setCanvasConnections() self.setCanvasConnections()
self.setJackConnections(["jack", "transport", "misc"]) self.setJackConnections(["jack", "transport", "misc"])


self.connect(self.ui.act_studio_new, SIGNAL("triggered()"), SLOT("slot_studio_new()"))
self.connect(self.ui.act_studio_start, SIGNAL("triggered()"), SLOT("slot_studio_start()"))
self.connect(self.ui.act_studio_stop, SIGNAL("triggered()"), SLOT("slot_studio_stop()"))
self.connect(self.ui.act_studio_save, SIGNAL("triggered()"), SLOT("slot_studio_save()"))
self.connect(self.ui.act_studio_save_as, SIGNAL("triggered()"), SLOT("slot_studio_save_as()"))
self.connect(self.ui.act_studio_rename, SIGNAL("triggered()"), SLOT("slot_studio_rename()"))
self.connect(self.ui.act_studio_unload, SIGNAL("triggered()"), SLOT("slot_studio_unload()"))
self.connect(self.ui.act_tools_a2j_start, SIGNAL("triggered()"), SLOT("slot_A2JBridgeStart()"))
self.connect(self.ui.act_tools_a2j_stop, SIGNAL("triggered()"), SLOT("slot_A2JBridgeStop()"))
self.connect(self.ui.act_tools_a2j_export_hw, SIGNAL("triggered()"), SLOT("slot_A2JBridgeExportHW()"))
self.connect(self.ui.b_studio_new, SIGNAL("clicked()"), SLOT("slot_studio_new()"))
self.connect(self.ui.b_studio_load, SIGNAL("clicked()"), SLOT("slot_studio_load_b()"))
self.connect(self.ui.b_studio_save, SIGNAL("clicked()"), SLOT("slot_studio_save()"))
self.connect(self.ui.b_studio_save_as, SIGNAL("clicked()"), SLOT("slot_studio_save_as()"))
self.connect(self.ui.b_studio_start, SIGNAL("clicked()"), SLOT("slot_studio_start()"))
self.connect(self.ui.b_studio_stop, SIGNAL("clicked()"), SLOT("slot_studio_stop()"))
self.connect(self.ui.menu_studio_load, SIGNAL("aboutToShow()"), SLOT("slot_updateMenuStudioList_Load()"))
self.connect(self.ui.menu_studio_delete, SIGNAL("aboutToShow()"), SLOT("slot_updateMenuStudioList_Delete()"))
self.connect(self.ui.act_room_create, SIGNAL("triggered()"), SLOT("slot_room_create()"))
self.connect(self.ui.menu_room_delete, SIGNAL("aboutToShow()"), SLOT("slot_updateMenuRoomList()"))
self.connect(self.ui.act_project_new, SIGNAL("triggered()"), SLOT("slot_project_new()"))
self.connect(self.ui.act_project_save, SIGNAL("triggered()"), SLOT("slot_project_save()"))
self.connect(self.ui.act_project_save_as, SIGNAL("triggered()"), SLOT("slot_project_save_as()"))
self.connect(self.ui.act_project_unload, SIGNAL("triggered()"), SLOT("slot_project_unload()"))
self.connect(self.ui.act_project_properties, SIGNAL("triggered()"), SLOT("slot_project_properties()"))
self.connect(self.ui.b_project_new, SIGNAL("clicked()"), SLOT("slot_project_new()"))
self.connect(self.ui.b_project_load, SIGNAL("clicked()"), SLOT("slot_project_load()"))
self.connect(self.ui.b_project_save, SIGNAL("clicked()"), SLOT("slot_project_save()"))
self.connect(self.ui.b_project_save_as, SIGNAL("clicked()"), SLOT("slot_project_save_as()"))
self.connect(self.ui.menu_project_load, SIGNAL("aboutToShow()"), SLOT("slot_updateMenuProjectList()"))
self.connect(self.ui.act_app_add_new, SIGNAL("triggered()"), SLOT("slot_app_add_new()"))
self.connect(self.ui.act_app_run_custom, SIGNAL("triggered()"), SLOT("slot_app_run_custom()"))
self.connect(self.ui.treeWidget, SIGNAL("itemSelectionChanged()"), SLOT("slot_checkCurrentRoom()"))
#self.connect(self.ui.treeWidget, SIGNAL("itemPressed(QTreeWidgetItem*, int)"), SLOT("slot_checkCurrentRoom()"))
self.connect(self.ui.treeWidget, SIGNAL("itemDoubleClicked(QTreeWidgetItem*, int)"), SLOT("slot_doubleClickedAppList(QTreeWidgetItem*, int)"))
self.connect(self.ui.treeWidget, SIGNAL("customContextMenuRequested(QPoint)"), SLOT("slot_showAppListCustomMenu()"))
self.connect(self.ui.miniCanvasPreview, SIGNAL("miniCanvasMoved(double, double)"), SLOT("slot_miniCanvasMoved(double, double)"))
self.connect(self.ui.graphicsView.horizontalScrollBar(), SIGNAL("valueChanged(int)"), SLOT("slot_horizontalScrollBarChanged(int)"))
self.connect(self.ui.graphicsView.verticalScrollBar(), SIGNAL("valueChanged(int)"), SLOT("slot_verticalScrollBarChanged(int)"))
self.connect(self.scene, SIGNAL("sceneGroupMoved(int, int, QPointF)"), SLOT("slot_canvasItemMoved(int, int, QPointF)"))
self.connect(self.scene, SIGNAL("scaleChanged(double)"), SLOT("slot_canvasScaleChanged(double)"))
self.connect(self.ui.act_settings_configure, SIGNAL("triggered()"), SLOT("slot_configureClaudia()"))
self.connect(self.ui.act_help_about, SIGNAL("triggered()"), SLOT("slot_aboutClaudia()"))
self.connect(self.ui.act_help_about_qt, SIGNAL("triggered()"), app, SLOT("aboutQt()"))
self.ui.act_studio_new.triggered.connect(self.slot_studio_new)
self.ui.act_studio_start.triggered.connect(self.slot_studio_start)
self.ui.act_studio_stop.triggered.connect(self.slot_studio_stop)
self.ui.act_studio_save.triggered.connect(self.slot_studio_save)
self.ui.act_studio_save_as.triggered.connect(self.slot_studio_save_as)
self.ui.act_studio_rename.triggered.connect(self.slot_studio_rename)
self.ui.act_studio_unload.triggered.connect(self.slot_studio_unload)
self.ui.act_tools_a2j_start.triggered.connect(self.slot_A2JBridgeStart)
self.ui.act_tools_a2j_stop.triggered.connect(self.slot_A2JBridgeStop)
self.ui.act_tools_a2j_export_hw.triggered.connect(self.slot_A2JBridgeExportHW)
self.ui.b_studio_new.clicked.connect(self.slot_studio_new)
self.ui.b_studio_load.clicked.connect(self.slot_studio_load_b)
self.ui.b_studio_save.clicked.connect(self.slot_studio_save)
self.ui.b_studio_save_as.clicked.connect(self.slot_studio_save_as)
self.ui.b_studio_start.clicked.connect(self.slot_studio_start)
self.ui.b_studio_stop.clicked.connect(self.slot_studio_stop)
self.ui.menu_studio_load.aboutToShow.connect(self.slot_updateMenuStudioList_Load)
self.ui.menu_studio_delete.aboutToShow.connect(self.slot_updateMenuStudioList_Delete)
self.ui.act_room_create.triggered.connect(self.slot_room_create)
self.ui.menu_room_delete.aboutToShow.connect(self.slot_updateMenuRoomList)
self.ui.act_project_new.triggered.connect(self.slot_project_new)
self.ui.act_project_save.triggered.connect(self.slot_project_save)
self.ui.act_project_save_as.triggered.connect(self.slot_project_save_as)
self.ui.act_project_unload.triggered.connect(self.slot_project_unload)
self.ui.act_project_properties.triggered.connect(self.slot_project_properties)
self.ui.b_project_new.clicked.connect(self.slot_project_new)
self.ui.b_project_load.clicked.connect(self.slot_project_load)
self.ui.b_project_save.clicked.connect(self.slot_project_save)
self.ui.b_project_save_as.clicked.connect(self.slot_project_save_as)
self.ui.menu_project_load.aboutToShow.connect(self.slot_updateMenuProjectList)
self.ui.act_app_add_new.triggered.connect(self.slot_app_add_new)
self.ui.act_app_run_custom.triggered.connect(self.slot_app_run_custom)
self.ui.treeWidget.itemSelectionChanged.connect(self.slot_checkCurrentRoom)
#self.ui.treeWidget.itemPressed.connect(self.slot_checkCurrentRoom)
self.ui.treeWidget.itemDoubleClicked.connect(self.slot_doubleClickedAppList)
self.ui.treeWidget.customContextMenuRequested.connect(self.slot_showAppListCustomMenu)
self.ui.miniCanvasPreview.miniCanvasMoved.connect(self.slot_miniCanvasMoved)
self.ui.graphicsView.horizontalScrollBar().valueChanged.connect(self.slot_horizontalScrollBarChanged)
self.ui.graphicsView.verticalScrollBar().valueChanged.connect(self.slot_verticalScrollBarChanged)
self.scene.sceneGroupMoved.connect(self.slot_canvasItemMoved)
self.scene.scaleChanged.connect(self.slot_canvasScaleChanged)
self.ui.act_settings_configure.triggered.connect(self.slot_configureClaudia)
self.ui.act_help_about.triggered.connect(self.slot_aboutClaudia)
self.ui.act_help_about_qt.triggered.connect(app.aboutQt)


# org.freedesktop.DBus # org.freedesktop.DBus
self.connect(self, SIGNAL("DBusCrashCallback(QString)"), SLOT("slot_DBusCrashCallback(QString)"))
self.DBusCrashCallback.connect(self.slot_DBusCrashCallback)


# org.jackaudio.JackControl # org.jackaudio.JackControl
self.connect(self, SIGNAL("DBusServerStartedCallback()"), SLOT("slot_DBusServerStartedCallback()"))
self.connect(self, SIGNAL("DBusServerStoppedCallback()"), SLOT("slot_DBusServerStoppedCallback()"))
self.DBusServerStartedCallback.connect(self.slot_DBusServerStartedCallback)
self.DBusServerStoppedCallback.connect(self.slot_DBusServerStoppedCallback)


# org.jackaudio.JackPatchbay # org.jackaudio.JackPatchbay
self.connect(self, SIGNAL("DBusClientAppearedCallback(int, QString)"), SLOT("slot_DBusClientAppearedCallback(int, QString)"))
self.connect(self, SIGNAL("DBusClientDisappearedCallback(int)"), SLOT("slot_DBusClientDisappearedCallback(int)"))
self.connect(self, SIGNAL("DBusClientRenamedCallback(int, QString)"), SLOT("slot_DBusClientRenamedCallback(int, QString)"))
self.connect(self, SIGNAL("DBusPortAppearedCallback(int, int, QString, int, int)"), SLOT("slot_DBusPortAppearedCallback(int, int, QString, int, int)"))
self.connect(self, SIGNAL("DBusPortDisppearedCallback(int)"), SLOT("slot_DBusPortDisppearedCallback(int)"))
self.connect(self, SIGNAL("DBusPortRenamedCallback(int, QString)"), SLOT("slot_DBusPortRenamedCallback(int, QString)"))
self.connect(self, SIGNAL("DBusPortsConnectedCallback(int, int, int)"), SLOT("slot_DBusPortsConnectedCallback(int, int, int)"))
self.connect(self, SIGNAL("DBusPortsDisconnectedCallback(int)"), SLOT("slot_DBusPortsDisconnectedCallback(int)"))
self.DBusClientAppearedCallback.connect(self.slot_DBusClientAppearedCallback)
self.DBusClientDisappearedCallback.connect(self.slot_DBusClientDisappearedCallback)
self.DBusClientRenamedCallback.connect(self.slot_DBusClientRenamedCallback)
self.DBusPortAppearedCallback.connect(self.slot_DBusPortAppearedCallback)
self.DBusPortDisppearedCallback.connect(self.slot_DBusPortDisppearedCallback)
self.DBusPortRenamedCallback.connect(self.slot_DBusPortRenamedCallback)
self.DBusPortsConnectedCallback.connect(self.slot_DBusPortsConnectedCallback)
self.DBusPortsDisconnectedCallback.connect(self.slot_DBusPortsDisconnectedCallback)


# org.ladish.Control # org.ladish.Control
self.connect(self, SIGNAL("DBusStudioAppearedCallback()"), SLOT("slot_DBusStudioAppearedCallback()"))
self.connect(self, SIGNAL("DBusStudioDisappearedCallback()"), SLOT("slot_DBusStudioDisappearedCallback()"))
self.connect(self, SIGNAL("DBusQueueExecutionHaltedCallback()"), SLOT("slot_DBusQueueExecutionHaltedCallback()"))
self.connect(self, SIGNAL("DBusCleanExitCallback()"), SLOT("slot_DBusCleanExitCallback()"))
self.DBusStudioAppearedCallback.connect(self.slot_DBusStudioAppearedCallback)
self.DBusStudioDisappearedCallback.connect(self.slot_DBusStudioDisappearedCallback)
self.DBusQueueExecutionHaltedCallback.connect(self.slot_DBusQueueExecutionHaltedCallback)
self.DBusCleanExitCallback.connect(self.slot_DBusCleanExitCallback)


# org.ladish.Studio # org.ladish.Studio
self.connect(self, SIGNAL("DBusStudioStartedCallback()"), SLOT("slot_DBusStudioStartedCallback()"))
self.connect(self, SIGNAL("DBusStudioStoppedCallback()"), SLOT("slot_DBusStudioStoppedCallback()"))
self.connect(self, SIGNAL("DBusStudioRenamedCallback(QString)"), SLOT("slot_DBusStudioRenamedCallback(QString)"))
self.connect(self, SIGNAL("DBusStudioCrashedCallback()"), SLOT("slot_DBusStudioCrashedCallback()"))
self.connect(self, SIGNAL("DBusRoomAppearedCallback(QString, QString)"), SLOT("slot_DBusRoomAppearedCallback(QString, QString)"))
self.connect(self, SIGNAL("DBusRoomDisappearedCallback(QString)"), SLOT("slot_DBusRoomDisappearedCallback(QString)"))
#self.connect(self, SIGNAL("DBusRoomChangedCallback()"), SLOT("slot_DBusRoomChangedCallback()"))
self.DBusStudioStartedCallback.connect(self.slot_DBusStudioStartedCallback)
self.DBusStudioStoppedCallback.connect(self.slot_DBusStudioStoppedCallback)
self.DBusStudioRenamedCallback.connect(self.slot_DBusStudioRenamedCallback)
self.DBusStudioCrashedCallback.connect(self.slot_DBusStudioCrashedCallback)
self.DBusRoomAppearedCallback.connect(self.slot_DBusRoomAppearedCallback)
self.DBusRoomDisappearedCallback.connect(self.slot_DBusRoomDisappearedCallback)
#self.DBusRoomChangedCallback.connect(self.slot_DBusRoomChangedCallback)


# org.ladish.Room # org.ladish.Room
self.connect(self, SIGNAL("DBusProjectPropertiesChanged(QString, QString)"), SLOT("slot_DBusProjectPropertiesChanged(QString, QString)"))
self.DBusProjectPropertiesChanged.connect(self.slot_DBusProjectPropertiesChanged)


# org.ladish.AppSupervisor # org.ladish.AppSupervisor
self.connect(self, SIGNAL("DBusAppAdded2Callback(QString, int, QString, bool, bool, QString)"), SLOT("slot_DBusAppAdded2Callback(QString, int, QString, bool, bool, QString)"))
self.connect(self, SIGNAL("DBusAppRemovedCallback(QString, int)"), SLOT("slot_DBusAppRemovedCallback(QString, int)"))
self.connect(self, SIGNAL("DBusAppStateChanged2Callback(QString, int, QString, bool, bool, QString)"), SLOT("slot_DBusAppStateChanged2Callback(QString, int, QString, bool, bool, QString)"))
self.DBusAppAdded2Callback.connect(self.slot_DBusAppAdded2Callback)
self.DBusAppRemovedCallback.connect(self.slot_DBusAppRemovedCallback)
self.DBusAppStateChanged2Callback.connect(self.slot_DBusAppStateChanged2Callback)


# JACK # JACK
self.connect(self, SIGNAL("JackBufferSizeCallback(int)"), SLOT("slot_JackBufferSizeCallback(int)"))
self.connect(self, SIGNAL("JackSampleRateCallback(int)"), SLOT("slot_JackSampleRateCallback(int)"))
self.connect(self, SIGNAL("JackShutdownCallback()"), SLOT("slot_JackShutdownCallback()"))
self.BufferSizeCallback.connect(self.slot_JackBufferSizeCallback)
self.SampleRateCallback.connect(self.slot_JackSampleRateCallback)
self.ShutdownCallback.connect(self.slot_JackShutdownCallback)


# ------------------------------------------------------------- # -------------------------------------------------------------
# Set-up DBus # Set-up DBus
@@ -1161,7 +1193,7 @@ class ClaudiaMainW(AbstractCanvasJackClass):
source_group_id, source_group_name, source_port_id, source_port_name, target_group_id, target_group_name, target_port_id, target_port_name, conn_id = conn source_group_id, source_group_name, source_port_id, source_port_name, target_group_id, target_group_name, target_port_id, target_port_name, conn_id = conn
self.canvas_connect_ports(int(conn_id), int(source_port_id), int(target_port_id)) self.canvas_connect_ports(int(conn_id), int(source_port_id), int(target_port_id))


QTimer.singleShot(1000 if (self.fSavedSettings['Canvas/EyeCandy']) else 0, self.ui.miniCanvasPreview, SLOT("update()"))
QTimer.singleShot(1000 if (self.fSavedSettings['Canvas/EyeCandy']) else 0, self.ui.miniCanvasPreview.update)


def room_add(self, room_path, room_name): def room_add(self, room_path, room_name):
room_index = int(room_path.replace("/org/ladish/Room", "")) room_index = int(room_path.replace("/org/ladish/Room", ""))
@@ -1254,35 +1286,35 @@ class ClaudiaMainW(AbstractCanvasJackClass):
if y2 is None: y2 = "%f" % (float(y) + 50) if y2 is None: y2 = "%f" % (float(y) + 50)
patchcanvas.setGroupPosFull(groupId, float(x), float(y), float(x2), float(y2)) patchcanvas.setGroupPosFull(groupId, float(x), float(y), float(x2), float(y2))


QTimer.singleShot(0, self.ui.miniCanvasPreview, SLOT("update()"))
QTimer.singleShot(0, self.ui.miniCanvasPreview.update)


def canvas_remove_group(self, group_id): def canvas_remove_group(self, group_id):
patchcanvas.removeGroup(group_id) patchcanvas.removeGroup(group_id)
QTimer.singleShot(0, self.ui.miniCanvasPreview, SLOT("update()"))
QTimer.singleShot(0, self.ui.miniCanvasPreview.update)


def canvas_rename_group(self, group_id, new_group_name): def canvas_rename_group(self, group_id, new_group_name):
patchcanvas.renameGroup(group_id, new_group_name) patchcanvas.renameGroup(group_id, new_group_name)
QTimer.singleShot(0, self.ui.miniCanvasPreview, SLOT("update()"))
QTimer.singleShot(0, self.ui.miniCanvasPreview.update)


def canvas_add_port(self, group_id, port_id, port_name, port_mode, port_type): def canvas_add_port(self, group_id, port_id, port_name, port_mode, port_type):
patchcanvas.addPort(group_id, port_id, port_name, port_mode, port_type) patchcanvas.addPort(group_id, port_id, port_name, port_mode, port_type)
QTimer.singleShot(0, self.ui.miniCanvasPreview, SLOT("update()"))
QTimer.singleShot(0, self.ui.miniCanvasPreview.update)


def canvas_remove_port(self, port_id): def canvas_remove_port(self, port_id):
patchcanvas.removePort(port_id) patchcanvas.removePort(port_id)
QTimer.singleShot(0, self.ui.miniCanvasPreview, SLOT("update()"))
QTimer.singleShot(0, self.ui.miniCanvasPreview.update)


def canvas_rename_port(self, port_id, new_port_name): def canvas_rename_port(self, port_id, new_port_name):
patchcanvas.renamePort(port_id, new_port_name) patchcanvas.renamePort(port_id, new_port_name)
QTimer.singleShot(0, self.ui.miniCanvasPreview, SLOT("update()"))
QTimer.singleShot(0, self.ui.miniCanvasPreview.update)


def canvas_connect_ports(self, connection_id, port_a, port_b): def canvas_connect_ports(self, connection_id, port_a, port_b):
patchcanvas.connectPorts(connection_id, port_a, port_b) patchcanvas.connectPorts(connection_id, port_a, port_b)
QTimer.singleShot(0, self.ui.miniCanvasPreview, SLOT("update()"))
QTimer.singleShot(0, self.ui.miniCanvasPreview.update)


def canvas_disconnect_ports(self, connection_id): def canvas_disconnect_ports(self, connection_id):
patchcanvas.disconnectPorts(connection_id) patchcanvas.disconnectPorts(connection_id)
QTimer.singleShot(0, self.ui.miniCanvasPreview, SLOT("update()"))
QTimer.singleShot(0, self.ui.miniCanvasPreview.update)


def jackStarted(self): def jackStarted(self):
if jacksettings.needsInit(): if jacksettings.needsInit():
@@ -1497,85 +1529,85 @@ class ClaudiaMainW(AbstractCanvasJackClass):
if not newId: if not newId:
# Something crashed # Something crashed
if appInterface == "org.gna.home.a2jmidid": if appInterface == "org.gna.home.a2jmidid":
QTimer.singleShot(0, self, SLOT("slot_handleCrash_a2j()"))
QTimer.singleShot(0, self.slot_handleCrash_a2j)
elif appInterface in ("org.jackaudio.service", "org.ladish"): elif appInterface in ("org.jackaudio.service", "org.ladish"):
# Prevent any more dbus calls # Prevent any more dbus calls
gDBus.jack = None gDBus.jack = None
gJack.client = None gJack.client = None
jacksettings.initBus(None) jacksettings.initBus(None)
self.emit(SIGNAL("DBusCrashCallback(QString)"), appInterface)
self.DBusCrashCallback.emit(appInterface)


elif kwds['interface'] == "org.jackaudio.JackControl": elif kwds['interface'] == "org.jackaudio.JackControl":
if DEBUG: print("DBus signal @org.jackaudio.JackControl,", kwds['member']) if DEBUG: print("DBus signal @org.jackaudio.JackControl,", kwds['member'])
if kwds['member'] == "ServerStarted": if kwds['member'] == "ServerStarted":
self.emit(SIGNAL("DBusServerStartedCallback()"))
self.DBusServerStartedCallback.emit()
elif kwds['member'] == "ServerStopped": elif kwds['member'] == "ServerStopped":
self.emit(SIGNAL("DBusServerStoppedCallback()"))
self.DBusServerStoppedCallback.emit()


elif kwds['interface'] == "org.jackaudio.JackPatchbay": elif kwds['interface'] == "org.jackaudio.JackPatchbay":
if gDBus.patchbay and kwds['path'] == gDBus.patchbay.object_path: if gDBus.patchbay and kwds['path'] == gDBus.patchbay.object_path:
if DEBUG: print("DBus signal @org.jackaudio.JackPatchbay,", kwds['member']) if DEBUG: print("DBus signal @org.jackaudio.JackPatchbay,", kwds['member'])
if kwds['member'] == "ClientAppeared": if kwds['member'] == "ClientAppeared":
self.emit(SIGNAL("DBusClientAppearedCallback(int, QString)"), args[iJackClientId], args[iJackClientName])
self.DBusClientAppearedCallback.emit(args[iJackClientId], args[iJackClientName])
elif kwds['member'] == "ClientDisappeared": elif kwds['member'] == "ClientDisappeared":
self.emit(SIGNAL("DBusClientDisappearedCallback(int)"), args[iJackClientId])
self.DBusClientDisappearedCallback.emit(args[iJackClientId])
elif kwds['member'] == "ClientRenamed": elif kwds['member'] == "ClientRenamed":
self.emit(SIGNAL("DBusClientRenamedCallback(int, QString)"), args[iRenamedId], args[iRenamedNewName])
self.DBusClientRenamedCallback.emit(args[iRenamedId], args[iRenamedNewName])
elif kwds['member'] == "PortAppeared": elif kwds['member'] == "PortAppeared":
self.emit(SIGNAL("DBusPortAppearedCallback(int, int, QString, int, int)"), args[iJackClientId], args[iJackPortId], args[iJackPortName], args[iJackPortFlags], args[iJackPortType])
self.DBusPortAppearedCallback.emit(args[iJackClientId], args[iJackPortId], args[iJackPortName], args[iJackPortFlags], args[iJackPortType])
elif kwds['member'] == "PortDisappeared": elif kwds['member'] == "PortDisappeared":
self.emit(SIGNAL("DBusPortDisppearedCallback(int)"), args[iJackPortId])
self.DBusPortDisppearedCallback.emit(args[iJackPortId])
elif kwds['member'] == "PortRenamed": elif kwds['member'] == "PortRenamed":
self.emit(SIGNAL("DBusPortRenamedCallback(int, QString)"), args[iJackPortId], args[iJackPortNewName])
self.DBusPortRenamedCallback.emit(args[iJackPortId], args[iJackPortNewName])
elif kwds['member'] == "PortsConnected": elif kwds['member'] == "PortsConnected":
self.emit(SIGNAL("DBusPortsConnectedCallback(int, int, int)"), args[iJackConnId], args[iSourcePortId], args[iTargetPortId])
self.DBusPortsConnectedCallback.emit(args[iJackConnId], args[iSourcePortId], args[iTargetPortId])
elif kwds['member'] == "PortsDisconnected": elif kwds['member'] == "PortsDisconnected":
self.emit(SIGNAL("DBusPortsDisconnectedCallback(int)"), args[iJackConnId])
self.DBusPortsDisconnectedCallback.emit(args[iJackConnId])


elif kwds['interface'] == "org.ladish.Control": elif kwds['interface'] == "org.ladish.Control":
if DEBUG: print("DBus signal @org.ladish.Control,", kwds['member']) if DEBUG: print("DBus signal @org.ladish.Control,", kwds['member'])
if kwds['member'] == "StudioAppeared": if kwds['member'] == "StudioAppeared":
self.emit(SIGNAL("DBusStudioAppearedCallback()"))
self.DBusStudioAppearedCallback.emit()
elif kwds['member'] == "StudioDisappeared": elif kwds['member'] == "StudioDisappeared":
self.emit(SIGNAL("DBusStudioDisappearedCallback()"))
self.DBusStudioDisappearedCallback.emit()
elif kwds['member'] == "QueueExecutionHalted": elif kwds['member'] == "QueueExecutionHalted":
self.emit(SIGNAL("DBusQueueExecutionHaltedCallback()"))
self.DBusQueueExecutionHaltedCallback.emit()
elif kwds['member'] == "CleanExit": elif kwds['member'] == "CleanExit":
self.emit(SIGNAL("DBusCleanExitCallback()"))
self.DBusCleanExitCallback.emit()


elif kwds['interface'] == "org.ladish.Studio": elif kwds['interface'] == "org.ladish.Studio":
if DEBUG: print("DBus signal @org.ladish.Studio,", kwds['member']) if DEBUG: print("DBus signal @org.ladish.Studio,", kwds['member'])
if kwds['member'] == "StudioStarted": if kwds['member'] == "StudioStarted":
self.emit(SIGNAL("DBusStudioStartedCallback()"))
self.DBusStudioStartedCallback.emit()
elif kwds['member'] == "StudioStopped": elif kwds['member'] == "StudioStopped":
self.emit(SIGNAL("DBusStudioStoppedCallback()"))
self.DBusStudioStoppedCallback.emit()
elif kwds['member'] == "StudioRenamed": elif kwds['member'] == "StudioRenamed":
self.emit(SIGNAL("DBusStudioRenamedCallback(QString)"), args[iStudioRenamedName])
self.DBusStudioRenamedCallback.emit(args[iStudioRenamedName])
elif kwds['member'] == "StudioCrashed": elif kwds['member'] == "StudioCrashed":
self.emit(SIGNAL("DBusStudioCrashedCallback()"))
self.DBusStudioCrashedCallback.emit()
elif kwds['member'] == "RoomAppeared": elif kwds['member'] == "RoomAppeared":
self.emit(SIGNAL("DBusRoomAppearedCallback(QString, QString)"), args[iRoomAppearedPath], args[iRoomAppearedDict]['name'])
self.DBusRoomAppearedCallback.emit(args[iRoomAppearedPath], args[iRoomAppearedDict]['name'])
elif kwds['member'] == "RoomDisappeared": elif kwds['member'] == "RoomDisappeared":
self.emit(SIGNAL("DBusRoomDisappearedCallback(QString)"), args[iRoomAppearedPath])
self.DBusRoomDisappearedCallback.emit(args[iRoomAppearedPath])
#elif kwds['member'] == "RoomChanged": #elif kwds['member'] == "RoomChanged":
#self.emit(SIGNAL("DBusRoomChangedCallback()"))
#self.DBusRoomChangedCallback.emit()


elif kwds['interface'] == "org.ladish.Room": elif kwds['interface'] == "org.ladish.Room":
if DEBUG: print("DBus signal @org.ladish.Room,", kwds['member']) if DEBUG: print("DBus signal @org.ladish.Room,", kwds['member'])
if kwds['member'] == "ProjectPropertiesChanged": if kwds['member'] == "ProjectPropertiesChanged":
if "name" in args[iProjChangedDict].keys(): if "name" in args[iProjChangedDict].keys():
self.emit(SIGNAL("DBusProjectPropertiesChanged(QString, QString)"), kwds['path'], args[iProjChangedDict]['name'])
self.DBusProjectPropertiesChanged.emit(kwds['path'], args[iProjChangedDict]['name'])
else: else:
self.emit(SIGNAL("DBusProjectPropertiesChanged(QString, QString)"), kwds['path'], "")
self.DBusProjectPropertiesChanged.emit(kwds['path'], "")


elif kwds['interface'] == "org.ladish.AppSupervisor": elif kwds['interface'] == "org.ladish.AppSupervisor":
if DEBUG: print("DBus signal @org.ladish.AppSupervisor,", kwds['member']) if DEBUG: print("DBus signal @org.ladish.AppSupervisor,", kwds['member'])
if kwds['member'] == "AppAdded2": if kwds['member'] == "AppAdded2":
self.emit(SIGNAL("DBusAppAdded2Callback(QString, int, QString, bool, bool, QString)"), kwds['path'], args[iAppChangedNumber], args[iAppChangedName], args[iAppChangedActive], args[iAppChangedTerminal], args[iAppChangedLevel])
self.DBusAppAdded2Callback.emit(kwds['path'], args[iAppChangedNumber], args[iAppChangedName], args[iAppChangedActive], args[iAppChangedTerminal], args[iAppChangedLevel])
elif kwds['member'] == "AppRemoved": elif kwds['member'] == "AppRemoved":
self.emit(SIGNAL("DBusAppRemovedCallback(QString, int)"), kwds['path'], args[iAppChangedNumber])
self.DBusAppRemovedCallback.emit(kwds['path'], args[iAppChangedNumber])
elif kwds['member'] == "AppStateChanged2": elif kwds['member'] == "AppStateChanged2":
self.emit(SIGNAL("DBusAppStateChanged2Callback(QString, int, QString, bool, bool, QString)"), kwds['path'], args[iAppChangedNumber], args[iAppChangedName], args[iAppChangedActive], args[iAppChangedTerminal], args[iAppChangedLevel])
self.DBusAppStateChanged2Callback.emit(kwds['path'], args[iAppChangedNumber], args[iAppChangedName], args[iAppChangedActive], args[iAppChangedTerminal], args[iAppChangedLevel])


elif kwds['interface'] == "org.gna.home.a2jmidid.control": elif kwds['interface'] == "org.gna.home.a2jmidid.control":
if kwds['member'] == "bridge_started": if kwds['member'] == "bridge_started":
@@ -1618,17 +1650,17 @@ class ClaudiaMainW(AbstractCanvasJackClass):


def JackBufferSizeCallback(self, buffer_size, arg): def JackBufferSizeCallback(self, buffer_size, arg):
if DEBUG: print("JackBufferSizeCallback(%i)" % buffer_size) if DEBUG: print("JackBufferSizeCallback(%i)" % buffer_size)
self.emit(SIGNAL("JackBufferSizeCallback(int)"), buffer_size)
self.BufferSizeCallback.emit(buffer_size)
return 0 return 0


def JackSampleRateCallback(self, sample_rate, arg): def JackSampleRateCallback(self, sample_rate, arg):
if DEBUG: print("JackSampleRateCallback(%i)" % sample_rate) if DEBUG: print("JackSampleRateCallback(%i)" % sample_rate)
self.emit(SIGNAL("JackSampleRateCallback(int)"), sample_rate)
self.SampleRateCallback.emit(sample_rate)
return 0 return 0


def JackShutdownCallback(self, arg): def JackShutdownCallback(self, arg):
if DEBUG: print("JackShutdownCallback()")
self.emit(SIGNAL("JackShutdownCallback()"))
if DEBUG: print("JackShutdownCallback")
self.ShutdownCallback.emit()
return 0 return 0


@pyqtSlot() @pyqtSlot()
@@ -1645,7 +1677,7 @@ class ClaudiaMainW(AbstractCanvasJackClass):


@pyqtSlot() @pyqtSlot()
def slot_studio_load_m(self): def slot_studio_load_m(self):
studio_name = self.sender().text()
studio_name = self.sender().property("data")
if studio_name: if studio_name:
gDBus.ladish_control.LoadStudio(studio_name) gDBus.ladish_control.LoadStudio(studio_name)


@@ -1679,7 +1711,7 @@ class ClaudiaMainW(AbstractCanvasJackClass):


@pyqtSlot() @pyqtSlot()
def slot_studio_delete_m(self): def slot_studio_delete_m(self):
studio_name = self.sender().text()
studio_name = self.sender().property("data")
if studio_name: if studio_name:
gDBus.ladish_control.DeleteStudio(studio_name) gDBus.ladish_control.DeleteStudio(studio_name)


@@ -1691,7 +1723,7 @@ class ClaudiaMainW(AbstractCanvasJackClass):


@pyqtSlot() @pyqtSlot()
def slot_room_delete_m(self): def slot_room_delete_m(self):
room_name = self.sender().text()
room_name = self.sender().property("data")
if room_name: if room_name:
gDBus.ladish_studio.DeleteRoom(room_name) gDBus.ladish_studio.DeleteRoom(room_name)


@@ -1716,7 +1748,7 @@ class ClaudiaMainW(AbstractCanvasJackClass):


@pyqtSlot() @pyqtSlot()
def slot_project_load_m(self): def slot_project_load_m(self):
act_x_text = self.sender().text()
act_x_text = self.sender().property("data")
if act_x_text: if act_x_text:
proj_path = "/" + act_x_text.rsplit("[/", 1)[-1].rsplit("]", 1)[0] proj_path = "/" + act_x_text.rsplit("[/", 1)[-1].rsplit("]", 1)[0]
gDBus.ladish_room.LoadProject(proj_path) gDBus.ladish_room.LoadProject(proj_path)
@@ -1892,8 +1924,9 @@ class ClaudiaMainW(AbstractCanvasJackClass):
for studio in studio_list: for studio in studio_list:
studio_name = str(studio[iStudioListName]) studio_name = str(studio[iStudioListName])
act_x_studio = QAction(studio_name, self.ui.menu_studio_load) act_x_studio = QAction(studio_name, self.ui.menu_studio_load)
act_x_studio.setProperty("data", studio_name);
self.ui.menu_studio_load.addAction(act_x_studio) self.ui.menu_studio_load.addAction(act_x_studio)
self.connect(act_x_studio, SIGNAL("triggered()"), SLOT("slot_studio_load_m()"))
act_x_studio.triggered.connect(self.slot_studio_load_m)


@pyqtSlot() @pyqtSlot()
def slot_updateMenuStudioList_Delete(self): def slot_updateMenuStudioList_Delete(self):
@@ -1908,8 +1941,9 @@ class ClaudiaMainW(AbstractCanvasJackClass):
for studio in studio_list: for studio in studio_list:
studio_name = str(studio[iStudioListName]) studio_name = str(studio[iStudioListName])
act_x_studio = QAction(studio_name, self.ui.menu_studio_delete) act_x_studio = QAction(studio_name, self.ui.menu_studio_delete)
act_x_studio.setProperty("data", studio_name);
self.ui.menu_studio_delete.addAction(act_x_studio) self.ui.menu_studio_delete.addAction(act_x_studio)
self.connect(act_x_studio, SIGNAL("triggered()"), SLOT("slot_studio_delete_m()"))
act_x_studio.triggered.connect(self.slot_studio_delete_m)


@pyqtSlot() @pyqtSlot()
def slot_updateMenuRoomList(self): def slot_updateMenuRoomList(self):
@@ -1923,8 +1957,9 @@ class ClaudiaMainW(AbstractCanvasJackClass):
ladish_room = gDBus.bus.get_object("org.ladish", room_path) ladish_room = gDBus.bus.get_object("org.ladish", room_path)
room_name = ladish_room.GetName() room_name = ladish_room.GetName()
act_x_room = QAction(room_name, self.ui.menu_room_delete) act_x_room = QAction(room_name, self.ui.menu_room_delete)
act_x_room.setProperty("data", room_name);
self.ui.menu_room_delete.addAction(act_x_room) self.ui.menu_room_delete.addAction(act_x_room)
self.connect(act_x_room, SIGNAL("triggered()"), SLOT("slot_room_delete_m()"))
act_x_room.triggered.connect(self.slot_room_delete_m)
else: else:
self.createEmptyMenuRoomActon() self.createEmptyMenuRoomActon()


@@ -1938,7 +1973,7 @@ class ClaudiaMainW(AbstractCanvasJackClass):
self.ui.menu_project_load.clear() self.ui.menu_project_load.clear()
act_project_load = QAction(self.tr("Load from folder..."), self.ui.menu_project_load) act_project_load = QAction(self.tr("Load from folder..."), self.ui.menu_project_load)
self.ui.menu_project_load.addAction(act_project_load) self.ui.menu_project_load.addAction(act_project_load)
self.connect(act_project_load, SIGNAL("triggered()"), SLOT("slot_project_load()"))
act_project_load.triggered.connect(self.slot_project_load)


ladish_recent_iface = dbus.Interface(gDBus.ladish_room, "org.ladish.RecentItems") ladish_recent_iface = dbus.Interface(gDBus.ladish_room, "org.ladish.RecentItems")
proj_list = ladish_recent_iface.get(RECENT_PROJECTS_STORE_MAX_ITEMS) proj_list = ladish_recent_iface.get(RECENT_PROJECTS_STORE_MAX_ITEMS)
@@ -1953,8 +1988,9 @@ class ClaudiaMainW(AbstractCanvasJackClass):


act_x_text = "%s [%s]" % (proj_name, proj_path) act_x_text = "%s [%s]" % (proj_name, proj_path)
act_x_proj = QAction(act_x_text, self.ui.menu_project_load) act_x_proj = QAction(act_x_text, self.ui.menu_project_load)
act_x_proj.setProperty("data", act_x_text);
self.ui.menu_project_load.addAction(act_x_proj) self.ui.menu_project_load.addAction(act_x_proj)
self.connect(act_x_proj, SIGNAL("triggered()"), SLOT("slot_project_load_m()"))
act_x_proj.triggered.connect(self.slot_project_load_m)


@pyqtSlot() @pyqtSlot()
def slot_showAppListCustomMenu(self): def slot_showAppListCustomMenu(self):
@@ -2193,11 +2229,11 @@ class ClaudiaMainW(AbstractCanvasJackClass):
if appInterface == "org.jackaudio.service": if appInterface == "org.jackaudio.service":
if not (self.m_crashedJACK or self.m_crashedLADISH): if not (self.m_crashedJACK or self.m_crashedLADISH):
self.m_crashedJACK = True self.m_crashedJACK = True
QTimer.singleShot(1000, self, SLOT("slot_handleCrash_jack()"))
QTimer.singleShot(1000, self.slot_handleCrash_jack)
elif appInterface == "org.ladish": elif appInterface == "org.ladish":
if not (self.m_crashedJACK or self.m_crashedLADISH): if not (self.m_crashedJACK or self.m_crashedLADISH):
self.m_crashedLADISH = True self.m_crashedLADISH = True
QTimer.singleShot(1000, self, SLOT("slot_handleCrash_ladish()"))
QTimer.singleShot(1000, self.slot_handleCrash_ladish)


@pyqtSlot() @pyqtSlot()
def slot_DBusServerStartedCallback(self): def slot_DBusServerStartedCallback(self):
@@ -2310,7 +2346,7 @@ class ClaudiaMainW(AbstractCanvasJackClass):


@pyqtSlot() @pyqtSlot()
def slot_DBusStudioCrashedCallback(self): def slot_DBusStudioCrashedCallback(self):
QTimer.singleShot(0, self, SLOT("slot_handleCrash_studio()"))
QTimer.singleShot(0, self.slot_handleCrash_studio)


@pyqtSlot(str, str) @pyqtSlot(str, str)
def slot_DBusRoomAppearedCallback(self, room_path, room_name): def slot_DBusRoomAppearedCallback(self, room_path, room_name):
@@ -2619,7 +2655,7 @@ class ClaudiaMainW(AbstractCanvasJackClass):
QMessageBox.about(self, self.tr("About Claudia"), self.tr("<h3>Claudia</h3>" QMessageBox.about(self, self.tr("About Claudia"), self.tr("<h3>Claudia</h3>"
"<br>Version %s" "<br>Version %s"
"<br>Claudia is a Graphical User Interface to LADISH.<br>" "<br>Claudia is a Graphical User Interface to LADISH.<br>"
"<br>Copyright (C) 2010-2013 falkTX" % VERSION))
"<br>Copyright (C) 2010-2018 falkTX" % VERSION))


def saveSettings(self): def saveSettings(self):
settings = QSettings() settings = QSettings()
@@ -2636,7 +2672,7 @@ class ClaudiaMainW(AbstractCanvasJackClass):
settings = QSettings() settings = QSettings()


if geometry: if geometry:
self.restoreGeometry(settings.value("Geometry", ""))
self.restoreGeometry(settings.value("Geometry", b""))


splitterSizes = settings.value("SplitterSizes", "") splitterSizes = settings.value("SplitterSizes", "")
if splitterSizes: if splitterSizes:
@@ -2671,7 +2707,7 @@ class ClaudiaMainW(AbstractCanvasJackClass):
self.ui.act_app_add_new.setEnabled(USE_CLAUDIA_ADD_NEW) self.ui.act_app_add_new.setEnabled(USE_CLAUDIA_ADD_NEW)


def resizeEvent(self, event): def resizeEvent(self, event):
QTimer.singleShot(0, self, SLOT("slot_miniCanvasCheckSize()"))
QTimer.singleShot(0, self.slot_miniCanvasCheckSize)
QMainWindow.resizeEvent(self, event) QMainWindow.resizeEvent(self, event)


def timerEvent(self, event): def timerEvent(self, event):


+ 1
- 1
src/claudia_database.py View File

@@ -38,7 +38,7 @@ list_DAW = [


[ "muse", "MusE", "DAW", "muse", "muse", TEMPLATE_YES, LEVEL_0, (1, 1, 0, 1, "Native", 1, 1, "ALSA + JACK"), ("file:///usr/share/doc/muse/html/window_ref.html", "http://www.muse-sequencer.org/") ], [ "muse", "MusE", "DAW", "muse", "muse", TEMPLATE_YES, LEVEL_0, (1, 1, 0, 1, "Native", 1, 1, "ALSA + JACK"), ("file:///usr/share/doc/muse/html/window_ref.html", "http://www.muse-sequencer.org/") ],


[ "musescore", "MuseScore", "MIDI Composer", "mscore", "mscore", TEMPLATE_NO, LEVEL_0, (0, 0, 0, 0, "", 0, 1, "ALSA | JACK"), ("file:///usr/share/kxstudio/docs/MuseScore-en.pdf", "http://www.musescore.org/") ],
[ "musescore", "MuseScore", "MIDI Composer", "mscore", "mscore", TEMPLATE_NO, LEVEL_0, (0, 0, 0, 0, "", 1, 1, "ALSA | JACK"), ("file:///usr/share/kxstudio/docs/MuseScore-en.pdf", "http://www.musescore.org/") ],


[ "non-sequencer", "Non-Sequencer", "MIDI Sequencer", "non-sequencer", "non-sequencer", TEMPLATE_YES, LEVEL_NSM, (0, 0, 0, 0, "", 1, 1, "JACK"), ("file:///usr/share/doc/non-sequencer/MANUAL.html", "http://non.tuxfamily.org/wiki/Non%20Sequencer") ], [ "non-sequencer", "Non-Sequencer", "MIDI Sequencer", "non-sequencer", "non-sequencer", TEMPLATE_YES, LEVEL_NSM, (0, 0, 0, 0, "", 1, 1, "JACK"), ("file:///usr/share/doc/non-sequencer/MANUAL.html", "http://non.tuxfamily.org/wiki/Non%20Sequencer") ],
[ "non-timeline", "Non-Timeline", "DAW", "non-timeline", "non-timeline", TEMPLATE_YES, LEVEL_NSM, (0, 0, 0, 0, "", 1, 0, "CV + OSC"), ("file:///usr/share/doc/non-timeline/MANUAL.html", "http://non.tuxfamily.org/wiki/Non%20Timeline") ], [ "non-timeline", "Non-Timeline", "DAW", "non-timeline", "non-timeline", TEMPLATE_YES, LEVEL_NSM, (0, 0, 0, 0, "", 1, 0, "CV + OSC"), ("file:///usr/share/doc/non-timeline/MANUAL.html", "http://non.tuxfamily.org/wiki/Non%20Timeline") ],


+ 51
- 40
src/claudia_launcher.py View File

@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-


# ... TODO # ... TODO
# Copyright (C) 2010-2013 Filipe Coelho <falktx@falktx.com>
# Copyright (C) 2010-2018 Filipe Coelho <falktx@falktx.com>
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -19,10 +19,15 @@
# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Imports (Global) # Imports (Global)


from PyQt4.QtCore import pyqtSlot, Qt, QTimer, QSettings
from PyQt4.QtGui import QMainWindow, QTableWidgetItem, QWidget
from random import randint from random import randint


if True:
from PyQt5.QtCore import pyqtSlot, Qt, QTimer, QSettings
from PyQt5.QtWidgets import QMainWindow, QTableWidgetItem, QWidget
else:
from PyQt4.QtCore import pyqtSlot, Qt, QTimer, QSettings
from PyQt4.QtGui import QMainWindow, QTableWidgetItem, QWidget

# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Imports (Custom) # Imports (Custom)


@@ -150,10 +155,11 @@ class ClaudiaLauncher(QWidget, ui_claudia_launcher.Ui_ClaudiaLauncherW):
if not os.path.exists(iconPath): if not os.path.exists(iconPath):
os.mkdir(iconPath) os.mkdir(iconPath)


if os.path.exists(os.path.join(sys.path[0], "..", "icons")):
os.system("cp -r '%s' '%s'" % (os.path.join(sys.path[0], "..", "icons", "claudia-hicolor"), iconPath))
elif os.path.exists(os.path.join(sys.path[0], "..", "data", "icons")):
os.system("cp -r '%s' '%s'" % (os.path.join(sys.path[0], "..", "data", "icons", "claudia-hicolor"), iconPath))
syspath = sys.path[0]
if os.path.exists(os.path.join(syspath, "..", "icons")):
os.system("cp -r '%s' '%s'" % (os.path.join(syspath, "..", "icons", "claudia-hicolor"), iconPath))
elif os.path.exists(os.path.join(syspath, "..", "data", "icons")):
os.system("cp -r '%s' '%s'" % (os.path.join(syspath, "..", "data", "icons", "claudia-hicolor"), iconPath))


os.system("sed -i 's/X-CURRENT-THEME-X/%s/' '%s'" % (self.m_lastThemeName, os.path.join(iconPath, "claudia-hicolor", "index.theme"))) os.system("sed -i 's/X-CURRENT-THEME-X/%s/' '%s'" % (self.m_lastThemeName, os.path.join(iconPath, "claudia-hicolor", "index.theme")))


@@ -170,22 +176,22 @@ class ClaudiaLauncher(QWidget, ui_claudia_launcher.Ui_ClaudiaLauncherW):


self.refreshAll() self.refreshAll()


self.connect(self.tabWidget, SIGNAL("currentChanged(int)"), SLOT("slot_checkSelectedTab(int)"))
self.connect(self.listDAW, SIGNAL("currentCellChanged(int, int, int, int)"), SLOT("slot_checkSelectedDAW(int)"))
self.connect(self.listHost, SIGNAL("currentCellChanged(int, int, int, int)"), SLOT("slot_checkSelectedHost(int)"))
self.connect(self.listInstrument, SIGNAL("currentCellChanged(int, int, int, int)"), SLOT("slot_checkSelectedInstrument(int)"))
self.connect(self.listBristol, SIGNAL("currentCellChanged(int, int, int, int)"), SLOT("slot_checkSelectedBristol(int)"))
self.connect(self.listPlugin, SIGNAL("currentCellChanged(int, int, int, int)"), SLOT("slot_checkSelectedPlugin(int)"))
self.connect(self.listEffect, SIGNAL("currentCellChanged(int, int, int, int)"), SLOT("slot_checkSelectedEffect(int)"))
self.connect(self.listTool, SIGNAL("currentCellChanged(int, int, int, int)"), SLOT("slot_checkSelectedTool(int)"))
self.connect(self.listDAW, SIGNAL("cellDoubleClicked(int, int)"), SLOT("slot_doubleClickedList()"))
self.connect(self.listHost, SIGNAL("cellDoubleClicked(int, int)"), SLOT("slot_doubleClickedList()"))
self.connect(self.listInstrument, SIGNAL("cellDoubleClicked(int, int)"), SLOT("slot_doubleClickedList()"))
self.connect(self.listBristol, SIGNAL("cellDoubleClicked(int, int)"), SLOT("slot_doubleClickedList()"))
self.connect(self.listPlugin, SIGNAL("cellDoubleClicked(int, int)"), SLOT("slot_doubleClickedList()"))
self.connect(self.listEffect, SIGNAL("cellDoubleClicked(int, int)"), SLOT("slot_doubleClickedList()"))
self.connect(self.listTool, SIGNAL("cellDoubleClicked(int, int)"), SLOT("slot_doubleClickedList()"))
self.tabWidget.currentChanged.connect(self.slot_checkSelectedTab)
self.listDAW.currentCellChanged.connect(self.slot_checkSelectedDAW)
self.listHost.currentCellChanged.connect(self.slot_checkSelectedHost)
self.listInstrument.currentCellChanged.connect(self.slot_checkSelectedInstrument)
self.listBristol.currentCellChanged.connect(self.slot_checkSelectedBristol)
self.listPlugin.currentCellChanged.connect(self.slot_checkSelectedPlugin)
self.listEffect.currentCellChanged.connect(self.slot_checkSelectedEffect)
self.listTool.currentCellChanged.connect(self.slot_checkSelectedTool)
self.listDAW.cellDoubleClicked.connect(self.slot_doubleClickedList)
self.listHost.cellDoubleClicked.connect(self.slot_doubleClickedList)
self.listInstrument.cellDoubleClicked.connect(self.slot_doubleClickedList)
self.listBristol.cellDoubleClicked.connect(self.slot_doubleClickedList)
self.listPlugin.cellDoubleClicked.connect(self.slot_doubleClickedList)
self.listEffect.cellDoubleClicked.connect(self.slot_doubleClickedList)
self.listTool.cellDoubleClicked.connect(self.slot_doubleClickedList)


def getSelectedAppAndBinary(self): def getSelectedAppAndBinary(self):
tabIndex = self.tabWidget.currentIndex() tabIndex = self.tabWidget.currentIndex()
@@ -208,7 +214,7 @@ class ClaudiaLauncher(QWidget, ui_claudia_launcher.Ui_ClaudiaLauncherW):


if tabIndex == iTabPlugin: if tabIndex == iTabPlugin:
plugin = self.listPlugin.item(self.listPlugin.currentRow(), 0).data(Qt.UserRole) plugin = self.listPlugin.item(self.listPlugin.currentRow(), 0).data(Qt.UserRole)
return (plugin["name"], "carla-single %s" % plugin["label"])
return (plugin["name"], "carla-single lv2 %s" % plugin["label"])


if tabIndex == iTabEffect: if tabIndex == iTabEffect:
item = self.listEffect.item(self.listEffect.currentRow(), 0).data(Qt.UserRole) item = self.listEffect.item(self.listEffect.currentRow(), 0).data(Qt.UserRole)
@@ -270,14 +276,16 @@ class ClaudiaLauncher(QWidget, ui_claudia_launcher.Ui_ClaudiaLauncherW):
tmplte_cmd = "" tmplte_cmd = ""
tmplte_lvl = "0" tmplte_lvl = "0"


if os.path.exists(os.path.join(sys.path[0], "..", "templates")):
tmplte_dir = os.path.join(sys.path[0], "..", "templates")
elif os.path.exists(os.path.join(sys.path[0], "..", "data", "templates")):
tmplte_dir = os.path.join(sys.path[0], "..", "data", "templates")
syspath = sys.path[0]
if os.path.exists(os.path.join(syspath, "..", "templates")):
tmplte_dir = os.path.join(syspath, "..", "templates")
elif os.path.exists(os.path.join(syspath, "..", "data", "templates")):
tmplte_dir = os.path.join(syspath, "..", "data", "templates")
else: else:
app = None app = None
tmplte_cmd = binary tmplte_cmd = binary
print("ClaudiaLauncher::createAppTemplate() - Failed to find template dir") print("ClaudiaLauncher::createAppTemplate() - Failed to find template dir")
return False


if not os.path.exists(proj_folder): if not os.path.exists(proj_folder):
os.mkdir(proj_folder) os.mkdir(proj_folder)
@@ -299,7 +307,7 @@ class ClaudiaLauncher(QWidget, ui_claudia_launcher.Ui_ClaudiaLauncherW):
tmplte_lvl = "1" tmplte_lvl = "1"


elif binary.startswith("carla-single"): elif binary.startswith("carla-single"):
tmplte_cmd = binary
tmplte_cmd = binary + " " + proj_folder
tmplte_lvl = "1" tmplte_lvl = "1"


elif binary == "ardour": elif binary == "ardour":
@@ -484,6 +492,7 @@ class ClaudiaLauncher(QWidget, ui_claudia_launcher.Ui_ClaudiaLauncherW):


else: else:
print("ClaudiaLauncher::createAppTemplate(%s) - Failed to parse app name" % app) print("ClaudiaLauncher::createAppTemplate(%s) - Failed to parse app name" % app)
return False


if tmplte_file is not None: if tmplte_file is not None:
os.system('sed -i "s|X_SR_X-CLAUDIA-X_SR_X|%s|" "%s"' % (proj_srate, tmplte_file)) os.system('sed -i "s|X_SR_X-CLAUDIA-X_SR_X|%s|" "%s"' % (proj_srate, tmplte_file))
@@ -492,6 +501,7 @@ class ClaudiaLauncher(QWidget, ui_claudia_launcher.Ui_ClaudiaLauncherW):


appBus = self.callback_getAppBus() appBus = self.callback_getAppBus()
appBus.RunCustom2(False, tmplte_cmd, app, tmplte_lvl) appBus.RunCustom2(False, tmplte_cmd, app, tmplte_lvl)
return True


def parentR(self): def parentR(self):
return self._parent return self._parent
@@ -816,7 +826,8 @@ class ClaudiaLauncher(QWidget, ui_claudia_launcher.Ui_ClaudiaLauncherW):
if haveCarla and os.path.exists("/usr/lib/carla/libcarla_utils.so"): if haveCarla and os.path.exists("/usr/lib/carla/libcarla_utils.so"):
utils = CarlaUtils("/usr/lib/carla/libcarla_utils.so") utils = CarlaUtils("/usr/lib/carla/libcarla_utils.so")
last_pos = 0 last_pos = 0
for i in range(utils.get_cached_plugin_count(PLUGIN_LV2, os.getenv("LV2_PATH", "~/.lv2:/usr/lib/lv2:/usr/local/lib/lv2"))):
lv2path = os.getenv("LV2_PATH", "~/.lv2:/usr/lib/lv2:/usr/local/lib/lv2")
for i in range(utils.get_cached_plugin_count(PLUGIN_LV2, lv2path)):
plugin = utils.get_cached_plugin_info(PLUGIN_LV2, i) plugin = utils.get_cached_plugin_info(PLUGIN_LV2, i)


if (plugin["hints"] & PLUGIN_HAS_CUSTOM_UI) == 0: if (plugin["hints"] & PLUGIN_HAS_CUSTOM_UI) == 0:
@@ -1119,7 +1130,7 @@ class ClaudiaLauncher(QWidget, ui_claudia_launcher.Ui_ClaudiaLauncherW):
if __name__ == '__main__': if __name__ == '__main__':
import dbus import dbus
from signal import signal, SIG_IGN, SIGUSR1 from signal import signal, SIG_IGN, SIGUSR1
from PyQt4.QtGui import QApplication
from PyQt5.QtWidgets import QApplication
import jacklib, ui_claudia_launcher_app import jacklib, ui_claudia_launcher_app


# DBus connections # DBus connections
@@ -1149,7 +1160,7 @@ if __name__ == '__main__':
# Check for JACK # Check for JACK
self.jack_client = jacklib.client_open("klaudia", jacklib.JackNoStartServer, None) self.jack_client = jacklib.client_open("klaudia", jacklib.JackNoStartServer, None)
if not self.jack_client: if not self.jack_client:
QTimer.singleShot(0, self, SLOT("slot_showJackError()"))
QTimer.singleShot(0, self.slot_showJackError)
return return


# Set-up GUI # Set-up GUI
@@ -1175,15 +1186,15 @@ if __name__ == '__main__':
else: else:
self.slot_enableLADISH(False) self.slot_enableLADISH(False)


self.connect(self.b_start, SIGNAL("clicked()"), SLOT("slot_startApp()"))
self.connect(self.b_add, SIGNAL("clicked()"), SLOT("slot_addAppToLADISH()"))
self.connect(self.b_refresh, SIGNAL("clicked()"), SLOT("slot_refreshStudioList()"))
self.b_start.clicked.connect(self.slot_startApp)
self.b_add.clicked.connect(self.slot_addAppToLADISH)
self.b_refresh.clicked.connect(self.slot_refreshStudioList)


self.connect(self.co_ladi_room, SIGNAL("currentIndexChanged(int)"), SLOT("slot_checkSelectedRoom(int)"))
self.connect(self.groupLADISH, SIGNAL("toggled(bool)"), SLOT("slot_enableLADISH(bool)"))
self.co_ladi_room.currentIndexChanged[int].connect(self.slot_checkSelectedRoom)
self.groupLADISH.toggled.connect(self.slot_enableLADISH)


self.connect(self.le_url, SIGNAL("textChanged(QString)"), SLOT("slot_checkFolderUrl(QString)"))
self.connect(self.b_open, SIGNAL("clicked()"), SLOT("slot_getAndSetPath()"))
self.le_url.textChanged.connect(self.slot_checkFolderUrl)
self.b_open.clicked.connect(self.slot_getAndSetPath)


def getIcon(self, icon): def getIcon(self, icon):
return self.launcher.getIcon(icon) return self.launcher.getIcon(icon)
@@ -1326,7 +1337,7 @@ if __name__ == '__main__':
self.launcher.saveSettings() self.launcher.saveSettings()


def loadSettings(self): def loadSettings(self):
self.restoreGeometry(self.settings.value("Geometry", ""))
self.restoreGeometry(self.settings.value("Geometry", b""))
self.launcher.loadSettings() self.launcher.loadSettings()


def closeEvent(self, event): def closeEvent(self, event):


+ 14
- 6
src/clickablelabel.py View File

@@ -1,8 +1,8 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-


# Clickable Label, a custom Qt4 widget
# Copyright (C) 2011-2013 Filipe Coelho <falktx@falktx.com>
# Clickable Label, a custom Qt widget
# Copyright (C) 2011-2018 Filipe Coelho <falktx@falktx.com>
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -19,23 +19,31 @@
# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Imports (Global) # Imports (Global)


from PyQt4.QtCore import pyqtSlot, Qt, QTimer, SIGNAL, SLOT
from PyQt4.QtGui import QLabel
if True:
from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QTimer
from PyQt5.QtWidgets import QLabel
else:
from PyQt4.QtCore import pyqtSignal, pyqtSlot, Qt, QTimer
from PyQt4.QtGui import QLabel


# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Widget Class # Widget Class


class ClickableLabel(QLabel): class ClickableLabel(QLabel):
clicked = pyqtSignal()

def __init__(self, parent): def __init__(self, parent):
QLabel.__init__(self, parent) QLabel.__init__(self, parent)


self.setCursor(Qt.PointingHandCursor) self.setCursor(Qt.PointingHandCursor)


def mousePressEvent(self, event): def mousePressEvent(self, event):
self.emit(SIGNAL("clicked()"))
self.clicked.emit()

# Use busy cursor for 2 secs # Use busy cursor for 2 secs
self.setCursor(Qt.WaitCursor) self.setCursor(Qt.WaitCursor)
QTimer.singleShot(2000, self, SLOT("slot_setNormalCursor()"))
QTimer.singleShot(2000, self.slot_setNormalCursor)

QLabel.mousePressEvent(self, event) QLabel.mousePressEvent(self, event)


@pyqtSlot() @pyqtSlot()


+ 50
- 34
src/jacksettings.py View File

@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-


# JACK Settings Dialog # JACK Settings Dialog
# Copyright (C) 2010-2013 Filipe Coelho <falktx@falktx.com>
# Copyright (C) 2010-2018 Filipe Coelho <falktx@falktx.com>
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -19,10 +19,17 @@
# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Imports (Global) # Imports (Global)


from PyQt4.QtCore import pyqtSlot, Qt, QSettings, QTimer, SIGNAL, SLOT
from PyQt4.QtGui import QDialog, QDialogButtonBox, QFontMetrics, QMessageBox
from sys import platform, version_info from sys import platform, version_info


if True:
from PyQt5.QtCore import pyqtSlot, Qt, QSettings, QTimer
from PyQt5.QtGui import QFontMetrics
from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QMessageBox
else:
from PyQt4.QtCore import pyqtSlot, Qt, QSettings, QTimer
from PyQt4.QtGui import QFontMetrics
from PyQt4.QtGui import QDialog, QDialogButtonBox, QMessageBox

# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Imports (Custom Stuff) # Imports (Custom Stuff)


@@ -196,13 +203,15 @@ class JackSettingsW(QDialog):
# Align driver text and hide non available ones # Align driver text and hide non available ones


driverList = gJackctl.ReadContainer(["drivers"])[1] driverList = gJackctl.ReadContainer(["drivers"])[1]
fontMetris = QFontMetrics(self.ui.obj_server_driver.font())
maxWidth = 75 maxWidth = 75


for i in range(self.ui.obj_server_driver.rowCount()): for i in range(self.ui.obj_server_driver.rowCount()):
self.ui.obj_server_driver.item(0, i).setTextAlignment(Qt.AlignCenter)
item = self.ui.obj_server_driver.item(i, 0)
item.setTextAlignment(Qt.AlignCenter)


itexText = self.ui.obj_server_driver.item(0, i).text()
itemWidth = QFontMetrics(self.ui.obj_server_driver.font()).width(itexText)+25
itexText = item.text()
itemWidth = fontMetris.width(itexText)+25


if itemWidth > maxWidth: if itemWidth > maxWidth:
maxWidth = itemWidth maxWidth = itemWidth
@@ -216,14 +225,14 @@ class JackSettingsW(QDialog):
# ------------------------------------------------------------- # -------------------------------------------------------------
# Set-up connections # Set-up connections


self.connect(self, SIGNAL("accepted()"), SLOT("slot_saveJackSettings()"))
self.connect(self.ui.buttonBox.button(QDialogButtonBox.Reset), SIGNAL("clicked()"), SLOT("slot_resetJackSettings()"))
self.accepted.connect(self.slot_saveJackSettings)
self.ui.buttonBox.button(QDialogButtonBox.Reset).clicked.connect(self.slot_resetJackSettings)


self.connect(self.ui.obj_driver_duplex, SIGNAL("clicked(bool)"), SLOT("slot_checkDuplexSelection(bool)"))
self.connect(self.ui.obj_server_driver, SIGNAL("currentCellChanged(int, int, int, int)"), SLOT("slot_checkDriverSelection(int)"))
self.ui.obj_driver_duplex.clicked.connect(self.slot_checkDuplexSelection)
self.ui.obj_server_driver.currentCellChanged.connect(self.slot_checkDriverSelection)


self.connect(self.ui.obj_driver_capture, SIGNAL("currentIndexChanged(int)"), SLOT("slot_checkALSASelection()"))
self.connect(self.ui.obj_driver_playback, SIGNAL("currentIndexChanged(int)"), SLOT("slot_checkALSASelection()"))
self.ui.obj_driver_capture.currentIndexChanged[int].connect(self.slot_checkALSASelection)
self.ui.obj_driver_playback.currentIndexChanged[int].connect(self.slot_checkALSASelection)


# ------------------------------------------------------------- # -------------------------------------------------------------
# Load initial settings # Load initial settings
@@ -395,28 +404,30 @@ class JackSettingsW(QDialog):
elif attribute == "alias": elif attribute == "alias":
self.ui.obj_server_alias.setChecked(bool(value)) self.ui.obj_server_alias.setChecked(bool(value))
elif attribute == "client-timeout": elif attribute == "client-timeout":
self.setComboBoxValue(self.ui.obj_server_client_timeout, str(value))
self.setComboBoxValue(self.ui.obj_server_client_timeout, str(int(value)))
elif attribute == "clock-source": elif attribute == "clock-source":
value = str(value)
if value == "c":
self.ui.obj_server_clock_source_cycle.setChecked(True)
elif value == "h":
self.ui.obj_server_clock_source_hpet.setChecked(True)
elif value == "s":
self.ui.obj_server_clock_source_system.setChecked(True)
if len(str(value)) == 1 :
value = str(value)
if value == "c":
self.ui.obj_server_clock_source_cycle.setChecked(True)
elif value == "h":
self.ui.obj_server_clock_source_hpet.setChecked(True)
elif value == "s":
self.ui.obj_server_clock_source_system.setChecked(True)
else: else:
value = int(value)
self.fBrokenServerClockSource = True self.fBrokenServerClockSource = True
if value == str(JACK_TIMER_SYSTEM_CLOCK):
if value == JACK_TIMER_SYSTEM_CLOCK:
self.ui.obj_server_clock_source_system.setChecked(True) self.ui.obj_server_clock_source_system.setChecked(True)
elif value == str(JACK_TIMER_CYCLE_COUNTER):
elif value == JACK_TIMER_CYCLE_COUNTER:
self.ui.obj_server_clock_source_cycle.setChecked(True) self.ui.obj_server_clock_source_cycle.setChecked(True)
elif value == str(JACK_TIMER_HPET):
elif value == JACK_TIMER_HPET:
self.ui.obj_server_clock_source_hpet.setChecked(True) self.ui.obj_server_clock_source_hpet.setChecked(True)
else: else:
self.ui.obj_server_clock_source.setEnabled(False) self.ui.obj_server_clock_source.setEnabled(False)
print("JackSettingsW::saveServerSettings() - Invalid clock-source value '%s'" % value) print("JackSettingsW::saveServerSettings() - Invalid clock-source value '%s'" % value)
elif attribute == "port-max": elif attribute == "port-max":
self.setComboBoxValue(self.ui.obj_server_port_max, str(value))
self.setComboBoxValue(self.ui.obj_server_port_max, str(int(value)))
elif attribute == "replace-registry": elif attribute == "replace-registry":
self.ui.obj_server_replace_registry.setChecked(bool(value)) self.ui.obj_server_replace_registry.setChecked(bool(value))
elif attribute == "sync": elif attribute == "sync":
@@ -618,17 +629,21 @@ class JackSettingsW(QDialog):
elif attribute == "capture": elif attribute == "capture":
if self.fDriverName == "firewire": if self.fDriverName == "firewire":
self.ui.obj_driver_capture.setCurrentIndex(1 if bool(value) else 0) self.ui.obj_driver_capture.setCurrentIndex(1 if bool(value) else 0)
elif self.fDriverName == "dummy":
self.setComboBoxValue(self.ui.obj_driver_capture, str(int(value)), True)
else: else:
self.setComboBoxValue(self.ui.obj_driver_capture, str(value), True) self.setComboBoxValue(self.ui.obj_driver_capture, str(value), True)
elif attribute == "playback": elif attribute == "playback":
if self.fDriverName == "firewire": if self.fDriverName == "firewire":
self.ui.obj_driver_playback.setCurrentIndex(1 if bool(value) else 0) self.ui.obj_driver_playback.setCurrentIndex(1 if bool(value) else 0)
elif self.fDriverName == "dummy":
self.setComboBoxValue(self.ui.obj_driver_playback, str(int(value)), True)
else: else:
self.setComboBoxValue(self.ui.obj_driver_playback, str(value), True) self.setComboBoxValue(self.ui.obj_driver_playback, str(value), True)
elif attribute == "rate": elif attribute == "rate":
self.setComboBoxValue(self.ui.obj_driver_rate, str(value))
self.setComboBoxValue(self.ui.obj_driver_rate, str(int(value)))
elif attribute == "period": elif attribute == "period":
self.setComboBoxValue(self.ui.obj_driver_period, str(value))
self.setComboBoxValue(self.ui.obj_driver_period, str(int(value)))
elif attribute == "nperiods": elif attribute == "nperiods":
self.ui.obj_driver_nperiods.setValue(int(value)) self.ui.obj_driver_nperiods.setValue(int(value))
elif attribute == "hwmon": elif attribute == "hwmon":
@@ -725,8 +740,8 @@ class JackSettingsW(QDialog):
# ----------------------------------------------------------------- # -----------------------------------------------------------------
# Qt SLOT calls # Qt SLOT calls


@pyqtSlot()
def slot_checkALSASelection(self):
@pyqtSlot(int)
def slot_checkALSASelection(self, ignored=0):
if self.fDriverName == "alsa": if self.fDriverName == "alsa":
check = bool(self.ui.obj_driver_duplex.isChecked() and (self.ui.obj_driver_capture.currentIndex() > 0 or self.ui.obj_driver_playback.currentIndex() > 0)) check = bool(self.ui.obj_driver_duplex.isChecked() and (self.ui.obj_driver_capture.currentIndex() > 0 or self.ui.obj_driver_playback.currentIndex() > 0))
self.ui.obj_driver_device.setEnabled(not check) self.ui.obj_driver_device.setEnabled(not check)
@@ -845,22 +860,22 @@ class JackSettingsW(QDialog):
self.ui.obj_driver_channels_label.setEnabled(driverHasFeature("channels")) self.ui.obj_driver_channels_label.setEnabled(driverHasFeature("channels"))


# Misc stuff # Misc stuff
if self.ui.obj_server_driver.item(0, row).text() == "ALSA":
if self.ui.obj_server_driver.item(row, 0).text() == "ALSA":
self.ui.toolbox_driver_misc.setCurrentIndex(1) self.ui.toolbox_driver_misc.setCurrentIndex(1)
self.ui.obj_driver_capture_label.setText(self.tr("Input Device:")) self.ui.obj_driver_capture_label.setText(self.tr("Input Device:"))
self.ui.obj_driver_playback_label.setText(self.tr("Output Device:")) self.ui.obj_driver_playback_label.setText(self.tr("Output Device:"))


elif self.ui.obj_server_driver.item(0, row).text() == "Dummy":
elif self.ui.obj_server_driver.item(row, 0).text() == "Dummy":
self.ui.toolbox_driver_misc.setCurrentIndex(2) self.ui.toolbox_driver_misc.setCurrentIndex(2)
self.ui.obj_driver_capture_label.setText(self.tr("Input Ports:")) self.ui.obj_driver_capture_label.setText(self.tr("Input Ports:"))
self.ui.obj_driver_playback_label.setText(self.tr("Output Ports:")) self.ui.obj_driver_playback_label.setText(self.tr("Output Ports:"))


elif self.ui.obj_server_driver.item(0, row).text() == "FireWire":
elif self.ui.obj_server_driver.item(row, 0).text() == "FireWire":
self.ui.toolbox_driver_misc.setCurrentIndex(3) self.ui.toolbox_driver_misc.setCurrentIndex(3)
self.ui.obj_driver_capture_label.setText(self.tr("Capture Ports:")) self.ui.obj_driver_capture_label.setText(self.tr("Capture Ports:"))
self.ui.obj_driver_playback_label.setText(self.tr("Playback Ports:")) self.ui.obj_driver_playback_label.setText(self.tr("Playback Ports:"))


elif self.ui.obj_server_driver.item(0, row).text() == "Loopback":
elif self.ui.obj_server_driver.item(row, 0).text() == "Loopback":
self.ui.toolbox_driver_misc.setCurrentIndex(4) self.ui.toolbox_driver_misc.setCurrentIndex(4)


else: else:
@@ -892,7 +907,7 @@ class JackSettingsW(QDialog):


def loadSettings(self): def loadSettings(self):
settings = QSettings("Cadence", "JackSettings") settings = QSettings("Cadence", "JackSettings")
self.restoreGeometry(settings.value("Geometry", ""))
self.restoreGeometry(settings.value("Geometry", b""))
self.ui.tabWidget.setCurrentIndex(settings.value("CurrentTab", 0, type=int)) self.ui.tabWidget.setCurrentIndex(settings.value("CurrentTab", 0, type=int))


def closeEvent(self, event): def closeEvent(self, event):
@@ -910,7 +925,8 @@ if __name__ == '__main__':
# Additional imports # Additional imports
import resources_rc import resources_rc
from sys import argv as sys_argv, exit as sys_exit from sys import argv as sys_argv, exit as sys_exit
from PyQt4.QtGui import QApplication, QIcon
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QApplication


# App initialization # App initialization
app = QApplication(sys_argv) app = QApplication(sys_argv)


+ 20
- 8
src/logs.py View File

@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-


# JACK, A2J, LASH and LADISH Logs Viewer # JACK, A2J, LASH and LADISH Logs Viewer
# Copyright (C) 2011-2013 Filipe Coelho <falktx@falktx.com>
# Copyright (C) 2011-2018 Filipe Coelho <falktx@falktx.com>
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -19,8 +19,14 @@
# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Imports (Global) # Imports (Global)


from PyQt4.QtCore import pyqtSlot, Qt, QFile, QIODevice, QMutex, QMutexLocker, QTextStream, QThread, QSettings
from PyQt4.QtGui import QDialog, QPalette, QSyntaxHighlighter
if True:
from PyQt5.QtCore import pyqtSlot, Qt, QFile, QIODevice, QMutex, QMutexLocker, QTextStream, QThread, QSettings
from PyQt5.QtGui import QPalette, QSyntaxHighlighter
from PyQt5.QtWidgets import QDialog
else:
from PyQt4.QtCore import pyqtSlot, Qt, QFile, QIODevice, QMutex, QMutexLocker, QTextStream, QThread, QSettings
from PyQt4.QtGui import QPalette, QSyntaxHighlighter
from PyQt4.QtGui import QDialog


# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Imports (Custom Stuff) # Imports (Custom Stuff)
@@ -118,6 +124,8 @@ class SyntaxHighlighter_LADISH(QSyntaxHighlighter):
class LogsReadThread(QThread): class LogsReadThread(QThread):
MAX_INITIAL_SIZE = 2*1024*1024 # 2Mb MAX_INITIAL_SIZE = 2*1024*1024 # 2Mb


updateLogs = pyqtSignal()

def __init__(self, parent): def __init__(self, parent):
QThread.__init__(self, parent) QThread.__init__(self, parent)


@@ -236,7 +244,7 @@ class LogsReadThread(QThread):
textLADISH = "" textLADISH = ""


self.fRealParent.setLogsText(textJACK, textA2J, textLASH, textLADISH) self.fRealParent.setLogsText(textJACK, textA2J, textLASH, textLADISH)
self.emit(SIGNAL("updateLogs()"))
self.updateLogs.emit()


if not self.fCloseNow: if not self.fCloseNow:
self.sleep(1) self.sleep(1)
@@ -279,6 +287,10 @@ class LogsW(QDialog):
if not os.path.exists(LOG_FILE_LADISH): if not os.path.exists(LOG_FILE_LADISH):
LOG_FILE_LADISH = None LOG_FILE_LADISH = None


SIGTERM = pyqtSignal()
SIGUSR1 = pyqtSignal()
SIGUSR2 = pyqtSignal()

def __init__(self, parent): def __init__(self, parent):
QDialog.__init__(self, parent) QDialog.__init__(self, parent)
self.ui = ui_logs.Ui_LogsW() self.ui = ui_logs.Ui_LogsW()
@@ -349,8 +361,8 @@ class LogsW(QDialog):
# ------------------------------------------------------------- # -------------------------------------------------------------
# Set-up connections # Set-up connections


self.connect(self.ui.b_purge, SIGNAL("clicked()"), SLOT("slot_purgeLogs()"))
self.connect(self.fReadThread, SIGNAL("updateLogs()"), SLOT("slot_updateLogs()"))
self.ui.b_purge.clicked.connect(self.slot_purgeLogs)
self.fReadThread.updateLogs.connect(self.slot_updateLogs)


# ------------------------------------------------------------- # -------------------------------------------------------------


@@ -405,7 +417,7 @@ class LogsW(QDialog):


def loadSettings(self): def loadSettings(self):
settings = QSettings("Cadence", "Cadence-Logs") settings = QSettings("Cadence", "Cadence-Logs")
self.restoreGeometry(settings.value("Geometry", ""))
self.restoreGeometry(settings.value("Geometry", b""))


def saveSettings(self): def saveSettings(self):
settings = QSettings("Cadence", "Cadence-Logs") settings = QSettings("Cadence", "Cadence-Logs")
@@ -431,7 +443,7 @@ class LogsW(QDialog):


if __name__ == '__main__': if __name__ == '__main__':
# Additional imports # Additional imports
from PyQt4.QtGui import QApplication
from PyQt5.QtWidgets import QApplication


# App initialization # App initialization
app = QApplication(sys.argv) app = QApplication(sys.argv)


+ 19
- 9
src/patchcanvas.py View File

@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-


# PatchBay Canvas engine using QGraphicsView/Scene # PatchBay Canvas engine using QGraphicsView/Scene
# Copyright (C) 2010-2013 Filipe Coelho <falktx@falktx.com>
# Copyright (C) 2010-2018 Filipe Coelho <falktx@falktx.com>
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -17,14 +17,24 @@
# For a full copy of the GNU General Public License see the GPL.txt file # For a full copy of the GNU General Public License see the GPL.txt file


# Imports (Global) # Imports (Global)
from PyQt4.QtCore import pyqtSignal, pyqtSlot, qDebug, qCritical, qFatal, qWarning, Qt, QObject
from PyQt4.QtCore import QAbstractAnimation, QLineF, QPointF, QRectF, QSizeF, QSettings, QTimer
from PyQt4.QtGui import QColor, QLinearGradient, QPen, QPolygonF, QPainter, QPainterPath
from PyQt4.QtGui import QCursor, QFont, QFontMetrics
from PyQt4.QtGui import QGraphicsScene, QGraphicsItem, QGraphicsLineItem, QGraphicsPathItem
from PyQt4.QtGui import QGraphicsColorizeEffect, QGraphicsDropShadowEffect
from PyQt4.QtGui import QInputDialog, QLineEdit, QMenu
from PyQt4.QtSvg import QGraphicsSvgItem, QSvgRenderer
if True:
from PyQt5.QtCore import pyqtSignal, pyqtSlot, qDebug, qCritical, qFatal, qWarning, Qt, QObject
from PyQt5.QtCore import QAbstractAnimation, QLineF, QPointF, QRectF, QSizeF, QSettings, QTimer
from PyQt5.QtGui import QColor, QLinearGradient, QPen, QPolygonF, QPainter, QPainterPath
from PyQt5.QtGui import QCursor, QFont, QFontMetrics
from PyQt5.QtWidgets import QGraphicsScene, QGraphicsItem, QGraphicsLineItem, QGraphicsPathItem
from PyQt5.QtWidgets import QGraphicsColorizeEffect, QGraphicsDropShadowEffect
from PyQt5.QtWidgets import QInputDialog, QLineEdit, QMenu
from PyQt5.QtSvg import QGraphicsSvgItem, QSvgRenderer
else:
from PyQt4.QtCore import pyqtSignal, pyqtSlot, qDebug, qCritical, qFatal, qWarning, Qt, QObject
from PyQt4.QtCore import QAbstractAnimation, QLineF, QPointF, QRectF, QSizeF, QSettings, QTimer
from PyQt4.QtGui import QColor, QLinearGradient, QPen, QPolygonF, QPainter, QPainterPath
from PyQt4.QtGui import QCursor, QFont, QFontMetrics
from PyQt4.QtGui import QGraphicsScene, QGraphicsItem, QGraphicsLineItem, QGraphicsPathItem
from PyQt4.QtGui import QGraphicsColorizeEffect, QGraphicsDropShadowEffect
from PyQt4.QtGui import QInputDialog, QLineEdit, QMenu
from PyQt4.QtSvg import QGraphicsSvgItem, QSvgRenderer


# Imports (Theme) # Imports (Theme)
from patchcanvas_theme import * from patchcanvas_theme import *


+ 7
- 3
src/patchcanvas_theme.py View File

@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-


# PatchBay Canvas Themes # PatchBay Canvas Themes
# Copyright (C) 2010-2012 Filipe Coelho <falktx@falktx.com>
# Copyright (C) 2010-2018 Filipe Coelho <falktx@falktx.com>
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -19,8 +19,12 @@
# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Imports (Global) # Imports (Global)


from PyQt4.QtCore import Qt
from PyQt4.QtGui import QColor, QFont, QPen, QPixmap
if True:
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QColor, QFont, QPen, QPixmap
else:
from PyQt4.QtCore import Qt
from PyQt4.QtGui import QColor, QFont, QPen, QPixmap


# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# patchcanvas-theme.cpp # patchcanvas-theme.cpp


+ 19
- 14
src/render.py View File

@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-


# JACK-Capture frontend, with freewheel and transport support # JACK-Capture frontend, with freewheel and transport support
# Copyright (C) 2010-2013 Filipe Coelho <falktx@falktx.com>
# Copyright (C) 2010-2018 Filipe Coelho <falktx@falktx.com>
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -19,10 +19,15 @@
# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Imports (Global) # Imports (Global)


from PyQt4.QtCore import pyqtSlot, QProcess, QTime, QTimer, QSettings
from PyQt4.QtGui import QDialog
from time import sleep from time import sleep


if True:
from PyQt5.QtCore import pyqtSlot, QProcess, QTime, QTimer, QSettings
from PyQt5.QtWidgets import QDialog
else:
from PyQt4.QtCore import pyqtSlot, QProcess, QTime, QTimer, QSettings
from PyQt4.QtGui import QDialog

# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Imports (Custom Stuff) # Imports (Custom Stuff)


@@ -138,15 +143,15 @@ class RenderW(QDialog):
# ------------------------------------------------------------- # -------------------------------------------------------------
# Set-up connections # Set-up connections


self.connect(self.ui.b_render, SIGNAL("clicked()"), SLOT("slot_renderStart()"))
self.connect(self.ui.b_stop, SIGNAL("clicked()"), SLOT("slot_renderStop()"))
self.connect(self.ui.b_open, SIGNAL("clicked()"), SLOT("slot_getAndSetPath()"))
self.connect(self.ui.b_now_start, SIGNAL("clicked()"), SLOT("slot_setStartNow()"))
self.connect(self.ui.b_now_end, SIGNAL("clicked()"), SLOT("slot_setEndNow()"))
self.connect(self.ui.te_start, SIGNAL("timeChanged(const QTime)"), SLOT("slot_updateStartTime(const QTime)"))
self.connect(self.ui.te_end, SIGNAL("timeChanged(const QTime)"), SLOT("slot_updateEndTime(const QTime)"))
self.connect(self.ui.group_time, SIGNAL("clicked(bool)"), SLOT("slot_transportChecked(bool)"))
self.connect(self.fTimer, SIGNAL("timeout()"), SLOT("slot_updateProgressbar()"))
self.ui.b_render.clicked.connect(self.slot_renderStart)
self.ui.b_stop.clicked.connect(self.slot_renderStop)
self.ui.b_open.clicked.connect(self.slot_getAndSetPath)
self.ui.b_now_start.clicked.connect(self.slot_setStartNow)
self.ui.b_now_end.clicked.connect(self.slot_setEndNow)
self.ui.te_start.timeChanged.connect(self.slot_updateStartTime)
self.ui.te_end.timeChanged.connect(self.slot_updateEndTime)
self.ui.group_time.clicked.connect(self.slot_transportChecked)
self.fTimer.timeout.connect(self.slot_updateProgressbar)


# ------------------------------------------------------------- # -------------------------------------------------------------


@@ -375,7 +380,7 @@ class RenderW(QDialog):
def loadSettings(self): def loadSettings(self):
settings = QSettings("Cadence", "Cadence-Render") settings = QSettings("Cadence", "Cadence-Render")


self.restoreGeometry(settings.value("Geometry", ""))
self.restoreGeometry(settings.value("Geometry", b""))


outputFolder = settings.value("OutputFolder", HOME) outputFolder = settings.value("OutputFolder", HOME)


@@ -429,7 +434,7 @@ class RenderW(QDialog):


if __name__ == '__main__': if __name__ == '__main__':
# Additional imports # Additional imports
from PyQt4.QtGui import QApplication
from PyQt5.QtWidgets import QApplication


# App initialization # App initialization
app = QApplication(sys.argv) app = QApplication(sys.argv)


+ 25
- 11
src/shared.py View File

@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-


# Common/Shared code # Common/Shared code
# Copyright (C) 2010-2013 Filipe Coelho <falktx@falktx.com>
# Copyright (C) 2010-2018 Filipe Coelho <falktx@falktx.com>
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -23,14 +23,21 @@ import os
import sys import sys
from codecs import open as codecopen from codecs import open as codecopen
from unicodedata import normalize from unicodedata import normalize
from PyQt4.QtCore import qWarning, SIGNAL, SLOT
from PyQt4.QtGui import QApplication, QFileDialog, QIcon, QMessageBox

if True:
from PyQt5.QtCore import pyqtSignal, qWarning
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QApplication, QFileDialog, QMessageBox
else:
from PyQt4.QtCore import pyqtSignal, qWarning
from PyQt4.QtGui import QIcon
from PyQt4.QtGui import QApplication, QFileDialog, QMessageBox


# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Set Platform # Set Platform


if sys.platform == "darwin": if sys.platform == "darwin":
from PyQt4.QtGui import qt_mac_set_menubar_icons
from PyQt5.QtGui import qt_mac_set_menubar_icons
qt_mac_set_menubar_icons(False) qt_mac_set_menubar_icons(False)
HAIKU = False HAIKU = False
LINUX = False LINUX = False
@@ -67,10 +74,18 @@ try:
except: except:
haveSignal = False haveSignal = False


# ------------------------------------------------------------------------------------------------------------
# Safe exception hook, needed for PyQt5

def sys_excepthook(typ, value, tback):
return sys.__excepthook__(typ, value, tback)

sys.excepthook = sys_excepthook

# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Set Version # Set Version


VERSION = "0.8.1"
VERSION = "0.9.0"


# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Set Debug mode # Set Debug mode
@@ -216,8 +231,8 @@ def setUpSignals(self_):
signal(SIGUSR1, signalHandler) signal(SIGUSR1, signalHandler)
signal(SIGUSR2, signalHandler) signal(SIGUSR2, signalHandler)


gGui.connect(gGui, SIGNAL("SIGTERM()"), closeWindowHandler)
gGui.connect(gGui, SIGNAL("SIGUSR2()"), showWindowHandler)
gGui.SIGTERM.connect(closeWindowHandler)
gGui.SIGUSR2.connect(showWindowHandler)


def signalHandler(sig, frame): def signalHandler(sig, frame):
global gGui global gGui
@@ -226,11 +241,11 @@ def signalHandler(sig, frame):
return return


if sig in (SIGINT, SIGTERM): if sig in (SIGINT, SIGTERM):
gGui.emit(SIGNAL("SIGTERM()"))
gGui.SIGTERM.emit()
elif sig == SIGUSR1: elif sig == SIGUSR1:
gGui.emit(SIGNAL("SIGUSR1()"))
gGui.SIGUSR1.emit()
elif sig == SIGUSR2: elif sig == SIGUSR2:
gGui.emit(SIGNAL("SIGUSR2()"))
gGui.SIGUSR2.emit()


def closeWindowHandler(): def closeWindowHandler():
global gGui global gGui
@@ -271,7 +286,6 @@ def setIcons(self_, modes):
gGui.ui.act_canvas_zoom_in.setIcon(getIcon("zoom-in")) gGui.ui.act_canvas_zoom_in.setIcon(getIcon("zoom-in"))
gGui.ui.act_canvas_zoom_out.setIcon(getIcon("zoom-out")) gGui.ui.act_canvas_zoom_out.setIcon(getIcon("zoom-out"))
gGui.ui.act_canvas_zoom_100.setIcon(getIcon("zoom-original")) gGui.ui.act_canvas_zoom_100.setIcon(getIcon("zoom-original"))
gGui.ui.act_canvas_print.setIcon(getIcon("document-print"))
gGui.ui.b_canvas_zoom_fit.setIcon(getIcon("zoom-fit-best")) gGui.ui.b_canvas_zoom_fit.setIcon(getIcon("zoom-fit-best"))
gGui.ui.b_canvas_zoom_in.setIcon(getIcon("zoom-in")) gGui.ui.b_canvas_zoom_in.setIcon(getIcon("zoom-in"))
gGui.ui.b_canvas_zoom_out.setIcon(getIcon("zoom-out")) gGui.ui.b_canvas_zoom_out.setIcon(getIcon("zoom-out"))


+ 15
- 5
src/shared_cadence.py View File

@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-


# Common/Shared code for Cadence # Common/Shared code for Cadence
# Copyright (C) 2012 Filipe Coelho <falktx@falktx.com>
# Copyright (C) 2012-2018 Filipe Coelho <falktx@falktx.com>
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -19,9 +19,13 @@
# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Imports (Global) # Imports (Global)


from PyQt4.QtCore import QProcess, QSettings
from time import sleep from time import sleep


if True:
from PyQt5.QtCore import QProcess, QSettings
else:
from PyQt4.QtCore import QProcess, QSettings

# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Imports (Custom Stuff) # Imports (Custom Stuff)


@@ -68,6 +72,11 @@ iAlsaFileMax = 4


GlobalSettings = QSettings("Cadence", "GlobalSettings") GlobalSettings = QSettings("Cadence", "GlobalSettings")


# ------------------------------------------------------------------------------------------------------------
# KXStudio Check

wantJackStart = os.path.exists("/usr/share/kxstudio/config/config/Cadence/GlobalSettings.conf")

# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Get Process list # Get Process list


@@ -130,8 +139,9 @@ def tryCloseJackDBus():
# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Stop all audio processes, used for force-restart # Stop all audio processes, used for force-restart


def stopAllAudioProcesses():
tryCloseJackDBus()
def stopAllAudioProcesses(tryCloseJack = True):
if tryCloseJack:
tryCloseJackDBus()


if not (HAIKU or LINUX or MACOS): if not (HAIKU or LINUX or MACOS):
print("stopAllAudioProcesses() - Not supported in this system") print("stopAllAudioProcesses() - Not supported in this system")
@@ -140,7 +150,7 @@ def stopAllAudioProcesses():
process = QProcess() process = QProcess()


# Tell pulse2jack script to create files, prevents pulseaudio respawn # Tell pulse2jack script to create files, prevents pulseaudio respawn
process.start("cadence-pulse2jack", "--dummy")
process.start("cadence-pulse2jack", ["--dummy"])
process.waitForFinished() process.waitForFinished()


procsTerm = ["a2j", "a2jmidid", "artsd", "jackd", "jackdmp", "knotify4", "lash", "ladishd", "ladiappd", "ladiconfd", "jmcore"] procsTerm = ["a2j", "a2jmidid", "artsd", "jackd", "jackdmp", "knotify4", "lash", "ladishd", "ladiappd", "ladiconfd", "jmcore"]


+ 63
- 58
src/shared_canvasjack.py View File

@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-


# Common/Shared code related to Canvas and JACK # Common/Shared code related to Canvas and JACK
# Copyright (C) 2010-2013 Filipe Coelho <falktx@falktx.com>
# Copyright (C) 2010-2018 Filipe Coelho <falktx@falktx.com>
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -19,8 +19,14 @@
# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Imports (Global) # Imports (Global)


from PyQt4.QtCore import pyqtSlot, QTimer
from PyQt4.QtGui import QCursor, QFontMetrics, QImage, QMainWindow, QMenu, QPainter, QPrinter, QPrintDialog
if True:
from PyQt5.QtCore import pyqtSlot, QTimer
from PyQt5.QtGui import QCursor, QFontMetrics, QImage, QPainter
from PyQt5.QtWidgets import QMainWindow, QMenu
else:
from PyQt4.QtCore import pyqtSlot, QTimer
from PyQt4.QtGui import QCursor, QFontMetrics, QImage, QPainter
from PyQt4.QtGui import QMainWindow, QMenu


# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Imports (Custom Stuff) # Imports (Custom Stuff)
@@ -95,6 +101,19 @@ gJack.client = None
# Abstract Canvas and JACK Class # Abstract Canvas and JACK Class


class AbstractCanvasJackClass(QMainWindow): class AbstractCanvasJackClass(QMainWindow):
XRunCallback = pyqtSignal()
BufferSizeCallback = pyqtSignal(int)
SampleRateCallback = pyqtSignal(int)
ClientRenameCallback = pyqtSignal(str, str)
PortRegistrationCallback = pyqtSignal(int, bool)
PortConnectCallback = pyqtSignal(int, int, bool)
PortRenameCallback = pyqtSignal(int, str, str)
ShutdownCallback = pyqtSignal()

SIGTERM = pyqtSignal()
SIGUSR1 = pyqtSignal()
SIGUSR2 = pyqtSignal()

def __init__(self, appName, UiClass, parent): def __init__(self, appName, UiClass, parent):
QMainWindow.__init__(self, parent) QMainWindow.__init__(self, parent)


@@ -477,23 +496,10 @@ class AbstractCanvasJackClass(QMainWindow):
def slot_canvasZoomReset(self): def slot_canvasZoomReset(self):
self.scene.zoom_reset() self.scene.zoom_reset()


@pyqtSlot()
def slot_canvasPrint(self):
self.scene.clearSelection()
self.fExportPrinter = QPrinter()
dialog = QPrintDialog(self.fExportPrinter, self)

if dialog.exec_():
painter = QPainter(self.fExportPrinter)
painter.save()
painter.setRenderHint(QPainter.Antialiasing, True)
painter.setRenderHint(QPainter.TextAntialiasing, True)
self.scene.render(painter)
painter.restore()

@pyqtSlot() @pyqtSlot()
def slot_canvasSaveImage(self): def slot_canvasSaveImage(self):
newPath = QFileDialog.getSaveFileName(self, self.tr("Save Image"), filter=self.tr("PNG Image (*.png);;JPEG Image (*.jpg)")) newPath = QFileDialog.getSaveFileName(self, self.tr("Save Image"), filter=self.tr("PNG Image (*.png);;JPEG Image (*.jpg)"))
newPath = newPath[0]


if not newPath: if not newPath:
return return
@@ -523,56 +529,55 @@ class AbstractCanvasJackClass(QMainWindow):


def setCanvasConnections(self): def setCanvasConnections(self):
self.ui.act_canvas_arrange.setEnabled(False) # TODO, later self.ui.act_canvas_arrange.setEnabled(False) # TODO, later
self.connect(self.ui.act_canvas_arrange, SIGNAL("triggered()"), SLOT("slot_canvasArrange()"))
self.connect(self.ui.act_canvas_refresh, SIGNAL("triggered()"), SLOT("slot_canvasRefresh()"))
self.connect(self.ui.act_canvas_zoom_fit, SIGNAL("triggered()"), SLOT("slot_canvasZoomFit()"))
self.connect(self.ui.act_canvas_zoom_in, SIGNAL("triggered()"), SLOT("slot_canvasZoomIn()"))
self.connect(self.ui.act_canvas_zoom_out, SIGNAL("triggered()"), SLOT("slot_canvasZoomOut()"))
self.connect(self.ui.act_canvas_zoom_100, SIGNAL("triggered()"), SLOT("slot_canvasZoomReset()"))
self.connect(self.ui.act_canvas_print, SIGNAL("triggered()"), SLOT("slot_canvasPrint()"))
self.connect(self.ui.act_canvas_save_image, SIGNAL("triggered()"), SLOT("slot_canvasSaveImage()"))
self.connect(self.ui.b_canvas_zoom_fit, SIGNAL("clicked()"), SLOT("slot_canvasZoomFit()"))
self.connect(self.ui.b_canvas_zoom_in, SIGNAL("clicked()"), SLOT("slot_canvasZoomIn()"))
self.connect(self.ui.b_canvas_zoom_out, SIGNAL("clicked()"), SLOT("slot_canvasZoomOut()"))
self.connect(self.ui.b_canvas_zoom_100, SIGNAL("clicked()"), SLOT("slot_canvasZoomReset()"))
self.ui.act_canvas_arrange.triggered.connect(self.slot_canvasArrange)
self.ui.act_canvas_refresh.triggered.connect(self.slot_canvasRefresh)
self.ui.act_canvas_zoom_fit.triggered.connect(self.slot_canvasZoomFit)
self.ui.act_canvas_zoom_in.triggered.connect(self.slot_canvasZoomIn)
self.ui.act_canvas_zoom_out.triggered.connect(self.slot_canvasZoomOut)
self.ui.act_canvas_zoom_100.triggered.connect(self.slot_canvasZoomReset)
self.ui.act_canvas_save_image.triggered.connect(self.slot_canvasSaveImage)
self.ui.b_canvas_zoom_fit.clicked.connect(self.slot_canvasZoomFit)
self.ui.b_canvas_zoom_in.clicked.connect(self.slot_canvasZoomIn)
self.ui.b_canvas_zoom_out.clicked.connect(self.slot_canvasZoomOut)
self.ui.b_canvas_zoom_100.clicked.connect(self.slot_canvasZoomReset)


def setJackConnections(self, modes): def setJackConnections(self, modes):
if "jack" in modes: if "jack" in modes:
self.connect(self.ui.act_jack_clear_xruns, SIGNAL("triggered()"), SLOT("slot_JackClearXruns()"))
self.connect(self.ui.act_jack_render, SIGNAL("triggered()"), SLOT("slot_showRender()"))
self.connect(self.ui.act_jack_configure, SIGNAL("triggered()"), SLOT("slot_showJackSettings()"))
self.connect(self.ui.b_jack_clear_xruns, SIGNAL("clicked()"), SLOT("slot_JackClearXruns()"))
self.connect(self.ui.b_jack_configure, SIGNAL("clicked()"), SLOT("slot_showJackSettings()"))
self.connect(self.ui.b_jack_render, SIGNAL("clicked()"), SLOT("slot_showRender()"))
self.connect(self.ui.cb_buffer_size, SIGNAL("currentIndexChanged(QString)"), SLOT("slot_jackBufferSize_ComboBox(QString)"))
self.connect(self.ui.cb_sample_rate, SIGNAL("currentIndexChanged(QString)"), SLOT("slot_jackSampleRate_ComboBox(QString)"))
self.connect(self.ui.b_xruns, SIGNAL("clicked()"), SLOT("slot_JackClearXruns()"))
self.ui.act_jack_clear_xruns.triggered.connect(self.slot_JackClearXruns)
self.ui.act_jack_render.triggered.connect(self.slot_showRender)
self.ui.act_jack_configure.triggered.connect(self.slot_showJackSettings)
self.ui.b_jack_clear_xruns.clicked.connect(self.slot_JackClearXruns)
self.ui.b_jack_configure.clicked.connect(self.slot_showJackSettings)
self.ui.b_jack_render.clicked.connect(self.slot_showRender)
self.ui.cb_buffer_size.currentIndexChanged[str].connect(self.slot_jackBufferSize_ComboBox)
self.ui.cb_sample_rate.currentIndexChanged[str].connect(self.slot_jackSampleRate_ComboBox)
self.ui.b_xruns.clicked.connect(self.slot_JackClearXruns)


if "buffer-size" in modes: if "buffer-size" in modes:
self.connect(self.ui.act_jack_bf_16, SIGNAL("triggered(bool)"), SLOT("slot_jackBufferSize_Menu(bool)"))
self.connect(self.ui.act_jack_bf_32, SIGNAL("triggered(bool)"), SLOT("slot_jackBufferSize_Menu(bool)"))
self.connect(self.ui.act_jack_bf_64, SIGNAL("triggered(bool)"), SLOT("slot_jackBufferSize_Menu(bool)"))
self.connect(self.ui.act_jack_bf_128, SIGNAL("triggered(bool)"), SLOT("slot_jackBufferSize_Menu(bool)"))
self.connect(self.ui.act_jack_bf_256, SIGNAL("triggered(bool)"), SLOT("slot_jackBufferSize_Menu(bool)"))
self.connect(self.ui.act_jack_bf_512, SIGNAL("triggered(bool)"), SLOT("slot_jackBufferSize_Menu(bool)"))
self.connect(self.ui.act_jack_bf_1024, SIGNAL("triggered(bool)"), SLOT("slot_jackBufferSize_Menu(bool)"))
self.connect(self.ui.act_jack_bf_2048, SIGNAL("triggered(bool)"), SLOT("slot_jackBufferSize_Menu(bool)"))
self.connect(self.ui.act_jack_bf_4096, SIGNAL("triggered(bool)"), SLOT("slot_jackBufferSize_Menu(bool)"))
self.connect(self.ui.act_jack_bf_8192, SIGNAL("triggered(bool)"), SLOT("slot_jackBufferSize_Menu(bool)"))
self.ui.act_jack_bf_16.triggered.connect(self.slot_jackBufferSize_Menu)
self.ui.act_jack_bf_32.triggered.connect(self.slot_jackBufferSize_Menu)
self.ui.act_jack_bf_64.triggered.connect(self.slot_jackBufferSize_Menu)
self.ui.act_jack_bf_128.triggered.connect(self.slot_jackBufferSize_Menu)
self.ui.act_jack_bf_256.triggered.connect(self.slot_jackBufferSize_Menu)
self.ui.act_jack_bf_512.triggered.connect(self.slot_jackBufferSize_Menu)
self.ui.act_jack_bf_1024.triggered.connect(self.slot_jackBufferSize_Menu)
self.ui.act_jack_bf_2048.triggered.connect(self.slot_jackBufferSize_Menu)
self.ui.act_jack_bf_4096.triggered.connect(self.slot_jackBufferSize_Menu)
self.ui.act_jack_bf_8192.triggered.connect(self.slot_jackBufferSize_Menu)


if "transport" in modes: if "transport" in modes:
self.connect(self.ui.act_transport_play, SIGNAL("triggered(bool)"), SLOT("slot_transportPlayPause(bool)"))
self.connect(self.ui.act_transport_stop, SIGNAL("triggered()"), SLOT("slot_transportStop()"))
self.connect(self.ui.act_transport_backwards, SIGNAL("triggered()"), SLOT("slot_transportBackwards()"))
self.connect(self.ui.act_transport_forwards, SIGNAL("triggered()"), SLOT("slot_transportForwards()"))
self.connect(self.ui.b_transport_play, SIGNAL("clicked(bool)"), SLOT("slot_transportPlayPause(bool)"))
self.connect(self.ui.b_transport_stop, SIGNAL("clicked()"), SLOT("slot_transportStop()"))
self.connect(self.ui.b_transport_backwards, SIGNAL("clicked()"), SLOT("slot_transportBackwards()"))
self.connect(self.ui.b_transport_forwards, SIGNAL("clicked()"), SLOT("slot_transportForwards()"))
self.connect(self.ui.label_time, SIGNAL("customContextMenuRequested(QPoint)"), SLOT("slot_transportViewMenu()"))
self.ui.act_transport_play.triggered.connect(self.slot_transportPlayPause)
self.ui.act_transport_stop.triggered.connect(self.slot_transportStop)
self.ui.act_transport_backwards.triggered.connect(self.slot_transportBackwards)
self.ui.act_transport_forwards.triggered.connect(self.slot_transportForwards)
self.ui.b_transport_play.clicked.connect(self.slot_transportPlayPause)
self.ui.b_transport_stop.clicked.connect(self.slot_transportStop)
self.ui.b_transport_backwards.clicked.connect(self.slot_transportBackwards)
self.ui.b_transport_forwards.clicked.connect(self.slot_transportForwards)
self.ui.label_time.customContextMenuRequested.connect(self.slot_transportViewMenu)


if "misc" in modes: if "misc" in modes:
if LINUX: if LINUX:
self.connect(self.ui.act_show_logs, SIGNAL("triggered()"), SLOT("slot_showLogs()"))
self.ui.act_show_logs.triggered.connect(self.slot_showLogs)
else: else:
self.ui.act_show_logs.setEnabled(False) self.ui.act_show_logs.setEnabled(False)

+ 10
- 6
src/shared_settings.py View File

@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-


# Common/Shared code related to the Settings dialog # Common/Shared code related to the Settings dialog
# Copyright (C) 2010-2013 Filipe Coelho <falktx@falktx.com>
# Copyright (C) 2010-2018 Filipe Coelho <falktx@falktx.com>
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -19,8 +19,12 @@
# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Imports (Global) # Imports (Global)


from PyQt4.QtCore import pyqtSlot, QSettings
from PyQt4.QtGui import QDialog, QDialogButtonBox
if True:
from PyQt5.QtCore import pyqtSlot, QSettings
from PyQt5.QtWidgets import QDialog, QDialogButtonBox
else:
from PyQt4.QtCore import pyqtSlot, QSettings
from PyQt4.QtGui import QDialog, QDialogButtonBox


# ------------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------------
# Imports (Custom Stuff) # Imports (Custom Stuff)
@@ -134,9 +138,9 @@ class SettingsW(QDialog):
# ------------------------------------------------------------- # -------------------------------------------------------------
# Set-up connections # Set-up connections


self.connect(self, SIGNAL("accepted()"), SLOT("slot_saveSettings()"))
self.connect(self.ui.buttonBox.button(QDialogButtonBox.Reset), SIGNAL("clicked()"), SLOT("slot_resetSettings()"))
self.connect(self.ui.b_main_def_folder_open, SIGNAL("clicked()"), SLOT("slot_getAndSetProjectPath()"))
self.accepted.connect(self.slot_saveSettings)
self.ui.buttonBox.button(QDialogButtonBox.Reset).clicked.connect(self.slot_resetSettings)
self.ui.b_main_def_folder_open.clicked.connect(self.slot_getAndSetProjectPath)


def loadSettings(self): def loadSettings(self):
settings = QSettings() settings = QSettings()


+ 34
- 43
src/systray.py View File

@@ -2,7 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-


# KDE, App-Indicator or Qt Systray # KDE, App-Indicator or Qt Systray
# Copyright (C) 2011-2012 Filipe Coelho <falktx@falktx.com>
# Copyright (C) 2011-2018 Filipe Coelho <falktx@falktx.com>
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -18,42 +18,31 @@


# Imports (Global) # Imports (Global)
import os, sys import os, sys
from PyQt4.QtCore import QTimer, SIGNAL
from PyQt4.QtGui import QAction, QIcon, QMainWindow, QMenu, QSystemTrayIcon

if True:
from PyQt5.QtCore import QTimer
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QAction, QMainWindow, QMenu, QSystemTrayIcon
else:
from PyQt4.QtCore import QTimer
from PyQt4.QtGui import QIcon
from PyQt4.QtGui import QAction, QMainWindow, QMenu, QSystemTrayIcon


try: try:
if False and os.getenv("DESKTOP_SESSION") in ("ubuntu", "ubuntu-2d") and not os.path.exists("/var/cadence/no_app_indicators"): if False and os.getenv("DESKTOP_SESSION") in ("ubuntu", "ubuntu-2d") and not os.path.exists("/var/cadence/no_app_indicators"):
# Check current Qt theme. If Gtk+, use Gtk2 AppIndicator
style = None
if len(sys.argv) > 2 and "-style" in sys.argv:
i = sys.argv.index("-style")
if i < len(sys.argv):
style = sys.argv[i+1]

check_cmd = "python3 -c 'import sys; from PyQt4.QtGui import QApplication; app = QApplication(sys.argv); print(app.style().objectName())'"

if style:
check_cmd += " -style %s" % style

from subprocess import getoutput
needsGtk2 = bool(getoutput(check_cmd).strip().lower() in ("gtk", "gtk+"))

if needsGtk2:
from gi import pygtkcompat
pygtkcompat.enable()
pygtkcompat.enable_gtk(version="2.0")
from gi.repository import Gtk, AppIndicator
else:
from gi.repository import Gtk, AppIndicator3 as AppIndicator

from gi import require_version
require_version('Gtk', '3.0')
from gi.repository import Gtk
require_version('AppIndicator3', '0.1')
from gi.repository import AppIndicator3 as AppIndicator
TrayEngine = "AppIndicator" TrayEngine = "AppIndicator"
elif os.getenv("KDE_SESSION_VERSION") >= 5:
TrayEngine = "Qt"


elif (os.getenv("KDE_FULL_SESSION") or os.getenv("DESKTOP_SESSION") == "kde-plasma") and not os.path.exists("/etc/debian_version"):
from PyKDE4.kdeui import KAction, KIcon, KMenu, KStatusNotifierItem
TrayEngine = "KDE"
#elif os.getenv("KDE_SESSION_VERSION") >= 5:
#TrayEngine = "Qt"

#elif os.getenv("KDE_FULL_SESSION") or os.getenv("DESKTOP_SESSION") == "kde-plasma":
#from PyKDE5.kdeui import KAction, KIcon, KMenu, KStatusNotifierItem
#TrayEngine = "KDE"


else: else:
TrayEngine = "Qt" TrayEngine = "Qt"
@@ -117,7 +106,7 @@ class GlobalSysTray(object):
self.tray = QSystemTrayIcon(getIcon(icon)) self.tray = QSystemTrayIcon(getIcon(icon))
self.tray.setContextMenu(self.menu) self.tray.setContextMenu(self.menu)
self.tray.setParent(parent) self.tray.setParent(parent)
self.tray.connect(self.tray, SIGNAL("activated(QSystemTrayIcon::ActivationReason)"), self.qt_systray_clicked)
self.tray.activated.connect(self.qt_systray_clicked)


# ------------------------------------------------------------------------------------------- # -------------------------------------------------------------------------------------------


@@ -289,14 +278,11 @@ class GlobalSysTray(object):


act_widget = self.act_indexes[i][iActWidget] act_widget = self.act_indexes[i][iActWidget]


if TrayEngine == "KDE":
self.tray.connect(act_widget, SIGNAL("triggered()"), act_func)

elif TrayEngine == "AppIndicator":
if TrayEngine == "AppIndicator":
act_widget.connect("activate", self.gtk_call_func, act_name_id) act_widget.connect("activate", self.gtk_call_func, act_name_id)


elif TrayEngine == "Qt":
self.tray.connect(act_widget, SIGNAL("triggered()"), act_func)
elif TrayEngine in ("KDE", "Qt"):
act_widget.triggered.connect(act_func)


self.act_indexes[i][iActFunc] = act_func self.act_indexes[i][iActFunc] = act_func


@@ -488,12 +474,14 @@ class GlobalSysTray(object):


def isTrayAvailable(self): def isTrayAvailable(self):
if TrayEngine in ("KDE", "Qt"): if TrayEngine in ("KDE", "Qt"):
# Ask Qt
return QSystemTrayIcon.isSystemTrayAvailable() return QSystemTrayIcon.isSystemTrayAvailable()
elif TrayEngine == "AppIndicator":

if TrayEngine == "AppIndicator":
# Ubuntu/Unity always has a systray # Ubuntu/Unity always has a systray
return True return True
else:
return False
return False


def handleQtCloseEvent(self, event): def handleQtCloseEvent(self, event):
if self.isTrayAvailable() and self._parent.isVisible(): if self.isTrayAvailable() and self._parent.isVisible():
@@ -654,13 +642,16 @@ class GlobalSysTray(object):
self._parent.hide() self._parent.hide()
self._parent.close() self._parent.close()


if self._app:
self._app.quit()

def __raiseWindow(self): def __raiseWindow(self):
self._parent.activateWindow() self._parent.activateWindow()
self._parent.raise_() self._parent.raise_()


#--------------- main ------------------ #--------------- main ------------------
if __name__ == '__main__': if __name__ == '__main__':
from PyQt4.QtGui import QApplication, QDialog, QMessageBox
from PyQt5.QtWidgets import QApplication, QDialog, QMessageBox


class ExampleGUI(QDialog): class ExampleGUI(QDialog):
def __init__(self, parent=None): def __init__(self, parent=None):


Loading…
Cancel
Save