unisi 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- unisi/__init__.py +7 -0
- unisi/autotest.py +210 -0
- unisi/common.py +28 -0
- unisi/containers.py +97 -0
- unisi/guielements.py +160 -0
- unisi/proxy.py +159 -0
- unisi/reloader.py +150 -0
- unisi/server.py +118 -0
- unisi/tables.py +116 -0
- unisi/users.py +271 -0
- unisi/utils.py +108 -0
- unisi/web/css/169.3abcdd94.css +1 -0
- unisi/web/css/app.31d6cfe0.css +0 -0
- unisi/web/css/vendor.9ed7638d.css +6 -0
- unisi/web/favicon.ico +0 -0
- unisi/web/fonts/KFOkCnqEu92Fr1MmgVxIIzQ.68bb21d0.woff +0 -0
- unisi/web/fonts/KFOlCnqEu92Fr1MmEU9fBBc-.48af7707.woff +0 -0
- unisi/web/fonts/KFOlCnqEu92Fr1MmSU5fBBc-.c2f7ab22.woff +0 -0
- unisi/web/fonts/KFOlCnqEu92Fr1MmWUlfBBc-.77ecb942.woff +0 -0
- unisi/web/fonts/KFOlCnqEu92Fr1MmYUtfBBc-.f5677eb2.woff +0 -0
- unisi/web/fonts/KFOmCnqEu92Fr1Mu4mxM.f1e2a767.woff +0 -0
- unisi/web/fonts/flUhRq6tzZclQEJ-Vdg-IuiaDsNa.4d73cb90.woff +0 -0
- unisi/web/fonts/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.c5371cfb.woff2 +0 -0
- unisi/web/icons/favicon-128x128.png +0 -0
- unisi/web/icons/favicon-16x16.png +0 -0
- unisi/web/icons/favicon-32x32.png +0 -0
- unisi/web/icons/favicon-96x96.png +0 -0
- unisi/web/index.html +1 -0
- unisi/web/js/169.f952e294.js +1 -0
- unisi/web/js/193.283445be.js +1 -0
- unisi/web/js/430.591e9a73.js +1 -0
- unisi/web/js/app.ba94719f.js +1 -0
- unisi/web/js/vendor.d6797c01.js +45 -0
- unisi-0.1.0.dist-info/METADATA +422 -0
- unisi-0.1.0.dist-info/RECORD +37 -0
- unisi-0.1.0.dist-info/WHEEL +4 -0
- unisi-0.1.0.dist-info/licenses/LICENSE +201 -0
unisi/utils.py
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
import os, platform, requests
|
2
|
+
|
3
|
+
blocks_dir = 'blocks'
|
4
|
+
screens_dir = 'screens'
|
5
|
+
UpdateScreen = True
|
6
|
+
Redesign = 2
|
7
|
+
public_dirs = 'public_dirs'
|
8
|
+
|
9
|
+
divpath = '\\' if platform.system() == 'Windows' else '/'
|
10
|
+
libpath = os.path.dirname(os.path.realpath(__file__))
|
11
|
+
webpath = f'{libpath}{divpath}web'
|
12
|
+
app_dir = os.getcwd()
|
13
|
+
|
14
|
+
try:
|
15
|
+
import config
|
16
|
+
except:
|
17
|
+
f = open('config.py', 'w')
|
18
|
+
f.write("""port = 8000
|
19
|
+
upload_dir = 'web'
|
20
|
+
hot_reload = True
|
21
|
+
logfile = 'log'
|
22
|
+
autotest = '*'
|
23
|
+
appname = 'unisi'
|
24
|
+
""")
|
25
|
+
f.close()
|
26
|
+
import config
|
27
|
+
print("Config with default parameters is created!")
|
28
|
+
|
29
|
+
def is_screen_switch(message):
|
30
|
+
return message.block == 'root' and message.element is None
|
31
|
+
|
32
|
+
def filename2url(fn):
|
33
|
+
if fn[0] == '/' or fn[1] == ':': #if full path
|
34
|
+
fn = fn[len(app_dir):]
|
35
|
+
if fn[0] == divpath:
|
36
|
+
fn = fn[1:]
|
37
|
+
return fn
|
38
|
+
|
39
|
+
def url2filepath(url):
|
40
|
+
return url[url.find('/') + 1:].replace('%20',' ')
|
41
|
+
|
42
|
+
def url2filename(url):
|
43
|
+
return url[url.rfind('/') + 1:].replace('%20',' ')
|
44
|
+
|
45
|
+
def upload_path(fpath):
|
46
|
+
return f'{config.upload_dir}{divpath}{fpath}'
|
47
|
+
|
48
|
+
def cache_url(url):
|
49
|
+
"""cache url file in upload_dir and returns the local file name"""
|
50
|
+
fname = url2filename(url)
|
51
|
+
fname = upload_path(fname)
|
52
|
+
response = requests.get(url)
|
53
|
+
if response.status_code != 200:
|
54
|
+
return None
|
55
|
+
file = open(fname, "wb")
|
56
|
+
file.write(response.content)
|
57
|
+
file.close()
|
58
|
+
return fname
|
59
|
+
|
60
|
+
class Message:
|
61
|
+
def __init__(self, *gui_objects, user = None, type = 'update'):
|
62
|
+
self.type = type
|
63
|
+
if gui_objects:
|
64
|
+
self.updates = [{'data': gui} for gui in gui_objects]
|
65
|
+
if user:
|
66
|
+
self.fill_paths4(user)
|
67
|
+
|
68
|
+
def fill_paths4(self, user):
|
69
|
+
if hasattr(self, 'updates'):
|
70
|
+
invalid = []
|
71
|
+
for update in self.updates:
|
72
|
+
data = update["data"]
|
73
|
+
path = user.find_path(data)
|
74
|
+
if path:
|
75
|
+
update['path'] = path
|
76
|
+
else:
|
77
|
+
invalid.append(update)
|
78
|
+
user.log(f'Invalid element update {data.name}, type {data.type}.\n\
|
79
|
+
Such element not on the screen!')
|
80
|
+
for inv in invalid:
|
81
|
+
self.updates.remove(inv)
|
82
|
+
|
83
|
+
def contains(self, guiobj):
|
84
|
+
if hasattr(self, 'updates'):
|
85
|
+
for update in self.updates:
|
86
|
+
if guiobj is update['data']:
|
87
|
+
return True
|
88
|
+
|
89
|
+
def TypeMessage(type, value, *data, user = None):
|
90
|
+
message = Message(*data, user=user, type = type)
|
91
|
+
message.value = value
|
92
|
+
return message
|
93
|
+
|
94
|
+
def Warning(text, *data):
|
95
|
+
return TypeMessage('warning', text, *data)
|
96
|
+
|
97
|
+
def Error(text, *data):
|
98
|
+
return TypeMessage('error', text, *data)
|
99
|
+
|
100
|
+
def Info(text, *data):
|
101
|
+
return TypeMessage('info', text, *data)
|
102
|
+
|
103
|
+
def Answer(type, message, result):
|
104
|
+
ms = TypeMessage(type, result)
|
105
|
+
ms.message = message
|
106
|
+
return ms
|
107
|
+
|
108
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
thead tr:first-child th{-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);position:sticky;top:0;z-index:1000}:root{--scrollbar-width-height:10px;--scrollbar-thumb-hover:#2176d2;--scrollbar-thumb-dark:#2176d2;--scrollbar-thumb-hover-dark:#2176d2}::-webkit-scrollbar{height:var(--scrollbar-width-height);width:var(--scrollbar-width-height)}::-webkit-scrollbar-track{box-shadow:inset 0 0 4px var(--scrollbar-track-dark)}::-webkit-scrollbar-corner{background:var(--scrollbar-track-dark)}::-webkit-scrollbar-thumb{background:var(--scrollbar-thumb-dark);border-radius:5px}::-webkit-scrollbar-thumb:hover{background:var(--scrollbar-thumb-hover-dark)}#graph{height:300px;width:300px}body[data-v-14d5bb7a]{display:flex;justify-content:center}.custom-caption[data-v-14d5bb7a]{padding:5px!important}.web-camera-container[data-v-14d5bb7a]{align-items:center;border:1px solid #ccc;border-radius:4px;display:flex;flex-direction:column;justify-content:center;margin-bottom:2rem;margin-top:2rem;padding:2rem;width:500px}.web-camera-container .camera-button[data-v-14d5bb7a]{margin-bottom:2rem}.web-camera-container .camera-box .camera-shutter[data-v-14d5bb7a]{background-color:#fff;height:337.5px;opacity:0;position:absolute;width:450px}.web-camera-container .camera-box .camera-shutter.flash[data-v-14d5bb7a]{opacity:1}.web-camera-container .camera-shoot[data-v-14d5bb7a]{margin:1rem 0}.web-camera-container .camera-shoot button[data-v-14d5bb7a]{align-items:center;border-radius:100%;display:flex;height:60px;justify-content:center;width:60px}.web-camera-container .camera-shoot button img[data-v-14d5bb7a]{height:35px;object-fit:cover}.web-camera-container .camera-loading[data-v-14d5bb7a]{height:100%;margin:3rem 0 0 -1.2rem;min-height:150px;overflow:hidden;position:absolute;width:100%}.web-camera-container .camera-loading ul[data-v-14d5bb7a]{height:100%;margin:0;position:absolute;width:100%;z-index:999999}.web-camera-container .camera-loading .loader-circle[data-v-14d5bb7a]{display:block;height:14px;left:100%;margin:0 auto;padding:0;position:absolute;top:50%;transform:translateY(-50%);transform:translateX(-50%);width:100%}.web-camera-container .camera-loading .loader-circle li[data-v-14d5bb7a]{animation:preload-14d5bb7a 1s infinite;background:#999;border-radius:100%;display:block;float:left;height:10px;line-height:10px;margin:0 0 0 4px;padding:0;position:relative;top:-50%;width:10px}.web-camera-container .camera-loading .loader-circle li[data-v-14d5bb7a]:nth-child(2){animation-delay:.2s}.web-camera-container .camera-loading .loader-circle li[data-v-14d5bb7a]:nth-child(3){animation-delay:.4s}@keyframes preload-14d5bb7a{0%{opacity:1}50%{opacity:.4}to{opacity:1}}.q-tab__label{font-size:16px;font-weight:700}
|
File without changes
|