From e91750e39acb119cf97f8105a7acc28a8901a4e2 Mon Sep 17 00:00:00 2001 From: falkTX Date: Fri, 7 Jul 2017 20:23:14 +0200 Subject: [PATCH 01/36] 61cadence-session-inject file installed as 755 See #91 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8acedc0..77fda0a 100644 --- a/Makefile +++ b/Makefile @@ -164,7 +164,7 @@ install: # Install addtional stuff for Cadence install -m 644 data/pulse2jack/* $(DESTDIR)$(PREFIX)/share/cadence/pulse2jack/ 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 cp -r data/icons/* $(DESTDIR)$(PREFIX)/share/cadence/icons/ From 612fcc1790624dfde8995c3d55f1bb16a48ce192 Mon Sep 17 00:00:00 2001 From: Olivier Humbert Date: Tue, 16 Jan 2018 00:34:08 +0100 Subject: [PATCH 02/36] Update claudia_database.py --- src/claudia_database.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/claudia_database.py b/src/claudia_database.py index 58b2317..7424fbf 100644 --- a/src/claudia_database.py +++ b/src/claudia_database.py @@ -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/") ], - [ "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-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") ], From 48b609b259111cd0df4e29700b922418e951baf8 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 18 Feb 2018 23:21:44 +0100 Subject: [PATCH 03/36] Start port to qt5 --- Makefile | 4 +- c++/Makefile.mk | 12 ++-- c++/jackmeter/Makefile | 4 +- c++/jackmeter/jackmeter.cpp | 4 +- c++/widgets/digitalpeakmeter.hpp | 2 +- c++/widgets/pixmapdial.hpp | 2 +- c++/widgets/pixmapkeyboard.hpp | 2 +- c++/xycontroller/Makefile | 4 +- c++/xycontroller/xycontroller.cpp | 12 ++-- src/catia.py | 63 ++++++++++++--------- src/jacksettings.py | 39 +++++++------ src/logs.py | 21 ++++--- src/patchcanvas.py | 19 ++++--- src/patchcanvas_theme.py | 6 +- src/render.py | 26 ++++----- src/shared.py | 17 +++--- src/shared_cadence.py | 4 +- src/shared_canvasjack.py | 93 ++++++++++++++++--------------- src/shared_settings.py | 13 +++-- 19 files changed, 189 insertions(+), 158 deletions(-) diff --git a/Makefile b/Makefile index 77fda0a..47c4246 100644 --- a/Makefile +++ b/Makefile @@ -8,8 +8,8 @@ PREFIX = /usr/local DESTDIR = LINK = ln -s -PYUIC ?= pyuic4 -PYRCC ?= pyrcc4 -py3 +PYUIC ?= pyuic5 +PYRCC ?= pyrcc5 # Detect X11 rules dir ifeq "$(wildcard /etc/X11/xinit/xinitrc.d/ )" "" diff --git a/c++/Makefile.mk b/c++/Makefile.mk index cc733ff..ec92861 100644 --- a/c++/Makefile.mk +++ b/c++/Makefile.mk @@ -7,12 +7,14 @@ AR ?= ar CC ?= gcc CXX ?= g++ -MOC ?= $(shell pkg-config --variable=moc_location QtCore) -RCC ?= $(shell pkg-config --variable=rcc_location QtCore) -UIC ?= $(shell pkg-config --variable=uic_location QtCore) STRIP ?= strip WINDRES ?= windres +HOSTBINS = $(shell pkg-config --variable=host_bins Qt5Core) +MOC ?= $(HOSTBINS)/moc +RCC ?= $(HOSTBINS)/rcc +UIC ?= $(HOSTBINS)/uic + # -------------------------------------------------------------- DEBUG ?= false @@ -22,10 +24,12 @@ BASE_FLAGS = -O0 -g -Wall -Wextra BASE_FLAGS += -DDEBUG STRIP = true # FIXME else -BASE_FLAGS = -O2 -ffast-math -mtune=generic -msse -mfpmath=sse -Wall -Wextra +BASE_FLAGS = -O3 -ffast-math -mtune=generic -msse -mfpmath=sse -Wall -Wextra BASE_FLAGS += -DNDEBUG endif +BASE_FLAGS += -fPIC + BUILD_C_FLAGS = $(BASE_FLAGS) -std=c99 $(CFLAGS) BUILD_CXX_FLAGS = $(BASE_FLAGS) -std=c++0x $(CXXFLAGS) LINK_FLAGS = $(LDFLAGS) diff --git a/c++/jackmeter/Makefile b/c++/jackmeter/Makefile index ede9178..004076d 100644 --- a/c++/jackmeter/Makefile +++ b/c++/jackmeter/Makefile @@ -9,8 +9,8 @@ include ../Makefile.mk # -------------------------------------------------------------- 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) BUILD_CXX_FLAGS += -DHAVE_JACKSESSION diff --git a/c++/jackmeter/jackmeter.cpp b/c++/jackmeter/jackmeter.cpp index dedbfa1..56c066a 100644 --- a/c++/jackmeter/jackmeter.cpp +++ b/c++/jackmeter/jackmeter.cpp @@ -27,9 +27,9 @@ #include "../widgets/digitalpeakmeter.hpp" #include -#include #include -#include +#include +#include // ------------------------------- diff --git a/c++/widgets/digitalpeakmeter.hpp b/c++/widgets/digitalpeakmeter.hpp index 7bbf42f..67459cd 100644 --- a/c++/widgets/digitalpeakmeter.hpp +++ b/c++/widgets/digitalpeakmeter.hpp @@ -19,7 +19,7 @@ #define __DIGITALPEAKMETER_HPP__ #include -#include +#include class DigitalPeakMeter : public QWidget { diff --git a/c++/widgets/pixmapdial.hpp b/c++/widgets/pixmapdial.hpp index cfc7090..0d1bafd 100644 --- a/c++/widgets/pixmapdial.hpp +++ b/c++/widgets/pixmapdial.hpp @@ -19,7 +19,7 @@ #define __PIXMAPDIAL_HPP__ #include -#include +#include class PixmapDial : public QDial { diff --git a/c++/widgets/pixmapkeyboard.hpp b/c++/widgets/pixmapkeyboard.hpp index 4bca9c8..d19bccf 100644 --- a/c++/widgets/pixmapkeyboard.hpp +++ b/c++/widgets/pixmapkeyboard.hpp @@ -20,7 +20,7 @@ #include #include -#include +#include class PixmapKeyboard : public QWidget { diff --git a/c++/xycontroller/Makefile b/c++/xycontroller/Makefile index af57a05..662a7af 100644 --- a/c++/xycontroller/Makefile +++ b/c++/xycontroller/Makefile @@ -9,8 +9,8 @@ include ../Makefile.mk # -------------------------------------------------------------- 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) BUILD_CXX_FLAGS += -DHAVE_JACKSESSION diff --git a/c++/xycontroller/xycontroller.cpp b/c++/xycontroller/xycontroller.cpp index ddac3c6..4b32e2b 100644 --- a/c++/xycontroller/xycontroller.cpp +++ b/c++/xycontroller/xycontroller.cpp @@ -29,13 +29,13 @@ #include #include -#include -#include -#include -#include #include -#include -#include +#include +#include +#include +#include +#include +#include // ------------------------------- diff --git a/src/catia.py b/src/catia.py index 4eba6b6..7879ba8 100755 --- a/src/catia.py +++ b/src/catia.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # JACK Patchbay -# Copyright (C) 2010-2013 Filipe Coelho +# Copyright (C) 2010-2018 Filipe Coelho # # 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 @@ -37,7 +37,7 @@ except: # Try Import OpenGL try: - from PyQt4.QtOpenGL import QGLWidget + from PyQt5.QtOpenGL import QGLWidget hasGL = True except: hasGL = False @@ -96,6 +96,15 @@ URI_CANVAS_ICON = "http://kxstudio.sf.net/ns/canvas/icon" # Catia Main Window class CatiaMainW(AbstractCanvasJackClass): + 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() + def __init__(self, parent=None): AbstractCanvasJackClass.__init__(self, "Catia", ui_catia.Ui_CatiaMainW, parent) @@ -215,26 +224,26 @@ class CatiaMainW(AbstractCanvasJackClass): self.setCanvasConnections() 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 @@ -1055,37 +1064,37 @@ class CatiaMainW(AbstractCanvasJackClass): def JackXRunCallback(self, arg): if DEBUG: print("JackXRunCallback()") - self.emit(SIGNAL("XRunCallback()")) + self.XRunCallback.emit() return 0 def JackBufferSizeCallback(self, bufferSize, arg): if DEBUG: print("JackBufferSizeCallback(%i)" % bufferSize) - self.emit(SIGNAL("BufferSizeCallback(int)"), bufferSize) + self.BufferSizeCallback.emit(bufferSize) return 0 def JackSampleRateCallback(self, sampleRate, arg): if DEBUG: print("JackSampleRateCallback(%i)" % sampleRate) - self.emit(SIGNAL("SampleRateCallback(int)"), sampleRate) + self.SampleRateCallback.emit(sampleRate) return 0 def JackClientRenameCallback(self, oldName, newName, arg): 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 def JackPortRegistrationCallback(self, portId, registerYesNo, arg): 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 def JackPortConnectCallback(self, portA, portB, connectYesNo, arg): 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 def JackPortRenameCallback(self, portId, oldName, newName, arg): 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 def JackSessionCallback(self, event, arg): @@ -1107,7 +1116,7 @@ class CatiaMainW(AbstractCanvasJackClass): def JackShutdownCallback(self, arg): if DEBUG: print("JackShutdownCallback()") - self.emit(SIGNAL("ShutdownCallback()")) + self.ShutdownCallback.emit() return 0 @pyqtSlot(bool) diff --git a/src/jacksettings.py b/src/jacksettings.py index 271a617..039c884 100755 --- a/src/jacksettings.py +++ b/src/jacksettings.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # JACK Settings Dialog -# Copyright (C) 2010-2013 Filipe Coelho +# Copyright (C) 2010-2018 Filipe Coelho # # 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 @@ -19,8 +19,9 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt4.QtCore import pyqtSlot, Qt, QSettings, QTimer, SIGNAL, SLOT -from PyQt4.QtGui import QDialog, QDialogButtonBox, QFontMetrics, QMessageBox +from PyQt5.QtCore import pyqtSlot, Qt, QSettings, QTimer +from PyQt5.QtGui import QFontMetrics +from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QMessageBox from sys import platform, version_info # ------------------------------------------------------------------------------------------------------------ @@ -198,17 +199,18 @@ class JackSettingsW(QDialog): driverList = gJackctl.ReadContainer(["drivers"])[1] maxWidth = 75 - for i in range(self.ui.obj_server_driver.rowCount()): - self.ui.obj_server_driver.item(0, i).setTextAlignment(Qt.AlignCenter) + # FIXME QT4 + #for i in range(self.ui.obj_server_driver.rowCount()): + #self.ui.obj_server_driver.item(0, i).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 = self.ui.obj_server_driver.item(0, i).text() + #itemWidth = QFontMetrics(self.ui.obj_server_driver.font()).width(itexText)+25 - if itemWidth > maxWidth: - maxWidth = itemWidth + #if itemWidth > maxWidth: + #maxWidth = itemWidth - if dbus.String(itexText.lower()) not in driverList: - self.ui.obj_server_driver.hideRow(i) + #if dbus.String(itexText.lower()) not in driverList: + #self.ui.obj_server_driver.hideRow(i) self.ui.obj_server_driver.setMinimumWidth(maxWidth) self.ui.obj_server_driver.setMaximumWidth(maxWidth) @@ -216,14 +218,14 @@ class JackSettingsW(QDialog): # ------------------------------------------------------------- # 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.connect(self.slot_checkALSASelection) + self.ui.obj_driver_playback.currentIndexChanged.connect(self.slot_checkALSASelection) # ------------------------------------------------------------- # Load initial settings @@ -910,7 +912,8 @@ if __name__ == '__main__': # Additional imports import resources_rc 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 = QApplication(sys_argv) diff --git a/src/logs.py b/src/logs.py index b597377..5c5e1f7 100755 --- a/src/logs.py +++ b/src/logs.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # JACK, A2J, LASH and LADISH Logs Viewer -# Copyright (C) 2011-2013 Filipe Coelho +# Copyright (C) 2011-2018 Filipe Coelho # # 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 @@ -19,8 +19,9 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt4.QtCore import pyqtSlot, Qt, QFile, QIODevice, QMutex, QMutexLocker, QTextStream, QThread, QSettings -from PyQt4.QtGui import QDialog, QPalette, QSyntaxHighlighter +from PyQt5.QtCore import pyqtSlot, Qt, QFile, QIODevice, QMutex, QMutexLocker, QTextStream, QThread, QSettings +from PyQt5.QtGui import QPalette, QSyntaxHighlighter +from PyQt5.QtWidgets import QDialog # ------------------------------------------------------------------------------------------------------------ # Imports (Custom Stuff) @@ -118,6 +119,8 @@ class SyntaxHighlighter_LADISH(QSyntaxHighlighter): class LogsReadThread(QThread): MAX_INITIAL_SIZE = 2*1024*1024 # 2Mb + updateLogs = pyqtSignal() + def __init__(self, parent): QThread.__init__(self, parent) @@ -236,7 +239,7 @@ class LogsReadThread(QThread): textLADISH = "" self.fRealParent.setLogsText(textJACK, textA2J, textLASH, textLADISH) - self.emit(SIGNAL("updateLogs()")) + self.updateLogs.emit() if not self.fCloseNow: self.sleep(1) @@ -279,6 +282,10 @@ class LogsW(QDialog): if not os.path.exists(LOG_FILE_LADISH): LOG_FILE_LADISH = None + SIGTERM = pyqtSignal() + SIGUSR1 = pyqtSignal() + SIGUSR2 = pyqtSignal() + def __init__(self, parent): QDialog.__init__(self, parent) self.ui = ui_logs.Ui_LogsW() @@ -349,8 +356,8 @@ class LogsW(QDialog): # ------------------------------------------------------------- # 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) # ------------------------------------------------------------- @@ -431,7 +438,7 @@ class LogsW(QDialog): if __name__ == '__main__': # Additional imports - from PyQt4.QtGui import QApplication + from PyQt5.QtWidgets import QApplication # App initialization app = QApplication(sys.argv) diff --git a/src/patchcanvas.py b/src/patchcanvas.py index 126bca1..f6f4b9c 100644 --- a/src/patchcanvas.py +++ b/src/patchcanvas.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # PatchBay Canvas engine using QGraphicsView/Scene -# Copyright (C) 2010-2013 Filipe Coelho +# Copyright (C) 2010-2018 Filipe Coelho # # 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 @@ -17,14 +17,15 @@ # For a full copy of the GNU General Public License see the GPL.txt file # 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 +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 # Imports (Theme) from patchcanvas_theme import * diff --git a/src/patchcanvas_theme.py b/src/patchcanvas_theme.py index 581e2bd..e641587 100644 --- a/src/patchcanvas_theme.py +++ b/src/patchcanvas_theme.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # PatchBay Canvas Themes -# Copyright (C) 2010-2012 Filipe Coelho +# Copyright (C) 2010-2018 Filipe Coelho # # 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 @@ -19,8 +19,8 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt4.QtCore import Qt -from PyQt4.QtGui import QColor, QFont, QPen, QPixmap +from PyQt5.QtCore import Qt +from PyQt5.QtGui import QColor, QFont, QPen, QPixmap # ------------------------------------------------------------------------------------------------------------ # patchcanvas-theme.cpp diff --git a/src/render.py b/src/render.py index 95d0018..8447843 100755 --- a/src/render.py +++ b/src/render.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # JACK-Capture frontend, with freewheel and transport support -# Copyright (C) 2010-2013 Filipe Coelho +# Copyright (C) 2010-2018 Filipe Coelho # # 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 @@ -19,8 +19,8 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt4.QtCore import pyqtSlot, QProcess, QTime, QTimer, QSettings -from PyQt4.QtGui import QDialog +from PyQt5.QtCore import pyqtSlot, QProcess, QTime, QTimer, QSettings +from PyQt5.QtWidgets import QDialog from time import sleep # ------------------------------------------------------------------------------------------------------------ @@ -138,15 +138,15 @@ class RenderW(QDialog): # ------------------------------------------------------------- # 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) # ------------------------------------------------------------- @@ -429,7 +429,7 @@ class RenderW(QDialog): if __name__ == '__main__': # Additional imports - from PyQt4.QtGui import QApplication + from PyQt5.QtWidgets import QApplication # App initialization app = QApplication(sys.argv) diff --git a/src/shared.py b/src/shared.py index 6a26f5b..c1caa3b 100644 --- a/src/shared.py +++ b/src/shared.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # Common/Shared code -# Copyright (C) 2010-2013 Filipe Coelho +# Copyright (C) 2010-2018 Filipe Coelho # # 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 @@ -23,8 +23,9 @@ import os import sys from codecs import open as codecopen from unicodedata import normalize -from PyQt4.QtCore import qWarning, SIGNAL, SLOT -from PyQt4.QtGui import QApplication, QFileDialog, QIcon, QMessageBox +from PyQt5.QtCore import pyqtSignal, qWarning +from PyQt5.QtGui import QIcon +from PyQt5.QtWidgets import QApplication, QFileDialog, QMessageBox # ------------------------------------------------------------------------------------------------------------ # Set Platform @@ -216,8 +217,8 @@ def setUpSignals(self_): signal(SIGUSR1, 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): global gGui @@ -226,11 +227,11 @@ def signalHandler(sig, frame): return if sig in (SIGINT, SIGTERM): - gGui.emit(SIGNAL("SIGTERM()")) + gGui.SIGTERM.emit() elif sig == SIGUSR1: - gGui.emit(SIGNAL("SIGUSR1()")) + gGui.SIGUSR1.emit() elif sig == SIGUSR2: - gGui.emit(SIGNAL("SIGUSR2()")) + gGui.SIGUSR2.emit() def closeWindowHandler(): global gGui diff --git a/src/shared_cadence.py b/src/shared_cadence.py index b75febc..d232be2 100644 --- a/src/shared_cadence.py +++ b/src/shared_cadence.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # Common/Shared code for Cadence -# Copyright (C) 2012 Filipe Coelho +# Copyright (C) 2012-2018 Filipe Coelho # # 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 @@ -19,7 +19,7 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt4.QtCore import QProcess, QSettings +from PyQt5.QtCore import QProcess, QSettings from time import sleep # ------------------------------------------------------------------------------------------------------------ diff --git a/src/shared_canvasjack.py b/src/shared_canvasjack.py index 9265e17..4ef18ce 100644 --- a/src/shared_canvasjack.py +++ b/src/shared_canvasjack.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # Common/Shared code related to Canvas and JACK -# Copyright (C) 2010-2013 Filipe Coelho +# Copyright (C) 2010-2018 Filipe Coelho # # 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 @@ -19,8 +19,9 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt4.QtCore import pyqtSlot, QTimer -from PyQt4.QtGui import QCursor, QFontMetrics, QImage, QMainWindow, QMenu, QPainter, QPrinter, QPrintDialog +from PyQt5.QtCore import pyqtSlot, QTimer +from PyQt5.QtGui import QCursor, QFontMetrics, QImage, QPainter +from PyQt5.QtWidgets import QMainWindow, QMenu # ------------------------------------------------------------------------------------------------------------ # Imports (Custom Stuff) @@ -95,6 +96,10 @@ gJack.client = None # Abstract Canvas and JACK Class class AbstractCanvasJackClass(QMainWindow): + SIGTERM = pyqtSignal() + SIGUSR1 = pyqtSignal() + SIGUSR2 = pyqtSignal() + def __init__(self, appName, UiClass, parent): QMainWindow.__init__(self, parent) @@ -523,56 +528,56 @@ class AbstractCanvasJackClass(QMainWindow): def setCanvasConnections(self): 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_print.triggered.connect(self.slot_canvasPrint) + 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): 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.connect(self.slot_jackBufferSize_ComboBox) + self.ui.cb_sample_rate.currentIndexChanged.connect(self.slot_jackSampleRate_ComboBox) + self.ui.b_xruns.clicked.connect(self.slot_JackClearXruns) 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: - 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 LINUX: - self.connect(self.ui.act_show_logs, SIGNAL("triggered()"), SLOT("slot_showLogs()")) + self.ui.act_show_logs.triggered.connect(self.slot_showLogs) else: self.ui.act_show_logs.setEnabled(False) diff --git a/src/shared_settings.py b/src/shared_settings.py index 038e29a..5d4c823 100644 --- a/src/shared_settings.py +++ b/src/shared_settings.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # Common/Shared code related to the Settings dialog -# Copyright (C) 2010-2013 Filipe Coelho +# Copyright (C) 2010-2018 Filipe Coelho # # 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 @@ -19,8 +19,8 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt4.QtCore import pyqtSlot, QSettings -from PyQt4.QtGui import QDialog, QDialogButtonBox +from PyQt5.QtCore import pyqtSlot, QSettings +from PyQt5.QtWidgets import QDialog, QDialogButtonBox # ------------------------------------------------------------------------------------------------------------ # Imports (Custom Stuff) @@ -134,9 +134,10 @@ class SettingsW(QDialog): # ------------------------------------------------------------- # 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()")) + # FIXME QT4 + #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): settings = QSettings() From d85e6e6526d35af5a690afcf81b1dec4e0401ae8 Mon Sep 17 00:00:00 2001 From: falkTX Date: Mon, 19 Feb 2018 23:54:57 +0100 Subject: [PATCH 04/36] Continue port to Qt5 --- src/cadence.py | 225 ++++++++++++------------ src/cadence_aloop_daemon.py | 4 +- src/canvaspreviewframe.py | 26 ++- src/catarina.py | 16 +- src/catia.py | 9 - src/claudia.py | 337 ++++++++++++++++++------------------ src/claudia_launcher.py | 56 +++--- src/clickablelabel.py | 14 +- src/shared.py | 2 +- src/shared_canvasjack.py | 9 + src/systray.py | 60 ++----- 11 files changed, 378 insertions(+), 380 deletions(-) mode change 100644 => 100755 src/systray.py diff --git a/src/cadence.py b/src/cadence.py index 3828fc1..2e08c69 100755 --- a/src/cadence.py +++ b/src/cadence.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # Cadence, JACK utilities -# Copyright (C) 2010-2013 Filipe Coelho +# Copyright (C) 2010-2018 Filipe Coelho # # 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 @@ -20,8 +20,8 @@ # Imports (Global) from platform import architecture -from PyQt4.QtCore import QFileSystemWatcher, QThread -from PyQt4.QtGui import QApplication, QDialogButtonBox, QLabel, QMainWindow, QSizePolicy +from PyQt5.QtCore import QFileSystemWatcher, QThread +from PyQt5.QtWidgets import QApplication, QDialogButtonBox, QLabel, QMainWindow, QSizePolicy # ------------------------------------------------------------------------------------------------------------ # Imports (Custom Stuff) @@ -38,12 +38,9 @@ from shared_canvasjack 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 @@ -522,11 +519,11 @@ class ForceRestartThread(QThread): def run(self): # Not started yet self.m_wasStarted = False - self.emit(SIGNAL("progressChanged(int)"), 0) + self.progressChanged.emit(0) # Kill All stopAllAudioProcesses() - self.emit(SIGNAL("progressChanged(int)"), 30) + self.progressChanged.emit(30) # Connect to jackdbus self.parent().DBusReconnect() @@ -535,18 +532,18 @@ class ForceRestartThread(QThread): return for x in range(30): - self.emit(SIGNAL("progressChanged(int)"), 30+x*2) + self.progressChanged.emit(30+x*2) procsList = getProcList() if "jackdbus" in procsList: break else: sleep(0.1) - self.emit(SIGNAL("progressChanged(int)"), 90) + self.progressChanged.emit(90) # Start it gDBus.jack.StartServer() - self.emit(SIGNAL("progressChanged(int)"), 93) + self.progressChanged.emit(93) # If we made it this far, then JACK is started self.m_wasStarted = True @@ -558,7 +555,7 @@ class ForceRestartThread(QThread): startAlsaAudioLoopBridge() sleep(0.5) - self.emit(SIGNAL("progressChanged(int)"), 94) + self.progressChanged.emit(94) # ALSA-MIDI if GlobalSettings.value("A2J/AutoStart", True, type=bool) and gDBus.a2j and not bool(gDBus.a2j.is_started()): @@ -566,7 +563,7 @@ class ForceRestartThread(QThread): gDBus.a2j.set_hw_export(a2jExportHW) gDBus.a2j.start() - self.emit(SIGNAL("progressChanged(int)"), 96) + self.progressChanged.emit(96) # PulseAudio if GlobalSettings.value("Pulse2JACK/AutoStart", True, type=bool) and not isPulseAudioBridged(): @@ -575,7 +572,7 @@ class ForceRestartThread(QThread): else: os.system("cadence-pulse2jack") - self.emit(SIGNAL("progressChanged(int)"), 100) + self.progressChanged.emit(100) # Force Restart Dialog class ForceWaitDialog(QDialog, ui_cadence_rwait.Ui_Dialog): @@ -587,8 +584,8 @@ class ForceWaitDialog(QDialog, ui_cadence_rwait.Ui_Dialog): self.rThread = ForceRestartThread(self) self.rThread.start() - self.connect(self.rThread, SIGNAL("progressChanged(int)"), self.progressBar, SLOT("setValue(int)")) - self.connect(self.rThread, SIGNAL("finished()"), SLOT("slot_rThreadFinished()")) + self.rThread.progressChanged.connect(self.progressBar.setValue) + self.rThread.finished.connect(self.slot_rThreadFinished) def DBusReconnect(self): self.parent().DBusReconnect() @@ -627,8 +624,8 @@ class ToolBarJackDialog(QDialog, ui_cadence_tb_jack.Ui_Dialog): if self.m_ladishLoaded: 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): gDBus.ladish_control = gDBus.bus.get_object("org.ladish", "/org/ladish/Control") @@ -690,7 +687,7 @@ class ToolBarAlsaAudioDialog(QDialog, ui_cadence_tb_alsa.Ui_Dialog): else: self.comboBox.setCurrentIndex(0) - self.connect(self, SIGNAL("accepted()"), SLOT("slot_setOptions()")) + self.accepted.connect(self.slot_setOptions) @pyqtSlot() def slot_setOptions(self): @@ -714,7 +711,7 @@ class ToolBarA2JDialog(QDialog, ui_cadence_tb_a2j.Ui_Dialog): self.cb_export_hw.setChecked(GlobalSettings.value("A2J/ExportHW", True, type=bool)) - self.connect(self, SIGNAL("accepted()"), SLOT("slot_setOptions()")) + self.accepted.connect(self.slot_setOptions) @pyqtSlot() def slot_setOptions(self): @@ -732,7 +729,7 @@ class ToolBarPADialog(QDialog, ui_cadence_tb_pa.Ui_Dialog): 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() def slot_setOptions(self): @@ -744,6 +741,10 @@ class ToolBarPADialog(QDialog, ui_cadence_tb_pa.Ui_Dialog): # Main Window class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): + SIGTERM = pyqtSignal() + SIGUSR1 = pyqtSignal() + SIGUSR2 = pyqtSignal() + def __init__(self, parent=None): QMainWindow.__init__(self, parent) self.setupUi(self) @@ -797,8 +798,8 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): if haveFreqSelector and os.path.exists(self.m_availGovPath) and os.path.exists(self.m_curGovPath): self.m_govWatcher = QFileSystemWatcher(self) 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") availGovRead = availGovFd.read().strip() @@ -886,8 +887,9 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): self.settings_changed_types = [] self.frame_tweaks_settings.setVisible(False) - for i in range(self.tw_tweaks.rowCount()): - self.tw_tweaks.item(0, i).setTextAlignment(Qt.AlignCenter) + # FIXME QT4 + #for i in range(self.tw_tweaks.rowCount()): + #self.tw_tweaks.item(0, i).setTextAlignment(Qt.AlignCenter) self.tw_tweaks.setCurrentCell(0, 0) @@ -1112,81 +1114,82 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): # ------------------------------------------------------------- # 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()")) - - # org.jackaudio.JackControl - self.connect(self, SIGNAL("DBusJackServerStartedCallback()"), SLOT("slot_DBusJackServerStartedCallback()")) - self.connect(self, SIGNAL("DBusJackServerStoppedCallback()"), SLOT("slot_DBusJackServerStoppedCallback()")) - - # 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)")) - - # org.gna.home.a2jmidid.control - self.connect(self, SIGNAL("DBusA2JBridgeStartedCallback()"), SLOT("slot_DBusA2JBridgeStartedCallback()")) - self.connect(self, SIGNAL("DBusA2JBridgeStoppedCallback()"), SLOT("slot_DBusA2JBridgeStoppedCallback()")) + 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.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_a2j_export_hw.clicked.connect(self.slot_A2JBridgeExportHW) + self.tb_a2j_options.clicked.connect(self.slot_A2JBridgeOptions) + + 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(lambda tool="catia": self.func_start_tool(tool)) + self.pic_claudia.clicked.connect(lambda tool="claudia": self.func_start_tool(tool)) + self.pic_meter_in.clicked.connect(lambda tool="cadence-jackmeter -in": self.func_start_tool(tool)) + self.pic_meter_out.clicked.connect(lambda tool="cadence-jackmeter": self.func_start_tool(tool)) + self.pic_logs.clicked.connect(lambda tool="cadence-logs": self.func_start_tool(tool)) + self.pic_render.clicked.connect(lambda tool="cadence-render": self.func_start_tool(tool)) + self.pic_xycontroller.clicked.connect(lambda tool="cadence-xycontroller": self.func_start_tool(tool)) + + 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.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.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.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.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.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.connect(self.slot_tweaksSettingsChanged_wineasio) + + # FIXME QT4 + ## org.jackaudio.JackControl + #self.DBusJackServerStartedCallback.connect(self.slot_DBusJackServerStartedCallback) + #self.DBusJackServerStoppedCallback.connect(self.slot_DBusJackServerStoppedCallback) + + ## org.jackaudio.JackPatchbay + #self.DBusJackClientAppearedCallback.connect(self.slot_DBusJackClientAppearedCallback) + #self.DBusJackClientDisappearedCallback.connect(self.slot_DBusJackClientDisappearedCallback) + + ## org.gna.home.a2jmidid.control + #self.DBusA2JBridgeStartedCallback.connect(self.slot_DBusA2JBridgeStartedCallback) + #self.DBusA2JBridgeStoppedCallback.connect(self.slot_DBusA2JBridgeStoppedCallback) # ------------------------------------------------------------- @@ -1279,31 +1282,31 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): if not newId: # Something crashed 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": - QTimer.singleShot(0, self, SLOT("slot_handleCrash_a2j()")) + QTimer.singleShot(0, self.slot_handleCrash_a2j) elif kwds['interface'] == "org.jackaudio.JackControl": if DEBUG: print("org.jackaudio.JackControl", kwds['member']) if kwds['member'] == "ServerStarted": - self.emit(SIGNAL("DBusJackServerStartedCallback()")) + self.DBusJackServerStartedCallback.emit() elif kwds['member'] == "ServerStopped": - self.emit(SIGNAL("DBusJackServerStoppedCallback()")) + self.DBusJackServerStoppedCallback.emit() elif kwds['interface'] == "org.jackaudio.JackPatchbay": if gDBus.patchbay and kwds['path'] == gDBus.patchbay.object_path: if DEBUG: print("org.jackaudio.JackPatchbay,", kwds['member']) 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": - self.emit(SIGNAL("DBusJackClientDisappearedCallback(int)"), args[iJackClientId]) + self.DBusJackClientDisappearedCallback.emit(args[iJackClientId]) elif kwds['interface'] == "org.gna.home.a2jmidid.control": if DEBUG: print("org.gna.home.a2jmidid.control", kwds['member']) if kwds['member'] == "bridge_started": - self.emit(SIGNAL("DBusA2JBridgeStartedCallback()")) + self.DBusA2JBridgeStartedCallback.emit() elif kwds['member'] == "bridge_stopped": - self.emit(SIGNAL("DBusA2JBridgeStoppedCallback()")) + self.DBusA2JBridgeStoppedCallback.emit() def jackStarted(self): self.m_last_dsp_load = gDBus.jack.GetLoad() @@ -1789,7 +1792,7 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): if self.cb_cpufreq.currentIndex() == -1: # First init - self.connect(self.cb_cpufreq, SIGNAL("currentIndexChanged(QString)"), SLOT("slot_changeGovernorMode(QString)")) + self.cb_cpufreq.currentIndexChanged.connect(self.slot_changeGovernorMode) self.cb_cpufreq.blockSignals(True) diff --git a/src/cadence_aloop_daemon.py b/src/cadence_aloop_daemon.py index c8e46c8..2a627aa 100755 --- a/src/cadence_aloop_daemon.py +++ b/src/cadence_aloop_daemon.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # Cadence ALSA-Loop daemon -# Copyright (C) 2012-2013 Filipe Coelho +# Copyright (C) 2012-2018 Filipe Coelho # # 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 @@ -23,7 +23,7 @@ import os import sys from signal import signal, SIGINT, SIGTERM from time import sleep -from PyQt4.QtCore import QProcess +from PyQt5.QtCore import QProcess # ------------------------------------------------------------------------------------------------------------ # Imports (Custom Stuff) diff --git a/src/canvaspreviewframe.py b/src/canvaspreviewframe.py index e28a625..d928dd7 100644 --- a/src/canvaspreviewframe.py +++ b/src/canvaspreviewframe.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # Custom Mini Canvas Preview, a custom Qt4 widget -# Copyright (C) 2011-2013 Filipe Coelho +# Copyright (C) 2011-2018 Filipe Coelho # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -19,8 +19,14 @@ # ------------------------------------------------------------------------------------------------------------ # 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 @@ -34,6 +40,8 @@ iHeight = 3 # Widget Class class CanvasPreviewFrame(QFrame): + miniCanvasMoved = pyqtSignal(float, float) + def __init__(self, parent): QFrame.__init__(self, parent) @@ -97,7 +105,7 @@ class CanvasPreviewFrame(QFrame): def setViewScale(self, scale): self.fScale = scale - QTimer.singleShot(0, self.fRealParent, SLOT("slot_miniCanvasCheckAll()")) + QTimer.singleShot(0, self.fRealParent.slot_miniCanvasCheckAll) def setViewSize(self, width, height): self.fViewRect[iWidth] = width * self.fFakeWidth @@ -137,7 +145,7 @@ class CanvasPreviewFrame(QFrame): self.fViewRect[iY] = y + self.fRenderSource.y() 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): if event.button() == Qt.LeftButton: @@ -176,7 +184,7 @@ class CanvasPreviewFrame(QFrame): else: painter.setBrush(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) @@ -199,6 +207,8 @@ class CanvasPreviewFrame(QFrame): def resizeEvent(self, event): 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) diff --git a/src/catarina.py b/src/catarina.py index 6c2bf17..ddfabd6 100755 --- a/src/catarina.py +++ b/src/catarina.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # PatchCanvas test application -# Copyright (C) 2010-2013 Filipe Coelho +# Copyright (C) 2010-2018 Filipe Coelho # # 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 @@ -19,9 +19,11 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt4.QtCore import pyqtSlot, QSettings -from PyQt4.QtGui import QApplication, QDialog, QDialogButtonBox, QTableWidgetItem -from PyQt4.QtXml import QDomDocument +from PyQt5.QtCore import pyqtSlot, QSettings +from PyQt5.QtWidgets import QApplication, QDialog, QDialogButtonBox, QTableWidgetItem + +# FIXME QT4 +#from PyQt5.QtXml import QDomDocument # ------------------------------------------------------------------------------------------------------------ # Imports (Custom Stuff) @@ -42,7 +44,7 @@ from shared_settings import * # Try Import OpenGL try: - from PyQt4.QtOpenGL import QGLWidget + from PyQt5.QtOpenGL import QGLWidget hasGL = True except: hasGL = False @@ -86,8 +88,8 @@ class CatarinaAddGroupW(QDialog, ui_catarina_addgroup.Ui_CatarinaAddGroupW): for group in group_list: 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_split = False diff --git a/src/catia.py b/src/catia.py index 7879ba8..794c248 100755 --- a/src/catia.py +++ b/src/catia.py @@ -96,15 +96,6 @@ URI_CANVAS_ICON = "http://kxstudio.sf.net/ns/canvas/icon" # Catia Main Window class CatiaMainW(AbstractCanvasJackClass): - 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() - def __init__(self, parent=None): AbstractCanvasJackClass.__init__(self, "Catia", ui_catia.Ui_CatiaMainW, parent) diff --git a/src/claudia.py b/src/claudia.py index 1e717c9..3d241c9 100755 --- a/src/claudia.py +++ b/src/claudia.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # LADISH frontend -# Copyright (C) 2010-2013 Filipe Coelho +# Copyright (C) 2010-2018 Filipe Coelho # # 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 @@ -20,8 +20,8 @@ # Imports (Global) from time import ctime -from PyQt4.QtCore import QPointF -from PyQt4.QtGui import QAction, QApplication, QCheckBox, QHBoxLayout, QVBoxLayout, QTableWidgetItem, QTreeWidgetItem +from PyQt5.QtCore import QPointF +from PyQt5.QtWidgets import QAction, QApplication, QCheckBox, QHBoxLayout, QVBoxLayout, QTableWidgetItem, QTreeWidgetItem # ------------------------------------------------------------------------------------------------------------ # Imports (Custom Stuff) @@ -207,8 +207,8 @@ class StudioNameW(QDialog): for studio in studioList: 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 = "" @@ -252,9 +252,9 @@ class StudioListW(QDialog, ui_claudia_studiolist.Ui_StudioListW): 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: self.tableWidget.setCurrentCell(0, 0) @@ -287,8 +287,8 @@ class CreateRoomW(QDialog, ui_claudia_createroom.Ui_CreateRoomW): for template_name, template_dict in templates_list: 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: self.lw_templates.setCurrentRow(0) @@ -332,10 +332,10 @@ class ProjectNameW(QDialog, ui_claudia_projectname.Ui_ProjectNameW): 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_path = "" @@ -384,9 +384,9 @@ class ProjectPropertiesW(QDialog, ui_claudia_projectproperties.Ui_ProjectPropert self.m_default_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_description.setText(description) @@ -458,8 +458,8 @@ class RunCustomW(QDialog, ui_claudia_runcustom.Ui_RunCustomW): self.rb_level_lash.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 @@ -532,8 +532,8 @@ class ClaudiaLauncherW(QDialog): 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 @@ -752,7 +752,7 @@ class ClaudiaMainW(AbstractCanvasJackClass): 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.init(self.scene, DEFAULT_CANVAS_WIDTH, DEFAULT_CANVAS_HEIGHT) - QTimer.singleShot(100, self, SLOT("slot_miniCanvasInit()")) + QTimer.singleShot(100, self.slot_miniCanvasInit) # ------------------------------------------------------------- # Check DBus @@ -795,104 +795,105 @@ class ClaudiaMainW(AbstractCanvasJackClass): self.setCanvasConnections() 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()")) - - # org.freedesktop.DBus - self.connect(self, SIGNAL("DBusCrashCallback(QString)"), SLOT("slot_DBusCrashCallback(QString)")) - - # org.jackaudio.JackControl - self.connect(self, SIGNAL("DBusServerStartedCallback()"), SLOT("slot_DBusServerStartedCallback()")) - self.connect(self, SIGNAL("DBusServerStoppedCallback()"), SLOT("slot_DBusServerStoppedCallback()")) - - # 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)")) - - # 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()")) - - # 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()")) - - # org.ladish.Room - self.connect(self, SIGNAL("DBusProjectPropertiesChanged(QString, QString)"), SLOT("slot_DBusProjectPropertiesChanged(QString, QString)")) - - # 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.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) + + # FIXME QT4 + ## org.freedesktop.DBus + #self.DBusCrashCallback.connect(self.slot_DBusCrashCallback) + + ## org.jackaudio.JackControl + #self.DBusServerStartedCallback.connect(self.slot_DBusServerStartedCallback) + #self.DBusServerStoppedCallback.connect(self.slot_DBusServerStoppedCallback) + + ## org.jackaudio.JackPatchbay + #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 + #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 + #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 + #self.DBusProjectPropertiesChanged.connect(self.slot_DBusProjectPropertiesChanged) + + ## org.ladish.AppSupervisor + #self.DBusAppAdded2Callback.connect(self.slot_DBusAppAdded2Callback) + #self.DBusAppRemovedCallback.connect(self.slot_DBusAppRemovedCallback) + #self.DBusAppStateChanged2Callback.connect(self.slot_DBusAppStateChanged2Callback) # 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 @@ -1161,7 +1162,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 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): room_index = int(room_path.replace("/org/ladish/Room", "")) @@ -1254,35 +1255,35 @@ class ClaudiaMainW(AbstractCanvasJackClass): if y2 is None: y2 = "%f" % (float(y) + 50) 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): 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): 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): 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): 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): 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): 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): patchcanvas.disconnectPorts(connection_id) - QTimer.singleShot(0, self.ui.miniCanvasPreview, SLOT("update()")) + QTimer.singleShot(0, self.ui.miniCanvasPreview.update) def jackStarted(self): if jacksettings.needsInit(): @@ -1497,85 +1498,85 @@ class ClaudiaMainW(AbstractCanvasJackClass): if not newId: # Something crashed 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"): # Prevent any more dbus calls gDBus.jack = None gJack.client = None jacksettings.initBus(None) - self.emit(SIGNAL("DBusCrashCallback(QString)"), appInterface) + self.DBusCrashCallback.emit(appInterface) elif kwds['interface'] == "org.jackaudio.JackControl": if DEBUG: print("DBus signal @org.jackaudio.JackControl,", kwds['member']) if kwds['member'] == "ServerStarted": - self.emit(SIGNAL("DBusServerStartedCallback()")) + self.DBusServerStartedCallback.emit() elif kwds['member'] == "ServerStopped": - self.emit(SIGNAL("DBusServerStoppedCallback()")) + self.DBusServerStoppedCallback.emit() elif kwds['interface'] == "org.jackaudio.JackPatchbay": if gDBus.patchbay and kwds['path'] == gDBus.patchbay.object_path: if DEBUG: print("DBus signal @org.jackaudio.JackPatchbay,", kwds['member']) 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": - self.emit(SIGNAL("DBusClientDisappearedCallback(int)"), args[iJackClientId]) + self.DBusClientDisappearedCallback.emit(args[iJackClientId]) 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": - 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": - self.emit(SIGNAL("DBusPortDisppearedCallback(int)"), args[iJackPortId]) + self.DBusPortDisppearedCallback.emit(args[iJackPortId]) 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": - 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": - self.emit(SIGNAL("DBusPortsDisconnectedCallback(int)"), args[iJackConnId]) + self.DBusPortsDisconnectedCallback.emit(args[iJackConnId]) elif kwds['interface'] == "org.ladish.Control": if DEBUG: print("DBus signal @org.ladish.Control,", kwds['member']) if kwds['member'] == "StudioAppeared": - self.emit(SIGNAL("DBusStudioAppearedCallback()")) + self.DBusStudioAppearedCallback.emit() elif kwds['member'] == "StudioDisappeared": - self.emit(SIGNAL("DBusStudioDisappearedCallback()")) + self.DBusStudioDisappearedCallback.emit() elif kwds['member'] == "QueueExecutionHalted": - self.emit(SIGNAL("DBusQueueExecutionHaltedCallback()")) + self.DBusQueueExecutionHaltedCallback.emit() elif kwds['member'] == "CleanExit": - self.emit(SIGNAL("DBusCleanExitCallback()")) + self.DBusCleanExitCallback.emit() elif kwds['interface'] == "org.ladish.Studio": if DEBUG: print("DBus signal @org.ladish.Studio,", kwds['member']) if kwds['member'] == "StudioStarted": - self.emit(SIGNAL("DBusStudioStartedCallback()")) + self.DBusStudioStartedCallback.emit() elif kwds['member'] == "StudioStopped": - self.emit(SIGNAL("DBusStudioStoppedCallback()")) + self.DBusStudioStoppedCallback.emit() elif kwds['member'] == "StudioRenamed": - self.emit(SIGNAL("DBusStudioRenamedCallback(QString)"), args[iStudioRenamedName]) + self.DBusStudioRenamedCallback.emit(args[iStudioRenamedName]) elif kwds['member'] == "StudioCrashed": - self.emit(SIGNAL("DBusStudioCrashedCallback()")) + self.DBusStudioCrashedCallback.emit() 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": - self.emit(SIGNAL("DBusRoomDisappearedCallback(QString)"), args[iRoomAppearedPath]) + self.DBusRoomDisappearedCallback.emit(args[iRoomAppearedPath]) #elif kwds['member'] == "RoomChanged": - #self.emit(SIGNAL("DBusRoomChangedCallback()")) + #self.DBusRoomChangedCallback.emit() elif kwds['interface'] == "org.ladish.Room": if DEBUG: print("DBus signal @org.ladish.Room,", kwds['member']) if kwds['member'] == "ProjectPropertiesChanged": 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: - self.emit(SIGNAL("DBusProjectPropertiesChanged(QString, QString)"), kwds['path'], "") + self.DBusProjectPropertiesChanged.emit(kwds['path'], "") elif kwds['interface'] == "org.ladish.AppSupervisor": if DEBUG: print("DBus signal @org.ladish.AppSupervisor,", kwds['member']) 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": - self.emit(SIGNAL("DBusAppRemovedCallback(QString, int)"), kwds['path'], args[iAppChangedNumber]) + self.DBusAppRemovedCallback.emit(kwds['path'], args[iAppChangedNumber]) 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": if kwds['member'] == "bridge_started": @@ -1618,17 +1619,17 @@ class ClaudiaMainW(AbstractCanvasJackClass): def JackBufferSizeCallback(self, buffer_size, arg): if DEBUG: print("JackBufferSizeCallback(%i)" % buffer_size) - self.emit(SIGNAL("JackBufferSizeCallback(int)"), buffer_size) + self.BufferSizeCallback.emit(buffer_size) return 0 def JackSampleRateCallback(self, sample_rate, arg): if DEBUG: print("JackSampleRateCallback(%i)" % sample_rate) - self.emit(SIGNAL("JackSampleRateCallback(int)"), sample_rate) + self.SampleRateCallback.emit(sample_rate) return 0 def JackShutdownCallback(self, arg): - if DEBUG: print("JackShutdownCallback()") - self.emit(SIGNAL("JackShutdownCallback()")) + if DEBUG: print("JackShutdownCallback") + self.ShutdownCallback.emit() return 0 @pyqtSlot() @@ -1893,7 +1894,7 @@ class ClaudiaMainW(AbstractCanvasJackClass): studio_name = str(studio[iStudioListName]) act_x_studio = QAction(studio_name, self.ui.menu_studio_load) 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() def slot_updateMenuStudioList_Delete(self): @@ -1909,7 +1910,7 @@ class ClaudiaMainW(AbstractCanvasJackClass): studio_name = str(studio[iStudioListName]) act_x_studio = QAction(studio_name, self.ui.menu_studio_delete) 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() def slot_updateMenuRoomList(self): @@ -1924,7 +1925,7 @@ class ClaudiaMainW(AbstractCanvasJackClass): room_name = ladish_room.GetName() act_x_room = QAction(room_name, self.ui.menu_room_delete) 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: self.createEmptyMenuRoomActon() @@ -1938,7 +1939,7 @@ class ClaudiaMainW(AbstractCanvasJackClass): self.ui.menu_project_load.clear() act_project_load = QAction(self.tr("Load from folder..."), self.ui.menu_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") proj_list = ladish_recent_iface.get(RECENT_PROJECTS_STORE_MAX_ITEMS) @@ -1954,7 +1955,7 @@ class ClaudiaMainW(AbstractCanvasJackClass): act_x_text = "%s [%s]" % (proj_name, proj_path) act_x_proj = QAction(act_x_text, self.ui.menu_project_load) 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() def slot_showAppListCustomMenu(self): @@ -2193,11 +2194,11 @@ class ClaudiaMainW(AbstractCanvasJackClass): if appInterface == "org.jackaudio.service": if not (self.m_crashedJACK or self.m_crashedLADISH): self.m_crashedJACK = True - QTimer.singleShot(1000, self, SLOT("slot_handleCrash_jack()")) + QTimer.singleShot(1000, self.slot_handleCrash_jack) elif appInterface == "org.ladish": if not (self.m_crashedJACK or self.m_crashedLADISH): self.m_crashedLADISH = True - QTimer.singleShot(1000, self, SLOT("slot_handleCrash_ladish()")) + QTimer.singleShot(1000, self.slot_handleCrash_ladish) @pyqtSlot() def slot_DBusServerStartedCallback(self): @@ -2310,7 +2311,7 @@ class ClaudiaMainW(AbstractCanvasJackClass): @pyqtSlot() def slot_DBusStudioCrashedCallback(self): - QTimer.singleShot(0, self, SLOT("slot_handleCrash_studio()")) + QTimer.singleShot(0, self.slot_handleCrash_studio) @pyqtSlot(str, str) def slot_DBusRoomAppearedCallback(self, room_path, room_name): @@ -2671,7 +2672,7 @@ class ClaudiaMainW(AbstractCanvasJackClass): self.ui.act_app_add_new.setEnabled(USE_CLAUDIA_ADD_NEW) def resizeEvent(self, event): - QTimer.singleShot(0, self, SLOT("slot_miniCanvasCheckSize()")) + QTimer.singleShot(0, self.slot_miniCanvasCheckSize) QMainWindow.resizeEvent(self, event) def timerEvent(self, event): diff --git a/src/claudia_launcher.py b/src/claudia_launcher.py index 173b2be..35578d2 100755 --- a/src/claudia_launcher.py +++ b/src/claudia_launcher.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # ... TODO -# Copyright (C) 2010-2013 Filipe Coelho +# Copyright (C) 2010-2018 Filipe Coelho # # 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 @@ -19,8 +19,8 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt4.QtCore import pyqtSlot, Qt, QTimer, QSettings -from PyQt4.QtGui import QMainWindow, QTableWidgetItem, QWidget +from PyQt5.QtCore import pyqtSlot, Qt, QTimer, QSettings +from PyQt5.QtWidgets import QMainWindow, QTableWidgetItem, QWidget from random import randint # ------------------------------------------------------------------------------------------------------------ @@ -170,22 +170,22 @@ class ClaudiaLauncher(QWidget, ui_claudia_launcher.Ui_ClaudiaLauncherW): 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): tabIndex = self.tabWidget.currentIndex() @@ -1119,7 +1119,7 @@ class ClaudiaLauncher(QWidget, ui_claudia_launcher.Ui_ClaudiaLauncherW): if __name__ == '__main__': import dbus from signal import signal, SIG_IGN, SIGUSR1 - from PyQt4.QtGui import QApplication + from PyQt5.QtWidgets import QApplication import jacklib, ui_claudia_launcher_app # DBus connections @@ -1149,7 +1149,7 @@ if __name__ == '__main__': # Check for JACK self.jack_client = jacklib.client_open("klaudia", jacklib.JackNoStartServer, None) if not self.jack_client: - QTimer.singleShot(0, self, SLOT("slot_showJackError()")) + QTimer.singleShot(0, self.slot_showJackError) return # Set-up GUI @@ -1175,15 +1175,15 @@ if __name__ == '__main__': else: 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.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): return self.launcher.getIcon(icon) diff --git a/src/clickablelabel.py b/src/clickablelabel.py index dbcbfe7..d639c5f 100644 --- a/src/clickablelabel.py +++ b/src/clickablelabel.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # Clickable Label, a custom Qt4 widget -# Copyright (C) 2011-2013 Filipe Coelho +# Copyright (C) 2011-2018 Filipe Coelho # # 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 @@ -19,23 +19,27 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt4.QtCore import pyqtSlot, Qt, QTimer, SIGNAL, SLOT -from PyQt4.QtGui import QLabel +from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QTimer +from PyQt5.QtWidgets import QLabel # ------------------------------------------------------------------------------------------------------------ # Widget Class class ClickableLabel(QLabel): + clicked = pyqtSignal() + def __init__(self, parent): QLabel.__init__(self, parent) self.setCursor(Qt.PointingHandCursor) def mousePressEvent(self, event): - self.emit(SIGNAL("clicked()")) + self.clicked.emit() + # Use busy cursor for 2 secs self.setCursor(Qt.WaitCursor) - QTimer.singleShot(2000, self, SLOT("slot_setNormalCursor()")) + QTimer.singleShot(2000, self.slot_setNormalCursor) + QLabel.mousePressEvent(self, event) @pyqtSlot() diff --git a/src/shared.py b/src/shared.py index c1caa3b..e16d8c0 100644 --- a/src/shared.py +++ b/src/shared.py @@ -31,7 +31,7 @@ from PyQt5.QtWidgets import QApplication, QFileDialog, QMessageBox # Set Platform 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) HAIKU = False LINUX = False diff --git a/src/shared_canvasjack.py b/src/shared_canvasjack.py index 4ef18ce..76c66b9 100644 --- a/src/shared_canvasjack.py +++ b/src/shared_canvasjack.py @@ -96,6 +96,15 @@ gJack.client = None # Abstract Canvas and JACK Class 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() diff --git a/src/systray.py b/src/systray.py old mode 100644 new mode 100755 index 1ec8dfc..5f65923 --- a/src/systray.py +++ b/src/systray.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # KDE, App-Indicator or Qt Systray -# Copyright (C) 2011-2012 Filipe Coelho +# Copyright (C) 2011-2018 Filipe Coelho # # 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 @@ -18,41 +18,20 @@ # Imports (Global) import os, sys -from PyQt4.QtCore import QTimer, SIGNAL -from PyQt4.QtGui import QAction, QIcon, QMainWindow, QMenu, QSystemTrayIcon +from PyQt5.QtCore import QTimer +from PyQt5.QtGui import QIcon +from PyQt5.QtWidgets import QAction, QMainWindow, QMenu, QSystemTrayIcon try: - 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 - + if os.getenv("DESKTOP_SESSION") in ("ubuntu", "ubuntu-2d") and not os.path.exists("/var/cadence/no_app_indicators"): + from gi.repository import Gtk, AppIndicator3 as 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 + elif os.getenv("KDE_FULL_SESSION") or os.getenv("DESKTOP_SESSION") == "kde-plasma": + from PyKDE5.kdeui import KAction, KIcon, KMenu, KStatusNotifierItem TrayEngine = "KDE" else: @@ -117,7 +96,7 @@ class GlobalSysTray(object): self.tray = QSystemTrayIcon(getIcon(icon)) self.tray.setContextMenu(self.menu) 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 +268,11 @@ class GlobalSysTray(object): 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) - 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 @@ -488,12 +464,14 @@ class GlobalSysTray(object): def isTrayAvailable(self): if TrayEngine in ("KDE", "Qt"): + # Ask Qt return QSystemTrayIcon.isSystemTrayAvailable() - elif TrayEngine == "AppIndicator": + + if TrayEngine == "AppIndicator": # Ubuntu/Unity always has a systray return True - else: - return False + + return False def handleQtCloseEvent(self, event): if self.isTrayAvailable() and self._parent.isVisible(): @@ -660,7 +638,7 @@ class GlobalSysTray(object): #--------------- main ------------------ if __name__ == '__main__': - from PyQt4.QtGui import QApplication, QDialog, QMessageBox + from PyQt5.QtWidgets import QApplication, QDialog, QMessageBox class ExampleGUI(QDialog): def __init__(self, parent=None): From 9ded51b0052899becbdd3a26c1976a413b3a8406 Mon Sep 17 00:00:00 2001 From: falkTX Date: Thu, 22 Feb 2018 23:00:57 +0100 Subject: [PATCH 05/36] Cleanup, compat for IDE --- src/cadence.py | 9 +++++++-- src/cadence_aloop_daemon.py | 6 +++++- src/cadence_session_start.py | 5 ++++- src/catarina.py | 14 +++++++++----- src/claudia.py | 9 +++++++-- src/claudia_launcher.py | 9 +++++++-- src/clickablelabel.py | 8 ++++++-- src/jacksettings.py | 12 +++++++++--- src/logs.py | 11 ++++++++--- src/patchcanvas.py | 23 ++++++++++++++++------- src/patchcanvas_theme.py | 8 ++++++-- src/render.py | 9 +++++++-- src/shared.py | 12 +++++++++--- src/shared_cadence.py | 6 +++++- src/shared_canvasjack.py | 11 ++++++++--- src/shared_settings.py | 8 ++++++-- src/systray.py | 12 +++++++++--- 17 files changed, 128 insertions(+), 44 deletions(-) diff --git a/src/cadence.py b/src/cadence.py index 2e08c69..4800bcd 100755 --- a/src/cadence.py +++ b/src/cadence.py @@ -20,8 +20,13 @@ # Imports (Global) from platform import architecture -from PyQt5.QtCore import QFileSystemWatcher, QThread -from PyQt5.QtWidgets import QApplication, QDialogButtonBox, QLabel, QMainWindow, QSizePolicy + +if True: + from PyQt5.QtCore import QFileSystemWatcher, QThread + from PyQt5.QtWidgets import QApplication, QDialogButtonBox, QLabel, QMainWindow, QSizePolicy +else: + from PyQt4.QtCore import QFileSystemWatcher, QThread + from PyQt4.QtGui import QApplication, QDialogButtonBox, QLabel, QMainWindow, QSizePolicy # ------------------------------------------------------------------------------------------------------------ # Imports (Custom Stuff) diff --git a/src/cadence_aloop_daemon.py b/src/cadence_aloop_daemon.py index 2a627aa..c8408ef 100755 --- a/src/cadence_aloop_daemon.py +++ b/src/cadence_aloop_daemon.py @@ -23,7 +23,11 @@ import os import sys from signal import signal, SIGINT, SIGTERM from time import sleep -from PyQt5.QtCore import QProcess + +if True: + from PyQt5.QtCore import QProcess +else: + from PyQt4.QtCore import QProcess # ------------------------------------------------------------------------------------------------------------ # Imports (Custom Stuff) diff --git a/src/cadence_session_start.py b/src/cadence_session_start.py index 135b869..6f26a70 100755 --- a/src/cadence_session_start.py +++ b/src/cadence_session_start.py @@ -3,7 +3,10 @@ # Imports (Global) import dbus, sys -from PyQt4.QtCore import QCoreApplication +if True: + from PyQt5.QtCore import QCoreApplication +else: + from PyQt4.QtCore import QCoreApplication # Imports (Custom Stuff) from shared_cadence import * diff --git a/src/catarina.py b/src/catarina.py index ddfabd6..3fff71b 100755 --- a/src/catarina.py +++ b/src/catarina.py @@ -19,11 +19,15 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import pyqtSlot, QSettings -from PyQt5.QtWidgets import QApplication, QDialog, QDialogButtonBox, QTableWidgetItem - -# FIXME QT4 -#from PyQt5.QtXml import QDomDocument +if True: + from PyQt5.QtCore import pyqtSlot, QSettings + from PyQt5.QtWidgets import QApplication, QDialog, QDialogButtonBox, QTableWidgetItem + # FIXME QT4 + #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) diff --git a/src/claudia.py b/src/claudia.py index 3d241c9..2d5f1c1 100755 --- a/src/claudia.py +++ b/src/claudia.py @@ -20,8 +20,13 @@ # Imports (Global) from time import ctime -from PyQt5.QtCore import QPointF -from PyQt5.QtWidgets 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) diff --git a/src/claudia_launcher.py b/src/claudia_launcher.py index 35578d2..5daad6c 100755 --- a/src/claudia_launcher.py +++ b/src/claudia_launcher.py @@ -19,10 +19,15 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import pyqtSlot, Qt, QTimer, QSettings -from PyQt5.QtWidgets import QMainWindow, QTableWidgetItem, QWidget 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) diff --git a/src/clickablelabel.py b/src/clickablelabel.py index d639c5f..ef47999 100644 --- a/src/clickablelabel.py +++ b/src/clickablelabel.py @@ -19,8 +19,12 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QTimer -from PyQt5.QtWidgets 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 diff --git a/src/jacksettings.py b/src/jacksettings.py index 039c884..013ba84 100755 --- a/src/jacksettings.py +++ b/src/jacksettings.py @@ -19,11 +19,17 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import pyqtSlot, Qt, QSettings, QTimer -from PyQt5.QtGui import QFontMetrics -from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QMessageBox 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) diff --git a/src/logs.py b/src/logs.py index 5c5e1f7..1909f05 100755 --- a/src/logs.py +++ b/src/logs.py @@ -19,9 +19,14 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import pyqtSlot, Qt, QFile, QIODevice, QMutex, QMutexLocker, QTextStream, QThread, QSettings -from PyQt5.QtGui import QPalette, QSyntaxHighlighter -from PyQt5.QtWidgets import QDialog +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) diff --git a/src/patchcanvas.py b/src/patchcanvas.py index f6f4b9c..cfa8441 100644 --- a/src/patchcanvas.py +++ b/src/patchcanvas.py @@ -17,13 +17,22 @@ # For a full copy of the GNU General Public License see the GPL.txt file # Imports (Global) -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 +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 +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 PyQt5.QtSvg import QGraphicsSvgItem, QSvgRenderer diff --git a/src/patchcanvas_theme.py b/src/patchcanvas_theme.py index e641587..110e980 100644 --- a/src/patchcanvas_theme.py +++ b/src/patchcanvas_theme.py @@ -19,8 +19,12 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import Qt -from PyQt5.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 diff --git a/src/render.py b/src/render.py index 8447843..0f5f8b0 100755 --- a/src/render.py +++ b/src/render.py @@ -19,10 +19,15 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import pyqtSlot, QProcess, QTime, QTimer, QSettings -from PyQt5.QtWidgets import QDialog 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) diff --git a/src/shared.py b/src/shared.py index e16d8c0..a758736 100644 --- a/src/shared.py +++ b/src/shared.py @@ -23,9 +23,15 @@ import os import sys from codecs import open as codecopen from unicodedata import normalize -from PyQt5.QtCore import pyqtSignal, qWarning -from PyQt5.QtGui import QIcon -from PyQt5.QtWidgets import QApplication, QFileDialog, 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 diff --git a/src/shared_cadence.py b/src/shared_cadence.py index d232be2..f69abeb 100644 --- a/src/shared_cadence.py +++ b/src/shared_cadence.py @@ -19,9 +19,13 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import QProcess, QSettings from time import sleep +if True: + from PyQt5.QtCore import QProcess, QSettings +else: + from PyQt4.QtCore import QProcess, QSettings + # ------------------------------------------------------------------------------------------------------------ # Imports (Custom Stuff) diff --git a/src/shared_canvasjack.py b/src/shared_canvasjack.py index 76c66b9..1241f3e 100644 --- a/src/shared_canvasjack.py +++ b/src/shared_canvasjack.py @@ -19,9 +19,14 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import pyqtSlot, QTimer -from PyQt5.QtGui import QCursor, QFontMetrics, QImage, QPainter -from PyQt5.QtWidgets import QMainWindow, QMenu +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) diff --git a/src/shared_settings.py b/src/shared_settings.py index 5d4c823..875f042 100644 --- a/src/shared_settings.py +++ b/src/shared_settings.py @@ -19,8 +19,12 @@ # ------------------------------------------------------------------------------------------------------------ # Imports (Global) -from PyQt5.QtCore import pyqtSlot, QSettings -from PyQt5.QtWidgets 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) diff --git a/src/systray.py b/src/systray.py index 5f65923..90f34b5 100755 --- a/src/systray.py +++ b/src/systray.py @@ -18,9 +18,15 @@ # Imports (Global) import os, sys -from PyQt5.QtCore import QTimer -from PyQt5.QtGui import QIcon -from PyQt5.QtWidgets import QAction, 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: if os.getenv("DESKTOP_SESSION") in ("ubuntu", "ubuntu-2d") and not os.path.exists("/var/cadence/no_app_indicators"): From 006d09e77f8484cf40ad185281bdebf850dfbf56 Mon Sep 17 00:00:00 2001 From: falkTX Date: Fri, 23 Feb 2018 00:02:01 +0100 Subject: [PATCH 06/36] Finish porting to Qt5, please test --- resources/ui/catarina.ui | 12 +--- resources/ui/catia.ui | 12 +--- resources/ui/claudia.ui | 12 +--- src/cadence.py | 33 +++++---- src/canvaspreviewframe.py | 2 +- src/catarina.py | 139 +++++++++++++++++++------------------- src/catia.py | 6 +- src/claudia.py | 110 ++++++++++++++++++------------ src/clickablelabel.py | 2 +- src/jacksettings.py | 27 ++++---- src/patchcanvas.py | 4 +- src/shared.py | 1 - src/shared_canvasjack.py | 15 ---- src/shared_settings.py | 3 +- 14 files changed, 181 insertions(+), 197 deletions(-) diff --git a/resources/ui/catarina.ui b/resources/ui/catarina.ui index fe77fce..1421c5e 100644 --- a/resources/ui/catarina.ui +++ b/resources/ui/catarina.ui @@ -419,7 +419,7 @@ 0 0 651 - 19 + 20 @@ -483,7 +483,6 @@ - @@ -677,15 +676,6 @@ Ctrl+G - - - - :/16x16/document-print.png:/16x16/document-print.png - - - Print... - - Save Image... diff --git a/resources/ui/catia.ui b/resources/ui/catia.ui index 3b7ec2b..ff6d5d9 100644 --- a/resources/ui/catia.ui +++ b/resources/ui/catia.ui @@ -458,7 +458,7 @@ 0 0 702 - 19 + 20 @@ -501,7 +501,6 @@ - @@ -940,15 +939,6 @@ Save As &Template... - - - - :/16x16/document-print.png:/16x16/document-print.png - - - &Print... - - Save &Image... diff --git a/resources/ui/claudia.ui b/resources/ui/claudia.ui index f1a27df..3283316 100644 --- a/resources/ui/claudia.ui +++ b/resources/ui/claudia.ui @@ -770,7 +770,7 @@ 0 0 877 - 19 + 20 @@ -916,7 +916,6 @@ - @@ -1346,15 +1345,6 @@ Ctrl+1 - - - - :/16x16/document-print.png:/16x16/document-print.png - - - Print... - - Save Image... diff --git a/src/cadence.py b/src/cadence.py index 4800bcd..20d250d 100755 --- a/src/cadence.py +++ b/src/cadence.py @@ -52,7 +52,7 @@ from subprocess import getoutput try: import dbus - from dbus.mainloop.qt import DBusQtMainLoop + from dbus.mainloop.pyqt5 import DBusQtMainLoop haveDBus = True except: haveDBus = False @@ -746,6 +746,13 @@ class ToolBarPADialog(QDialog, ui_cadence_tb_pa.Ui_Dialog): # Main Window 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() @@ -892,9 +899,8 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): self.settings_changed_types = [] self.frame_tweaks_settings.setVisible(False) - # FIXME QT4 - #for i in range(self.tw_tweaks.rowCount()): - #self.tw_tweaks.item(0, i).setTextAlignment(Qt.AlignCenter) + for i in range(self.tw_tweaks.rowCount()): + self.tw_tweaks.item(i, 0).setTextAlignment(Qt.AlignCenter) self.tw_tweaks.setCurrentCell(0, 0) @@ -1183,18 +1189,17 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): self.cb_wineasio_fixed_bsize.clicked.connect(self.slot_tweaksSettingsChanged_wineasio) self.cb_wineasio_bsizes.currentIndexChanged.connect(self.slot_tweaksSettingsChanged_wineasio) - # FIXME QT4 - ## org.jackaudio.JackControl - #self.DBusJackServerStartedCallback.connect(self.slot_DBusJackServerStartedCallback) - #self.DBusJackServerStoppedCallback.connect(self.slot_DBusJackServerStoppedCallback) + # org.jackaudio.JackControl + self.DBusJackServerStartedCallback.connect(self.slot_DBusJackServerStartedCallback) + self.DBusJackServerStoppedCallback.connect(self.slot_DBusJackServerStoppedCallback) - ## org.jackaudio.JackPatchbay - #self.DBusJackClientAppearedCallback.connect(self.slot_DBusJackClientAppearedCallback) - #self.DBusJackClientDisappearedCallback.connect(self.slot_DBusJackClientDisappearedCallback) + # org.jackaudio.JackPatchbay + self.DBusJackClientAppearedCallback.connect(self.slot_DBusJackClientAppearedCallback) + self.DBusJackClientDisappearedCallback.connect(self.slot_DBusJackClientDisappearedCallback) - ## org.gna.home.a2jmidid.control - #self.DBusA2JBridgeStartedCallback.connect(self.slot_DBusA2JBridgeStartedCallback) - #self.DBusA2JBridgeStoppedCallback.connect(self.slot_DBusA2JBridgeStoppedCallback) + # org.gna.home.a2jmidid.control + self.DBusA2JBridgeStartedCallback.connect(self.slot_DBusA2JBridgeStartedCallback) + self.DBusA2JBridgeStoppedCallback.connect(self.slot_DBusA2JBridgeStoppedCallback) # ------------------------------------------------------------- diff --git a/src/canvaspreviewframe.py b/src/canvaspreviewframe.py index d928dd7..e04611e 100644 --- a/src/canvaspreviewframe.py +++ b/src/canvaspreviewframe.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -# Custom Mini Canvas Preview, a custom Qt4 widget +# Custom Mini Canvas Preview, a custom Qt widget # Copyright (C) 2011-2018 Filipe Coelho # # This program is free software; you can redistribute it and/or diff --git a/src/catarina.py b/src/catarina.py index 3fff71b..3a3156e 100755 --- a/src/catarina.py +++ b/src/catarina.py @@ -22,8 +22,7 @@ if True: from PyQt5.QtCore import pyqtSlot, QSettings from PyQt5.QtWidgets import QApplication, QDialog, QDialogButtonBox, QTableWidgetItem - # FIXME QT4 - #from PyQt5.QtXml import QDomDocument + from PyQt5.QtXml import QDomDocument else: from PyQt4.QtCore import pyqtSlot, QSettings from PyQt4.QtGui import QApplication, QDialog, QDialogButtonBox, QTableWidgetItem @@ -133,9 +132,9 @@ class CatarinaRemoveGroupW(QDialog, ui_catarina_removegroup.Ui_CatarinaRemoveGro self.tw_group_list.setItem(index, 2, twi_group_split) 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 @@ -169,9 +168,9 @@ class CatarinaRenameGroupW(QDialog, ui_catarina_renamegroup.Ui_CatarinaRenameGro self.cb_group_to_rename.addItem("%i - %s" % (group[iGroupId], 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.connect(self.slot_checkItem) + self.le_new_group_name.textChanged.connect(self.slot_checkText) self.ret_group_id = -1 self.ret_new_group_name = "" @@ -210,8 +209,8 @@ class CatarinaAddPortW(QDialog, ui_catarina_addport.Ui_CatarinaAddPortW): for group in group_list: 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_port_name = "" @@ -249,15 +248,15 @@ class CatarinaRemovePortW(QDialog, ui_catarina_removeport.Ui_CatarinaRemovePortW self.m_group_list = group_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.reAddPorts() @@ -331,16 +330,16 @@ class CatarinaRenamePortW(QDialog, ui_catarina_renameport.Ui_CatarinaRenamePortW self.m_group_list = group_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_new_port_name = "" @@ -435,13 +434,13 @@ class CatarinaConnectPortsW(QDialog, ui_catarina_connectports.Ui_CatarinaConnect elif port[iPortType] == patchcanvas.PORT_TYPE_MIDI_ALSA: 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_in_id = -1 @@ -516,13 +515,13 @@ class CatarinaDisconnectPortsW(QDialog, ui_catarina_disconnectports.Ui_CatarinaD self.m_port_list = port_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_in_id = -1 @@ -665,39 +664,39 @@ class CatarinaMainW(AbstractCanvasJackClass): patchcanvas.setFeatures(p_features) 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.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 self.fUpdateTimer = self.startTimer(1000) diff --git a/src/catia.py b/src/catia.py index 794c248..3664f5f 100755 --- a/src/catia.py +++ b/src/catia.py @@ -28,7 +28,7 @@ from shared_settings import * try: import dbus - from dbus.mainloop.qt import DBusQtMainLoop + from dbus.mainloop.pyqt5 import DBusQtMainLoop haveDBus = True except: haveDBus = False @@ -1022,9 +1022,9 @@ class CatiaMainW(AbstractCanvasJackClass): if not newId: # Something crashed 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": - QTimer.singleShot(0, self, SLOT("slot_handleCrash_jack()")) + QTimer.singleShot(0, self.slot_handleCrash_jack) elif kwds['interface'] == "org.jackaudio.JackControl": if kwds['member'] == "ServerStarted": diff --git a/src/claudia.py b/src/claudia.py index 2d5f1c1..9e4e50c 100755 --- a/src/claudia.py +++ b/src/claudia.py @@ -48,7 +48,7 @@ from shared_settings import * try: import dbus - from dbus.mainloop.qt import DBusQtMainLoop + from dbus.mainloop.pyqt5 import DBusQtMainLoop haveDBus = True except: haveDBus = False @@ -57,7 +57,7 @@ except: # Try Import OpenGL try: - from PyQt4.QtOpenGL import QGLWidget + from PyQt5.QtOpenGL import QGLWidget hasGL = True except: hasGL = False @@ -602,6 +602,33 @@ class ClaudiaLauncherW(QDialog): # Claudia Main Window 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): AbstractCanvasJackClass.__init__(self, "Claudia", ui_claudia.Ui_ClaudiaMainW, parent) @@ -854,46 +881,45 @@ class ClaudiaMainW(AbstractCanvasJackClass): self.ui.act_help_about.triggered.connect(self.slot_aboutClaudia) self.ui.act_help_about_qt.triggered.connect(app.aboutQt) - # FIXME QT4 - ## org.freedesktop.DBus - #self.DBusCrashCallback.connect(self.slot_DBusCrashCallback) - - ## org.jackaudio.JackControl - #self.DBusServerStartedCallback.connect(self.slot_DBusServerStartedCallback) - #self.DBusServerStoppedCallback.connect(self.slot_DBusServerStoppedCallback) - - ## org.jackaudio.JackPatchbay - #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 - #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 - #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 - #self.DBusProjectPropertiesChanged.connect(self.slot_DBusProjectPropertiesChanged) - - ## org.ladish.AppSupervisor - #self.DBusAppAdded2Callback.connect(self.slot_DBusAppAdded2Callback) - #self.DBusAppRemovedCallback.connect(self.slot_DBusAppRemovedCallback) - #self.DBusAppStateChanged2Callback.connect(self.slot_DBusAppStateChanged2Callback) + # org.freedesktop.DBus + self.DBusCrashCallback.connect(self.slot_DBusCrashCallback) + + # org.jackaudio.JackControl + self.DBusServerStartedCallback.connect(self.slot_DBusServerStartedCallback) + self.DBusServerStoppedCallback.connect(self.slot_DBusServerStoppedCallback) + + # org.jackaudio.JackPatchbay + 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 + 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 + 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 + self.DBusProjectPropertiesChanged.connect(self.slot_DBusProjectPropertiesChanged) + + # org.ladish.AppSupervisor + self.DBusAppAdded2Callback.connect(self.slot_DBusAppAdded2Callback) + self.DBusAppRemovedCallback.connect(self.slot_DBusAppRemovedCallback) + self.DBusAppStateChanged2Callback.connect(self.slot_DBusAppStateChanged2Callback) # JACK self.BufferSizeCallback.connect(self.slot_JackBufferSizeCallback) diff --git a/src/clickablelabel.py b/src/clickablelabel.py index ef47999..ad55568 100644 --- a/src/clickablelabel.py +++ b/src/clickablelabel.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -# Clickable Label, a custom Qt4 widget +# Clickable Label, a custom Qt widget # Copyright (C) 2011-2018 Filipe Coelho # # This program is free software; you can redistribute it and/or modify diff --git a/src/jacksettings.py b/src/jacksettings.py index 013ba84..49b0fd3 100755 --- a/src/jacksettings.py +++ b/src/jacksettings.py @@ -203,20 +203,21 @@ class JackSettingsW(QDialog): # Align driver text and hide non available ones driverList = gJackctl.ReadContainer(["drivers"])[1] + fontMetris = QFontMetrics(self.ui.obj_server_driver.font()) maxWidth = 75 - # FIXME QT4 - #for i in range(self.ui.obj_server_driver.rowCount()): - #self.ui.obj_server_driver.item(0, i).setTextAlignment(Qt.AlignCenter) + for i in range(self.ui.obj_server_driver.rowCount()): + 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: - #maxWidth = itemWidth + if itemWidth > maxWidth: + maxWidth = itemWidth - #if dbus.String(itexText.lower()) not in driverList: - #self.ui.obj_server_driver.hideRow(i) + if dbus.String(itexText.lower()) not in driverList: + self.ui.obj_server_driver.hideRow(i) self.ui.obj_server_driver.setMinimumWidth(maxWidth) self.ui.obj_server_driver.setMaximumWidth(maxWidth) @@ -853,22 +854,22 @@ class JackSettingsW(QDialog): self.ui.obj_driver_channels_label.setEnabled(driverHasFeature("channels")) # 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.obj_driver_capture_label.setText(self.tr("Input 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.obj_driver_capture_label.setText(self.tr("Input 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.obj_driver_capture_label.setText(self.tr("Capture 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) else: diff --git a/src/patchcanvas.py b/src/patchcanvas.py index cfa8441..eb05377 100644 --- a/src/patchcanvas.py +++ b/src/patchcanvas.py @@ -25,6 +25,7 @@ if True: 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 @@ -33,8 +34,7 @@ else: from PyQt4.QtGui import QGraphicsScene, QGraphicsItem, QGraphicsLineItem, QGraphicsPathItem from PyQt4.QtGui import QGraphicsColorizeEffect, QGraphicsDropShadowEffect from PyQt4.QtGui import QInputDialog, QLineEdit, QMenu - -from PyQt5.QtSvg import QGraphicsSvgItem, QSvgRenderer + from PyQt4.QtSvg import QGraphicsSvgItem, QSvgRenderer # Imports (Theme) from patchcanvas_theme import * diff --git a/src/shared.py b/src/shared.py index a758736..8e5893a 100644 --- a/src/shared.py +++ b/src/shared.py @@ -278,7 +278,6 @@ def setIcons(self_, modes): 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_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_in.setIcon(getIcon("zoom-in")) gGui.ui.b_canvas_zoom_out.setIcon(getIcon("zoom-out")) diff --git a/src/shared_canvasjack.py b/src/shared_canvasjack.py index 1241f3e..6c73622 100644 --- a/src/shared_canvasjack.py +++ b/src/shared_canvasjack.py @@ -496,20 +496,6 @@ class AbstractCanvasJackClass(QMainWindow): def slot_canvasZoomReset(self): 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() def slot_canvasSaveImage(self): newPath = QFileDialog.getSaveFileName(self, self.tr("Save Image"), filter=self.tr("PNG Image (*.png);;JPEG Image (*.jpg)")) @@ -548,7 +534,6 @@ class AbstractCanvasJackClass(QMainWindow): 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_print.triggered.connect(self.slot_canvasPrint) 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) diff --git a/src/shared_settings.py b/src/shared_settings.py index 875f042..19412d6 100644 --- a/src/shared_settings.py +++ b/src/shared_settings.py @@ -138,8 +138,7 @@ class SettingsW(QDialog): # ------------------------------------------------------------- # Set-up connections - # FIXME QT4 - #self.accepted.connect(self.slot_saveSettings) + 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) From ea66f54bfcb98c339242741d6466f8b856324045 Mon Sep 17 00:00:00 2001 From: falkTX Date: Fri, 23 Feb 2018 23:41:11 +0100 Subject: [PATCH 07/36] More qt5 fixes --- src/cadence.py | 28 ++++++++++++++-------------- src/catarina.py | 8 ++++---- src/catia.py | 2 +- src/claudia.py | 4 ++-- src/claudia_launcher.py | 4 ++-- src/jacksettings.py | 10 +++++----- src/logs.py | 2 +- src/render.py | 2 +- src/shared_canvasjack.py | 4 ++-- 9 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/cadence.py b/src/cadence.py index 20d250d..da36084 100755 --- a/src/cadence.py +++ b/src/cadence.py @@ -1134,7 +1134,7 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): self.b_alsa_start.clicked.connect(self.slot_AlsaBridgeStart) self.b_alsa_stop.clicked.connect(self.slot_AlsaBridgeStop) - self.cb_alsa_type.currentIndexChanged.connect(self.slot_AlsaBridgeChanged) + 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) @@ -1168,26 +1168,26 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): self.ch_app_image.clicked.connect(self.slot_tweaksSettingsChanged_apps) self.cb_app_image.highlighted.connect(self.slot_tweakAppImageHighlighted) - self.cb_app_image.currentIndexChanged.connect(self.slot_tweakAppImageChanged) + 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.connect(self.slot_tweakAppMusicChanged) + 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.connect(self.slot_tweakAppVideoChanged) + 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.connect(self.slot_tweakAppTextChanged) + 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.connect(self.slot_tweakAppBrowserChanged) + 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.connect(self.slot_tweaksSettingsChanged_wineasio) + self.cb_wineasio_bsizes.currentIndexChanged[int].connect(self.slot_tweaksSettingsChanged_wineasio) # org.jackaudio.JackControl self.DBusJackServerStartedCallback.connect(self.slot_DBusJackServerStartedCallback) @@ -1802,7 +1802,7 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): if self.cb_cpufreq.currentIndex() == -1: # First init - self.cb_cpufreq.currentIndexChanged.connect(self.slot_changeGovernorMode) + self.cb_cpufreq.currentIndexChanged[str].connect(self.slot_changeGovernorMode) self.cb_cpufreq.blockSignals(True) @@ -2090,7 +2090,7 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): self.setAppDetails(self.cb_app_image.itemText(index)) @pyqtSlot(int) - def slot_tweakAppImageChanged(self): + def slot_tweakAppImageChanged(self, ignored): self.setAppDetails(self.cb_app_image.currentText()) self.func_settings_changed("apps") @@ -2099,7 +2099,7 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): self.setAppDetails(self.cb_app_music.itemText(index)) @pyqtSlot(int) - def slot_tweakAppMusicChanged(self): + def slot_tweakAppMusicChanged(self, ignored): self.setAppDetails(self.cb_app_music.currentText()) self.func_settings_changed("apps") @@ -2108,7 +2108,7 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): self.setAppDetails(self.cb_app_video.itemText(index)) @pyqtSlot(int) - def slot_tweakAppVideoChanged(self): + def slot_tweakAppVideoChanged(self, ignored): self.setAppDetails(self.cb_app_video.currentText()) self.func_settings_changed("apps") @@ -2117,7 +2117,7 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): self.setAppDetails(self.cb_app_text.itemText(index)) @pyqtSlot(int) - def slot_tweakAppTextChanged(self): + def slot_tweakAppTextChanged(self, ignored): self.setAppDetails(self.cb_app_text.currentText()) self.func_settings_changed("apps") @@ -2126,7 +2126,7 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): self.setAppDetails(self.cb_app_browser.itemText(index)) @pyqtSlot(int) - def slot_tweakAppBrowserChanged(self): + def slot_tweakAppBrowserChanged(self, ignored): self.setAppDetails(self.cb_app_browser.currentText()) self.func_settings_changed("apps") @@ -2268,7 +2268,7 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): def loadSettings(self, 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) diff --git a/src/catarina.py b/src/catarina.py index 3a3156e..6ebc745 100755 --- a/src/catarina.py +++ b/src/catarina.py @@ -169,14 +169,14 @@ class CatarinaRenameGroupW(QDialog, ui_catarina_renamegroup.Ui_CatarinaRenameGro self.m_group_list_names.append(group[iGroupName]) self.accepted.connect(self.slot_setReturn) - self.cb_group_to_rename.currentIndexChanged.connect(self.slot_checkItem) + 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_new_group_name = "" - @pyqtSlot() - def slot_checkItem(self): + @pyqtSlot(int) + def slot_checkItem(self, ignored): self.slot_checkText(self.le_new_group_name.text()) @pyqtSlot(str) @@ -1272,7 +1272,7 @@ class CatarinaMainW(AbstractCanvasJackClass): settings = QSettings() if geometry: - self.restoreGeometry(settings.value("Geometry", "")) + self.restoreGeometry(settings.value("Geometry", b"")) showToolbar = settings.value("ShowToolbar", True, type=bool) self.ui.act_settings_show_toolbar.setChecked(showToolbar) diff --git a/src/catia.py b/src/catia.py index 3664f5f..81edd42 100755 --- a/src/catia.py +++ b/src/catia.py @@ -1333,7 +1333,7 @@ class CatiaMainW(AbstractCanvasJackClass): settings = QSettings() if geometry: - self.restoreGeometry(settings.value("Geometry", "")) + self.restoreGeometry(settings.value("Geometry", b"")) showAlsaMidi = settings.value("ShowAlsaMIDI", False, type=bool) self.ui.act_settings_show_alsa.setChecked(showAlsaMidi) diff --git a/src/claudia.py b/src/claudia.py index 9e4e50c..c1000bb 100755 --- a/src/claudia.py +++ b/src/claudia.py @@ -585,7 +585,7 @@ class ClaudiaLauncherW(QDialog): def loadSettings(self): if self.settings.contains("Geometry"): - self.restoreGeometry(self.settings.value("Geometry", "")) + self.restoreGeometry(self.settings.value("Geometry", b"")) else: self.resize(850, 500) self.launcher.loadSettings() @@ -2668,7 +2668,7 @@ class ClaudiaMainW(AbstractCanvasJackClass): settings = QSettings() if geometry: - self.restoreGeometry(settings.value("Geometry", "")) + self.restoreGeometry(settings.value("Geometry", b"")) splitterSizes = settings.value("SplitterSizes", "") if splitterSizes: diff --git a/src/claudia_launcher.py b/src/claudia_launcher.py index 5daad6c..9383b94 100755 --- a/src/claudia_launcher.py +++ b/src/claudia_launcher.py @@ -1184,7 +1184,7 @@ if __name__ == '__main__': self.b_add.clicked.connect(self.slot_addAppToLADISH) self.b_refresh.clicked.connect(self.slot_refreshStudioList) - self.co_ladi_room.currentIndexChanged.connect(self.slot_checkSelectedRoom) + self.co_ladi_room.currentIndexChanged[int].connect(self.slot_checkSelectedRoom) self.groupLADISH.toggled.connect(self.slot_enableLADISH) self.le_url.textChanged.connect(self.slot_checkFolderUrl) @@ -1331,7 +1331,7 @@ if __name__ == '__main__': self.launcher.saveSettings() def loadSettings(self): - self.restoreGeometry(self.settings.value("Geometry", "")) + self.restoreGeometry(self.settings.value("Geometry", b"")) self.launcher.loadSettings() def closeEvent(self, event): diff --git a/src/jacksettings.py b/src/jacksettings.py index 49b0fd3..69e9f75 100755 --- a/src/jacksettings.py +++ b/src/jacksettings.py @@ -231,8 +231,8 @@ class JackSettingsW(QDialog): self.ui.obj_driver_duplex.clicked.connect(self.slot_checkDuplexSelection) self.ui.obj_server_driver.currentCellChanged.connect(self.slot_checkDriverSelection) - self.ui.obj_driver_capture.currentIndexChanged.connect(self.slot_checkALSASelection) - self.ui.obj_driver_playback.currentIndexChanged.connect(self.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 @@ -734,8 +734,8 @@ class JackSettingsW(QDialog): # ----------------------------------------------------------------- # Qt SLOT calls - @pyqtSlot() - def slot_checkALSASelection(self): + @pyqtSlot(int) + def slot_checkALSASelection(self, ignored=0): 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)) self.ui.obj_driver_device.setEnabled(not check) @@ -901,7 +901,7 @@ class JackSettingsW(QDialog): def loadSettings(self): 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)) def closeEvent(self, event): diff --git a/src/logs.py b/src/logs.py index 1909f05..06982a4 100755 --- a/src/logs.py +++ b/src/logs.py @@ -417,7 +417,7 @@ class LogsW(QDialog): def loadSettings(self): settings = QSettings("Cadence", "Cadence-Logs") - self.restoreGeometry(settings.value("Geometry", "")) + self.restoreGeometry(settings.value("Geometry", b"")) def saveSettings(self): settings = QSettings("Cadence", "Cadence-Logs") diff --git a/src/render.py b/src/render.py index 0f5f8b0..ff1af79 100755 --- a/src/render.py +++ b/src/render.py @@ -380,7 +380,7 @@ class RenderW(QDialog): def loadSettings(self): settings = QSettings("Cadence", "Cadence-Render") - self.restoreGeometry(settings.value("Geometry", "")) + self.restoreGeometry(settings.value("Geometry", b"")) outputFolder = settings.value("OutputFolder", HOME) diff --git a/src/shared_canvasjack.py b/src/shared_canvasjack.py index 6c73622..f0cbfea 100644 --- a/src/shared_canvasjack.py +++ b/src/shared_canvasjack.py @@ -548,8 +548,8 @@ class AbstractCanvasJackClass(QMainWindow): 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.connect(self.slot_jackBufferSize_ComboBox) - self.ui.cb_sample_rate.currentIndexChanged.connect(self.slot_jackSampleRate_ComboBox) + 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: From 3e0fce81aceaf3b21c0ca06a5b9eb5d40a032013 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 24 Feb 2018 00:09:07 +0100 Subject: [PATCH 08/36] Bump version --- src/catarina.py | 2 +- src/catia.py | 2 +- src/claudia.py | 2 +- src/shared.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/catarina.py b/src/catarina.py index 6ebc745..6ad38fb 100755 --- a/src/catarina.py +++ b/src/catarina.py @@ -1260,7 +1260,7 @@ class CatarinaMainW(AbstractCanvasJackClass): QMessageBox.about(self, self.tr("About Catarina"), self.tr("

