From e755408bd4e7a802752f5a9940695e305298fdf7 Mon Sep 17 00:00:00 2001 From: Julio Date: Wed, 22 Aug 2018 12:40:06 +0200 Subject: [PATCH] Solve issue #27: Set double slider limits to system float limits This fix lets the user write slider limits that are higher than 10k or lower than -10k. The min and max spinboxes become slightly larger due to the larger limits. It would be a good feature to set a fixed spinbox length to solve this. --- src/rqt_ez_publisher/widget/double_value_widget.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/rqt_ez_publisher/widget/double_value_widget.py b/src/rqt_ez_publisher/widget/double_value_widget.py index f6b5a7a..f4818c2 100644 --- a/src/rqt_ez_publisher/widget/double_value_widget.py +++ b/src/rqt_ez_publisher/widget/double_value_widget.py @@ -1,7 +1,7 @@ from python_qt_binding import QtCore from python_qt_binding import QtWidgets import value_widget - +from sys import float_info as float_info class DoubleValueWidget(value_widget.ValueWidget): @@ -36,15 +36,15 @@ def slider_changed(self, val): def setup_ui(self, name): self._min_spin_box = QtWidgets.QDoubleSpinBox() - self._min_spin_box.setMaximum(10000) - self._min_spin_box.setMinimum(-10000) + self._min_spin_box.setMaximum(float_info.max) + self._min_spin_box.setMinimum(-float_info.max) self._min_spin_box.setValue(self.DEFAULT_MIN_VALUE) self._slider = QtWidgets.QSlider(QtCore.Qt.Horizontal) self._slider.setTickPosition(QtWidgets.QSlider.TicksBelow) self._slider.valueChanged.connect(self.slider_changed) self._max_spin_box = QtWidgets.QDoubleSpinBox() - self._max_spin_box.setMaximum(10000) - self._max_spin_box.setMinimum(-10000) + self._max_spin_box.setMaximum(float_info.max) + self._max_spin_box.setMinimum(-float_info.max) self._max_spin_box.setValue(self.DEFAULT_MAX_VALUE) self._lcd = QtWidgets.QLCDNumber() self._lcd.setMaximumHeight(self.LCD_HEIGHT)