summaryrefslogtreecommitdiff
path: root/src/leap/bitmask
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap/bitmask')
-rw-r--r--src/leap/bitmask/gui/loggerwindow.py30
-rw-r--r--src/leap/bitmask/gui/mainwindow.py9
2 files changed, 28 insertions, 11 deletions
diff --git a/src/leap/bitmask/gui/loggerwindow.py b/src/leap/bitmask/gui/loggerwindow.py
index 9f396574..4bf20e35 100644
--- a/src/leap/bitmask/gui/loggerwindow.py
+++ b/src/leap/bitmask/gui/loggerwindow.py
@@ -21,14 +21,14 @@ History log window
import logging
import cgi
-from PySide import QtGui
+from PySide import QtCore, QtGui
from twisted.internet import threads
from ui_loggerwindow import Ui_LoggerWindow
from leap.bitmask.util.constants import PASTEBIN_API_DEV_KEY
from leap.bitmask.util.leap_log_handler import LeapLogHandler
-from leap.bitmask.util.pastebin import PastebinAPI, PastebinError
+from leap.bitmask.util.pastebin import PastebinAPI
from leap.common.check import leap_assert, leap_assert_type
logger = logging.getLogger(__name__)
@@ -220,12 +220,16 @@ class LoggerWindow(QtGui.QDialog):
:param link: the recently created pastebin link.
:type link: str
"""
+ self._set_pastebin_sending(False)
msg = self.tr("Your pastebin link <a href='{0}'>{0}</a>")
msg = msg.format(link)
- show_info = lambda: QtGui.QMessageBox.information(
- self, self.tr("Pastebin OK"), msg)
- self._set_pastebin_sending(False)
- self.reactor.callLater(0, show_info)
+
+ # We save the dialog in an instance member to avoid dialog being
+ # deleted right after we exit this method
+ self._msgBox = msgBox = QtGui.QMessageBox(
+ QtGui.QMessageBox.Information, self.tr("Pastebin OK"), msg)
+ msgBox.setWindowModality(QtCore.Qt.NonModal)
+ msgBox.show()
def pastebin_err(failure):
"""
@@ -234,13 +238,17 @@ class LoggerWindow(QtGui.QDialog):
:param failure: the failure that triggered the errback.
:type failure: twisted.python.failure.Failure
"""
+ self._set_pastebin_sending(False)
logger.error(repr(failure))
+
msg = self.tr("Sending logs to Pastebin failed!")
- show_err = lambda: QtGui.QMessageBox.critical(
- self, self.tr("Pastebin Error"), msg)
- self._set_pastebin_sending(False)
- self.reactor.callLater(0, show_err)
- failure.trap(PastebinError)
+
+ # We save the dialog in an instance member to avoid dialog being
+ # deleted right after we exit this method
+ self._msgBox = msgBox = QtGui.QMessageBox(
+ QtGui.QMessageBox.Critical, self.tr("Pastebin Error"), msg)
+ msgBox.setWindowModality(QtCore.Qt.NonModal)
+ msgBox.show()
self._set_pastebin_sending(True)
d = threads.deferToThread(do_pastebin)
diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py
index 0cc6104b..9d0f9145 100644
--- a/src/leap/bitmask/gui/mainwindow.py
+++ b/src/leap/bitmask/gui/mainwindow.py
@@ -2054,6 +2054,15 @@ class MainWindow(QtGui.QMainWindow):
# TODO separate the shutting down of services from the
# UI stuff.
+ # first thing to do quitting, hide the mainwindow and show tooltip.
+ self.hide()
+ self._systray.showMessage(
+ self.tr('Quitting...'),
+ self.tr('The app is quitting, please wait.'))
+
+ # explicitly process events to display tooltip immediately
+ QtCore.QCoreApplication.processEvents()
+
# Set this in case that the app is hidden
QtGui.QApplication.setQuitOnLastWindowClosed(True)