From 5692fe7ea33dc871c8ad7210867bd2cf36f56f7f Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 7 Jul 2013 05:42:01 +0100 Subject: [PATCH] Properly disable UI parameters when needed --- source/carla_shared.py | 2 ++ source/widgets/paramspinbox.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/source/carla_shared.py b/source/carla_shared.py index 48a6498b4..b9614b7e5 100644 --- a/source/carla_shared.py +++ b/source/carla_shared.py @@ -933,6 +933,8 @@ class PluginParameter(QWidget): self.ui.widget.setScalePoints(pInfo['scalePoints'], bool(pHints & PARAMETER_USES_SCALEPOINTS)) if not pHints & PARAMETER_IS_ENABLED: + self.ui.label.setEnabled(False) + self.ui.widget.setEnabled(False) self.ui.widget.setReadOnly(True) self.ui.sb_control.setEnabled(False) self.ui.sb_channel.setEnabled(False) diff --git a/source/widgets/paramspinbox.py b/source/widgets/paramspinbox.py index 13a01e302..7816a35cf 100644 --- a/source/widgets/paramspinbox.py +++ b/source/widgets/paramspinbox.py @@ -268,6 +268,10 @@ class ParamSpinBox(QAbstractSpinBox): self.fReadOnly = yesNo QAbstractSpinBox.setReadOnly(self, yesNo) + def setEnabled(self, yesNo): + self.fBar.setEnabled(yesNo) + QAbstractSpinBox.setEnabled(self, yesNo) + def setScalePoints(self, scalePoints, useScalePoints): if len(scalePoints) == 0: self.fScalePoints = None