Debugging scripts import hell.

This commit is contained in:
lwark
2024-12-30 09:49:09 -06:00
parent 0808b54264
commit 482b641569
6 changed files with 67 additions and 63 deletions

View File

@@ -1,6 +1,5 @@
import sys, os
from tools import ctx, setup_logger, check_if_app, timer
from threading import Thread
from tools import ctx, setup_logger, check_if_app
# environment variable must be set to enable qtwebengine in network path
if check_if_app():
@@ -14,25 +13,9 @@ from PyQt6.QtWidgets import QApplication
from frontend.widgets.app import App
@timer
def run_startup():
for script in ctx.startup_scripts.values():
logger.info(f"Running startup script: {script.__name__}")
thread = Thread(target=script, args=(ctx,))
thread.start()
@timer
def run_teardown():
for script in ctx.teardown_scripts.values():
logger.info(f"Running teardown script: {script.__name__}")
thread = Thread(target=script, args=(ctx,))
thread.start()
if __name__ == '__main__':
run_startup()
ctx.run_startup()
app = QApplication(['', '--no-sandbox'])
ex = App(ctx=ctx)
app.exec()
sys.exit(run_teardown())
sys.exit(ctx.run_teardown())