gui: work around quamash bug with python 3.8

This commit is contained in:
Sebastien Bourdeauducq 2020-07-28 12:08:47 +08:00
parent cf19c9512d
commit 5fd0d0bbb6
2 changed files with 8 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import asyncio
import atexit import atexit
import os import os
import logging import logging
import sys
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
from quamash import QEventLoop from quamash import QEventLoop
@ -143,6 +144,9 @@ def main():
app = QtWidgets.QApplication(["ARTIQ Browser"]) app = QtWidgets.QApplication(["ARTIQ Browser"])
loop = QEventLoop(app) loop = QEventLoop(app)
asyncio.set_event_loop(loop) asyncio.set_event_loop(loop)
# https://github.com/harvimt/quamash/issues/123
if sys.version_info >= (3, 8):
asyncio.events._set_running_loop(loop)
atexit.register(loop.close) atexit.register(loop.close)
datasets_sub = models.LocalModelManager(datasets.Model) datasets_sub = models.LocalModelManager(datasets.Model)

View File

@ -5,6 +5,7 @@ import asyncio
import atexit import atexit
import os import os
import logging import logging
import sys
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
from quamash import QEventLoop from quamash import QEventLoop
@ -104,6 +105,9 @@ def main():
app = QtWidgets.QApplication(["ARTIQ Dashboard"]) app = QtWidgets.QApplication(["ARTIQ Dashboard"])
loop = QEventLoop(app) loop = QEventLoop(app)
asyncio.set_event_loop(loop) asyncio.set_event_loop(loop)
# https://github.com/harvimt/quamash/issues/123
if sys.version_info >= (3, 8):
asyncio.events._set_running_loop(loop)
atexit.register(loop.close) atexit.register(loop.close)
smgr = state.StateManager(args.db_file) smgr = state.StateManager(args.db_file)