forked from kubikaugustyn/PyJSCom
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExample.py
More file actions
89 lines (85 loc) · 1.95 KB
/
Copy pathExample.py
File metadata and controls
89 lines (85 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# -*- coding: utf-8 -*-
__author__ = "kubik.augustyn@post.cz"
from COM.COM import Communication
import time
data = [
{
"type": "header",
"text": "Hello.",
"tag": "h1"
},
{
"type": "progressBar",
"progress": 0,
"width": 1000,
},
{
"type": "text",
"text": "Hello..."
},
{
"type": "table",
"fullWidth": "true",
"HTML": [
[
{
"type": "text",
"text": "Hello..."
},
{
"type": "progressBar",
"progress": 0,
"width": 100,
},
{
"type": "header",
"text": "Hello.",
"tag": "h1"
}
],
[
{
"type": "text",
"text": "How are you?"
},
{
"type": "text",
"text": "How are you?"
},
{
"type": "text",
"text": "How are you?"
},
]
]
},
{
"type": "sendData",
"data": "CreateConsole",
"buttonText": "Recreate console"
},
{
"type": "sendDataWithInput",
"buttonText": "Readed 1",
"placeholder": "What readed",
"firstPart":"<yournamehere>Is",
"size": 10,
"id": "data0"
}
]
def onReceive(text):
print(text)
com = Communication(data=data, port=12345)
com.onReceive = onReceive
com.run()
while True:
time.sleep(1)
if data[3]["HTML"][0][1]["progress"] == 100:
break
data[3]["HTML"][0][1]["progress"] = data[3]["HTML"][0][1]["progress"] + 10
com.data = data
com.reloadConsole()
print("Ended.")
data[0]["text"] = "Finished"
com.data = data
com.reloadConsole()