diff --git a/Makefile b/Makefile index 66ac79140..cde00daa8 100644 --- a/Makefile +++ b/Makefile @@ -249,6 +249,7 @@ wine64: # Resources RES = \ + bin/resources/carla_app.py \ bin/resources/carla_backend.py \ bin/resources/carla_config.py \ bin/resources/carla_database.py \ @@ -258,7 +259,7 @@ RES = \ bin/resources/carla_settings.py \ bin/resources/carla_skin.py \ bin/resources/carla_shared.py \ - bin/resources/carla_style.py \ + bin/resources/carla_utils.py \ bin/resources/carla_widgets.py \ bin/resources/canvaspreviewframe.py \ bin/resources/digitalpeakmeter.py \ @@ -503,6 +504,7 @@ install: $(DESTDIR)$(PREFIX)/share/carla/resources/zynaddsubfx/ # Install resources (re-use python files) + $(LINK) $(PREFIX)/share/carla/carla_app.py $(DESTDIR)$(PREFIX)/share/carla/resources/ $(LINK) $(PREFIX)/share/carla/carla_backend.py $(DESTDIR)$(PREFIX)/share/carla/resources/ $(LINK) $(PREFIX)/share/carla/carla_config.py $(DESTDIR)$(PREFIX)/share/carla/resources/ $(LINK) $(PREFIX)/share/carla/carla_database.py $(DESTDIR)$(PREFIX)/share/carla/resources/ @@ -512,7 +514,7 @@ install: $(LINK) $(PREFIX)/share/carla/carla_settings.py $(DESTDIR)$(PREFIX)/share/carla/resources/ $(LINK) $(PREFIX)/share/carla/carla_skin.py $(DESTDIR)$(PREFIX)/share/carla/resources/ $(LINK) $(PREFIX)/share/carla/carla_shared.py $(DESTDIR)$(PREFIX)/share/carla/resources/ - $(LINK) $(PREFIX)/share/carla/carla_style.py $(DESTDIR)$(PREFIX)/share/carla/resources/ + $(LINK) $(PREFIX)/share/carla/carla_utils.py $(DESTDIR)$(PREFIX)/share/carla/resources/ $(LINK) $(PREFIX)/share/carla/carla_widgets.py $(DESTDIR)$(PREFIX)/share/carla/resources/ $(LINK) $(PREFIX)/share/carla/canvaspreviewframe.py $(DESTDIR)$(PREFIX)/share/carla/resources/ $(LINK) $(PREFIX)/share/carla/digitalpeakmeter.py $(DESTDIR)$(PREFIX)/share/carla/resources/ diff --git a/source/carla_backend.py b/source/carla_backend.py index d7d1d9cbe..e5c4bfc85 100644 --- a/source/carla_backend.py +++ b/source/carla_backend.py @@ -2032,3 +2032,5 @@ class Host(object): self.msvcrt._putenv.restype = None else: self.msvcrt = None + +# ------------------------------------------------------------------------------------------------------------ diff --git a/source/carla_patchbay.py b/source/carla_patchbay.py index e82cffcec..6bb3672d7 100644 --- a/source/carla_patchbay.py +++ b/source/carla_patchbay.py @@ -391,10 +391,10 @@ class CarlaPatchbayW(QFrame, PluginEditParentMeta, metaclass=PyQtMetaClass): # ----------------------------------------------------------------- # called by PluginEdit to plugin skin parent, ignored here - def recheckPluginHints(self, hints): + def editDialogChanged(self, visible): pass - def editDialogChanged(self, visible): + def pluginHintsChanged(self, hints): pass def parameterValueChanged(self, parameterId, value): diff --git a/source/carla_shared.py b/source/carla_shared.py index fb4fc79d8..fa301b70a 100644 --- a/source/carla_shared.py +++ b/source/carla_shared.py @@ -603,33 +603,6 @@ def getAndSetPath(parent, currentPath, lineEdit): lineEdit.setText(newPath) return newPath -# ------------------------------------------------------------------------------------------------------------ -# Get plugin type as string -# TODO - move into new carla_utils.py - -def getPluginTypeAsString(ptype): - if ptype == PLUGIN_INTERNAL: - return "Internal" - if ptype == PLUGIN_LADSPA: - return "LADSPA" - if ptype == PLUGIN_DSSI: - return "DSSI" - if ptype == PLUGIN_LV2: - return "LV2" - if ptype == PLUGIN_VST: - return "VST" - if ptype == PLUGIN_VST3: - return "VST3" - if ptype == PLUGIN_AU: - return "AU" - if ptype == PLUGIN_GIG: - return "GIG" - if ptype == PLUGIN_SF2: - return "SF2" - if ptype == PLUGIN_SFZ: - return "SFZ" - return "Unknown" - # ------------------------------------------------------------------------------------------------------------ # Custom MessageBox diff --git a/source/carla_skin.py b/source/carla_skin.py index 019344554..5f73efa52 100644 --- a/source/carla_skin.py +++ b/source/carla_skin.py @@ -189,12 +189,6 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta, metaclass=PyQtMetaClass): #------------------------------------------------------------------ - def recheckPluginHints(self, hints): - self.fPluginInfo['hints'] = hints - - if self.b_gui is not None: - self.b_gui.setEnabled(bool(hints & PLUGIN_HAS_CUSTOM_UI)) - def setId(self, idx): self.fPluginId = idx self.fEditDialog.setId(idx) @@ -322,14 +316,6 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta, metaclass=PyQtMetaClass): self.b_enable.setChecked(onOff) self.b_enable.blockSignals(False) - def editDialogChanged(self, visible): - if self.b_edit is None: - return - - self.b_edit.blockSignals(True) - self.b_edit.setChecked(visible) - self.b_edit.blockSignals(False) - def customUiStateChanged(self, state): if self.b_gui is None: return @@ -358,6 +344,26 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta, metaclass=PyQtMetaClass): self.led_midi.setChecked(onOff) + def optionChanged(self, option, yesNo): + pass + + # ----------------------------------------------------------------- + # PluginEdit callbacks + + def editDialogChanged(self, visible): + if self.b_edit is None: + return + + self.b_edit.blockSignals(True) + self.b_edit.setChecked(visible) + self.b_edit.blockSignals(False) + + def pluginHintsChanged(self, hints): + self.fPluginInfo['hints'] = hints + + if self.b_gui is not None: + self.b_gui.setEnabled(bool(hints & PLUGIN_HAS_CUSTOM_UI)) + def parameterValueChanged(self, parameterId, value): for paramIndex, paramWidget in self.fParameterList: if paramIndex != parameterId: @@ -384,9 +390,6 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta, metaclass=PyQtMetaClass): self.cb_presets.setCurrentIndex(index) self.cb_presets.blockSignals(False) - def optionChanged(self, option, yesNo): - pass - def notePressed(self, note): pass @@ -1100,13 +1103,13 @@ class PluginSlot_Calf(AbstractPluginSlot): #------------------------------------------------------------------ - def recheckPluginHints(self, hints): + def pluginHintsChanged(self, hints): if hints & PLUGIN_HAS_CUSTOM_UI: self.ui.b_gui.setTopText(self.tr("GUI"), self.fButtonColorOn, self.fButtonFont) else: self.ui.b_gui.setTopText(self.tr("GUI"), self.fButtonColorOff, self.fButtonFont) - AbstractPluginSlot.recheckPluginHints(self, hints) + AbstractPluginSlot.pluginHintsChanged(self, hints) # ------------------------------------------------------------------------------------------------------------ diff --git a/source/carla_utils.py b/source/carla_utils.py new file mode 100644 index 000000000..7d493d168 --- /dev/null +++ b/source/carla_utils.py @@ -0,0 +1,85 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Carla Backend utils +# Copyright (C) 2011-2014 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 the Free Software Foundation; either version 2 of +# the License, or any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# For a full copy of the GNU General Public License see the doc/GPL.txt file. + +# ------------------------------------------------------------------------------------------------------------ +# Imports (Custom) + +from carla_backend import * + +# ------------------------------------------------------------------------------------------------------------ + +def getPluginTypeAsString(ptype): + if ptype == PLUGIN_NONE: + return "NONE" + if ptype == PLUGIN_INTERNAL: + return "Internal" + if ptype == PLUGIN_LADSPA: + return "LADSPA" + if ptype == PLUGIN_DSSI: + return "DSSI" + if ptype == PLUGIN_LV2: + return "LV2" + if ptype == PLUGIN_VST: + return "VST" + if ptype == PLUGIN_VST3: + return "VST3" + if ptype == PLUGIN_AU: + return "AU" + if ptype == PLUGIN_GIG: + return "GIG" + if ptype == PLUGIN_SF2: + return "SF2" + if ptype == PLUGIN_SFZ: + return "SFZ" + + print("getPluginTypeAsString(%i) - invalid type" % ptype); + return "Unknown" + +def getPluginTypeFromString(stype): + if not stype: + return PLUGIN_NONE + + stype = stype.lower() + + if stype == "none": + return PLUGIN_NONE + if stype == "internal": + return PLUGIN_INTERNAL + if stype == "ladspa": + return PLUGIN_LADSPA + if stype == "dssi": + return PLUGIN_DSSI + if stype == "lv2": + return PLUGIN_LV2 + if stype == "vst": + return PLUGIN_VST + if stype == "vst3": + return PLUGIN_VST3 + if stype == "au": + return PLUGIN_AU + if stype == "gig": + return PLUGIN_GIG + if stype == "sf2": + return PLUGIN_SF2 + if stype == "sfz": + return PLUGIN_SFZ + + print("getPluginTypeFromString(\"%s\") - invalid string type" % stype) + return PLUGIN_NONE + +# ------------------------------------------------------------------------------------------------------------ diff --git a/source/carla_widgets.py b/source/carla_widgets.py index b7818fa15..9890a5d67 100755 --- a/source/carla_widgets.py +++ b/source/carla_widgets.py @@ -42,6 +42,7 @@ import ui_carla_edit import ui_carla_parameter from carla_shared import * +from carla_utils import * from pixmapkeyboard import PixmapKeyboardHArea # ------------------------------------------------------------------------------------------------------------ @@ -399,11 +400,11 @@ class PluginParameter(QWidget): class PluginEditParentMeta(metaclass=ABCMeta): @abstractmethod - def recheckPluginHints(self, hints): + def editDialogChanged(self, visible): raise NotImplementedError @abstractmethod - def editDialogChanged(self, visible): + def pluginHintsChanged(self, hints): raise NotImplementedError @abstractmethod @@ -737,7 +738,7 @@ class PluginEdit(QDialog): # Force-Update parent for new hints if self.fRealParent and not self.fFirstInit: - self.fRealParent.recheckPluginHints(pluginHints) + self.fRealParent.pluginHintsChanged(pluginHints) def reloadParameters(self): # Reset