Browse Source

Rework ZynFX skin; Adjust code to 'shortify' parameter names

tags/1.9.5
falkTX 10 years ago
parent
commit
94cb6dabee
4 changed files with 483 additions and 158 deletions
  1. +6
    -3
      resources/ui/carla_plugin_basic_fx.ui
  2. +380
    -113
      resources/ui/carla_plugin_zynfx.ui
  3. +97
    -37
      source/carla_skin.py
  4. +0
    -5
      source/widgets/pixmapdial.py

+ 6
- 3
resources/ui/carla_plugin_basic_fx.ui View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>378</width>
<height>69</height>
<width>374</width>
<height>71</height>
</rect>
</property>
<property name="contextMenuPolicy">
@@ -24,7 +24,7 @@
<number>2</number>
</property>
<property name="topMargin">
<number>1</number>
<number>3</number>
</property>
<property name="rightMargin">
<number>2</number>
@@ -176,6 +176,9 @@
<property name="text">
<string>PluginName</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>


+ 380
- 113
resources/ui/carla_plugin_zynfx.ui View File

@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>458</width>
<width>559</width>
<height>75</height>
</rect>
</property>
@@ -22,128 +22,58 @@
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>1</number>
</property>
<property name="leftMargin">
<number>4</number>
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
<number>3</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<property name="horizontalSpacing">
<number>2</number>
</property>
<property name="verticalSpacing">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0" rowspan="2">
<widget class="DigitalPeakMeter" name="peak_in" native="true">
<property name="minimumSize">
<size>
<width>25</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>25</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item row="0" column="4" rowspan="2">
<widget class="DigitalPeakMeter" name="peak_out" native="true">
<property name="minimumSize">
<size>
<width>25</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>25</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QWidget" name="container" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>306</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="1" column="3">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>5</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>5</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1" colspan="3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>3</number>
<number>1</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="PixmapButton" name="b_enable">
<property name="minimumSize">
<size>
<width>22</width>
<height>22</height>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>22</width>
<height>22</height>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="text">
@@ -171,14 +101,14 @@
<widget class="PixmapButton" name="b_edit">
<property name="minimumSize">
<size>
<width>22</width>
<height>22</height>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>22</width>
<height>22</height>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="text">
@@ -202,50 +132,377 @@
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_presets">
<property name="text">
<string>Preset:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>3</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QComboBox" name="cb_presets">
<property name="minimumSize">
<size>
<width>125</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_name">
<property name="text">
<string>Name</string>
<string>PluginName</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>138</width>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_presets">
<widget class="QLabel" name="spacer_counter">
<property name="minimumSize">
<size>
<width>160</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>160</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Preset:</string>
<string/>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="cb_presets">
<widget class="LEDButton" name="led_control">
<property name="minimumSize">
<size>
<width>125</width>
<width>14</width>
<height>14</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>14</width>
<height>14</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="LEDButton" name="led_midi">
<property name="minimumSize">
<size>
<width>14</width>
<height>14</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>14</width>
<height>14</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="LEDButton" name="led_audio_in">
<property name="minimumSize">
<size>
<width>14</width>
<height>14</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>14</width>
<height>14</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="LEDButton" name="led_audio_out">
<property name="minimumSize">
<size>
<width>14</width>
<height>14</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>14</width>
<height>14</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line">
<property name="lineWidth">
<number>0</number>
</property>
<property name="midLineWidth">
<number>1</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>10</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<item>
<widget class="QWidget" name="w_screws_left" native="true">
<property name="minimumSize">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>20</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="w_knobs" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_4"/>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="PixmapDial" name="dial_drywet">
<property name="minimumSize">
<size>
<width>34</width>
<height>34</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>34</width>
<height>34</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="PixmapDial" name="dial_vol">
<property name="minimumSize">
<size>
<width>34</width>
<height>34</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>34</width>
<height>34</height>
</size>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="spacing">
<number>1</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item>
<widget class="DigitalPeakMeter" name="peak_in" native="true">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>150</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="DigitalPeakMeter" name="peak_out" native="true">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>150</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QWidget" name="w_screws_right" native="true">
<property name="minimumSize">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>20</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
</layout>
@@ -259,11 +516,21 @@
<header>digitalpeakmeter.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>LEDButton</class>
<extends>QPushButton</extends>
<header>ledbutton.h</header>
</customwidget>
<customwidget>
<class>PixmapButton</class>
<extends>QPushButton</extends>
<header>pixmapbutton.h</header>
</customwidget>
<customwidget>
<class>PixmapDial</class>
<extends>QDial</extends>
<header>pixmapdial.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../resources.qrc"/>


+ 97
- 37
source/carla_skin.py View File

@@ -44,10 +44,45 @@ import ui_carla_plugin_zynfx
from carla_widgets import *
from pixmapdial import PixmapDial

# ------------------------------------------------------------------------------------------------------------
# Try to "shortify" a parameter name

