Skip to content

Commit

Permalink
Added estimated position in numbers to the Loco Positioning tab, closes
Browse files Browse the repository at this point in the history
bitcraze#314

Also reorganised the graphical layout to save space
  • Loading branch information
krichardsson committed Nov 17, 2017
1 parent 1bb0575 commit 0b612f6
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 49 deletions.
11 changes: 11 additions & 0 deletions src/cfclient/ui/tabs/locopositioning_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ def __init__(self, tabWidget, helper, *args):
self._anchor_pos_timer.setInterval(self.UPDATE_PERIOD_ANCHOR_POS)
self._anchor_pos_timer.timeout.connect(self._poll_anchor_positions)

self._update_position_label(self._position)
self._enable_anchor_pos_ui()

def _do_when_checked(self, enabled, fkn, arg):
Expand Down Expand Up @@ -780,4 +781,14 @@ def _update_graphics(self):
self._plot_yz.update(anchors, self._position, self._display_mode)
self._plot_xy.update(anchors, self._position, self._display_mode)
self._plot_xz.update(anchors, self._position, self._display_mode)
self._update_position_label(self._position)
self._enable_anchor_pos_ui()

def _update_position_label(self, position):
if len(position) == 3:
coordinate = "({:0.2f}, {:0.2f}, {:0.2f})".format(
position[0], position[1], position[2])
else:
coordinate = '(0.00, 0.00, 0.00)'

self._status_position.setText(coordinate)
133 changes: 84 additions & 49 deletions src/cfclient/ui/tabs/locopositioning_tab.ui
Original file line number Diff line number Diff line change
Expand Up @@ -32,37 +32,94 @@
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Mode</string>
<string>Graph settings</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QRadioButton" name="_estimated_postion_button">
<property name="text">
<string>Position estimate</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="_id_anchor_button">
<property name="text">
<string>Anchor identification</string>
</property>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QRadioButton" name="_estimated_postion_button">
<property name="text">
<string>Position estimate</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="_id_anchor_button">
<property name="text">
<string>Anchor identification</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QPushButton" name="_show_all_button">
<property name="text">
<string>Zoom to fit</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>Anchor ranging status</string>
<string>System status</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>Position</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="_status_position">
<property name="text">
<string>(0.0 , 0.0 , 0.0)</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="label_8">
<property name="text">
<string>Anchor</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="_status_a0">
<property name="frameShape">
Expand Down Expand Up @@ -165,37 +222,17 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>Graph settings</string>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QPushButton" name="_show_all_button">
<property name="text">
<string>Zoom to fit</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
Expand Down Expand Up @@ -635,8 +672,6 @@
</layout>
</widget>
<tabstops>
<tabstop>_estimated_postion_button</tabstop>
<tabstop>_id_anchor_button</tabstop>
<tabstop>_show_all_button</tabstop>
<tabstop>spin_a0x</tabstop>
<tabstop>spin_a0y</tabstop>
Expand Down

0 comments on commit 0b612f6

Please sign in to comment.