Added more buttons from Qt GUI

This commit is contained in:
Igor Nurullaev
2019-08-29 16:36:09 +03:00
parent 2bddf31a2e
commit e4aa7a4e70
14 changed files with 511 additions and 154 deletions

View File

@@ -48,4 +48,8 @@ html {
.btn-group button {
width: 100%;
}
.dropdown-menu div {
width: 200px;
}

224
Server/static/css/ply.css Normal file
View File

@@ -0,0 +1,224 @@
/* Global loading */
.ply-global-loading {
top: 50%;
left: 50%;
padding: 30px;
width: 60px;
height: 60px;
margin: -100px 0 0 -60px;
z-index: 100000;
position: fixed;
border-radius: 10%;
background-color: rgba(255,255,255,.5);
box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.ply-loading-spinner {
width: 100%;
height: 100%;
opacity: .9;
background: #fff;
border-radius: 100%;
overflow: hidden;
position: relative;
box-shadow: 0 1px 3px rgba(0,0,0,.6);
}
.ply-loading-spinner::before {
content: "";
display: block;
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
background: #333;
max-height: 0;
-webkit-animation: loading 3s normal infinite;
animation: loading 3s normal infinite;
}
@keyframes loading {
0% { max-height: 0; }
50% { max-height: 100%; top: 0; }
100% { max-height: 0; top: 120%; }
}
@-webkit-keyframes loading {
0% { max-height: 0; }
50% { max-height: 100%; top: 0; }
100% { max-height: 0; top: 120%; }
}
/* Layer */
.ply-layer {
color: #333;
min-width: 280px;
box-shadow: 0 0 3px rgba(0,0,0,.3);
background-color: #fff;
border-radius: 20px;
font-size: 16px;
font-family: "Arial", Helvetica;
}
.ply-layer.alert .ply-content,
.ply-layer.confirm .ply-content {
padding: 20px 0 15px;
text-align: center;
}
.ply-layer.base .ply-footer,
.ply-layer.alert .ply-footer,
.ply-layer.confirm .ply-footer,
.ply-layer.prompt .ply-footer {
margin-top: 20px;
text-align: center;
}
.ply-inside {
padding: 20px;
}
.ply-header {
margin: -20px -20px 20px;
padding: 10px 20px;
font-size: 18px;
background-color: #f1f1f1;
border-radius: 2px 2px 0 0;
}
.ply-content {
}
.ply-footer {
}
.ply-footer .ply-ctrl {
margin-left: 20px;
}
.ply-footer .ply-ctrl:first-child {
margin-left: 0;
}
/* Controls */
.ply-x {
top: 12px;
right: 5px;
cursor: pointer;
padding: 5px;
z-index: 1000;
position: absolute;
font-size: 20px;
line-height: 0;
}
.ply-ok,
.ply-cancel {
color: #fff;
cursor: pointer;
border: 0;
outline: 0;
padding: 5px 20px;
box-shadow: 0 1px 1px rgba(0,0,0,.2);
background-color: #39C082;
border-radius: 3px;
font-size: 18px;
}
.ply-ok {
width: 100px;
}
.ply-cancel {
background-color: #b2b2b2;
}
.ply-ok:focus,
.ply-cancel:focus {
box-shadow: 0 0 1px 2px rgba(255, 180, 0, .6);
border: 2px solid rgb(255, 210, 102)\9;
}
.ply-ok::-moz-focus-inner,
.ply-cancel::-moz-focus-inner {
border: 0;
}
/* Forms */
.ply-input {
width: 100%;
border: 2px solid #ccc;
outline: 0;
padding: 5px 10px;
margin-top: 15px;
font-size: 16px;
font-family: "Arial", Helvetica;
box-sizing: border-box;
}
.ply-input:first-child {
margin-top: 0;
}
.ply-input:focus {
border-color: #39C082;
}
/* Global modifiers */
.ply-invalid .ply-input {
border-color: #c00;
}
.ply-loading:before {
top: 0;
left: 0;
right: 0;
bottom: 0;
display: block;
content: '';
position: absolute;
}
.ply-loading .ply-ok {
color: rgba(255,255,255,.7);
-webkit-animation: ply-ok-loading 1s linear infinite;
-moz-animation: ply-ok-loading 1s linear infinite;
animation: ply-ok-loading 1s linear infinite;
-webkit-background-size: 30px 30px;
-moz-background-size: 30px 30px;
background-size: 30px 30px;
background-image: -webkit-gradient(linear, left top, right bottom,
color-stop(.25, rgba(255, 255, 255, .15)), color-stop(.25, transparent),
color-stop(.5, transparent), color-stop(.5, rgba(255, 255, 255, .15)),
color-stop(.75, rgba(255, 255, 255, .15)), color-stop(.75, transparent),
to(transparent));
background-image: -webkit-linear-gradient(135deg, rgba(255, 255, 255, .15) 25%, transparent 25%,
transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%,
transparent 75%, transparent);
background-image: -moz-linear-gradient(135deg, rgba(255, 255, 255, .15) 25%, transparent 25%,
transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%,
transparent 75%, transparent);
background-image: -ms-linear-gradient(135deg, rgba(255, 255, 255, .15) 25%, transparent 25%,
transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%,
transparent 75%, transparent);
background-image: -o-linear-gradient(135deg, rgba(255, 255, 255, .15) 25%, transparent 25%,
transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%,
transparent 75%, transparent);
background-image: linear-gradient(135deg, rgba(255, 255, 255, .15) 25%, transparent 25%,
transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%,
transparent 75%, transparent);
}
@-webkit-keyframes ply-ok-loading {
to { background-position: 60px; }
}
@-moz-keyframes ply-ok-loading {
to { background-position: 60px; }
}
@keyframes ply-ok-loading {
to { background-position: 60px; }
}

7
Server/static/js/bootstrap.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -3,42 +3,25 @@ let configInput = document.getElementById('configFile');
let arucoInput = document.getElementById('arucoFile');
animationInput.onchange = function (e) {
document.getElementById('animationFileLabel').innerText = animationInput.files[0].name;
sendRows(table.getSelectedRows(), animationInput.files[0], 'animation');
};
configInput.onchange = function (e) {
document.getElementById('configFileLabel').innerText = configInput.files[0].name;
sendRows(table.getSelectedRows(), configInput.files[0], 'config');
};
arucoInput.onchange = function (e) {
document.getElementById('arucoFileLabel').innerText = arucoInput.files[0].name;
sendRows(table.getSelectedRows(), arucoInput.files[0], 'aruco');
};
function sendRows(selectedRows) {
var animationFile = animationInput.files[0];
var configFile = configInput.files[0];
var arucoFile = arucoInput.files[0];
function sendRows(selectedRows, file, file_type) {
spinner.style.display = 'inline-block';
setTimeout(function () {
selectedRows.forEach(function (element) {
if (animationFile) {
let animReq = new XMLHttpRequest();
let animFormData = new FormData();
animFormData.append("file", animationFile);
animReq.open("POST", '/set/animation?ip=' + element._row.data.ip, false);
animReq.send(animFormData);
}
if (configFile) {
let configReq = new XMLHttpRequest();
let congifFormData = new FormData();
congifFormData.append("file", configFile);
configReq.open("POST", '/set/config?ip=' + element._row.data.ip, false);
configReq.send(congifFormData);
}
if (arucoFile) {
let arucoReq = new XMLHttpRequest();
let arucoFormData = new FormData();
arucoFormData.append("file", arucoFile);
arucoReq.open("POST", '/set/animation?ip=' + element._row.data.ip, false);
arucoReq.send(arucoFormData);
if (file) {
let fileReq = new XMLHttpRequest();
let fileFormData = new FormData();
fileFormData.append("file", file);
fileReq.open("POST", '/set/' + file_type + '?ip=' + element._row.data.ip, false);
fileReq.send(fileFormData);
}
element.deselect();
});

4
Server/static/js/jquery.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,22 @@
let spinner = document.getElementById('spinner');
var tabledata = [];
var delay = 0;
updateData();
updateDelay();
function updateDelay() {
let req = new XMLHttpRequest();
req.open('POST', '/get/delay', false);
req.send();
delay = parseInt(req.response);
document.getElementById('delay').innerText = 'Set time (now is ' + delay.toString() + ')';
}
function setDelay(delay) {
let req = new XMLHttpRequest();
req.open('POST', '/set/delay?delay=' + delay.toString(), false);
req.send();
}
function updateData() {
let req = new XMLHttpRequest();
@@ -16,12 +32,11 @@ var table = new Tabulator("#copters-table", {
layout: "fitColumns",
columns: [
{title: "Name", field: "name"},
{title: "IP", field: "ip"},
{title: "Animation id", field: "anim_id"},
{title: "Batt voltage", field: "batt_voltage"},
{title: "Cell voltage", field: "cell_voltage"},
{title: "Selfcheck", field: "selfcheck"},
{title: "Time", field: "time"},
{title: "Time delta", field: "time"},
],
});
@@ -48,4 +63,56 @@ function refreshSelected() {
function refreshAll() {
refreshRows(table.getRows());
}
function selectAll() {
table.getRows().forEach(function (element) {
element.select();
});
}
function deselectAll() {
table.getRows().forEach(function (element) {
element.deselect();
});
}
function testLedSelected() {
spinner.style.display = 'inline-block';
setTimeout(function () {
table.getSelectedRows().forEach(function (element) {
let req = new XMLHttpRequest();
req.open('POST', '/test_led/selected?ip=' + element._row.data.ip);
req.send();
});
deselectAll();
spinner.style.display = 'none';
}, 20);
}
function pauseCopters() {
}
function stopCopters() {
}
function emLand() {
}
function setStartTime() {
Ply.dialog("prompt", {
title: "Set animation delay",
form: {delay: "Delay"}
}).done(function (ui) {
setDelay(parseInt(ui.data.delay));
updateDelay();
});
}
function startAnimation() {
}

2
Server/static/js/ply.js Normal file

File diff suppressed because one or more lines are too long

5
Server/static/js/popper.min.js vendored Normal file

File diff suppressed because one or more lines are too long