|
|
@ -71,6 +71,7 @@ class EventLoop(object): |
|
|
|
|
|
|
|
self.fastLoop = QtCore.QTimer() |
|
|
|
self.slowLoop = QtCore.QTimer() |
|
|
|
self.verySlowLoop = QtCore.QTimer() |
|
|
|
|
|
|
|
def fastConnect(self, function): |
|
|
|
self.fastLoop.timeout.connect(function) |
|
|
@ -78,6 +79,9 @@ class EventLoop(object): |
|
|
|
def slowConnect(self, function): |
|
|
|
self.slowLoop.timeout.connect(function) |
|
|
|
|
|
|
|
def verySlowConnect(self, function): |
|
|
|
self.verySlowLoop.timeout.connect(function) |
|
|
|
|
|
|
|
def fastDisconnect(self, function): |
|
|
|
"""The function must be the exact instance that was registered""" |
|
|
|
self.fastLoop.timeout.disconnect(function) |
|
|
@ -86,18 +90,27 @@ class EventLoop(object): |
|
|
|
"""The function must be the exact instance that was registered""" |
|
|
|
self.slowLoop.timeout.disconnect(function) |
|
|
|
|
|
|
|
def verySlowDisconnect(self, function): |
|
|
|
"""The function must be the exact instance that was registered""" |
|
|
|
self.verySlowLoop.timeout.disconnect(function) |
|
|
|
|
|
|
|
|
|
|
|
def start(self): |
|
|
|
"""The event loop MUST be started after the Qt Application instance creation""" |
|
|
|
logger.info("Starting fast qt event loop") |
|
|
|
self.fastLoop.start(20) |
|
|
|
logger.info("Starting slow qt event loop") |
|
|
|
self.slowLoop.start(100) |
|
|
|
logger.info("Starting very slow qt event loop") |
|
|
|
self.verySlowLoop.start(200) |
|
|
|
|
|
|
|
def stop(self): |
|
|
|
logger.info("Stopping fast qt event loop") |
|
|
|
self.fastLoop.stop() |
|
|
|
logger.info("Stopping slow qt event loop") |
|
|
|
self.slowLoop.stop() |
|
|
|
logger.info("Stopping very slow qt event loop") |
|
|
|
self.verySlowLoop.stop() |
|
|
|
|
|
|
|
api.session.eventLoop = EventLoop() |
|
|
|
#QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_DontUseNativeMenuBar) #Force a real menu bar. Qt on wayland will not display it otherwise. |
|
|
|