From 1c40a5e418022793e27fe0f7fd7970b64bc0a75f Mon Sep 17 00:00:00 2001 From: Samuel Sloniker Date: Mon, 29 Jul 2024 09:46:36 -0700 Subject: [PATCH] Always run the about server --- navpoint/about.py | 16 ++-------------- navpoint/run.py | 1 + 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/navpoint/about.py b/navpoint/about.py index 4dbf22a..e7ced4a 100644 --- a/navpoint/about.py +++ b/navpoint/about.py @@ -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): """ ) - 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/") diff --git a/navpoint/run.py b/navpoint/run.py index 59f9dee..d326a87 100755 --- a/navpoint/run.py +++ b/navpoint/run.py @@ -46,6 +46,7 @@ def run(): except tk.TclError: pass + navpoint.about.run_server() window.mainloop() if mode == "mobile":