-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathgui.py
More file actions
37 lines (27 loc) · 1.06 KB
/
gui.py
File metadata and controls
37 lines (27 loc) · 1.06 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
from path_lib import *
from pywebio import platform
import asyncio
import threading
from pgpl.utils import t2t, logger
if not ROOT_PATH.isascii():
logger.critical(t2t("Error:PGPL path must contain only ASCII characters\nThe current path is ")+ROOT_PATH)
input(t2t("Press enter to exit"))
os._exit(0)
from pgpl import webio
def server_thread():
# https://zhuanlan.zhihu.com/p/101586682
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
platform.tornado.start_server(webio.main, auto_open_webbrowser=False, port = 22269, debug=False)
import webview
def main():
threading.Thread(target=server_thread, daemon=False).start()
window = webview.create_window("PGPL", "http://localhost:22269/", width=1280, height=720) # 1024 576
webview.start(http_server=True, gui='qt')
# window.show()
if __name__ == '__main__':
print("this output is used by CPP launcher to check if the python-version PGPL is successfully opened.")
main()
# cef: pip install cefpython3
# qt: pip install PyQtWebEngine
# edgechromium: install edge