| @@ -94,7 +94,7 @@ class PluginInfo(object): | |||||
| # ------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------ | ||||
| # Patchbay widget | # Patchbay widget | ||||
| class CarlaPatchbayW(QFrame): | |||||
| class CarlaPatchbayW(QFrame, PluginEditParentMeta, metaclass=PyQtMetaClass): | |||||
| def __init__(self, parent, doSetup = True, onlyPatchbay = True, is3D = False): | def __init__(self, parent, doSetup = True, onlyPatchbay = True, is3D = False): | ||||
| QFrame.__init__(self, parent) | QFrame.__init__(self, parent) | ||||
| @@ -391,10 +391,19 @@ class CarlaPatchbayW(QFrame): | |||||
| # ----------------------------------------------------------------- | # ----------------------------------------------------------------- | ||||
| # called by PluginEdit to plugin skin parent, ignored here | # called by PluginEdit to plugin skin parent, ignored here | ||||
| def recheckPluginHints(self, hints): | |||||
| pass | |||||
| def editDialogChanged(self, visible): | def editDialogChanged(self, visible): | ||||
| pass | pass | ||||
| def recheckPluginHints(self, hints): | |||||
| def parameterValueChanged(self, parameterId, value): | |||||
| pass | |||||
| def programChanged(self, index): | |||||
| pass | |||||
| def midiProgramChanged(self, index): | |||||
| pass | pass | ||||
| def notePressed(self, note): | def notePressed(self, note): | ||||
| @@ -29,14 +29,19 @@ import sys | |||||
| if config_UseQt5: | if config_UseQt5: | ||||
| from PyQt5.Qt import PYQT_VERSION_STR | 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.QtGui import QIcon | ||||
| from PyQt5.QtWidgets import QFileDialog, QMessageBox | from PyQt5.QtWidgets import QFileDialog, QMessageBox | ||||
| else: | else: | ||||
| from PyQt4.Qt import PYQT_VERSION_STR | 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 | from PyQt4.QtGui import QFileDialog, QIcon, QMessageBox | ||||
| # ------------------------------------------------------------------------------------------------------------ | |||||
| # Import ABC | |||||
| from abc import ABCMeta, abstractmethod | |||||
| # ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
| # Import Signal | # Import Signal | ||||
| @@ -636,3 +641,9 @@ def CustomMessageBox(parent, icon, title, text, extraText="", buttons=QMessageBo | |||||
| return msgBox.exec_() | return msgBox.exec_() | ||||
| # ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
| # An empty class used to resolve metaclass conflicts between ABC and PyQt modules | |||||
| class PyQtMetaClass(pyqtWrapperType, ABCMeta): | |||||
| pass | |||||
| # ------------------------------------------------------------------------------------------------------------ | |||||
| @@ -47,7 +47,7 @@ from pixmapdial import PixmapDial | |||||
| # ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
| # Abstract plugin slot | # Abstract plugin slot | ||||
| class AbstractPluginSlot(QFrame): | |||||
| class AbstractPluginSlot(QFrame, PluginEditParentMeta, metaclass=PyQtMetaClass): | |||||
| def __init__(self, parent, pluginId): | def __init__(self, parent, pluginId): | ||||
| QFrame.__init__(self, parent) | QFrame.__init__(self, parent) | ||||
| @@ -25,11 +25,11 @@ from carla_config import * | |||||
| # Imports (Global) | # Imports (Global) | ||||
| if config_UseQt5: | 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.QtGui import QColor, QCursor, QFontMetrics, QPainter, QPainterPath | ||||
| from PyQt5.QtWidgets import QDialog, QInputDialog, QLineEdit, QMenu, QVBoxLayout, QWidget | from PyQt5.QtWidgets import QDialog, QInputDialog, QLineEdit, QMenu, QVBoxLayout, QWidget | ||||
| else: | 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 QColor, QCursor, QFontMetrics, QPainter, QPainterPath | ||||
| from PyQt4.QtGui import QDialog, QInputDialog, QLineEdit, QMenu, QVBoxLayout, QWidget | from PyQt4.QtGui import QDialog, QInputDialog, QLineEdit, QMenu, QVBoxLayout, QWidget | ||||
| @@ -394,6 +394,38 @@ class PluginParameter(QWidget): | |||||
| def _textCallBack(self): | def _textCallBack(self): | ||||
| return gCarla.host.get_parameter_text(self.fPluginId, self.fParameterId) | 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) | # Plugin Editor (Built-in) | ||||
| @@ -405,6 +437,9 @@ class PluginEdit(QDialog): | |||||
| self.ui = ui_carla_edit.Ui_PluginEdit() | self.ui = ui_carla_edit.Ui_PluginEdit() | ||||
| self.ui.setupUi(self) | self.ui.setupUi(self) | ||||
| if False: | |||||
| parent = PluginEditParent() | |||||
| # ------------------------------------------------------------- | # ------------------------------------------------------------- | ||||
| # Internal stuff | # Internal stuff | ||||