| @@ -123,6 +123,7 @@ class ParamProgressBar(QProgressBar): | |||||
| self.fLeftClickDown = False | self.fLeftClickDown = False | ||||
| self.fIsInteger = False | self.fIsInteger = False | ||||
| self.fIsReadOnly = False | |||||
| self.fMinimum = 0.0 | self.fMinimum = 0.0 | ||||
| self.fMaximum = 1.0 | self.fMaximum = 1.0 | ||||
| @@ -184,6 +185,9 @@ class ParamProgressBar(QProgressBar): | |||||
| def setName(self, name): | def setName(self, name): | ||||
| self.fName = name | self.fName = name | ||||
| def setReadOnly(self, yesNo): | |||||
| self.fIsReadOnly = yesNo | |||||
| def setTextCall(self, textCall): | def setTextCall(self, textCall): | ||||
| self.fTextCall = textCall | self.fTextCall = textCall | ||||
| @@ -191,6 +195,9 @@ class ParamProgressBar(QProgressBar): | |||||
| self.fValueCall = valueCall | self.fValueCall = valueCall | ||||
| def handleMouseEventPos(self, pos): | def handleMouseEventPos(self, pos): | ||||
| if self.fIsReadOnly: | |||||
| return | |||||
| xper = float(pos.x()) / float(self.width()) | xper = float(pos.x()) / float(self.width()) | ||||
| value = xper * (self.fMaximum - self.fMinimum) + self.fMinimum | value = xper * (self.fMaximum - self.fMinimum) + self.fMinimum | ||||
| @@ -206,19 +213,30 @@ class ParamProgressBar(QProgressBar): | |||||
| self.valueChanged.emit(value) | self.valueChanged.emit(value) | ||||
| def mousePressEvent(self, event): | def mousePressEvent(self, event): | ||||
| if self.fIsReadOnly: | |||||
| return | |||||
| if event.button() == Qt.LeftButton: | if event.button() == Qt.LeftButton: | ||||
| self.handleMouseEventPos(event.pos()) | self.handleMouseEventPos(event.pos()) | ||||
| self.fLeftClickDown = True | self.fLeftClickDown = True | ||||
| else: | else: | ||||
| self.fLeftClickDown = False | self.fLeftClickDown = False | ||||
| QProgressBar.mousePressEvent(self, event) | QProgressBar.mousePressEvent(self, event) | ||||
| def mouseMoveEvent(self, event): | def mouseMoveEvent(self, event): | ||||
| if self.fIsReadOnly: | |||||
| return | |||||
| if self.fLeftClickDown: | if self.fLeftClickDown: | ||||
| self.handleMouseEventPos(event.pos()) | self.handleMouseEventPos(event.pos()) | ||||
| QProgressBar.mouseMoveEvent(self, event) | QProgressBar.mouseMoveEvent(self, event) | ||||
| def mouseReleaseEvent(self, event): | def mouseReleaseEvent(self, event): | ||||
| if self.fIsReadOnly: | |||||
| return | |||||
| self.fLeftClickDown = False | self.fLeftClickDown = False | ||||
| QProgressBar.mouseReleaseEvent(self, event) | QProgressBar.mouseReleaseEvent(self, event) | ||||
| @@ -353,6 +371,7 @@ class ParamSpinBox(QAbstractSpinBox): | |||||
| def setReadOnly(self, yesNo): | def setReadOnly(self, yesNo): | ||||
| self.fIsReadOnly = yesNo | self.fIsReadOnly = yesNo | ||||
| self.fBar.setReadOnly(yesNo) | |||||
| self.setButtonSymbols(QAbstractSpinBox.UpDownArrows if yesNo else QAbstractSpinBox.NoButtons) | self.setButtonSymbols(QAbstractSpinBox.UpDownArrows if yesNo else QAbstractSpinBox.NoButtons) | ||||
| QAbstractSpinBox.setReadOnly(self, yesNo) | QAbstractSpinBox.setReadOnly(self, yesNo) | ||||