Browse Source

Some Ui experiments; Start ZynFX skin

tags/1.9.4
falkTX 12 years ago
parent
commit
7605c6a552
10 changed files with 421 additions and 23 deletions
  1. +2
    -1
      Makefile
  2. BIN
      resources/bitmaps/background_zynfx.png
  3. BIN
      resources/bitmaps/dial_05.png
  4. BIN
      resources/bitmaps/dial_05d.png
  5. +2
    -0
      resources/resources.qrc
  6. +0
    -0
      resources/ui/carla_plugin_default.ui
  7. +234
    -0
      resources/ui/carla_plugin_zynfx.ui
  8. +3
    -1
      source/carla_rack.py
  9. +178
    -19
      source/carla_skin.py
  10. +2
    -2
      source/carla_widgets.py

+ 2
- 1
Makefile View File

@@ -88,7 +88,8 @@ UIs = \
source/ui_carla_edit.py \
source/ui_carla_host.py \
source/ui_carla_parameter.py \
source/ui_carla_plugin.py \
source/ui_carla_plugin_default.py \
source/ui_carla_plugin_zynfx.py \
source/ui_carla_refresh.py \
source/ui_carla_settings.py \
source/ui_carla_settings_driver.py \


BIN
resources/bitmaps/background_zynfx.png View File

Before After
Width: 51  |  Height: 51  |  Size: 3.1KB

BIN
resources/bitmaps/dial_05.png View File

Before After
Width: 4530  |  Height: 30  |  Size: 154KB

BIN
resources/bitmaps/dial_05d.png View File

Before After
Width: 8909  |  Height: 59  |  Size: 372KB

+ 2
- 0
resources/resources.qrc View File

@@ -48,6 +48,7 @@
<file>scalable/distrho.svg</file>

<file>bitmaps/carla_about.png</file>
<file>bitmaps/background_zynfx.png</file>
<file>bitmaps/button_distrho.png</file>
<file>bitmaps/button_distrho2.png</file>
<file>bitmaps/button_distrho_down.png</file>
@@ -82,6 +83,7 @@
<file>bitmaps/dial_03d.png</file>
<file>bitmaps/dial_04.png</file>
<file>bitmaps/dial_04d.png</file>
<file>bitmaps/dial_05.png</file>
<file>bitmaps/kbd_h_classic.png</file>
<file>bitmaps/kbd_h_orange.png</file>
<file>bitmaps/kbd_v_classic.png</file>


resources/ui/carla_plugin.ui → resources/ui/carla_plugin_default.ui View File


+ 234
- 0
resources/ui/carla_plugin_zynfx.ui View File

@@ -0,0 +1,234 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PluginWidget</class>
<widget class="QFrame" name="PluginWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>397</width>
<height>72</height>
</rect>
</property>
<property name="windowTitle">
<string>Frame</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>2</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">
<number>0</number>
</property>
<item row="0" column="0" rowspan="2">
<widget class="DigitalPeakMeter" name="peak_in" native="true">
<property name="minimumSize">
<size>
<width>30</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>30</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>1</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="PixmapButton" name="b_enable">
<property name="minimumSize">
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/bitmaps/button_off.png</normaloff>:/bitmaps/button_off.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="PixmapButton" name="b_edit">
<property name="minimumSize">
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/bitmaps/button_edit.png</normaloff>:/bitmaps/button_edit.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_name">
<property name="text">
<string>Name</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>138</width>
<height>20</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>
<widget class="QComboBox" name="cb_presets"/>
</item>
</layout>
</item>
<item row="0" column="2" rowspan="2">
<widget class="DigitalPeakMeter" name="peak_out" native="true">
<property name="minimumSize">
<size>
<width>30</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>30</width>
<height>16777215</height>
</size>
</property>
<zorder>peak_in</zorder>
</widget>
</item>
<item row="1" column="1">
<widget class="QWidget" name="container" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>5</number>
</property>
<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>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>DigitalPeakMeter</class>
<extends>QWidget</extends>
<header>digitalpeakmeter.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>PixmapButton</class>
<extends>QPushButton</extends>
<header>pixmapbutton.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../resources.qrc"/>
</resources>
<connections/>
</ui>

+ 3
- 1
source/carla_rack.py View File

@@ -36,7 +36,9 @@ class CarlaRackItem(QListWidgetItem):
def __init__(self, parent, pluginId):
QListWidgetItem.__init__(self, parent, self.kRackItemType)

self.widget = createPluginSlot(pluginId, parent)
self.widget = createPluginSlot(parent, pluginId)
self.widget.setFixedHeight(self.widget.getFixedHeight())

self.setSizeHint(QSize(300, self.widget.getFixedHeight()))

parent.setItemWidget(self, self.widget)


+ 178
- 19
source/carla_skin.py View File

@@ -19,15 +19,16 @@
# ------------------------------------------------------------------------------------------------------------
# Imports (Global)

from PyQt4.QtCore import pyqtSignal, pyqtSlot
from PyQt4.QtGui import QFrame

# ------------------------------------------------------------------------------------------------------------
# Imports (Custom)

