showError in Gui
authorstack <stack@inventati.org>
Sun, 8 Jul 2012 16:16:58 +0000 (18:16 +0200)
committerstack <stack@inventati.org>
Sun, 8 Jul 2012 16:16:58 +0000 (18:16 +0200)
showError displays a QErrorMessage, usually when catchin a AppError
containing an errorstring to display

gui.py

diff --git a/gui.py b/gui.py
index 6ed893d..c4a1866 100755 (executable)
--- a/gui.py
+++ b/gui.py
@@ -35,6 +35,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 import sys
 import os
 from PyQt4 import QtGui
+from PyQt4.QtCore import SIGNAL
 
 from apperror import AppError
 from settings import appconf
@@ -59,7 +60,7 @@ class Gui(QtGui.QDialog):
         self.trayIcon.show()
 
         self.setWindowTitle("Profile manager / Dboxswitch - dropbox profile switcher")
-        self.resize(400, 300)
+        self.resize(200, 200)
 
         self.profileManager = prManager
 
@@ -79,6 +80,7 @@ class Gui(QtGui.QDialog):
 
 
     def createTrayIcon(self):
+         #context menu build, right click
          self.trayIconMenu = QtGui.QMenu(self)
          self.trayIconMenu.addAction(self.manageprofiles)
          self.trayIconMenu.addSeparator()
@@ -88,3 +90,11 @@ class Gui(QtGui.QDialog):
          self.trayIcon.setContextMenu(self.trayIconMenu)
          #baloon on hover
          self.trayIcon.setToolTip(appconf.appname+" "+appconf.appversion+"\nRight Click to manage profiles.")
+    def showError(self, err):
+        """ Display an error message """
+        self.setWindowTitle("Error - Dboxswitch - dropbox profile switcher")
+        self.resize(200, 100)
+        err = QtGui.QErrorMessage.showMessage(QtGui.QErrorMessage.qtHandler(), "Error: "+err)
+
+
+