diff --git a/source/carla_patchbay.py b/source/carla_patchbay.py index d839476c2..360151e29 100644 --- a/source/carla_patchbay.py +++ b/source/carla_patchbay.py @@ -94,7 +94,7 @@ class PluginInfo(object): # ------------------------------------------------------------------------------------------------ # Patchbay widget -class CarlaPatchbayW(QFrame): +class CarlaPatchbayW(QFrame, PluginEditParentMeta, metaclass=PyQtMetaClass): def __init__(self, parent, doSetup = True, onlyPatchbay = True, is3D = False): QFrame.__init__(self, parent) @@ -391,10 +391,19 @@ class CarlaPatchbayW(QFrame): # ----------------------------------------------------------------- # called by PluginEdit to plugin skin parent, ignored here + def recheckPluginHints(self, hints): + pass + def editDialogChanged(self, visible): pass - def recheckPluginHints(self, hints): + def parameterValueChanged(self, parameterId, value): + pass + + def programChanged(self, index): + pass + + def midiProgramChanged(self, index): pass def notePressed(self, note): diff --git a/source/carla_shared.py b/source/carla_shared.py index 5610564ee..f642cafba 100644 --- a/source/carla_shared.py +++ b/source/carla_shared.py @@ -29,14 +29,19 @@ import sys if config_UseQt5: from PyQt5.Qt import PYQT_VERSION_STR - from PyQt5.QtCore import qFatal, qVersion, qWarning, QDir + from PyQt5.QtCore import pyqtWrapperType, qFatal, qVersion, qWarning, QDir from PyQt5.QtGui import QIcon from PyQt5.QtWidgets import QFileDialog, QMessageBox else: from PyQt4.Qt import PYQT_VERSION_STR - from PyQt4.QtCore import qFatal, qVersion, qWarning, QDir + from PyQt4.QtCore import pyqtWrapperType, qFatal, qVersion, qWarning, QDir from PyQt4.QtGui import QFileDialog, QIcon, QMessageBox +# ------------------------------------------------------------------------------------------------------------ +# Import ABC + +from abc import ABCMeta, abstractmethod + # ------------------------------------------------------------------------------------------------------------ # Import Signal @@ -636,3 +641,9 @@ def CustomMessageBox(parent, icon, title, text, extraText="", buttons=QMessageBo return msgBox.exec_() # ------------------------------------------------------------------------------------------------------------ +# An empty class used to resolve metaclass conflicts between ABC and PyQt modules + +class PyQtMetaClass(pyqtWrapperType, ABCMeta): + pass + +# ------------------------------------------------------------------------------------------------------------ diff --git a/source/carla_skin.py b/source/carla_skin.py index 5b37e6431..0fad4d176 100644 --- a/source/carla_skin.py +++ b/source/carla_skin.py @@ -47,7 +47,7 @@ from pixmapdial import PixmapDial # ------------------------------------------------------------------------------------------------------------ # Abstract plugin slot -class AbstractPluginSlot(QFrame): +class AbstractPluginSlot(QFrame, PluginEditParentMeta, metaclass=PyQtMetaClass): def __init__(self, parent, pluginId): QFrame.__init__(self, parent) diff --git a/source/carla_widgets.py b/source/carla_widgets.py index 75a6fd561..22203d524 100755 --- a/source/carla_widgets.py +++ b/source/carla_widgets.py @@ -25,11 +25,11 @@ from carla_config import * # Imports (Global) if config_UseQt5: - from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QByteArray, QSettings, QTimer + from PyQt5.QtCore import pyqtSignal, pyqtSlot, pyqtWrapperType, Qt, QByteArray, QSettings, QTimer from PyQt5.QtGui import QColor, QCursor, QFontMetrics, QPainter, QPainterPath from PyQt5.QtWidgets import QDialog, QInputDialog, QLineEdit, QMenu, QVBoxLayout, QWidget else: - from PyQt4.QtCore import pyqtSignal, pyqtSlot, Qt, QByteArray, QSettings, QTimer + from PyQt4.QtCore import pyqtSignal, pyqtSlot, pyqtWrapperType, Qt, QByteArray, QSettings, QTimer from PyQt4.QtGui import QColor, QCursor, QFontMetrics, QPainter, QPainterPath from PyQt4.QtGui import QDialog, QInputDialog, QLineEdit, QMenu, QVBoxLayout, QWidget @@ -394,6 +394,38 @@ class PluginParameter(QWidget): def _textCallBack(self): return gCarla.host.get_parameter_text(self.fPluginId, self.fParameterId) +# ------------------------------------------------------------------------------------------------------------ +# Plugin Editor Parent (Meta class) + +class PluginEditParentMeta(metaclass=ABCMeta): + @abstractmethod + def recheckPluginHints(self, hints): + raise NotImplementedError + + @abstractmethod + def editDialogChanged(self, visible): + raise NotImplementedError + + @abstractmethod + def parameterValueChanged(self, parameterId, value): + raise NotImplementedError + + @abstractmethod + def programChanged(self, index): + raise NotImplementedError + + @abstractmethod + def midiProgramChanged(self, index): + raise NotImplementedError + + @abstractmethod + def notePressed(self, note): + raise NotImplementedError + + @abstractmethod + def noteReleased(self, note): + raise NotImplementedError + # ------------------------------------------------------------------------------------------------------------ # Plugin Editor (Built-in) @@ -405,6 +437,9 @@ class PluginEdit(QDialog): self.ui = ui_carla_edit.Ui_PluginEdit() self.ui.setupUi(self) + if False: + parent = PluginEditParent() + # ------------------------------------------------------------- # Internal stuff