import ui_carla_plugin
import ui_carla_plugin_default
import ui_carla_plugin_zynfx

from carla_widgets import *
from pixmapdial import PixmapDial

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

@@ -226,7 +227,7 @@ class PluginSlot(QFrame):
class PluginSlot_Default(PluginSlot):
def __init__(self, parent, pluginId):
PluginSlot.__init__(self, parent, pluginId)
self.ui = ui_carla_plugin.Ui_PluginWidget()
self.ui = ui_carla_plugin_default.Ui_PluginWidget()
self.ui.setupUi(self)

# -------------------------------------------------------------
@@ -306,8 +307,6 @@ class PluginSlot_Default(PluginSlot):

self.ui.label_name.setText(self.fPluginInfo['name'])

self.setFixedHeight(32)

# -------------------------------------------------------------
# Set-up connections

@@ -414,7 +413,7 @@ class PluginSlot_Default(PluginSlot):
def slot_showCustomMenu(self):
menu = QMenu(self)

actActive = menu.addAction(self.tr("Disable") if self.fIsEnabled else self.tr("Enable"))
actActive = menu.addAction(self.tr("Disable") if self.ui.b_enable.isChecked() else self.tr("Enable"))
menu.addSeparator()

actGui = menu.addAction(self.tr("Show GUI"))
@@ -473,7 +472,9 @@ class PluginSlot_Default(PluginSlot):
painter = QPainter(self)
painter.save()

areaX = self.ui.area_right.x()+7
areaX = self.ui.area_right.x()+7
width = self.width()
height = self.height()

painter.setPen(self.fColorSeprtr.lighter(110))
painter.setBrush(self.fColorBottom)
@@ -481,45 +482,203 @@ class PluginSlot_Default(PluginSlot):

# name -> leds arc
path = QPainterPath()
path.moveTo(areaX-20, self.height()-4)
path.cubicTo(areaX, self.height()-5, areaX-20, 4.75, areaX, 4.75)
path.lineTo(areaX, self.height()-5)
path.moveTo(areaX-20, height-4)
path.cubicTo(areaX, height-5, areaX-20, 4.75, areaX, 4.75)
path.lineTo(areaX, height-5)
painter.drawPath(path)

painter.setPen(self.fColorSeprtr)
painter.setRenderHint(QPainter.Antialiasing, False)

# separator lines
painter.drawLine(0, self.height()-5, areaX-20, self.height()-5)
painter.drawLine(areaX, 4, self.width(), 4)
painter.drawLine(0, height-5, areaX-20, height-5)
painter.drawLine(areaX, 4, width, 4)

painter.setPen(self.fColorBottom)
painter.setBrush(self.fColorBottom)

# top, bottom and left lines
painter.drawLine(0, 0, self.width(), 0)
painter.drawRect(0, self.height()-4, areaX, 4)
painter.drawRoundedRect(areaX-20, self.height()-5, areaX, 5, 22, 22)
painter.drawLine(0, 0, 0, self.height())
painter.drawLine(0, 0, width, 0)
painter.drawRect(0, height-4, areaX, 4)
painter.drawRoundedRect(areaX-20, height-5, areaX, 5, 22, 22)
painter.drawLine(0, 0, 0, height)

# fill the rest
painter.drawRect(areaX-1, 5, self.width(), self.height())
painter.drawRect(areaX-1, 5, width, height)

# bottom 1px line
painter.setPen(self.fColorSeprtr)
painter.drawLine(0, self.height()-1, self.width(), self.height()-1)
painter.drawLine(0, height-1, width, height-1)

painter.restore()
PluginSlot.paintEvent(self, event)

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

def createPluginSlot(pluginId, parent):
class PluginSlot_ZynFX(PluginSlot):
def __init__(self, parent, pluginId):
PluginSlot.__init__(self, parent, pluginId)
self.ui = ui_carla_plugin_zynfx.Ui_PluginWidget()
self.ui.setupUi(self)

# -------------------------------------------------------------
# Set-up GUI

self.setStyleSheet("""
QFrame#PluginWidget {
background-image: url(:/bitmaps/background_zynfx.png);
background-repeat: repeat-xy;
}""")

#background-position: top left;

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

self.ui.peak_in.setColor(self.ui.peak_in.GREEN)
self.ui.peak_in.setChannels(self.fPeaksInputCount)
self.ui.peak_in.setOrientation(self.ui.peak_in.VERTICAL)

self.ui.peak_out.setColor(self.ui.peak_in.BLUE)
self.ui.peak_out.setChannels(self.fPeaksOutputCount)
self.ui.peak_out.setOrientation(self.ui.peak_out.VERTICAL)

self.ui.label_name.setText(self.fPluginInfo['name'])

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

self.fParameterList = [] # index, widget

parameterCount = Carla.host.get_parameter_count(self.fPluginId)

index = 0
for i in range(parameterCount):
paramInfo = Carla.host.get_parameter_info(self.fPluginId, i)
paramData = Carla.host.get_parameter_data(self.fPluginId, i)
paramRanges = Carla.host.get_parameter_ranges(self.fPluginId, i)
paramValue = Carla.host.get_current_parameter_value(self.fPluginId, i)