Catarina

" "
Version %s" "
Catarina is a testing ground for the 'PatchCanvas' module.
" - "
Copyright (C) 2010-2013 falkTX") % VERSION) + "
Copyright (C) 2010-2018 falkTX") % VERSION) def saveSettings(self): settings = QSettings() diff --git a/src/catia.py b/src/catia.py index 81edd42..dded9e1 100755 --- a/src/catia.py +++ b/src/catia.py @@ -1318,7 +1318,7 @@ class CatiaMainW(AbstractCanvasJackClass): QMessageBox.about(self, self.tr("About Catia"), self.tr("

Catia

" "
Version %s" "
Catia is a nice JACK Patchbay with A2J Bridge integration.
" - "
Copyright (C) 2010-2013 falkTX" % VERSION)) + "
Copyright (C) 2010-2018 falkTX" % VERSION)) def saveSettings(self): settings = QSettings() diff --git a/src/claudia.py b/src/claudia.py index c1000bb..15bed9d 100755 --- a/src/claudia.py +++ b/src/claudia.py @@ -2651,7 +2651,7 @@ class ClaudiaMainW(AbstractCanvasJackClass): QMessageBox.about(self, self.tr("About Claudia"), self.tr("

Claudia

" "
Version %s" "
Claudia is a Graphical User Interface to LADISH.
" - "
Copyright (C) 2010-2013 falkTX" % VERSION)) + "
Copyright (C) 2010-2018 falkTX" % VERSION)) def saveSettings(self): settings = QSettings() diff --git a/src/shared.py b/src/shared.py index 8e5893a..b1a9528 100644 --- a/src/shared.py +++ b/src/shared.py @@ -77,7 +77,7 @@ except: # ------------------------------------------------------------------------------------------------------------ # Set Version -VERSION = "0.8.1" +VERSION = "0.9.0" # ------------------------------------------------------------------------------------------------------------ # Set Debug mode From 94478bd46100cd82ff72d2f45befc91e708f0c48 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 24 Feb 2018 00:28:38 +0100 Subject: [PATCH 09/36] Cleanup --- src/systray.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/systray.py b/src/systray.py index 90f34b5..d222ab4 100755 --- a/src/systray.py +++ b/src/systray.py @@ -29,16 +29,20 @@ else: from PyQt4.QtGui import QAction, QMainWindow, QMenu, QSystemTrayIcon try: - if os.getenv("DESKTOP_SESSION") in ("ubuntu", "ubuntu-2d") and not os.path.exists("/var/cadence/no_app_indicators"): - from gi.repository import Gtk, AppIndicator3 as AppIndicator + if False and os.getenv("DESKTOP_SESSION") in ("ubuntu", "ubuntu-2d") and not os.path.exists("/var/cadence/no_app_indicators"): + 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" - elif os.getenv("KDE_SESSION_VERSION") >= 5: - TrayEngine = "Qt" + #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" + #elif os.getenv("KDE_FULL_SESSION") or os.getenv("DESKTOP_SESSION") == "kde-plasma": + #from PyKDE5.kdeui import KAction, KIcon, KMenu, KStatusNotifierItem + #TrayEngine = "KDE" else: TrayEngine = "Qt" From 122af7b95fa75fd8ca280573d1cfcec26048149f Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 24 Feb 2018 08:02:29 +0100 Subject: [PATCH 10/36] Invert logic to find X11 dir --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 47c4246..337ef96 100644 --- a/Makefile +++ b/Makefile @@ -12,10 +12,10 @@ PYUIC ?= pyuic5 PYRCC ?= pyrcc5 # 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/ +else + X11_RC_DIR = $(DESTDIR)/etc/X11/Xsession.d/ endif # ----------------------------------------------------------------------------------------------------------------------------------------- From 57062ef0e03dd9825c90e99196c5efd93df1de83 Mon Sep 17 00:00:00 2001 From: falkTX Date: Mon, 19 Mar 2018 09:10:02 +0100 Subject: [PATCH 11/36] Don't abort app when exception is thrown --- src/shared.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/shared.py b/src/shared.py index b1a9528..d1276cd 100644 --- a/src/shared.py +++ b/src/shared.py @@ -74,6 +74,14 @@ try: except: 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 From 8d32325c26624244d2e4b0a787ba53688b79559c Mon Sep 17 00:00:00 2001 From: falkTX Date: Mon, 19 Mar 2018 09:10:32 +0100 Subject: [PATCH 12/36] Import small tweaks needed for kxstudio --- src/cadence.py | 13 +++++++++++-- src/cadence_session_start.py | 2 +- src/shared_cadence.py | 5 +++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/cadence.py b/src/cadence.py index da36084..1df02a4 100755 --- a/src/cadence.py +++ b/src/cadence.py @@ -55,7 +55,16 @@ try: from dbus.mainloop.pyqt5 import DBusQtMainLoop haveDBus = True except: - haveDBus = False + kxstudioWorkaround = "/opt/kxstudio/python3/dist-packages/dbus/mainloop" + if os.path.exists(kxstudioWorkaround): + try: + sys.path.insert(0, kxstudioWorkaround) + from pyqt5 import DBusQtMainLoop + haveDBus = True + except: + haveDBus = False + else: + haveDBus = False # ------------------------------------------------------------------------------------------------------------ # Check for PulseAudio and Wine @@ -2272,7 +2281,7 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): 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_pulse_autostart.setChecked(GlobalSettings.value("Pulse2JACK/AutoStart", havePulseAudio and not usingAlsaLoop, type=bool)) diff --git a/src/cadence_session_start.py b/src/cadence_session_start.py index 6f26a70..8ed1f8f 100755 --- a/src/cadence_session_start.py +++ b/src/cadence_session_start.py @@ -46,7 +46,7 @@ def forceReset(): # Start JACK, A2J and Pulse, according to user settings def startSession(systemStarted, secondSystemStartAttempt): # 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") return True diff --git a/src/shared_cadence.py b/src/shared_cadence.py index f69abeb..5d14ef6 100644 --- a/src/shared_cadence.py +++ b/src/shared_cadence.py @@ -72,6 +72,11 @@ iAlsaFileMax = 4 GlobalSettings = QSettings("Cadence", "GlobalSettings") +# ------------------------------------------------------------------------------------------------------------ +# KXStudio Check + +wantJackStart = os.path.exists("/usr/share/kxstudio/config/config/Cadence/GlobalSettings.conf") + # ------------------------------------------------------------------------------------------------------------ # Get Process list From 49c567c43efc80e69b642963d8fa6580be58a6fa Mon Sep 17 00:00:00 2001 From: falkTX Date: Mon, 19 Mar 2018 09:15:37 +0100 Subject: [PATCH 13/36] Fix small issues in qt5 port --- src/cadence.py | 2 ++ src/shared_cadence.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cadence.py b/src/cadence.py index 1df02a4..090d817 100755 --- a/src/cadence.py +++ b/src/cadence.py @@ -522,6 +522,8 @@ def initSystemChecks(): # Wait while JACK restarts class ForceRestartThread(QThread): + progressChanged = pyqtSignal(int) + def __init__(self, parent): QThread.__init__(self, parent) diff --git a/src/shared_cadence.py b/src/shared_cadence.py index 5d14ef6..65065e3 100644 --- a/src/shared_cadence.py +++ b/src/shared_cadence.py @@ -149,7 +149,7 @@ def stopAllAudioProcesses(): process = QProcess() # Tell pulse2jack script to create files, prevents pulseaudio respawn - process.start("cadence-pulse2jack", "--dummy") + process.start("cadence-pulse2jack", ["--dummy"]) process.waitForFinished() procsTerm = ["a2j", "a2jmidid", "artsd", "jackd", "jackdmp", "knotify4", "lash", "ladishd", "ladiappd", "ladiconfd", "jmcore"] From 9bf9965d2063d875aa9bd8e289a89c519a0251cf Mon Sep 17 00:00:00 2001 From: falkTX Date: Mon, 19 Mar 2018 09:15:55 +0100 Subject: [PATCH 14/36] Fix systray quit action not working properly --- src/systray.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/systray.py b/src/systray.py index d222ab4..5a3fb59 100755 --- a/src/systray.py +++ b/src/systray.py @@ -642,6 +642,9 @@ class GlobalSysTray(object): self._parent.hide() self._parent.close() + if self._app: + self._app.quit() + def __raiseWindow(self): self._parent.activateWindow() self._parent.raise_() From 4489a66d517f00951eb92d0531a95965d6da6c5b Mon Sep 17 00:00:00 2001 From: falkTX Date: Mon, 19 Mar 2018 09:51:52 +0100 Subject: [PATCH 15/36] Cadence: Run DBus stuff only on main thread --- src/cadence.py | 36 ++++++++++++++++++++++++++++-------- src/shared_cadence.py | 5 +++-- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/src/cadence.py b/src/cadence.py index 090d817..09e82b7 100755 --- a/src/cadence.py +++ b/src/cadence.py @@ -22,10 +22,10 @@ from platform import architecture if True: - from PyQt5.QtCore import QFileSystemWatcher, QThread + from PyQt5.QtCore import QFileSystemWatcher, QThread, QSemaphore from PyQt5.QtWidgets import QApplication, QDialogButtonBox, QLabel, QMainWindow, QSizePolicy else: - from PyQt4.QtCore import QFileSystemWatcher, QThread + from PyQt4.QtCore import QFileSystemWatcher, QThread, QSemaphore from PyQt4.QtGui import QApplication, QDialogButtonBox, QLabel, QMainWindow, QSizePolicy # ------------------------------------------------------------------------------------------------------------ @@ -528,21 +528,30 @@ class ForceRestartThread(QThread): QThread.__init__(self, parent) self.m_wasStarted = False + self.m_a2jExportHW = False def wasJackStarted(self): return self.m_wasStarted + def startA2J(self): + gDBus.a2j.set_hw_export(self.m_a2jExportHW) + gDBus.a2j.start() + def run(self): # Not started yet self.m_wasStarted = False self.progressChanged.emit(0) + # Stop JACK safely first, if possible + runFunctionInMainThread(tryCloseJackDBus) + self.progressChanged.emit(20) + # Kill All - stopAllAudioProcesses() + stopAllAudioProcesses(False) self.progressChanged.emit(30) # Connect to jackdbus - self.parent().DBusReconnect() + runFunctionInMainThread(self.parent().DBusReconnect) if not gDBus.jack: return @@ -558,7 +567,7 @@ class ForceRestartThread(QThread): self.progressChanged.emit(90) # Start it - gDBus.jack.StartServer() + runFunctionInMainThread(gDBus.jack.StartServer) self.progressChanged.emit(93) # If we made it this far, then JACK is started @@ -575,9 +584,8 @@ class ForceRestartThread(QThread): # 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() + self.m_a2jExportHW = GlobalSettings.value("A2J/ExportHW", True, type=bool) + runFunctionInMainThread(self.startA2J) self.progressChanged.emit(96) @@ -2325,6 +2333,18 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): self.saveSettings() self.systray.handleQtCloseEvent(event) +# ------------------------------------------------------------------------------------------------------------ + +def runFunctionInMainThread(task): + waiter = QSemaphore(1) + + def taskInMainThread(): + task() + waiter.release() + + QTimer.singleShot(0, taskInMainThread) + waiter.tryAcquire() + #--------------- main ------------------ if __name__ == '__main__': # App initialization diff --git a/src/shared_cadence.py b/src/shared_cadence.py index 65065e3..2a819f3 100644 --- a/src/shared_cadence.py +++ b/src/shared_cadence.py @@ -139,8 +139,9 @@ def tryCloseJackDBus(): # ------------------------------------------------------------------------------------------------------------ # 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): print("stopAllAudioProcesses() - Not supported in this system") From 89fdc6943333856980226088d497b828691a47b7 Mon Sep 17 00:00:00 2001 From: falkTX Date: Mon, 19 Mar 2018 09:55:10 +0100 Subject: [PATCH 16/36] Fix unused variable warning --- c++/jackmeter/jackmeter.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/c++/jackmeter/jackmeter.cpp b/c++/jackmeter/jackmeter.cpp index 56c066a..db17864 100644 --- a/c++/jackmeter/jackmeter.cpp +++ b/c++/jackmeter/jackmeter.cpp @@ -134,17 +134,13 @@ void reconnect_ports() } 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")) 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")) jackbridge_connect(jClient, "system:capture_2", nameIn2.toUtf8().constData()); - } } } From f36bc4c73e19be4a3f28d0f2942c0936f652d5f0 Mon Sep 17 00:00:00 2001 From: falkTX Date: Mon, 19 Mar 2018 10:23:57 +0100 Subject: [PATCH 17/36] Last piece missing of qt5 port --- data/unity/cadence-unity-support | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/data/unity/cadence-unity-support b/data/unity/cadence-unity-support index 0b6c07b..d85094d 100755 --- a/data/unity/cadence-unity-support +++ b/data/unity/cadence-unity-support @@ -3,7 +3,7 @@ # Imports (Global) import dbus, signal, sys -from PyQt4.QtCore import QCoreApplication, QObject +from PyQt5.QtCore import QCoreApplication, QObject # DBus class DBus(object): @@ -98,6 +98,8 @@ class CadenceUnityApp(QObject): if __name__ == '__main__': # Imports (Unity) + from gi import require_version as gi_require_version + gi_require_version('Unity', '7.0') from gi.repository import Unity # App initialization From 7e98325af344e7b710dde86898af127d12651186 Mon Sep 17 00:00:00 2001 From: falkTX Date: Mon, 19 Mar 2018 13:35:30 +0100 Subject: [PATCH 18/36] Add kxstudio dbus workaround to catia and claudia --- src/catia.py | 11 ++++++++++- src/claudia.py | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/catia.py b/src/catia.py index dded9e1..098a843 100755 --- a/src/catia.py +++ b/src/catia.py @@ -31,7 +31,16 @@ try: from dbus.mainloop.pyqt5 import DBusQtMainLoop haveDBus = True except: - haveDBus = False + kxstudioWorkaround = "/opt/kxstudio/python3/dist-packages/dbus/mainloop" + if os.path.exists(kxstudioWorkaround): + try: + sys.path.insert(0, kxstudioWorkaround) + from pyqt5 import DBusQtMainLoop + haveDBus = True + except: + haveDBus = False + else: + haveDBus = False # ------------------------------------------------------------------------------------------------------------ # Try Import OpenGL diff --git a/src/claudia.py b/src/claudia.py index 15bed9d..fd9c36e 100755 --- a/src/claudia.py +++ b/src/claudia.py @@ -51,7 +51,16 @@ try: from dbus.mainloop.pyqt5 import DBusQtMainLoop haveDBus = True except: - haveDBus = False + kxstudioWorkaround = "/opt/kxstudio/python3/dist-packages/dbus/mainloop" + if os.path.exists(kxstudioWorkaround): + try: + sys.path.insert(0, kxstudioWorkaround) + from pyqt5 import DBusQtMainLoop + haveDBus = True + except: + haveDBus = False + else: + haveDBus = False # ------------------------------------------------------------------------------------------------------------ # Try Import OpenGL From 7c6ca1026f3f4732f0a3d6f9e3d1827d6a797284 Mon Sep 17 00:00:00 2001 From: falkTX Date: Mon, 19 Mar 2018 13:40:38 +0100 Subject: [PATCH 19/36] Fix save dialog for qt5 --- src/catarina.py | 1 + src/shared_canvasjack.py | 1 + 2 files changed, 2 insertions(+) diff --git a/src/catarina.py b/src/catarina.py index 6ad38fb..c5b375c 100755 --- a/src/catarina.py +++ b/src/catarina.py @@ -1040,6 +1040,7 @@ class CatarinaMainW(AbstractCanvasJackClass): @pyqtSlot() def slot_projectSaveAs(self): path = QFileDialog.getSaveFileName(self, self.tr("Save State"), filter=self.tr("Catarina XML Document (*.xml)")) + path = path[0] if path: self.m_save_path = path self.saveFile(path) diff --git a/src/shared_canvasjack.py b/src/shared_canvasjack.py index f0cbfea..c465aab 100644 --- a/src/shared_canvasjack.py +++ b/src/shared_canvasjack.py @@ -499,6 +499,7 @@ class AbstractCanvasJackClass(QMainWindow): @pyqtSlot() def slot_canvasSaveImage(self): newPath = QFileDialog.getSaveFileName(self, self.tr("Save Image"), filter=self.tr("PNG Image (*.png);;JPEG Image (*.jpg)")) + newPath = newPath[0] if not newPath: return From 99b39989a010fae1acbce07af002b15e56a1d161 Mon Sep 17 00:00:00 2001 From: falkTX Date: Thu, 22 Mar 2018 00:58:48 +0100 Subject: [PATCH 20/36] Systray fixes Closes #209 --- src/cadence.py | 86 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 58 insertions(+), 28 deletions(-) diff --git a/src/cadence.py b/src/cadence.py index 09e82b7..1893c38 100755 --- a/src/cadence.py +++ b/src/cadence.py @@ -1129,14 +1129,14 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): self.systray.addMenuAction("tools", "app_xy-controller", "XY-Controller") 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.show() @@ -1165,13 +1165,13 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): self.b_pulse_stop.clicked.connect(self.slot_PulseAudioBridgeStop) self.tb_pulse_options.clicked.connect(self.slot_PulseAudioBridgeOptions) - self.pic_catia.clicked.connect(lambda tool="catia": self.func_start_tool(tool)) - self.pic_claudia.clicked.connect(lambda tool="claudia": self.func_start_tool(tool)) - self.pic_meter_in.clicked.connect(lambda tool="cadence-jackmeter -in": self.func_start_tool(tool)) - self.pic_meter_out.clicked.connect(lambda tool="cadence-jackmeter": self.func_start_tool(tool)) - self.pic_logs.clicked.connect(lambda tool="cadence-logs": self.func_start_tool(tool)) - self.pic_render.clicked.connect(lambda tool="cadence-render": self.func_start_tool(tool)) - self.pic_xycontroller.clicked.connect(lambda tool="cadence-xycontroller": self.func_start_tool(tool)) + 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) @@ -1543,24 +1543,54 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): self.label_app_comment.setText(comment) def updateSystrayTooltip(self): - systrayText = "" - #systrayText += "" - systrayText += "" % (self.tr("JACK Status"), self.label_jack_status.text()) - systrayText += "" % (self.tr("Realtime"), self.label_jack_realtime.text()) - systrayText += "" % (self.tr("DSP Load"), self.label_jack_dsp.text()) - systrayText += "" % (self.tr("Xruns"), self.label_jack_xruns.text()) - systrayText += "" % (self.tr("Buffer Size"), self.label_jack_bfsize.text()) - systrayText += "" % (self.tr("Sample Rate"), self.label_jack_srate.text()) - systrayText += "" % (self.tr("Block Latency"), self.label_jack_latency.text()) - systrayText += "

