Add moving and resetting start animation position

This commit is contained in:
Arthur Golubtsov
2019-09-19 17:13:15 +03:00
parent 392b06f494
commit 424f1cbec2
4 changed files with 44 additions and 2 deletions

View File

@@ -35,7 +35,7 @@ class CopterDataModel(QtCore.QAbstractTableModel):
def __init__(self, parent=None):
super(CopterDataModel, self).__init__(parent)
self.headers = ('copter ID', ' animation ID ', 'batt V', 'batt %', 'system', 'calibration', 'selfcheck', 'current x y z yaw frame_id', 'time delta')
self.headers = ('copter ID', ' animation ID ', 'batt V', 'batt %', ' system ', 'calibration', 'selfcheck', 'current x y z yaw frame_id', 'time delta')
self.data_contents = []
self.first_col_is_checked = False

View File

@@ -141,6 +141,8 @@ class Ui_MainWindow(object):
self.menuDeveloper_mode.setObjectName("menuDeveloper_mode")
self.menuTable = QtWidgets.QMenu(self.menubar)
self.menuTable.setObjectName("menuTable")
self.menuAnimation = QtWidgets.QMenu(self.menubar)
self.menuAnimation.setObjectName("menuAnimation")
MainWindow.setMenuBar(self.menubar)
self.action_send_animations = QtWidgets.QAction(MainWindow)
self.action_send_animations.setObjectName("action_send_animations")
@@ -160,6 +162,10 @@ class Ui_MainWindow(object):
self.action_restart_clever_show.setObjectName("action_restart_clever_show")
self.action_select_all_rows = QtWidgets.QAction(MainWindow)
self.action_select_all_rows.setObjectName("action_select_all_rows")
self.action_set_start_to_current_position = QtWidgets.QAction(MainWindow)
self.action_set_start_to_current_position.setObjectName("action_set_start_to_current_position")
self.action_reset_start = QtWidgets.QAction(MainWindow)
self.action_reset_start.setObjectName("action_reset_start")
self.menuDeveloper_mode.addAction(self.action_send_launch_file)
self.menuDeveloper_mode.addAction(self.action_restart_clever)
self.menuDeveloper_mode.addAction(self.action_restart_clever_show)
@@ -170,7 +176,10 @@ class Ui_MainWindow(object):
self.menuOptions.addSeparator()
self.menuOptions.addAction(self.menuDeveloper_mode.menuAction())
self.menuTable.addAction(self.action_select_all_rows)
self.menuAnimation.addAction(self.action_set_start_to_current_position)
self.menuAnimation.addAction(self.action_reset_start)
self.menubar.addAction(self.menuOptions.menuAction())
self.menubar.addAction(self.menuAnimation.menuAction())
self.menubar.addAction(self.menuTable.menuAction())
self.retranslateUi(MainWindow)
@@ -204,6 +213,7 @@ class Ui_MainWindow(object):
self.menuOptions.setTitle(_translate("MainWindow", "Actions"))
self.menuDeveloper_mode.setTitle(_translate("MainWindow", "Developer mode"))
self.menuTable.setTitle(_translate("MainWindow", "Table"))
self.menuAnimation.setTitle(_translate("MainWindow", "Animation"))
self.action_send_animations.setText(_translate("MainWindow", "Send Animations"))
self.action_send_configurations.setText(_translate("MainWindow", "Send Configurations"))
self.action_send_Aruco_map.setText(_translate("MainWindow", "Send Aruco map"))
@@ -214,3 +224,5 @@ class Ui_MainWindow(object):
self.action_restart_clever_show.setText(_translate("MainWindow", "Restart clever-show service"))
self.action_select_all_rows.setText(_translate("MainWindow", "Select All"))
self.action_select_all_rows.setShortcut(_translate("MainWindow", "Ctrl+A"))
self.action_set_start_to_current_position.setText(_translate("MainWindow", "Set start to current position"))
self.action_reset_start.setText(_translate("MainWindow", "Reset start position"))

View File

@@ -287,7 +287,15 @@
</property>
<addaction name="action_select_all_rows"/>
</widget>
<widget class="QMenu" name="menuAnimation">
<property name="title">
<string>Animation</string>
</property>
<addaction name="action_set_start_to_current_position"/>
<addaction name="action_reset_start"/>
</widget>
<addaction name="menuOptions"/>
<addaction name="menuAnimation"/>
<addaction name="menuTable"/>
</widget>
<action name="action_send_animations">
@@ -338,6 +346,16 @@
<string>Ctrl+A</string>
</property>
</action>
<action name="action_set_start_to_current_position">
<property name="text">
<string>Set start to current position</string>
</property>
</action>
<action name="action_reset_start">
<property name="text">
<string>Reset start position</string>
</property>
</action>
</widget>
<tabstops>
<tabstop>check_button</tabstop>

View File

@@ -121,6 +121,8 @@ class MainWindow(QtWidgets.QMainWindow):
self.ui.action_restart_clever.triggered.connect(self.restart_clever)
self.ui.action_restart_clever_show.triggered.connect(self.restart_clever_show)
self.ui.action_update_client_repo.triggered.connect(self.update_client_repo)
self.ui.action_set_start_to_current_position.triggered.connect(self.update_start_to_current_position)
self.ui.action_reset_start.triggered.connect(self.reset_start)
# Set most safety-important buttons disabled
self.ui.start_button.setEnabled(False)
@@ -337,7 +339,17 @@ class MainWindow(QtWidgets.QMainWindow):
@pyqtSlot()
def update_client_repo(self):
for copter in self.model.user_selected():
copter.client.send_message("update_repo")
copter.client.send_message("update_repo")
@pyqtSlot()
def update_start_to_current_position(self):
for copter in self.model.user_selected():
copter.client.send_message("move_start")
@pyqtSlot()
def reset_start(self):
for copter in self.model.user_selected():
copter.client.send_message("reset_start")
@pyqtSlot()
def emergency(self):