You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.1 KiB
57 lines
1.1 KiB
7 years ago
|
#!/usr/bin/python3
|
||
|
|
||
|
import functools
|
||
|
import asyncio
|
||
|
import logging
|
||
|
import threading
|
||
|
import time
|
||
|
import uuid
|
||
|
|
||
|
import quamash
|
||
|
from PyQt5.QtCore import Qt
|
||
|
from PyQt5 import QtCore
|
||
|
from PyQt5 import QtWidgets
|
||
|
from PyQt5 import QtGui
|
||
|
|
||
|
from noisicaa import core
|
||
|
from noisicaa.core import ipc
|
||
|
|
||
|
from . import editor_app
|
||
|
from .. import runtime_settings
|
||
|
|
||
|
logger = logging.getLogger(__name__)
|
||
|
|
||
|
|
||
|
class UIProcessMixin(object):
|
||
|
def __init__(self, *args, **kwargs):
|
||
|
super().__init__(*args, **kwargs)
|
||
|
|
||
|
self.app = self.create_app(
|
||
|
self, runtime_settings.RuntimeSettings(), [])
|
||
|
|
||
|
def create_app(self, *args, **kwargs):
|
||
|
return editor_app.EditorApp(*args, **kwargs)
|
||
|
|
||
|
def create_event_loop(self):
|
||
|
return quamash.QEventLoop(self.app)
|
||
|
|
||
|
async def setup(self):
|
||
|
self._shutting_down = asyncio.Event()
|
||
|
|
||
|
await super().setup()
|
||
|
self.app.setup()
|
||
|
|
||
|
async def cleanup(self):
|
||
|
self.app.cleanup()
|
||
|
await super().cleanup()
|
||
|
|
||
|
async def run(self):
|
||
|
await self._shutting_down.wait()
|
||
|
|
||
|
def quit(self):
|
||
|
self._shutting_down.set()
|
||
|
|
||
|
|
||
|
class UIProcess(UIProcessMixin, core.ProcessImpl):
|
||
|
pass
|