forked from M-Labs/thermostat
Get rid of app global
QApplication is a singleton, no need for global
This commit is contained in:
parent
73887564a5
commit
299ef7dcc3
|
@ -21,7 +21,6 @@ ui: Ui_MainWindow = None
|
||||||
|
|
||||||
client_watcher = None
|
client_watcher = None
|
||||||
client_watcher_task = None
|
client_watcher_task = None
|
||||||
app: QtWidgets.QApplication = None
|
|
||||||
|
|
||||||
|
|
||||||
def get_argparser():
|
def get_argparser():
|
||||||
|
@ -152,7 +151,7 @@ async def connect(_):
|
||||||
ui.report_apply_btn.clicked.connect(
|
ui.report_apply_btn.clicked.connect(
|
||||||
lambda: client_watcher.set_update_s(ui.report_refresh_spin.value())
|
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())
|
client_watcher_task = asyncio.create_task(client_watcher.run())
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(f"Failed communicating to the {ip}:{port}: {e}")
|
logging.error(f"Failed communicating to the {ip}:{port}: {e}")
|
||||||
|
@ -160,7 +159,7 @@ async def connect(_):
|
||||||
|
|
||||||
|
|
||||||
async def coro_main():
|
async def coro_main():
|
||||||
global ui, app
|
global ui
|
||||||
|
|
||||||
args = get_argparser().parse_args()
|
args = get_argparser().parse_args()
|
||||||
if args.logLevel:
|
if args.logLevel:
|
||||||
|
|
Loading…
Reference in New Issue