Get rid of app global

QApplication is a singleton, no need for global
This commit is contained in:
atse 2023-06-30 11:27:31 +08:00
parent 73887564a5
commit 299ef7dcc3
1 changed files with 2 additions and 3 deletions

View File

@ -21,7 +21,6 @@ ui: Ui_MainWindow = None
client_watcher = None
client_watcher_task = None
app: QtWidgets.QApplication = None
def get_argparser():
@ -152,7 +151,7 @@ async def connect(_):
ui.report_apply_btn.clicked.connect(
lambda: client_watcher.set_update_s(ui.report_refresh_spin.value())
)
app.aboutToQuit.connect(client_watcher.stop_watching)
QtWidgets.QApplication.instance().aboutToQuit.connect(client_watcher.stop_watching)
client_watcher_task = asyncio.create_task(client_watcher.run())
except Exception as e:
logging.error(f"Failed communicating to the {ip}:{port}: {e}")
@ -160,7 +159,7 @@ async def connect(_):
async def coro_main():
global ui, app
global ui
args = get_argparser().parse_args()
if args.logLevel: