diff --git a/resource/dial.ui b/resource/dial.ui index 7352e72..82e3622 100644 --- a/resource/dial.ui +++ b/resource/dial.ui @@ -181,7 +181,7 @@ p, li { white-space: pre-wrap; } Units: - + 370 @@ -190,26 +190,6 @@ p, li { white-space: pre-wrap; } 31 - - - Mph - - - - - Km/h - - - - - m/s - - - - - - - diff --git a/resource/rotational.ui b/resource/rotational.ui index a6e4194..5d1e41c 100644 --- a/resource/rotational.ui +++ b/resource/rotational.ui @@ -31,8 +31,8 @@ - 40 - 460 + 30 + 470 81 31 @@ -49,8 +49,8 @@ - 120 - 460 + 110 + 470 51 31 @@ -60,7 +60,7 @@ <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">0</p></body></html> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">-45</p></body></html> @@ -72,8 +72,8 @@ p, li { white-space: pre-wrap; } - 272 - 460 + 260 + 470 51 31 @@ -101,10 +101,10 @@ p, li { white-space: pre-wrap; } - 190 - 460 + 170 + 476 81 - 31 + 21 diff --git a/src/rqt_gauges/base_widget.py b/src/rqt_gauges/base_widget.py index 86d859e..9dd89a1 100644 --- a/src/rqt_gauges/base_widget.py +++ b/src/rqt_gauges/base_widget.py @@ -42,6 +42,12 @@ def __init__(self, node, name, ui_path): except AttributeError: print("obj does not have attribute 'minValue'") + try: + getattr(self.gauge, 'units') + self.units.textChanged.connect(self.updateUnits) + except AttributeError: + pass + # Signals Connection self.subscribe_button.pressed.connect(self.updateSubscription) self.gauge.updateValueSignal.connect(self.updateValue) @@ -79,6 +85,11 @@ def updateMaxValue(self): def updateValue(self, value): self.gauge.updateValue(value) + @pyqtSlot() + def updateUnits(self): + self.gauge.units = self.units.toPlainText() + self.gauge.update() + @pyqtSlot() def updateSubscription(self): if self.node.destroy_subscription(self.sub):