Always run the about server

This commit is contained in:
Samuel Sloniker 2024-07-29 09:46:36 -07:00
parent 6d4855ff58
commit ca4420925a
2 changed files with 3 additions and 14 deletions

View File

@ -1,20 +1,10 @@
import multiprocessing
import webbrowser
import threading
import asyncio
import signal
import time
import sys
import os
import markdown
import tornado.ioloop
import tornado.web
import navpoint.fix_path
def timed_exit():
time.sleep(3)
os.kill(os.getpid(), signal.SIGTERM)
class AboutHandler(tornado.web.RequestHandler):
def get(self):
with open(navpoint.fix_path.fix_path("README.md")) as f:
@ -53,7 +43,6 @@ class AboutHandler(tornado.web.RequestHandler):
</html>
"""
)
threading.Thread(target=timed_exit).start()
async def _run():
@ -65,10 +54,9 @@ async def _run():
app.listen(9999, address="127.0.0.1")
await asyncio.Event().wait()
def _wrapper():
asyncio.run(_run())
def run_server():
threading.Thread(target=asyncio.run, args=(_run(),), daemon=True).start()
def about():
multiprocessing.Process(target=_wrapper).start()
webbrowser.open("http://127.0.0.1:9999/")

View File

@ -46,6 +46,7 @@ def run():
except tk.TclError:
pass
navpoint.about.run_server()
window.mainloop()
if mode == "mobile":