From 76731502235d63f038bf75e528c9756d2176d665 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 18 Aug 2018 14:23:32 +0200 Subject: [PATCH] Allow output/read-only params to go out of bounds --- source/carla_widgets.py | 5 +++-- source/widgets/paramspinbox.py | 8 +++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/source/carla_widgets.py b/source/carla_widgets.py index 9dd9e88b1..b34a36633 100755 --- a/source/carla_widgets.py +++ b/source/carla_widgets.py @@ -202,11 +202,9 @@ class PluginParameter(QWidget): self.ui.label.setText(pInfo['name']) self.ui.widget.setName(pInfo['name']) - self.ui.widget.setMinimum(pInfo['minimum']) self.ui.widget.setMaximum(pInfo['maximum']) self.ui.widget.setDefault(pInfo['default']) - self.ui.widget.setValue(pInfo['current']) self.ui.widget.setLabel(pInfo['unit']) self.ui.widget.setStep(pInfo['step']) self.ui.widget.setStepSmall(pInfo['stepSmall']) @@ -236,6 +234,9 @@ class PluginParameter(QWidget): self.ui.sb_control.setVisible(False) self.ui.sb_channel.setVisible(False) + # Only set value after all hints are handled + self.ui.widget.setValue(pInfo['current']) + if pHints & PARAMETER_USES_CUSTOM_TEXT and not host.isPlugin: self.ui.widget.setTextCallback(self._textCallBack) diff --git a/source/widgets/paramspinbox.py b/source/widgets/paramspinbox.py index bfbff801b..51a67455d 100644 --- a/source/widgets/paramspinbox.py +++ b/source/widgets/paramspinbox.py @@ -164,6 +164,11 @@ class ParamProgressBar(QProgressBar): else: vper = float(value - self.fMinimum) / div + if vper < 0.0: + vper = 0.0 + elif vper > 1.0: + vper = 1.0 + if self.fValueCall is not None: self.fValueCall(value) @@ -306,7 +311,8 @@ class ParamSpinBox(QAbstractSpinBox): self.fBar.setMaximum(value) def setValue(self, value): - value = geFixedValue(self.fName, value, self.fMinimum, self.fMaximum) + if not self.fIsReadOnly: + value = geFixedValue(self.fName, value, self.fMinimum, self.fMaximum) if self.fBar.fIsInteger: value = round(value)