Run UI with asyncio event_loop.

looper
Ben Niemann 7 years ago
parent c5e023e3d5
commit edf35afc6b
  1. 19
      noisicaa/editor.py
  2. 1
      noisicaa/ui/editor_window.py

@ -1,9 +1,12 @@
#!/usr/bin/python3
import argparse
import asyncio
import os
import sys
import quamash
from . import logging
from .runtime_settings import RuntimeSettings
@ -30,13 +33,17 @@ def main(argv):
from .ui.editor_app import EditorApp
app = EditorApp(runtime_settings, args.path)
app.setup()
try:
exit_code = app.exec()
finally:
app.cleanup()
event_loop = quamash.QEventLoop(app)
asyncio.set_event_loop(event_loop)
with event_loop:
app.setup()
try:
event_loop.run_forever()
finally:
app.cleanup()
return exit_code
return 0
if __name__ == '__main__':
# Doing a regular sys.exit() often causes SIGSEGVs somewhere in the PyQT5

@ -289,7 +289,6 @@ class EditorWindow(QMainWindow):
self.player_status = LoadHistoryWidget(100, 30)
self.player_status.setToolTip("Load of the playback engine.")
self.statusbar.addPermanentWidget(self.player_status)
self._app.sink.add_status_listener(self.player_status.addValue)
self.setStatusBar(self.statusbar)

Loading…
Cancel
Save