if paramData['type'] not in (PARAMETER_INPUT, PARAMETER_OUTPUT):
continue

widget = PixmapDial(self)
widget.setPixmap(5)
widget.setLabel(charPtrToString(paramInfo['name']))

widget.setMinimum(paramRanges['min']*100)
widget.setMaximum(paramRanges['max']*100)
widget.setValue(paramValue*100)

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

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

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

midiProgramCount = Carla.host.get_midi_program_count(self.fPluginId) if Carla.host is not None else 0

if midiProgramCount > 0:
self.ui.cb_presets.setEnabled(True)
self.ui.label_presets.setEnabled(True)

for i in range(midiProgramCount):
mpData = Carla.host.get_midi_program_data(self.fPluginId, i)
mpName = charPtrToString(mpData['name'])

self.ui.cb_presets.addItem(mpName)

self.fCurrentMidiProgram = Carla.host.get_current_midi_program_index(self.fPluginId)
self.ui.cb_presets.setCurrentIndex(self.fCurrentMidiProgram)

else:
self.fCurrentMidiProgram = -1
self.ui.cb_presets.setEnabled(False)
self.ui.label_presets.setEnabled(False)

# -------------------------------------------------------------
# Set-up connections

self.ui.b_enable.clicked.connect(self.slot_enableClicked)
self.ui.b_edit.clicked.connect(self.slot_showEditDialog)

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

def getFixedHeight(self):
return 75

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

def setName(self, name):
self.ui.label_name.setText(name)
PluginSlot.setName(self, name)

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

def activeChanged(self, onOff):
self.ui.b_enable.setChecked(onOff)

def editDialogChanged(self, visible):
self.ui.b_edit.blockSignals(True)
self.ui.b_edit.setChecked(visible)
self.ui.b_edit.blockSignals(False)

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

def idleFast(self):
# Input peaks
if self.fPeaksInputCount > 0:
if self.fPeaksInputCount > 1:
peak1 = Carla.host.get_input_peak_value(self.fPluginId, 1)
peak2 = Carla.host.get_input_peak_value(self.fPluginId, 2)
self.ui.peak_in.displayMeter(1, peak1)
self.ui.peak_in.displayMeter(2, peak2)
else:
peak = Carla.host.get_input_peak_value(self.fPluginId, 1)
self.ui.peak_in.displayMeter(1, peak)

# Output peaks
if self.fPeaksOutputCount > 0:
if self.fPeaksOutputCount > 1:
peak1 = Carla.host.get_output_peak_value(self.fPluginId, 1)
peak2 = Carla.host.get_output_peak_value(self.fPluginId, 2)
self.ui.peak_out.displayMeter(1, peak1)
self.ui.peak_out.displayMeter(2, peak2)
else:
peak = Carla.host.get_output_peak_value(self.fPluginId, 1)
self.ui.peak_out.displayMeter(1, peak)

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

@pyqtSlot(bool)
def slot_enableClicked(self, yesNo):
self.setActive(yesNo, False, True)

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

#def paintEvent(self, event):
#painter = QPainter(self)
#painter.save()

#painter.setPen(QColor(0, 0, 200))
#painter.setBrush(QColor(0, 0, 200))
#painter.drawRect(0, 0, self.width(), self.height())

#painter.restore()
#PluginSlot.paintEvent(self, event)

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

def createPluginSlot(parent, pluginId):
pluginInfo = Carla.host.get_plugin_info(pluginId)
pluginInfo['label'] = charPtrToString(pluginInfo['label'])
pluginInfo['maker'] = charPtrToString(pluginInfo['maker'])
pluginInfo['iconName'] = charPtrToString(pluginInfo['iconName'])

#return PluginSlot(parent, pluginId)
return PluginSlot_Default(parent, pluginId)
#return PluginSlot_ZynFX(parent, pluginId)

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

+ 2
- 2
source/carla_widgets.py View File

@@ -21,7 +21,7 @@

from PyQt4.QtCore import pyqtSignal, pyqtSlot, QByteArray, QSettings
from PyQt4.QtGui import QColor, QCursor, QFontMetrics, QPainter, QPainterPath
from PyQt4.QtGui import QDialog, QFrame, QInputDialog, QLineEdit, QMenu, QVBoxLayout, QWidget
from PyQt4.QtGui import QDialog, QInputDialog, QLineEdit, QMenu, QVBoxLayout, QWidget

# ------------------------------------------------------------------------------------------------------------
# Imports (Custom)
@@ -735,7 +735,7 @@ class PluginEdit(QDialog):
}

for j in range(paramInfo['scalePointCount']):
scalePointInfo = Carla.host.get_parameter_scalepoint_info(self.fPluginId, i, j)
scalePointInfo = Carla.host.get_parameter_scalepoint_info(self.fPluginId, i, j)

parameter['scalePoints'].append({
'value': scalePointInfo['value'],


Loading…
Cancel
Save