Commit a2a6645a authored by Wen Wei Li's avatar Wen Wei Li

debug

parent 7ac3df96
flask flask
flask-bootstrap flask-bootstrap
sqlite3
pyotp pyotp
...@@ -17,6 +17,10 @@ input { ...@@ -17,6 +17,10 @@ input {
.btn-font{ .btn-font{
font-size:18px; font-size:18px;
} }
.hg-button{
font-size:20px;
height: 60px;
}
td { td {
cursor: pointer; cursor: pointer;
} }
......
import ('./Keyboard.js') import ('./Keyboard.js')
let Keyboard = window.SimpleKeyboard.default; let Keyboard = window.SimpleKeyboard.default;
let myKeyboard = new Keyboard({ let keyboard = new Keyboard({
onChange: input => onChange(input), onChange: input => onChange(input),
onKeyPress: button => onKeyPress(button) onKeyPress: button => onKeyPress(button),
theme: "hg-theme-default hg-theme-ios",
layout: {
default: [
"q w e r t y u i o p {bksp}",
"a s d f g h j k l",
"{shift} z x c v b n m , . {shift}",
"{alt} {space} {enter}"
],
shift: [
"Q W E R T Y U I O P {bksp}",
"A S D F G H J K L",
"{shiftactivated} Z X C V B N M , . {shiftactivated}",
"{alt} {space} {enter}"
],
alt: [
"1 2 3 4 5 6 7 8 9 0 {bksp}",
`@ # $ & * ( ) ' "`,
"{shift} % - + = / ; : ! ? {shift}",
"{default} {space} {enter}"
],
},
display: {
"{alt}": ".?123",
"{shift}": "",
"{shiftactivated}": "",
"{enter}": "return",
"{bksp}": "",
"{altright}": ".?123",
"{downkeyboard}": "🞃",
"{space}": "space",
"{default}": "ABC",
"{back}": ""
}
});
/**
* Update simple-keyboard when input is changed directly
*/
document.querySelector(".input").addEventListener("input", event => {
keyboard.setInput(event.target.value);
}); });
console.log(keyboard);
function onChange(input) {
document.querySelector(".input").value = input;
console.log("Input changed", input);
}
function onKeyPress(button) {
console.log("Button pressed", button);
/**
* Handle toggles
*/
if (button.includes("{") && button.includes("}")) {
handleLayoutChange(button);
}
}
function handleLayoutChange(button) {
let currentLayout = keyboard.options.layoutName;
let layoutName;
switch (button) {
case "{shift}":
case "{shiftactivated}":
case "{default}":
layoutName = currentLayout === "default" ? "shift" : "default";
break;
case "{alt}":
case "{altright}":
layoutName = currentLayout === "alt" ? "default" : "alt";
break;
default:
break;
}
if (layoutName) {
keyboard.setOptions({
layoutName: layoutName
});
}
}
function onChange(input) { function onChange(input) {
document.querySelector(".input").value = input; document.querySelector(".input").value = input;
console.log("Input changed", input); console.log("Input changed", input);
} }
function onKeyPress(button) { function onKeyPress(button) {
handleLayoutChange(button);
console.log("Button pressed", button); console.log("Button pressed", button);
} }
...@@ -2,6 +2,10 @@ ...@@ -2,6 +2,10 @@
{% block head %} {% block head %}
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-store" />
<meta http-equiv="expires" content="-1" />
<meta http-equiv="pragma" content="no-cache" />
{{super()}} {{super()}}
......
{% extends "bootstrap/base.html" %} {% extends "bootstrap/base.html" %}
{% block head %} {% block head %}
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-store" />
<meta http-equiv="expires" content="-1" />
<meta http-equiv="pragma" content="no-cache" />
{{super()}} {{super()}}
<link rel="stylesheet" href="{{url_for('static', filename='css/bootstrap.min.css')}}"> <link rel="stylesheet" href="{{url_for('static', filename='css/bootstrap.min.css')}}">
......
...@@ -2,6 +2,10 @@ ...@@ -2,6 +2,10 @@
{% block head %} {% block head %}
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-store" />
<meta http-equiv="expires" content="-1" />
<meta http-equiv="pragma" content="no-cache" />
{{super()}} {{super()}}
......
{% extends "bootstrap/base.html" %} {% extends "bootstrap/base.html" %}
{% block head %} {% block head %}
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-store" />
<meta http-equiv="expires" content="-1" />
<meta http-equiv="pragma" content="no-cache" />
{{super()}} {{super()}}
<link href="{{url_for('static',filename='css/main.css')}}" rel="stylesheet"> <link href="{{url_for('static',filename='css/main.css')}}" rel="stylesheet">
......
...@@ -22,20 +22,18 @@ def shell_exec(cmd): ...@@ -22,20 +22,18 @@ def shell_exec(cmd):
def scan_wifi(): def scan_wifi():
cmd="nmcli d wifi list" cmd="nmcli -t d wifi list"
resp = shell_exec(cmd) resp = shell_exec(cmd)
ret = [] ret = []
for line in resp.splitlines(): for line in resp.splitlines():
info = line.split() info = line.split(":")
if(info[0] == '*'): print(info)
cell = Wifi_cell(info[1],info[2],info[3],info[4],info[5],info[6]) cell = Wifi_cell(info[1],info[2],info[3],info[4],info[5],info[7])
else:
cell = Wifi_cell(info[0],info[1],info[2],info[3],info[4],info[5])
ret.append(cell) ret.append(cell)
return ret return ret
def wifi_connect(ssid, password): def wifi_connect(ssid, password):
cmd = "nmcli d wifi connect {} password {} con-name wifi_test".format(ssid, password) cmd = "nmcli d wifi connect {} password {}".format(ssid, password)
resp = shell_exec(cmd) resp = shell_exec(cmd)
print(resp) print(resp)
if "failed" in resp or "Error" in resp: if "failed" in resp or "Error" in resp:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment