Debugging scripts import hell.
This commit is contained in:
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user