Browse Source

Use the proper Keyboard scrollArea class in Edit dialog

tags/1.9.4
falkTX 10 years ago
parent
commit
b63b6683c6
3 changed files with 8 additions and 98 deletions
  1. +2
    -85
      resources/ui/carla_edit.ui
  2. +5
    -11
      source/carla_widgets.py
  3. +1
    -2
      source/widgets/pixmapkeyboard.py

+ 2
- 85
resources/ui/carla_edit.ui View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>592</width>
<height>494</height>
<width>488</width>
<height>407</height>
</rect>
</property>
<property name="windowTitle">
@@ -816,92 +816,9 @@ Plugin Name
</widget>
</widget>
</item>
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1440</width>
<height>64</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>1440</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>1440</width>
<height>64</height>
</size>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="PixmapKeyboard" name="keyboard" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>1440</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>1440</width>
<height>64</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>PixmapKeyboard</class>
<extends>QWidget</extends>
<header>pixmapkeyboard.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>PixmapDial</class>
<extends>QDial</extends>


+ 5
- 11
source/carla_widgets.py View File

@@ -31,6 +31,7 @@ import ui_carla_edit
import ui_carla_parameter

from carla_shared import *
from pixmapkeyboard import PixmapKeyboardHArea

# ------------------------------------------------------------------------------------------------------------
# Carla GUI defines
@@ -388,7 +389,6 @@ class PluginEdit(QDialog):
self.fCurrentStateFilename = None
self.fControlChannel = 0
self.fFirstInit = True
self.fScrollAreaSetup = False

self.fParameterCount = 0
self.fParameterList = [] # (type, id, widget)
@@ -424,12 +424,15 @@ class PluginEdit(QDialog):
self.ui.dial_pan.setPixmap(4)
self.ui.dial_pan.setLabel("Pan")

self.ui.scrollArea = PixmapKeyboardHArea(self)
self.layout().addWidget(self.ui.scrollArea)

self.ui.keyboard = self.ui.scrollArea.keyboard
self.ui.keyboard.setMode(self.ui.keyboard.HORIZONTAL)
self.ui.keyboard.setOctaves(10)

self.ui.sb_ctrl_channel.setValue(self.fControlChannel+1)

self.ui.scrollArea.ensureVisible(self.ui.keyboard.width() / 3, 0)
self.ui.scrollArea.setEnabled(False)
self.ui.scrollArea.setVisible(False)

@@ -1398,15 +1401,6 @@ class PluginEdit(QDialog):

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

def showEvent(self, event):
if not self.fScrollAreaSetup:
self.fScrollAreaSetup = True
minHeight = self.ui.scrollArea.height()+2
self.ui.scrollArea.setMinimumHeight(minHeight)
self.ui.scrollArea.setMaximumHeight(minHeight)

QDialog.showEvent(self, event)

def done(self, r):
QDialog.done(self, r)
self.close()


+ 1
- 2
source/widgets/pixmapkeyboard.py View File

@@ -449,11 +449,10 @@ class PixmapKeyboardHArea(QScrollArea):

self.keyboard = PixmapKeyboard(self)
self.keyboard.setOctaves(10)

self.setFixedHeight(self.keyboard.height() + self.horizontalScrollBar().height()/2 + 2)
self.setWidget(self.keyboard)

self.setEnabled(False)
self.setFixedHeight(self.keyboard.height() + self.horizontalScrollBar().height()/2 + 2)

QTimer.singleShot(0, self.slot_initScrollbarValue)



Loading…
Cancel
Save