def getParameterShortName(paramName):
paramName = paramName.split("/",1)[0].split(" (",1)[0].split(" [",1)[0].strip()
paramLow = paramName.lower()

# Cut generic names
if "bandwidth" in paramLow:
paramName = paramName.replace("andwidth", "w")
elif "distortion" in paramLow:
paramName = paramName.replace("istortion", "ist")
elif "frequency" in paramLow:
paramName = paramName.replace("requency", "req")
elif "output" in paramLow:
paramName = paramName.replace("utput", "ut")
elif "threshold" in paramLow:
paramName = paramName.replace("hreshold", "hres")

# Cut useless prefix
elif paramLow.startswith("room "):
paramName = paramName.split(" ",1)[1]

# Cut useless suffix
elif paramLow.endswith(" level"):
paramName = paramName.rsplit(" ",1)[0]
elif paramLow.endswith(" time"):
paramName = paramName.rsplit(" ",1)[0]

if len(paramName) > 8:
paramName = paramName[:8]

return paramName.strip()

# ------------------------------------------------------------------------------------------------------------
# Abstract plugin slot

class AbstractPluginSlot(QFrame, PluginEditParentMeta, metaclass=PyQtMetaClass):
class AbstractPluginSlot(QFrame, PluginEditParentMeta):
#class AbstractPluginSlot(QFrame, PluginEditParentMeta, metaclass=PyQtMetaClass):
def __init__(self, parent, pluginId):
QFrame.__init__(self, parent)

@@ -776,10 +811,9 @@ class PluginSlot_BasicFX(AbstractPluginSlot):
# -------------------------------------------------------------
# Set-up GUI

labelFont = QFont()
labelFont = self.ui.label_name.font()
labelFont.setBold(True)
labelFont.setPointSize(9)

self.ui.label_name.setFont(labelFont)

r = 40
@@ -847,23 +881,12 @@ class PluginSlot_BasicFX(AbstractPluginSlot):

if paramData['type'] != PARAMETER_INPUT:
continue
if paramData['hints'] & PARAMETER_IS_BOOLEAN:
continue
if (paramData['hints'] & PARAMETER_IS_ENABLED) == 0:
continue

paramName = paramInfo['name'].split("/", 1)[0].split(" (", 1)[0].strip()
paramLow = paramName.lower()

if "Bandwidth" in paramName:
paramName = paramName.replace("Bandwidth", "Bw")
elif "Frequency" in paramName:
paramName = paramName.replace("Frequency", "Freq")
elif "Output" in paramName:
paramName = paramName.replace("Output", "Out")
elif paramLow == "threshold":
paramName = "Thres"

if len(paramName) > 9:
paramName = paramName[:9]
paramName = getParameterShortName(paramInfo['name'])

#if self.fPluginInfo['category'] == PLUGIN_CATEGORY_FILTER:
#_r = 55 + float(i)/8*200
@@ -892,7 +915,6 @@ class PluginSlot_BasicFX(AbstractPluginSlot):
widget.setCustomPaintColor(QColor(_r, _g, _b))
widget.setCustomPaintMode(PixmapDial.CUSTOM_PAINT_MODE_COLOR)
widget.forceWhiteLabelGradientText()

widget.setMinimum(paramRanges['min'])
widget.setMaximum(paramRanges['max'])

@@ -957,7 +979,7 @@ class PluginSlot_BasicFX(AbstractPluginSlot):
painter.setBrush(Qt.transparent)

painter.setPen(QPen(QColor(42, 42, 42), 1))
painter.drawRect(0, 1, self.width()-1, 76)
painter.drawRect(0, 1, self.width()-1, 79-3)

painter.setPen(QPen(QColor(60, 60, 60), 1))
painter.drawLine(0, 0, self.width(), 0)
@@ -1285,6 +1307,16 @@ class PluginSlot_ZynFX(AbstractPluginSlot):
self.ui.b_enable.setPixmaps(":/bitmaps/button_off.png", ":/bitmaps/button_on.png", ":/bitmaps/button_off.png")
self.ui.b_edit.setPixmaps(":/bitmaps/button_edit.png", ":/bitmaps/button_edit_down.png", ":/bitmaps/button_edit_hover.png")

labelFont = self.ui.label_name.font()
labelFont.setBold(True)
labelFont.setPointSize(9)
self.ui.label_name.setFont(labelFont)

presetFont = self.ui.label_presets.font()
presetFont.setBold(True)
presetFont.setPointSize(8)
self.ui.label_presets.setFont(presetFont)

# -------------------------------------------------------------
# Set-up parameters

@@ -1298,9 +1330,12 @@ class PluginSlot_ZynFX(AbstractPluginSlot):

if paramData['type'] != PARAMETER_INPUT:
continue
if paramData['hints'] & PARAMETER_IS_BOOLEAN:
continue
if (paramData['hints'] & PARAMETER_IS_ENABLED) == 0:
continue

