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):