Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Agüero <[email protected]>
  • Loading branch information
caguero committed Mar 7, 2024
1 parent 011fc31 commit d5ebb40
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 31 deletions.
22 changes: 1 addition & 21 deletions resource/dial.ui
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ p, li { white-space: pre-wrap; }
<string>Units:</string>
</property>
</widget>
<widget class="QComboBox" name="units">
<widget class="QTextEdit" name="units">
<property name="geometry">
<rect>
<x>370</x>
Expand All @@ -190,26 +190,6 @@ p, li { white-space: pre-wrap; }
<height>31</height>
</rect>
</property>
<item>
<property name="text">
<string>Mph</string>
</property>
</item>
<item>
<property name="text">
<string>Km/h</string>
</property>
</item>
<item>
<property name="text">
<string>m/s</string>
</property>
</item>
<item>
<property name="text">
<string/>
</property>
</item>
</widget>
<widget class="TopicQLineEdit" name="topic_to_subscribe">
<property name="geometry">
Expand Down
20 changes: 10 additions & 10 deletions resource/rotational.ui
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
<widget class="QLabel" name="min_value_label">
<property name="geometry">
<rect>
<x>40</x>
<y>460</y>
<x>30</x>
<y>470</y>
<width>81</width>
<height>31</height>
</rect>
Expand All @@ -49,8 +49,8 @@
<widget class="QTextEdit" name="min_value">
<property name="geometry">
<rect>
<x>120</x>
<y>460</y>
<x>110</x>
<y>470</y>
<width>51</width>
<height>31</height>
</rect>
Expand All @@ -60,7 +60,7 @@
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;0&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;-45&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="placeholderText">
<string/>
Expand All @@ -72,8 +72,8 @@ p, li { white-space: pre-wrap; }
</property>
<property name="geometry">
<rect>
<x>272</x>
<y>460</y>
<x>260</x>
<y>470</y>
<width>51</width>
<height>31</height>
</rect>
Expand Down Expand Up @@ -101,10 +101,10 @@ p, li { white-space: pre-wrap; }
<widget class="QLabel" name="max_value_label">
<property name="geometry">
<rect>
<x>190</x>
<y>460</y>
<x>170</x>
<y>476</y>
<width>81</width>
<height>31</height>
<height>21</height>
</rect>
</property>
<property name="font">
Expand Down
11 changes: 11 additions & 0 deletions src/rqt_gauges/base_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit d5ebb40

Please sign in to comment.