This commit is contained in:
Neptune-1
2018-12-07 21:50:59 +03:00
parent 4d0fc0c323
commit bb083575e1
4 changed files with 44 additions and 461 deletions

View File

@@ -237,6 +237,26 @@ class Widget(QMainWindow, main_gui.Ui_MainWindow):
f = open(sub_file, 'r')
prog = f.read()
self.sender(b'programm' + bytes(prog, 'utf-8')+b'stop', str(counter))
t1 = Thread(target=self.start_retime)
t1.daemon = True
t1.start()
def start_retime(self):
for i in range(11):
time.sleep(1)
self.time_to_start_label.setText("<html><head/><body><p align=\"center\"><span style=\" font-size:16pt;\">"+str(10-i)+"</p></body></html>")
'''if i==10:
k=0
while True:
k+=1
time.sleep(0.2r)
self.time_to_start_label.setText("<html><head/><body><p align=\"center\">"+k*'.'+"</p></body></html>")
if k>3:
k=0'''# for ... animation
self.time_to_start_label.setText("<html><head/><body><p align=\"center\"><span style=\" font-size:11pt;\">Take off</p></body></html>")
time.sleep(2)
self.time_to_start_label.setText("<html><head/><body><p align=\"center\"><span style=\" font-size:11pt;\"></p></body></html>")
def stop_swarm(self):
pass

View File

@@ -414,6 +414,22 @@ p, li { white-space: pre-wrap; }
<string>Synchronize</string>
</property>
</widget>
<widget class="QLabel" name="time_to_start_label">
<property name="geometry">
<rect>
<x>220</x>
<y>200</y>
<width>141</width>
<height>51</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">color:rgb(30, 30, 30)</string>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:16pt;&quot;/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<zorder>back_label</zorder>
<zorder>take_off_button</zorder>
<zorder>land_all_button</zorder>
@@ -440,6 +456,7 @@ p, li { white-space: pre-wrap; }
<zorder>start_animation_button</zorder>
<zorder>safty_button</zorder>
<zorder>synch_button</zorder>
<zorder>time_to_start_label</zorder>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">

View File