paramName = paramInfo['name']
#paramLow = paramName.lower()

# real zyn fx plugins
if self.fPluginInfo['label'] == "zynalienwah":
@@ -1363,35 +1398,44 @@ class PluginSlot_ZynFX(AbstractPluginSlot):
elif i == 9: paramName = "R.S."
elif i == 10: paramName = "I.del"

#elif paramLow.find("damp"):
#paramName = "Damp"
#elif paramLow.find("frequency"):
#paramName = "Freq"

# Cut generic names
#elif paramName == "Depth": paramName = "Dpth"
#elif paramName == "Feedback": paramName = "Fb"
#elif paramName == "L/R Cross": #paramName = "L/R"
#elif paramName == "Random": paramName = "Rnd"
else:
paramName = getParameterShortName(paramInfo['name'])

widget = PixmapDial(self, i)

widget.setPixmap(5)
widget.setLabel(paramName)
widget.setCustomPaintMode(PixmapDial.CUSTOM_PAINT_MODE_NO_GRADIENT)
#widget.setMidWhiteText()

widget.setMinimum(paramRanges['min'])
widget.setMaximum(paramRanges['max'])

if (paramData['hints'] & PARAMETER_IS_ENABLED) == 0:
widget.setEnabled(False)

self.ui.container.layout().insertWidget(index, widget)
self.ui.w_knobs.layout().insertWidget(index, widget)
index += 1

self.fParameterList.append([i, widget])

self.ui.dial_drywet.setIndex(PARAMETER_DRYWET)
self.ui.dial_drywet.setPixmap(5)
self.ui.dial_drywet.setLabel("Wet")
self.ui.dial_drywet.setCustomPaintMode(PixmapDial.CUSTOM_PAINT_MODE_NO_GRADIENT)
self.ui.dial_drywet.setMinimum(0.0)
self.ui.dial_drywet.setMaximum(1.0)
self.ui.dial_drywet.setVisible(self.fPluginInfo['hints'] & PLUGIN_CAN_DRYWET)

self.ui.dial_vol.setIndex(PARAMETER_VOLUME)
self.ui.dial_vol.setPixmap(5)
self.ui.dial_vol.setLabel("Vol")
self.ui.dial_vol.setCustomPaintMode(PixmapDial.CUSTOM_PAINT_MODE_NO_GRADIENT)
self.ui.dial_vol.setMinimum(0.0)
self.ui.dial_vol.setMaximum(1.27)
self.ui.dial_vol.setVisible(self.fPluginInfo['hints'] & PLUGIN_CAN_VOLUME)

self.fParameterList.append([PARAMETER_DRYWET, self.ui.dial_drywet])
self.fParameterList.append([PARAMETER_VOLUME, self.ui.dial_vol])

# -------------------------------------------------------------
# Set-up MIDI programs

@@ -1426,21 +1470,37 @@ class PluginSlot_ZynFX(AbstractPluginSlot):

self.label_name = self.ui.label_name

self.led_control = self.ui.led_control
self.led_midi = self.ui.led_midi
self.led_audio_in = self.ui.led_audio_in
self.led_audio_out = self.ui.led_audio_out

self.peak_in = self.ui.peak_in
self.peak_out = self.ui.peak_out

self.ready()

self.peak_in.setOrientation(self.peak_in.VERTICAL)
self.peak_out.setOrientation(self.peak_out.VERTICAL)

self.customContextMenuRequested.connect(self.slot_showDefaultCustomMenu)
self.ui.cb_presets.currentIndexChanged.connect(self.slot_midiProgramChanged)

#------------------------------------------------------------------

def getFixedHeight(self):
return 70
return 74

#------------------------------------------------------------------

def paintEvent(self, event):
painter = QPainter(self)
painter.setBrush(Qt.transparent)

painter.setPen(QPen(QColor(60, 60, 60), 1))
painter.drawRect(0, 1, self.width()-1, 74-3)

painter.setPen(QPen(QColor(94, 94, 94), 1))
painter.drawLine(0, 0, self.width(), 0)

AbstractPluginSlot.paintEvent(self, event)

# ------------------------------------------------------------------------------------------------------------



+ 0
- 5
source/widgets/pixmapdial.py View File

@@ -129,11 +129,6 @@ class PixmapDial(QDial):
self.fLabelGradientColor2 = QColor(0, 0, 0, 0)
self.fLabelGradientColorT = [Qt.white, Qt.darkGray]

#def setMidWhiteText(self):
#self.fColor1 = QColor(0, 0, 0, 255)
#self.fColor2 = QColor(0, 0, 0, 0)
#self.fColorT = [QColor("#BBB"), Qt.darkGray]

def updateSizes(self):
self.fPixmapWidth = self.fPixmap.width()
self.fPixmapHeight = self.fPixmap.height()


Loading…
Cancel
Save