summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/gui/twisted_main.py
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2014-05-16 16:18:59 -0300
committerTomás Touceda <chiiph@leap.se>2014-05-16 16:18:59 -0300
commit4c550c558dcb554b3ea1bc0246492e39e8532886 (patch)
tree3a18999e62eb18091d002e6c1c7222846a92947b /src/leap/bitmask/gui/twisted_main.py
parent81715dc47d77934c4f67d2527a56c28f58f0345d (diff)
parentd52daa106a97562e1cc67c5a2f242f2ef9884508 (diff)
Merge branch 'release-0.5.1'0.5.1
Diffstat (limited to 'src/leap/bitmask/gui/twisted_main.py')
-rw-r--r--src/leap/bitmask/gui/twisted_main.py24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/leap/bitmask/gui/twisted_main.py b/src/leap/bitmask/gui/twisted_main.py
index 1e876c57..dfd69033 100644
--- a/src/leap/bitmask/gui/twisted_main.py
+++ b/src/leap/bitmask/gui/twisted_main.py
@@ -19,14 +19,23 @@ Main functions for integration of twisted reactor
"""
import logging
-from twisted.internet import error
-
-# Resist the temptation of putting the import reactor here,
-# it will raise an "reactor already imported" error.
+from twisted.internet import error, reactor
+from PySide import QtCore
logger = logging.getLogger(__name__)
+def stop():
+ QtCore.QCoreApplication.sendPostedEvents()
+ QtCore.QCoreApplication.flush()
+ try:
+ reactor.stop()
+ logger.debug('Twisted reactor stopped')
+ except error.ReactorNotRunning:
+ logger.debug('Twisted reactor not running')
+ logger.debug("Done stopping all the things.")
+
+
def quit(app):
"""
Stop the mainloop.
@@ -34,9 +43,4 @@ def quit(app):
:param app: the main qt QApplication instance.
:type app: QtCore.QApplication
"""
- from twisted.internet import reactor
- logger.debug('Stopping twisted reactor')
- try:
- reactor.callLater(0, reactor.stop)
- except error.ReactorNotRunning:
- logger.debug('Reactor not running')
+ reactor.callLater(0, stop)