@@ -1,460 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1280</width>
<height>720</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>1280</width>
<height>720</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>1280</width>
<height>720</height>
</size>
</property>
<property name="windowTitle">
<string>Drone Swarm</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QPushButton" name="take_off_button">
<property name="geometry">
<rect>
<x>760</x>
<y>70</y>
<width>100</width>
<height>40</height>
</rect>
</property>
<property name="text">
<string>Take off all</string>
</property>
</widget>
<widget class="QPushButton" name="land_all_button">
<property name="geometry">
<rect>
<x>890</x>
<y>70</y>
<width>91</width>
<height>40</height>
</rect>
</property>
<property name="text">
<string>Land all</string>
</property>
</widget>
<widget class="QPushButton" name="disarm_all_button">
<property name="geometry">
<rect>
<x>1010</x>
<y>70</y>
<width>101</width>
<height>40</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">background-color: red
</string>
</property>
<property name="text">
<string>Disarm all</string>
</property>
</widget>
<widget class="QPushButton" name="take_off_n_button">
<property name="geometry">
<rect>
<x>760</x>
<y>150</y>
<width>100</width>
<height>40</height>
</rect>
</property>
<property name="text">
<string>Take off n</string>
</property>
</widget>
<widget class="QPushButton" name="land_n_button">
<property name="geometry">
<rect>
<x>890</x>
<y>150</y>
<width>91</width>
<height>40</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>Land n</string>
</property>
</widget>
<widget class="QPushButton" name="disarm_n_button">
<property name="geometry">
<rect>
<x>1010</x>
<y>150</y>
<width>101</width>
<height>40</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">background-color: red
</string>
</property>
<property name="text">
<string>Disarm n</string>
</property>
</widget>
<widget class="QSpinBox" name="take_off_spinBox">
<property name="geometry">
<rect>
<x>790</x>
<y>120</y>
<width>50</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QSpinBox" name="land_spinBox">
<property name="geometry">
<rect>
<x>910</x>
<y>120</y>
<width>50</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QSpinBox" name="disarm_spinBox">
<property name="geometry">
<rect>
<x>1040</x>
<y>120</y>
<width>50</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="control_console_label">
<property name="geometry">
<rect>
<x>840</x>
<y>20</y>
<width>200</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:12pt; color:#c8c8c8;&quot;&gt;Control console&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QPushButton" name="turn_on_led_button">
<property name="geometry">
<rect>
<x>1140</x>
<y>60</y>
<width>100</width>
<height>61</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>Turn on Leds</string>
</property>
</widget>
<widget class="QPushButton" name="turn_off_led_button">
<property name="geometry">
<rect>
<x>1140</x>
<y>140</y>
<width>100</width>
<height>61</height>
</rect>
</property>
<property name="text">
<string>Turn off Leds</string>
</property>
</widget>
<widget class="QPushButton" name="stop_swarm_but">
<property name="geometry">
<rect>
<x>220</x>
<y>510</y>
<width>141</width>
<height>51</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>Stop swarm</string>
</property>
</widget>
<widget class="QPushButton" name="connect_button">
<property name="geometry">
<rect>
<x>620</x>
<y>60</y>
<width>111</width>
<height>40</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>Connect</string>
</property>
</widget>
<widget class="QSpinBox" name="swarm_size_spinBox">
<property name="geometry">
<rect>
<x>260</x>
<y>80</y>
<width>50</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="swarm_size_label">
<property name="geometry">
<rect>
<x>240</x>
<y>50</y>
<width>100</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:9pt;&quot;&gt;Swarm Size&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="send_command_label">
<property name="geometry">
<rect>
<x>840</x>
<y>260</y>
<width>200</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:12pt; color:#c8c8c8;&quot;&gt;Send command&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QTextEdit" name="console_textEdit">
<property name="geometry">
<rect>
<x>640</x>
<y>290</y>
<width>591</width>
<height>271</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(1, 36, 86)</string>
</property>
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&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:'Noto Sans'; font-size:9pt; 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;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:7.8pt; color:#ffffff;&quot;&gt;...&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QPushButton" name="show_3d_scene_button">
<property name="geometry">
<rect>
<x>220</x>
<y>300</y>
<width>141</width>
<height>51</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>Show 3d scene</string>
</property>
</widget>
<widget class="QPushButton" name="upload_animation_button">
<property name="geometry">
<rect>
<x>220</x>
<y>370</y>
<width>141</width>
<height>51</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>Upload animation</string>
</property>
</widget>
<widget class="QLabel" name="state_label">
<property name="geometry">
<rect>
<x>220</x>
<y>160</y>
<width>131</width>
<height>41</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">color: red
</string>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;Disconnect&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QLabel" name="statement_swarm_label">
<property name="geometry">
<rect>
<x>230</x>
<y>140</y>
<width>111</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Statement swarm</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QPushButton" name="start_animation_button">
<property name="geometry">
<rect>
<x>220</x>
<y>440</y>
<width>141</width>
<height>51</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>Start animation</string>
</property>
</widget>
<widget class="QLabel" name="back_label">
<property name="geometry">
<rect>
<x>0</x>
<y>-1</y>
<width>1280</width>
<height>701</height>
</rect>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;img src=&quot;:/back/back.png&quot;/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QPushButton" name="safty_button">
<property name="geometry">
<rect>
<x>620</x>
<y>110</y>
<width>111</width>
<height>40</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>Safty check</string>
</property>
</widget>
<widget class="QPushButton" name="synch_button">
<property name="geometry">
<rect>
<x>620</x>
<y>160</y>
<width>111</width>
<height>40</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>Synchronize</string>
</property>
</widget>
<zorder>back_label</zorder>
<zorder>take_off_button</zorder>
<zorder>land_all_button</zorder>
<zorder>disarm_all_button</zorder>
<zorder>take_off_n_button</zorder>
<zorder>land_n_button</zorder>
<zorder>disarm_n_button</zorder>
<zorder>take_off_spinBox</zorder>
<zorder>land_spinBox</zorder>
<zorder>disarm_spinBox</zorder>
<zorder>control_console_label</zorder>
<zorder>turn_on_led_button</zorder>
<zorder>turn_off_led_button</zorder>
<zorder>stop_swarm_but</zorder>
<zorder>connect_button</zorder>
<zorder>swarm_size_spinBox</zorder>
<zorder>swarm_size_label</zorder>
<zorder>send_command_label</zorder>
<zorder>console_textEdit</zorder>
<zorder>show_3d_scene_button</zorder>
<zorder>upload_animation_button</zorder>
<zorder>state_label</zorder>
<zorder>statement_swarm_label</zorder>
<zorder>start_animation_button</zorder>
<zorder>safty_button</zorder>
<zorder>synch_button</zorder>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1280</width>
<height>23</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources>
<include location="back_1.qrc"/>
</resources>
<connections/>
</ui>

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'swarm_5.ui'
# Form implementation generated from reading ui file 'gui.ui'
#
# Created by: PyQt5 UI code generator 5.11.3
#
@@ -116,6 +116,10 @@ class Ui_MainWindow(object):
self.synch_button.setGeometry(QtCore.QRect(620, 160, 111, 40))
self.synch_button.setStyleSheet("")
self.synch_button.setObjectName("synch_button")
self.time_to_start_label = QtWidgets.QLabel(self.centralwidget)
self.time_to_start_label.setGeometry(QtCore.QRect(220, 200, 141, 51))
self.time_to_start_label.setStyleSheet("color:rgb(30, 30, 30)")
self.time_to_start_label.setObjectName("time_to_start_label")
self.back_label.raise_()
self.take_off_button.raise_()
self.land_all_button.raise_()
@@ -142,6 +146,7 @@ class Ui_MainWindow(object):
self.start_animation_button.raise_()
self.safty_button.raise_()
self.synch_button.raise_()
self.time_to_start_label.raise_()
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 1280, 23))
@@ -183,6 +188,7 @@ class Ui_MainWindow(object):
self.back_label.setText(_translate("MainWindow", "<html><head/><body><p><img src=\":/back/back.png\"/></p></body></html>"))
self.safty_button.setText(_translate("MainWindow", "Safty check"))
self.synch_button.setText(_translate("MainWindow", "Synchronize"))
self.time_to_start_label.setText(_translate("MainWindow", "<html><head/><body><p align=\"center\"><span style=\" font-size:16pt;\"/></p></body></html>"))
import back_1_rc