-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Server: Add flip and emergency buttons
- Loading branch information
Showing
5 changed files
with
197 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import os | ||
import glob | ||
|
||
from PyQt5 import QtWidgets | ||
from PyQt5.QtGui import QStandardItemModel, QStandardItem | ||
from PyQt5.QtCore import Qt, pyqtSlot | ||
from PyQt5.QtWidgets import QFileDialog, QMessageBox | ||
from PyQt5 import QtCore, QtGui, QtWidgets | ||
from server import * | ||
from server_qt import * | ||
|
||
class Ui_Dialog(object): | ||
def setupUi(self, Dialog): | ||
Dialog.setObjectName("Dialog") | ||
Dialog.resize(632, 214) | ||
self.pushButton_2 = QtWidgets.QPushButton(Dialog) | ||
self.pushButton_2.setGeometry(QtCore.QRect(470, 110, 121, 61)) | ||
self.pushButton_2.setSizeIncrement(QtCore.QSize(16, 16)) | ||
self.pushButton_2.setObjectName("pushButton_2") | ||
self.pushButton_3 = QtWidgets.QPushButton(Dialog) | ||
self.pushButton_3.setGeometry(QtCore.QRect(40, 100, 121, 61)) | ||
self.pushButton_3.setSizeIncrement(QtCore.QSize(16, 16)) | ||
self.pushButton_3.setObjectName("pushButton_3") | ||
self.pushButton_2.clicked.connect(self.btn_2) | ||
self.pushButton_3.clicked.connect(self.btn_3) | ||
self.label = QtWidgets.QLabel(Dialog) | ||
self.label.setGeometry(QtCore.QRect(40, 40, 561, 51)) | ||
font = QtGui.QFont() | ||
font.setPointSize(16) | ||
self.label.setFont(font) | ||
self.label.setObjectName("label") | ||
|
||
self.retranslateUi(Dialog) | ||
QtCore.QMetaObject.connectSlotsByName(Dialog) | ||
|
||
def retranslateUi(self, Dialog): | ||
_translate = QtCore.QCoreApplication.translate | ||
Dialog.setWindowTitle(_translate("Dialog", "Dialog")) | ||
self.pushButton_2.setText(_translate("Dialog", "PushButton")) | ||
self.pushButton_3.setText(_translate("Dialog", "PushButton")) | ||
self.label.setText(_translate("Dialog", "\n" | ||
"Select a group in which the drone does not work correctly")) | ||
def btn_2(self): | ||
for row_num in range(model.rowCount()): | ||
item = model.item(row_num, 0) | ||
if item.isCheckable() and item.checkState() == Qt.Checked: | ||
copter = Client.get_by_id(item.text()) | ||
copter.send_message("green") | ||
def btn_3(self): | ||
for row_num in range(model.rowCount()): | ||
item = model.item(row_num, 0) | ||
if item.isCheckable() and item.checkState() == Qt.Checked: | ||
copter = Client.get_by_id(item.text()) | ||
copter.send_message("red") | ||
|
||
if __name__ == "__main__": | ||
import sys | ||
app = QtWidgets.QApplication(sys.argv) | ||
Dialog = QtWidgets.QDialog() | ||
ui = Ui_Dialog() | ||
ui.setupUi(Dialog) | ||
Dialog.show() | ||
sys.exit(app.exec_()) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>Dialog</class> | ||
<widget class="QDialog" name="Dialog"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>632</width> | ||
<height>214</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Dialog</string> | ||
</property> | ||
<widget class="QPushButton" name="pushButton_2"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>470</x> | ||
<y>110</y> | ||
<width>121</width> | ||
<height>61</height> | ||
</rect> | ||
</property> | ||
<property name="sizeIncrement"> | ||
<size> | ||
<width>16</width> | ||
<height>16</height> | ||
</size> | ||
</property> | ||
<property name="text"> | ||
<string>PushButton</string> | ||
</property> | ||
</widget> | ||
<widget class="QPushButton" name="pushButton_3"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>40</x> | ||
<y>100</y> | ||
<width>121</width> | ||
<height>61</height> | ||
</rect> | ||
</property> | ||
<property name="sizeIncrement"> | ||
<size> | ||
<width>16</width> | ||
<height>16</height> | ||
</size> | ||
</property> | ||
<property name="text"> | ||
<string>PushButton</string> | ||
</property> | ||
</widget> | ||
<widget class="QLabel" name="label"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>40</x> | ||
<y>40</y> | ||
<width>561</width> | ||
<height>51</height> | ||
</rect> | ||
</property> | ||
<property name="font"> | ||
<font> | ||
<pointsize>16</pointsize> | ||
</font> | ||
</property> | ||
<property name="text"> | ||
<string> | ||
Select a group in which the drone does not work correctly</string> | ||
</property> | ||
</widget> | ||
</widget> | ||
<resources/> | ||
<connections/> | ||
</ui> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters