Skip to content

Commit 46fe8ca

Browse files
committed
Update UI style
1 parent 3e89f3d commit 46fe8ca

File tree

9 files changed

+101
-43
lines changed

9 files changed

+101
-43
lines changed

PyPI/Package/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ include-package-data = true
2828
where = ["src"]
2929

3030
[tool.setuptools.package-data]
31-
webui = ["*.dll", "*.so", "*.dyn"]
31+
webui = ["webui-windows-msvc-x64/*", "webui-linux-gcc-x64/*", "webui-macos-clang-x64/*"]
0 Bytes
Binary file not shown.
-27.5 KB
Binary file not shown.
0 Bytes
Binary file not shown.

PyPI/Package/src/webui/webui.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
PTR_CHAR = ctypes.POINTER(ctypes.c_char)
2424
PTR_PTR_CHAR = ctypes.POINTER(PTR_CHAR)
2525

26+
2627
# Scripts Runtime
2728
class browser:
2829
NoBrowser:int = 0 # No web browser
@@ -39,6 +40,7 @@ class browser:
3940
yandex:int = 11 # The Yandex Browser
4041
ChromiumBased:int = 12 # 12. Any Chromium based browser
4142

43+
4244
# event
4345
class event:
4446
window = 0
@@ -64,11 +66,13 @@ class runtime:
6466
# The window class
6567
class window:
6668

69+
6770
window = 0
6871
window_id = ""
6972
c_events = None
7073
cb_fun_list = {}
7174

75+
7276
def __init__(self):
7377
global webui_lib
7478
try:
@@ -208,6 +212,7 @@ def get_str(self, e: event, index: c_size_t = 0) -> str:
208212
decode = data.decode('utf-8')
209213
return decode
210214

215+
211216
def get_int(self, e: event, index: c_size_t = 0) -> int:
212217
global webui_lib
213218
if webui_lib is None:
@@ -259,6 +264,7 @@ def script(self, script, timeout=0, response_size=(1024 * 8)) -> javascript:
259264
res.error = not status
260265
return res
261266

267+
262268
# Run JavaScript quickly with no waiting for the response
263269
def run(self, script):
264270
global webui_lib

PyPI/test_package.py

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,29 @@
2121
<title>WebUI 2 - Python Wrapper Test</title>
2222
<script src="webui.js"></script>
2323
<style>
24-
body {
25-
color: white;
26-
background: #0F2027;
27-
background: -webkit-linear-gradient(to right, #4e99bb, #2c91b5, #07587a);
28-
background: linear-gradient(to right, #4e99bb, #2c91b5, #07587a);
29-
text-align: center;
30-
font-size: 18px;
31-
font-family: sans-serif;
32-
}
24+
body {
25+
font-family: 'Arial', sans-serif;
26+
color: white;
27+
background: linear-gradient(to right, #507d91, #1c596f, #022737);
28+
text-align: center;
29+
font-size: 18px;
30+
}
31+
button, input {
32+
padding: 10px;
33+
border-radius: 3px;
34+
border: 1px solid #ccc;
35+
box-shadow: 0 3px 5px rgba(0,0,0,0.1);
36+
transition: 0.2s;
37+
}
38+
button {
39+
background: #3498db;
40+
color: #fff;
41+
cursor: pointer;
42+
font-size: 16px;
43+
}
44+
h1 { text-shadow: -7px 10px 7px rgb(67 57 57 / 76%); }
45+
button:hover { background: #c9913d; }
46+
input:focus { outline: none; border-color: #3498db; }
3347
</style>
3448
</head>
3549
<body>

examples/hello_world.py

Lines changed: 35 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,53 +3,63 @@
33

44
from webui import webui
55

6+
# CSS
7+
css = """
8+
body {
9+
font-family: 'Arial', sans-serif;
10+
color: white;
11+
background: linear-gradient(to right, #507d91, #1c596f, #022737);
12+
text-align: center;
13+
font-size: 18px;
14+
}
15+
button, input {
16+
padding: 10px;
17+
border-radius: 3px;
18+
border: 1px solid #ccc;
19+
box-shadow: 0 3px 5px rgba(0,0,0,0.1);
20+
transition: 0.2s;
21+
}
22+
button {
23+
background: #3498db;
24+
color: #fff;
25+
cursor: pointer;
26+
font-size: 16px;
27+
}
28+
h1 { text-shadow: -7px 10px 7px rgb(67 57 57 / 76%); }
29+
button:hover { background: #c9913d; }
30+
input:focus { outline: none; border-color: #3498db; }
31+
"""
32+
633
# HTML
7-
login_html = """
34+
login_html = f"""
835
<!DOCTYPE html>
936
<html>
1037
<head>
1138
<title>WebUI 2 - Python Example</title>
1239
<script src="webui.js"></script>
1340
<style>
14-
body {
15-
color: white;
16-
background: #0F2027;
17-
background: -webkit-linear-gradient(to right, #4e99bb, #2c91b5, #07587a);
18-
background: linear-gradient(to right, #4e99bb, #2c91b5, #07587a);
19-
text-align: center;
20-
font-size: 18px;
21-
font-family: sans-serif;
22-
}
41+
{css}
2342
</style>
2443
</head>
2544
<body>
26-
<h1>WebUI 2 - Python Example</h1>
45+
<h1>WebUI Python Example</h1>
2746
<br>
2847
<input type="password" id="MyInput" OnKeyUp="document.getElementById('err').innerHTML='&nbsp;';" autocomplete="off">
48+
<h3 id="err" style="color: #dbdd52">&nbsp;</h3>
2949
<br>
30-
<h3 id="err" style="color: #dbdd52">&nbsp;</h3>
31-
<br>
32-
<button id="CheckPassword">Check Password</button> - <button id="Exit">Exit</button>
50+
<button id="CheckPassword">Check Password</button> - <button id="Exit">Exit</button>
3351
</body>
3452
</html>
3553
"""
3654

37-
dashboard_html = """
55+
dashboard_html = f"""
3856
<!DOCTYPE html>
3957
<html>
4058
<head>
4159
<title>Dashboard</title>
4260
<script src="webui.js"></script>
4361
<style>
44-
body {
45-
color: white;
46-
background: #0F2027;
47-
background: -webkit-linear-gradient(to right, #4e99bb, #2c91b5, #07587a);
48-
background: linear-gradient(to right, #4e99bb, #2c91b5, #07587a);
49-
text-align: center;
50-
font-size: 18px;
51-
font-family: sans-serif;
52-
}
62+
{css}
5363
</style>
5464
</head>
5565
<body>
@@ -78,7 +88,7 @@ def check_the_password(e : webui.event):
7888
e.window.show(dashboard_html)
7989
else:
8090
print("Wrong password: " + res.data)
81-
e.window.script(" document.getElementById('err').innerHTML = 'Sorry. Wrong password'; ")
91+
e.window.script(" document.getElementById('err').innerHTML = '[ ! ] Wrong password'; ")
8292

8393
def close_the_application(e : webui.event):
8494
webui.exit()

examples/second.html

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,28 @@
44
<title>WebUI - Second Page (Python)</title>
55
<style>
66
body {
7+
font-family: 'Arial', sans-serif;
78
color: white;
8-
background: #0F2027;
9-
background: -webkit-linear-gradient(to right, #3e6983, #314562, #10273e);
10-
background: linear-gradient(to right, #3e6983, #314562, #10273e);
9+
background: linear-gradient(to right, #507d91, #1c596f, #022737);
1110
text-align: center;
11+
font-size: 18px;
12+
}
13+
button, input {
14+
padding: 10px;
15+
border-radius: 3px;
16+
border: 1px solid #ccc;
17+
box-shadow: 0 3px 5px rgba(0,0,0,0.1);
18+
transition: 0.2s;
19+
}
20+
button {
21+
background: #3498db;
22+
color: #fff;
23+
cursor: pointer;
1224
font-size: 16px;
13-
font-family: sans-serif;
1425
}
26+
h1 { text-shadow: -7px 10px 7px rgb(67 57 57 / 76%); }
27+
button:hover { background: #c9913d; }
28+
input:focus { outline: none; border-color: #3498db; }
1529
</style>
1630
</head>
1731
<body>

examples/serve_folder.html

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,28 @@
44
<title>WebUI - Serve a Folder Example (Python)</title>
55
<style>
66
body {
7+
font-family: 'Arial', sans-serif;
78
color: white;
8-
background: #0F2027;
9-
background: -webkit-linear-gradient(to right, #3e6983, #314562, #10273e);
10-
background: linear-gradient(to right, #3e6983, #314562, #10273e);
9+
background: linear-gradient(to right, #507d91, #1c596f, #022737);
1110
text-align: center;
11+
font-size: 18px;
12+
}
13+
button, input {
14+
padding: 10px;
15+
border-radius: 3px;
16+
border: 1px solid #ccc;
17+
box-shadow: 0 3px 5px rgba(0,0,0,0.1);
18+
transition: 0.2s;
19+
}
20+
button {
21+
background: #3498db;
22+
color: #fff;
23+
cursor: pointer;
1224
font-size: 16px;
13-
font-family: sans-serif;
1425
}
26+
h1 { text-shadow: -7px 10px 7px rgb(67 57 57 / 76%); }
27+
button:hover { background: #c9913d; }
28+
input:focus { outline: none; border-color: #3498db; }
1529
</style>
1630
</head>
1731
<body>

0 commit comments

Comments
 (0)