Cadence

%s:%s
%s:%s
%s:%s
%s:%s
%s:%s
%s:%s
%s:%s
" + systrayText = "Cadence
" + systrayText += "" + systrayText += "%s: %s
" % (self.tr("JACK Status"), self.label_jack_status.text()) + systrayText += "%s: %s
" % (self.tr("Realtime"), self.label_jack_realtime.text()) + systrayText += "%s: %s
" % (self.tr("DSP Load"), self.label_jack_dsp.text()) + systrayText += "%s: %s
" % (self.tr("Xruns"), self.label_jack_xruns.text()) + systrayText += "%s: %s
" % (self.tr("Buffer Size"), self.label_jack_bfsize.text()) + systrayText += "%s: %s
" % (self.tr("Sample Rate"), self.label_jack_srate.text()) + systrayText += "%s: %s" % (self.tr("Block Latency"), self.label_jack_latency.text()) + 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): if sys.argv[0].endswith(".py"): - if tool == "cadence-jacksettings": - tool = "jacksettings" - elif tool == "cadence-logs": + if tool == "cadence-logs": tool = "logs" elif tool == "cadence-render": tool = "render" From af26e8150d54b6668370c83819f146ab061abf6f Mon Sep 17 00:00:00 2001 From: Olivier Humbert Date: Tue, 17 Apr 2018 14:57:30 +0200 Subject: [PATCH 21/36] Qt4 -> Qt5 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c774769..af5a81b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # --- README for Cadence --- Cadence is a set of tools useful for audio production.
-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).
Also, lots of custom widgets were coded when needed (like pixmapdial, pixmapkeyboard, patchcanvas and systray).
From 3e1df2db586e279d77a46a3bd525db84897c9ab7 Mon Sep 17 00:00:00 2001 From: falkTX Date: Fri, 27 Apr 2018 07:55:28 +0300 Subject: [PATCH 22/36] Fix adding new apps in claudia when using pyqt5 dbus workaround --- src/claudia_launcher.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/claudia_launcher.py b/src/claudia_launcher.py index 9383b94..ccf928c 100755 --- a/src/claudia_launcher.py +++ b/src/claudia_launcher.py @@ -275,14 +275,20 @@ class ClaudiaLauncher(QWidget, ui_claudia_launcher.Ui_ClaudiaLauncherW): tmplte_cmd = "" 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") + # Fix for KXStudio PyQt5 mainloop workaround + syspath = sys.path[0] + if syspath == "/opt/kxstudio/python3/dist-packages/dbus/mainloop" and len(sys.path) >= 2: + syspath = sys.path[1] + + 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: app = None tmplte_cmd = binary print("ClaudiaLauncher::createAppTemplate() - Failed to find template dir") + return False if not os.path.exists(proj_folder): os.mkdir(proj_folder) @@ -489,6 +495,7 @@ class ClaudiaLauncher(QWidget, ui_claudia_launcher.Ui_ClaudiaLauncherW): else: print("ClaudiaLauncher::createAppTemplate(%s) - Failed to parse app name" % app) + return False if tmplte_file is not None: os.system('sed -i "s|X_SR_X-CLAUDIA-X_SR_X|%s|" "%s"' % (proj_srate, tmplte_file)) @@ -497,6 +504,7 @@ class ClaudiaLauncher(QWidget, ui_claudia_launcher.Ui_ClaudiaLauncherW): appBus = self.callback_getAppBus() appBus.RunCustom2(False, tmplte_cmd, app, tmplte_lvl) + return True def parentR(self): return self._parent From 8a1940ce247893a40a6dd67466c516ec37e22873 Mon Sep 17 00:00:00 2001 From: falkTX Date: Fri, 27 Apr 2018 07:58:56 +0300 Subject: [PATCH 23/36] Proper workaround, dont add to front of sys.path --- src/cadence.py | 2 +- src/catia.py | 2 +- src/claudia.py | 2 +- src/claudia_launcher.py | 13 +++++-------- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/cadence.py b/src/cadence.py index 1893c38..88816d9 100755 --- a/src/cadence.py +++ b/src/cadence.py @@ -58,7 +58,7 @@ except: kxstudioWorkaround = "/opt/kxstudio/python3/dist-packages/dbus/mainloop" if os.path.exists(kxstudioWorkaround): try: - sys.path.insert(0, kxstudioWorkaround) + sys.path.insert(1, kxstudioWorkaround) from pyqt5 import DBusQtMainLoop haveDBus = True except: diff --git a/src/catia.py b/src/catia.py index 098a843..8101d60 100755 --- a/src/catia.py +++ b/src/catia.py @@ -34,7 +34,7 @@ except: kxstudioWorkaround = "/opt/kxstudio/python3/dist-packages/dbus/mainloop" if os.path.exists(kxstudioWorkaround): try: - sys.path.insert(0, kxstudioWorkaround) + sys.path.insert(1, kxstudioWorkaround) from pyqt5 import DBusQtMainLoop haveDBus = True except: diff --git a/src/claudia.py b/src/claudia.py index fd9c36e..c69bfc4 100755 --- a/src/claudia.py +++ b/src/claudia.py @@ -54,7 +54,7 @@ except: kxstudioWorkaround = "/opt/kxstudio/python3/dist-packages/dbus/mainloop" if os.path.exists(kxstudioWorkaround): try: - sys.path.insert(0, kxstudioWorkaround) + sys.path.insert(1, kxstudioWorkaround) from pyqt5 import DBusQtMainLoop haveDBus = True except: diff --git a/src/claudia_launcher.py b/src/claudia_launcher.py index ccf928c..5fdde47 100755 --- a/src/claudia_launcher.py +++ b/src/claudia_launcher.py @@ -155,10 +155,11 @@ class ClaudiaLauncher(QWidget, ui_claudia_launcher.Ui_ClaudiaLauncherW): if not os.path.exists(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"))) @@ -275,11 +276,7 @@ class ClaudiaLauncher(QWidget, ui_claudia_launcher.Ui_ClaudiaLauncherW): tmplte_cmd = "" tmplte_lvl = "0" - # Fix for KXStudio PyQt5 mainloop workaround syspath = sys.path[0] - if syspath == "/opt/kxstudio/python3/dist-packages/dbus/mainloop" and len(sys.path) >= 2: - syspath = sys.path[1] - 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")): From b82db9af8d0beb5c89731fee6f8de2d9db87e263 Mon Sep 17 00:00:00 2001 From: falkTX Date: Fri, 27 Apr 2018 08:43:10 +0300 Subject: [PATCH 24/36] Add fix for carla-single not having proper PWD --- src/claudia_launcher.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/claudia_launcher.py b/src/claudia_launcher.py index 5fdde47..dc06058 100755 --- a/src/claudia_launcher.py +++ b/src/claudia_launcher.py @@ -214,7 +214,7 @@ class ClaudiaLauncher(QWidget, ui_claudia_launcher.Ui_ClaudiaLauncherW): if tabIndex == iTabPlugin: 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: item = self.listEffect.item(self.listEffect.currentRow(), 0).data(Qt.UserRole) @@ -307,7 +307,7 @@ class ClaudiaLauncher(QWidget, ui_claudia_launcher.Ui_ClaudiaLauncherW): tmplte_lvl = "1" elif binary.startswith("carla-single"): - tmplte_cmd = binary + tmplte_cmd = binary + " " + proj_folder tmplte_lvl = "1" elif binary == "ardour": @@ -826,7 +826,8 @@ class ClaudiaLauncher(QWidget, ui_claudia_launcher.Ui_ClaudiaLauncherW): if haveCarla and os.path.exists("/usr/lib/carla/libcarla_utils.so"): utils = CarlaUtils("/usr/lib/carla/libcarla_utils.so") 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) if (plugin["hints"] & PLUGIN_HAS_CUSTOM_UI) == 0: From fa3794add4d1b628360a01d769109df8a2c22a23 Mon Sep 17 00:00:00 2001 From: Jonathan Liu Date: Sun, 26 Aug 2018 15:05:16 +1000 Subject: [PATCH 25/36] Add workaround for KDE modifying QAction text to add accelerators See https://bugs.kde.org/show_bug.cgi?id=337491 Closes #220 --- src/claudia.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/claudia.py b/src/claudia.py index c69bfc4..8a5f19c 100755 --- a/src/claudia.py +++ b/src/claudia.py @@ -1686,7 +1686,7 @@ class ClaudiaMainW(AbstractCanvasJackClass): @pyqtSlot() def slot_studio_load_m(self): - studio_name = self.sender().text() + studio_name = self.sender().property("data") if studio_name: gDBus.ladish_control.LoadStudio(studio_name) @@ -1720,7 +1720,7 @@ class ClaudiaMainW(AbstractCanvasJackClass): @pyqtSlot() def slot_studio_delete_m(self): - studio_name = self.sender().text() + studio_name = self.sender().property("data") if studio_name: gDBus.ladish_control.DeleteStudio(studio_name) @@ -1732,7 +1732,7 @@ class ClaudiaMainW(AbstractCanvasJackClass): @pyqtSlot() def slot_room_delete_m(self): - room_name = self.sender().text() + room_name = self.sender().proeprty("data") if room_name: gDBus.ladish_studio.DeleteRoom(room_name) @@ -1757,7 +1757,7 @@ class ClaudiaMainW(AbstractCanvasJackClass): @pyqtSlot() def slot_project_load_m(self): - act_x_text = self.sender().text() + act_x_text = self.sender().property("data") if act_x_text: proj_path = "/" + act_x_text.rsplit("[/", 1)[-1].rsplit("]", 1)[0] gDBus.ladish_room.LoadProject(proj_path) @@ -1933,6 +1933,7 @@ class ClaudiaMainW(AbstractCanvasJackClass): for studio in studio_list: studio_name = str(studio[iStudioListName]) 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) act_x_studio.triggered.connect(self.slot_studio_load_m) @@ -1949,6 +1950,7 @@ class ClaudiaMainW(AbstractCanvasJackClass): for studio in studio_list: studio_name = str(studio[iStudioListName]) 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) act_x_studio.triggered.connect(self.slot_studio_delete_m) @@ -1964,6 +1966,7 @@ class ClaudiaMainW(AbstractCanvasJackClass): ladish_room = gDBus.bus.get_object("org.ladish", room_path) room_name = ladish_room.GetName() act_x_room = QAction(room_name, self.ui.menu_room_delete) + act_x_room.setProperty("data", studio_name); self.ui.menu_room_delete.addAction(act_x_room) act_x_room.triggered.connect(self.slot_room_delete_m) else: @@ -1994,6 +1997,7 @@ class ClaudiaMainW(AbstractCanvasJackClass): act_x_text = "%s [%s]" % (proj_name, proj_path) 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) act_x_proj.triggered.connect(self.slot_project_load_m) From 4a5f5b445bfb3cd23a797c172dfbcb42e0cf114f Mon Sep 17 00:00:00 2001 From: Jonathan Liu Date: Mon, 27 Aug 2018 09:19:34 +1000 Subject: [PATCH 26/36] Fix typos in workaround Closes #220 --- src/claudia.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/claudia.py b/src/claudia.py index 8a5f19c..9e5bb9e 100755 --- a/src/claudia.py +++ b/src/claudia.py @@ -1732,7 +1732,7 @@ class ClaudiaMainW(AbstractCanvasJackClass): @pyqtSlot() def slot_room_delete_m(self): - room_name = self.sender().proeprty("data") + room_name = self.sender().property("data") if room_name: gDBus.ladish_studio.DeleteRoom(room_name) @@ -1966,7 +1966,7 @@ class ClaudiaMainW(AbstractCanvasJackClass): ladish_room = gDBus.bus.get_object("org.ladish", room_path) room_name = ladish_room.GetName() act_x_room = QAction(room_name, self.ui.menu_room_delete) - act_x_room.setProperty("data", studio_name); + act_x_room.setProperty("data", room_name); self.ui.menu_room_delete.addAction(act_x_room) act_x_room.triggered.connect(self.slot_room_delete_m) else: From 38941feee88ddea0f1d018c3d7c5474782f4b345 Mon Sep 17 00:00:00 2001 From: falkTX Date: Wed, 18 Sep 2019 11:33:32 +0100 Subject: [PATCH 27/36] Don't use sse flags in the makefile Code is not that heavy on audio DSP that really makes a difference --- c++/Makefile.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c++/Makefile.mk b/c++/Makefile.mk index ec92861..6391bbb 100644 --- a/c++/Makefile.mk +++ b/c++/Makefile.mk @@ -24,7 +24,7 @@ BASE_FLAGS = -O0 -g -Wall -Wextra BASE_FLAGS += -DDEBUG STRIP = true # FIXME else -BASE_FLAGS = -O3 -ffast-math -mtune=generic -msse -mfpmath=sse -Wall -Wextra +BASE_FLAGS = -O3 -ffast-math -mtune=generic -Wall -Wextra BASE_FLAGS += -DNDEBUG endif From 01bfb7a3c914352144b38e063574adfb8f1bb5bc Mon Sep 17 00:00:00 2001 From: falkTX Date: Wed, 18 Sep 2019 11:36:38 +0100 Subject: [PATCH 28/36] Remove DBus workaround for Neon --- src/cadence.py | 11 +---------- src/catia.py | 11 +---------- src/claudia.py | 11 +---------- 3 files changed, 3 insertions(+), 30 deletions(-) diff --git a/src/cadence.py b/src/cadence.py index 88816d9..5581078 100755 --- a/src/cadence.py +++ b/src/cadence.py @@ -55,16 +55,7 @@ try: from dbus.mainloop.pyqt5 import DBusQtMainLoop haveDBus = True except: - kxstudioWorkaround = "/opt/kxstudio/python3/dist-packages/dbus/mainloop" - if os.path.exists(kxstudioWorkaround): - try: - sys.path.insert(1, kxstudioWorkaround) - from pyqt5 import DBusQtMainLoop - haveDBus = True - except: - haveDBus = False - else: - haveDBus = False + haveDBus = False # ------------------------------------------------------------------------------------------------------------ # Check for PulseAudio and Wine diff --git a/src/catia.py b/src/catia.py index 8101d60..dded9e1 100755 --- a/src/catia.py +++ b/src/catia.py @@ -31,16 +31,7 @@ try: from dbus.mainloop.pyqt5 import DBusQtMainLoop haveDBus = True except: - kxstudioWorkaround = "/opt/kxstudio/python3/dist-packages/dbus/mainloop" - if os.path.exists(kxstudioWorkaround): - try: - sys.path.insert(1, kxstudioWorkaround) - from pyqt5 import DBusQtMainLoop - haveDBus = True - except: - haveDBus = False - else: - haveDBus = False + haveDBus = False # ------------------------------------------------------------------------------------------------------------ # Try Import OpenGL diff --git a/src/claudia.py b/src/claudia.py index 9e5bb9e..8828009 100755 --- a/src/claudia.py +++ b/src/claudia.py @@ -51,16 +51,7 @@ try: from dbus.mainloop.pyqt5 import DBusQtMainLoop haveDBus = True except: - kxstudioWorkaround = "/opt/kxstudio/python3/dist-packages/dbus/mainloop" - if os.path.exists(kxstudioWorkaround): - try: - sys.path.insert(1, kxstudioWorkaround) - from pyqt5 import DBusQtMainLoop - haveDBus = True - except: - haveDBus = False - else: - haveDBus = False + haveDBus = False # ------------------------------------------------------------------------------------------------------------ # Try Import OpenGL From 5466e35d427c2cdbaae7ccbffb5e0edad1b55e9e Mon Sep 17 00:00:00 2001 From: falkTX Date: Wed, 18 Sep 2019 11:51:58 +0100 Subject: [PATCH 29/36] Remove -mtune=generic as well --- c++/Makefile.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c++/Makefile.mk b/c++/Makefile.mk index 6391bbb..c0697c9 100644 --- a/c++/Makefile.mk +++ b/c++/Makefile.mk @@ -24,7 +24,7 @@ BASE_FLAGS = -O0 -g -Wall -Wextra BASE_FLAGS += -DDEBUG STRIP = true # FIXME else -BASE_FLAGS = -O3 -ffast-math -mtune=generic -Wall -Wextra +BASE_FLAGS = -O3 -ffast-math -Wall -Wextra BASE_FLAGS += -DNDEBUG endif From 20877a8e27a521c302688bbe0f36844d5aab33fe Mon Sep 17 00:00:00 2001 From: Alexis Caffa Date: Wed, 11 Sep 2019 20:51:57 -0300 Subject: [PATCH 30/36] Qt4 -> Qt5 I had to manually install some different dependencies. So much to run as to install. --- INSTALL.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 7451c3a..21a3f44 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -19,12 +19,12 @@ Packagers can make use of the 'PREFIX' and 'DESTDIR' variable during install, li The required build dependencies are: (devel packages of these) - JACK - - Qt4 - - PyQt4 (Py3 version) + - Qt5 + - PyQt5 (Py3 version) On Debian and Ubuntu, use these commands to install all build dependencies:
-`$ sudo apt-get install libjack-dev libqt4-dev qt4-dev-tools`
-`$ sudo apt-get install python-qt4-dev python3-pyqt4 pyqt4-dev-tools` +`$ sudo apt-get install libjack-jackd2-dev libqt4-dev qt4-dev-tools`
+`$ sudo apt-get install python-qt5-dev python3-pyqt5 pyqt5-dev-tools python3-pyqt5.qtsvg` To run all the apps/tools, you'll additionally need: From 393f05dd146a44069eb378316fea733b7b666185 Mon Sep 17 00:00:00 2001 From: falkTX Date: Wed, 18 Sep 2019 13:21:26 +0100 Subject: [PATCH 31/36] Fix more INSTALL.md references to Qt4 --- INSTALL.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 21a3f44..1942a88 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -23,8 +23,8 @@ The required build dependencies are: (devel packages of these) - PyQt5 (Py3 version) On Debian and Ubuntu, use these commands to install all build dependencies:
-`$ sudo apt-get install libjack-jackd2-dev libqt4-dev qt4-dev-tools`
-`$ sudo apt-get install python-qt5-dev python3-pyqt5 pyqt5-dev-tools python3-pyqt5.qtsvg` +`$ sudo apt-get install libjack-jackd2-dev qtbase5-dev, qtbase5-dev-tools`
+`$ sudo apt-get install python3-pyqt5 python3-pyqt5.qtsvg pyqt5-dev-tools` To run all the apps/tools, you'll additionally need: From 655e0a361ecbe9de04777e53f159216724d4d4ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=A9rence=20Clastres?= Date: Fri, 18 Oct 2019 19:37:17 +0200 Subject: [PATCH 32/36] A2JMIDI: Simplify startup and ports export - Add option to start a2j when JACK starts - Add option to always export ports when a2j starts - Remove now unused a2j options menu - Remove unneeded HW export yes/no dialog and automatically (re)start a2j after exporting --- resources/ui/cadence.ui | 10 ++++---- src/cadence.py | 56 +++++++++++++---------------------------- 2 files changed, 22 insertions(+), 44 deletions(-) diff --git a/resources/ui/cadence.ui b/resources/ui/cadence.ui index b0e1c63..2ee5a42 100644 --- a/resources/ui/cadence.ui +++ b/resources/ui/cadence.ui @@ -785,7 +785,7 @@ - Export HW... + Export HW ports and (re)start @@ -823,16 +823,16 @@ - + - Auto-start at login + Export ports on startup - + - ... + Start with Jack diff --git a/src/cadence.py b/src/cadence.py index 5581078..3edca68 100755 --- a/src/cadence.py +++ b/src/cadence.py @@ -519,13 +519,13 @@ class ForceRestartThread(QThread): QThread.__init__(self, parent) self.m_wasStarted = False - self.m_a2jExportHW = False def wasJackStarted(self): return self.m_wasStarted def startA2J(self): - gDBus.a2j.set_hw_export(self.m_a2jExportHW) + 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): @@ -574,8 +574,7 @@ class ForceRestartThread(QThread): self.progressChanged.emit(94) # ALSA-MIDI - if GlobalSettings.value("A2J/AutoStart", True, type=bool) and gDBus.a2j and not bool(gDBus.a2j.is_started()): - self.m_a2jExportHW = GlobalSettings.value("A2J/ExportHW", True, type=bool) + if GlobalSettings.value("A2J/AutoStart", True, type=bool) and not bool(gDBus.a2j.is_started()): runFunctionInMainThread(self.startA2J) self.progressChanged.emit(96) @@ -718,24 +717,6 @@ class ToolBarAlsaAudioDialog(QDialog, ui_cadence_tb_alsa.Ui_Dialog): QDialog.done(self, r) 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.accepted.connect(self.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 class ToolBarPADialog(QDialog, ui_cadence_tb_pa.Ui_Dialog): def __init__(self, parent): @@ -1104,7 +1085,6 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): self.systray.connect("alsa_stop", self.slot_AlsaBridgeStop) self.systray.connect("a2j_start", self.slot_A2JBridgeStart) 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_stop", self.slot_PulseAudioBridgeStop) @@ -1150,8 +1130,6 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): self.b_a2j_start.clicked.connect(self.slot_A2JBridgeStart) self.b_a2j_stop.clicked.connect(self.slot_A2JBridgeStop) self.b_a2j_export_hw.clicked.connect(self.slot_A2JBridgeExportHW) - self.tb_a2j_options.clicked.connect(self.slot_A2JBridgeOptions) - 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) @@ -1290,6 +1268,7 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): else: self.toolBox_alsamidi.setEnabled(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.settings.setValue("A2J/AutoStart", False) @@ -1358,8 +1337,13 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): self.m_timer500 = self.startTimer(500) if gDBus.a2j and not gDBus.a2j.is_started(): - self.b_a2j_start.setEnabled(True) - self.systray.setActionEnabled("a2j_start", True) + if GlobalSettings.value("A2J/AutoStart", True, type=bool): + if not gDBus.a2j.get_hw_export() and GlobalSettings.value("A2J/AutoExport", True, type=bool): + gDBus.a2j.set_hw_export(True) + gDBus.a2j.start() + else: + self.b_a2j_start.setEnabled(True) + self.systray.setActionEnabled("a2j_start", True) self.checkAlsaAudio() self.checkPulseAudio() @@ -1405,7 +1389,6 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): def a2jStarted(self): self.b_a2j_start.setEnabled(False) self.b_a2j_stop.setEnabled(True) - self.b_a2j_export_hw.setEnabled(False) self.systray.setActionEnabled("a2j_start", False) self.systray.setActionEnabled("a2j_stop", True) self.systray.setActionEnabled("a2j_export_hw", False) @@ -1415,7 +1398,6 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): jackRunning = bool(gDBus.jack and gDBus.jack.IsStarted()) self.b_a2j_start.setEnabled(jackRunning) self.b_a2j_stop.setEnabled(False) - self.b_a2j_export_hw.setEnabled(True) self.systray.setActionEnabled("a2j_start", jackRunning) self.systray.setActionEnabled("a2j_stop", False) self.systray.setActionEnabled("a2j_export_hw", True) @@ -1790,16 +1772,10 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): @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) - - if ask == QMessageBox.Yes: - gDBus.a2j.set_hw_export(True) - elif ask == QMessageBox.No: - gDBus.a2j.set_hw_export(False) - - @pyqtSlot() - def slot_A2JBridgeOptions(self): - ToolBarA2JDialog(self).exec_() + if bool(gDBus.a2j.is_started()): + gDBus.a2j.stop() + gDBus.a2j.set_hw_export(True) + gDBus.a2j.start() @pyqtSlot() def slot_PulseAudioBridgeStart(self): @@ -2304,6 +2280,7 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): GlobalSettings.setValue("JACK/AutoStart", self.cb_jack_autostart.isChecked()) GlobalSettings.setValue("ALSA-Audio/BridgeIndexType", self.cb_alsa_type.currentIndex()) 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())) def loadSettings(self, geometry): @@ -2314,6 +2291,7 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): 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_autoexport.setChecked(GlobalSettings.value("A2J/AutoExport", True, type=bool)) self.cb_pulse_autostart.setChecked(GlobalSettings.value("Pulse2JACK/AutoStart", havePulseAudio and not usingAlsaLoop, type=bool)) def timerEvent(self, event): From 0642494c69f061de4956927d9a5c5c12c23e3915 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=A9rence=20Clastres?= Date: Mon, 21 Oct 2019 01:49:35 +0200 Subject: [PATCH 33/36] Refine #256 - Fix 'Export HW port' tray option not working and incorrect state - Disable 'Export HW port' when ports are already exported and notify it with the button text - Do not start A2JMIDI after exporting ports - Stop A2JMIDI before stopping JACK --- resources/ui/cadence.ui | 2 +- src/cadence.py | 36 +++++++++++++++++++++++++++++++----- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/resources/ui/cadence.ui b/resources/ui/cadence.ui index 2ee5a42..e61a8db 100644 --- a/resources/ui/cadence.ui +++ b/resources/ui/cadence.ui @@ -785,7 +785,7 @@ - Export HW ports and (re)start + Export HW ports diff --git a/src/cadence.py b/src/cadence.py index 3edca68..44369ce 100755 --- a/src/cadence.py +++ b/src/cadence.py @@ -1085,6 +1085,7 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): self.systray.connect("alsa_stop", self.slot_AlsaBridgeStop) self.systray.connect("a2j_start", self.slot_A2JBridgeStart) 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_stop", self.slot_PulseAudioBridgeStop) @@ -1337,14 +1338,25 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): self.m_timer500 = self.startTimer(500) if gDBus.a2j and not gDBus.a2j.is_started(): + portsExported = bool(gDBus.a2j.get_hw_export()) if GlobalSettings.value("A2J/AutoStart", True, type=bool): - if not gDBus.a2j.get_hw_export() and GlobalSettings.value("A2J/AutoExport", True, type=bool): + if not portsExported and GlobalSettings.value("A2J/AutoExport", True, type=bool): gDBus.a2j.set_hw_export(True) + self.systray.setActionEnabled("a2j_start", False) + portsExported = True gDBus.a2j.start() else: self.b_a2j_start.setEnabled(True) + self.b_a2j_export_hw.setEnabled(True) self.systray.setActionEnabled("a2j_start", True) + if portsExported: + self.b_a2j_export_hw.setText('Ports exported!') + + # It is only needed to export the ports initially, new ones will appear automatically + self.b_a2j_export_hw.setEnabled(not portsExported) + self.systray.setActionEnabled("a2j_export_hw", not portsExported) + self.checkAlsaAudio() self.checkPulseAudio() @@ -1376,7 +1388,10 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): if gDBus.a2j: self.b_a2j_start.setEnabled(False) + self.b_a2j_export_hw.setEnabled(False) self.systray.setActionEnabled("a2j_start", False) + if bool(gDBus.a2j.get_hw_export()): + self.b_a2j_export_hw.setText('Ports exported!') global jackClientIdALSA, jackClientIdPulse jackClientIdALSA = -1 @@ -1391,16 +1406,17 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): self.b_a2j_stop.setEnabled(True) self.systray.setActionEnabled("a2j_start", False) self.systray.setActionEnabled("a2j_stop", True) - self.systray.setActionEnabled("a2j_export_hw", False) self.label_bridge_a2j.setText(self.tr("ALSA MIDI Bridge is running")) def a2jStopped(self): jackRunning = bool(gDBus.jack and gDBus.jack.IsStarted()) + needExport = bool(not gDBus.a2j.get_hw_export() and jackRunning) self.b_a2j_start.setEnabled(jackRunning) self.b_a2j_stop.setEnabled(False) self.systray.setActionEnabled("a2j_start", jackRunning) self.systray.setActionEnabled("a2j_stop", False) - self.systray.setActionEnabled("a2j_export_hw", True) + self.systray.setActionEnabled("a2j_export_hw", needExport) + self.b_a2j_export_hw.setEnabled(needExport) self.label_bridge_a2j.setText(self.tr("ALSA MIDI Bridge is stopped")) def checkAlsaAudio(self): @@ -1651,6 +1667,8 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): @pyqtSlot() def slot_JackServerStop(self): + if gDBus.a2j: + gDBus.a2j.stop() try: gDBus.jack.StopServer() except: @@ -1772,10 +1790,18 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): @pyqtSlot() def slot_A2JBridgeExportHW(self): - if bool(gDBus.a2j.is_started()): + a2jWasStarted = bool(gDBus.a2j.is_started()) + + if a2jWasStarted: gDBus.a2j.stop() + gDBus.a2j.set_hw_export(True) - gDBus.a2j.start() + self.b_a2j_export_hw.setText('Ports exported!') + self.b_a2j_export_hw.setEnabled(False) + self.systray.setActionEnabled("a2j_export_hw", False) + + if a2jWasStarted: + gDBus.a2j.start() @pyqtSlot() def slot_PulseAudioBridgeStart(self): From 12e39079818ca43e6feb620403336767207d3761 Mon Sep 17 00:00:00 2001 From: Alex Tsitsimpis Date: Sun, 17 Nov 2019 20:21:07 +0200 Subject: [PATCH 34/36] Ensure a2j is started before attempting to stop it When stopping jackd, ensure that a2j is actually started before attempting to stop it. Otherwise we get an error and jackd is not stopped. Signed-off-by: Alex Tsitsimpis --- src/cadence.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cadence.py b/src/cadence.py index 44369ce..708dd4b 100755 --- a/src/cadence.py +++ b/src/cadence.py @@ -1667,7 +1667,7 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): @pyqtSlot() def slot_JackServerStop(self): - if gDBus.a2j: + if gDBus.a2j and bool(gDBus.a2j.is_started()): gDBus.a2j.stop() try: gDBus.jack.StopServer() From b69d157501bdf004dbd4c121eec12afd189057cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=A9rence=20Clastres?= Date: Sun, 17 Nov 2019 18:26:46 +0100 Subject: [PATCH 35/36] DBus cast fixes --- src/cadence.py | 4 ++-- src/jacksettings.py | 34 ++++++++++++++++++++-------------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/cadence.py b/src/cadence.py index 708dd4b..d99ab33 100755 --- a/src/cadence.py +++ b/src/cadence.py @@ -1310,7 +1310,7 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): def jackStarted(self): 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.b_jack_start.setEnabled(False) @@ -2324,7 +2324,7 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): if event.timerId() == self.m_timer500: if gDBus.jack and self.m_last_dsp_load != None: next_dsp_load = gDBus.jack.GetLoad() - next_xruns = gDBus.jack.GetXruns() + next_xruns = int(gDBus.jack.GetXruns()) needUpdateTip = False if self.m_last_dsp_load != next_dsp_load: diff --git a/src/jacksettings.py b/src/jacksettings.py index 69e9f75..d90a838 100755 --- a/src/jacksettings.py +++ b/src/jacksettings.py @@ -404,28 +404,30 @@ class JackSettingsW(QDialog): elif attribute == "alias": self.ui.obj_server_alias.setChecked(bool(value)) 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": - 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: + value = int(value) 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) - elif value == str(JACK_TIMER_CYCLE_COUNTER): + elif value == JACK_TIMER_CYCLE_COUNTER: 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) else: self.ui.obj_server_clock_source.setEnabled(False) print("JackSettingsW::saveServerSettings() - Invalid clock-source value '%s'" % value) 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": self.ui.obj_server_replace_registry.setChecked(bool(value)) elif attribute == "sync": @@ -627,17 +629,21 @@ class JackSettingsW(QDialog): elif attribute == "capture": if self.fDriverName == "firewire": 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: self.setComboBoxValue(self.ui.obj_driver_capture, str(value), True) elif attribute == "playback": if self.fDriverName == "firewire": 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: self.setComboBoxValue(self.ui.obj_driver_playback, str(value), True) 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": - self.setComboBoxValue(self.ui.obj_driver_period, str(value)) + self.setComboBoxValue(self.ui.obj_driver_period, str(int(value))) elif attribute == "nperiods": self.ui.obj_driver_nperiods.setValue(int(value)) elif attribute == "hwmon": From a2e733abc9b6617fa00246334a1544e2795d1d1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=A9rence=20Clastres?= Date: Sun, 17 Nov 2019 20:44:48 +0100 Subject: [PATCH 36/36] A2JMIDI: Simplify UI - Remove "Export HW Ports" button - Make the "Export Ports" checkbox apply changes immediately - Change the status label to show when ports are exported --- resources/ui/cadence.ui | 9 +-------- src/cadence.py | 33 ++++++++------------------------- 2 files changed, 9 insertions(+), 33 deletions(-) diff --git a/resources/ui/cadence.ui b/resources/ui/cadence.ui index e61a8db..267f04d 100644 --- a/resources/ui/cadence.ui +++ b/resources/ui/cadence.ui @@ -782,13 +782,6 @@
- - - - Export HW ports - - - @@ -825,7 +818,7 @@ - Export ports on startup + Export hardware ports diff --git a/src/cadence.py b/src/cadence.py index d99ab33..8b5192f 100755 --- a/src/cadence.py +++ b/src/cadence.py @@ -1063,7 +1063,6 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): self.systray.addMenu("a2j", self.tr("ALSA MIDI Bridge")) self.systray.addMenuAction("a2j", "a2j_start", self.tr("Start")) 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.addMenuAction("pulse", "pulse_start", self.tr("Start")) self.systray.addMenuAction("pulse", "pulse_stop", self.tr("Stop")) @@ -1085,7 +1084,6 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): self.systray.connect("alsa_stop", self.slot_AlsaBridgeStop) self.systray.connect("a2j_start", self.slot_A2JBridgeStart) 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_stop", self.slot_PulseAudioBridgeStop) @@ -1130,7 +1128,6 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): self.b_a2j_start.clicked.connect(self.slot_A2JBridgeStart) self.b_a2j_stop.clicked.connect(self.slot_A2JBridgeStop) - self.b_a2j_export_hw.clicked.connect(self.slot_A2JBridgeExportHW) 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) @@ -1189,6 +1186,7 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): # org.gna.home.a2jmidid.control self.DBusA2JBridgeStartedCallback.connect(self.slot_DBusA2JBridgeStartedCallback) self.DBusA2JBridgeStoppedCallback.connect(self.slot_DBusA2JBridgeStoppedCallback) + self.cb_a2j_autoexport.stateChanged[int].connect(self.slot_A2JBridgeExportHW) # ------------------------------------------------------------- @@ -1342,21 +1340,12 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): 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) - self.systray.setActionEnabled("a2j_start", False) portsExported = True gDBus.a2j.start() else: self.b_a2j_start.setEnabled(True) - self.b_a2j_export_hw.setEnabled(True) self.systray.setActionEnabled("a2j_start", True) - if portsExported: - self.b_a2j_export_hw.setText('Ports exported!') - - # It is only needed to export the ports initially, new ones will appear automatically - self.b_a2j_export_hw.setEnabled(not portsExported) - self.systray.setActionEnabled("a2j_export_hw", not portsExported) - self.checkAlsaAudio() self.checkPulseAudio() @@ -1388,10 +1377,7 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): if gDBus.a2j: self.b_a2j_start.setEnabled(False) - self.b_a2j_export_hw.setEnabled(False) self.systray.setActionEnabled("a2j_start", False) - if bool(gDBus.a2j.get_hw_export()): - self.b_a2j_export_hw.setText('Ports exported!') global jackClientIdALSA, jackClientIdPulse jackClientIdALSA = -1 @@ -1406,17 +1392,17 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): self.b_a2j_stop.setEnabled(True) self.systray.setActionEnabled("a2j_start", False) self.systray.setActionEnabled("a2j_stop", True) - 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): jackRunning = bool(gDBus.jack and gDBus.jack.IsStarted()) - needExport = bool(not gDBus.a2j.get_hw_export() and jackRunning) self.b_a2j_start.setEnabled(jackRunning) self.b_a2j_stop.setEnabled(False) self.systray.setActionEnabled("a2j_start", jackRunning) self.systray.setActionEnabled("a2j_stop", False) - self.systray.setActionEnabled("a2j_export_hw", needExport) - self.b_a2j_export_hw.setEnabled(needExport) self.label_bridge_a2j.setText(self.tr("ALSA MIDI Bridge is stopped")) def checkAlsaAudio(self): @@ -1788,17 +1774,14 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): def slot_A2JBridgeStop(self): gDBus.a2j.stop() - @pyqtSlot() - def slot_A2JBridgeExportHW(self): + @pyqtSlot(int) + def slot_A2JBridgeExportHW(self, state): a2jWasStarted = bool(gDBus.a2j.is_started()) if a2jWasStarted: gDBus.a2j.stop() - gDBus.a2j.set_hw_export(True) - self.b_a2j_export_hw.setText('Ports exported!') - self.b_a2j_export_hw.setEnabled(False) - self.systray.setActionEnabled("a2j_export_hw", False) + gDBus.a2j.set_hw_export(bool(state)) if a2jWasStarted: gDBus.a2j.start()