Browse Source

Proper knobs enable change behaviour, fixes zyn skin after loading

tags/1.9.5
falkTX 11 years ago
parent
commit
62694ac83d
2 changed files with 13 additions and 18 deletions
  1. +2
    -6
      source/carla_skin.py
  2. +11
    -12
      source/widgets/pixmapdial.py

+ 2
- 6
source/carla_skin.py View File

@@ -464,9 +464,6 @@ class AbstractPluginSlot(QFrame, PluginEditParentMeta, metaclass=PyQtMetaClass):
#------------------------------------------------------------------

def drawOutline(self):
# FIXME - broken in Qt4
if MACOS: return

painter = QPainter(self)

if self.fIsSelected:
@@ -1378,7 +1375,6 @@ class PluginSlot_ZynFX(AbstractPluginSlot):
#elif paramName == "Random": paramName = "Rnd"

widget = PixmapDial(self, i)
widget.setEnabled(True)

widget.setPixmap(5)
widget.setLabel(paramName)
@@ -1388,8 +1384,8 @@ class PluginSlot_ZynFX(AbstractPluginSlot):
widget.setMinimum(paramRanges['min'])
widget.setMaximum(paramRanges['max'])

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

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


+ 11
- 12
source/widgets/pixmapdial.py View File

@@ -27,12 +27,12 @@ from carla_config import *
from math import cos, floor, pi, sin

if config_UseQt5:
from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QPointF, QRectF, QTimer, QSize
from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QEvent, QPointF, QRectF, QTimer, QSize
from PyQt5.QtGui import QColor, QConicalGradient, QFont, QFontMetrics
from PyQt5.QtGui import QLinearGradient, QPainter, QPainterPath, QPen, QPixmap
from PyQt5.QtWidgets import QDial
else:
from PyQt4.QtCore import pyqtSignal, pyqtSlot, Qt, QPointF, QRectF, QTimer, QSize
from PyQt4.QtCore import pyqtSignal, pyqtSlot, Qt, QEvent, QPointF, QRectF, QTimer, QSize
from PyQt4.QtGui import QColor, QConicalGradient, QFont, QFontMetrics
from PyQt4.QtGui import QDial, QLinearGradient, QPainter, QPainterPath, QPen, QPixmap

@@ -196,16 +196,6 @@ class PixmapDial(QDial):
self.updateSizes()
self.update()

def setEnabled(self, enabled):
if self.isEnabled() == enabled:
return

QDial.setEnabled(self, enabled)

self.fPixmap.load(":/bitmaps/dial_%s%s.png" % (self.fPixmapNum, "" if enabled else "d"))
self.updateSizes()
self.update()

def setIndex(self, index):
self.fIndex = index

@@ -254,12 +244,21 @@ class PixmapDial(QDial):
self.fRealValue = float(value)/10000.0 * (self.fMaximum - self.fMinimum) + self.fMinimum
self.realValueChanged.emit(self.fRealValue)

@pyqtSlot()
def slot_updatePixmap(self):
self.setPixmap(int(self.fPixmapNum))

def minimumSizeHint(self):
return QSize(self.fPixmapBaseSize, self.fPixmapBaseSize)

def sizeHint(self):
return QSize(self.fPixmapBaseSize, self.fPixmapBaseSize)

def changeEvent(self, event):
if event.type() == QEvent.EnabledChange:
QTimer.singleShot(0, self.slot_updatePixmap)
QDial.changeEvent(self, event)

def enterEvent(self, event):
self.fIsHovered = True
if self.fHoverStep == self.HOVER_MIN:


Loading…
Cancel
Save