WebBrowser/WebBrowserWindow.py

changeset 5842
c3f41b959a65
parent 5820
b610cb5b501a
child 5920
e47dd106c3d6
--- a/WebBrowser/WebBrowserWindow.py	Thu Aug 10 11:57:04 2017 +0200
+++ b/WebBrowser/WebBrowserWindow.py	Thu Aug 10 13:58:50 2017 +0200
@@ -4719,17 +4719,23 @@
     ##########################################
     
     @classmethod
-    def showNotification(cls, icon, heading, text):
+    def showNotification(cls, icon, heading, text, timeout=None):
         """
         Class method to show a desktop notification.
         
-        @param icon icon to be shown in the notification (QPixmap)
-        @param heading heading of the notification (string)
-        @param text text of the notification (string)
+        @param icon icon to be shown in the notification
+        @type QPixmap
+        @param heading heading of the notification
+        @type str
+        @param text text of the notification
+        @type str
+        @param timeout time in seconds the notification should be shown
+            (None = use configured timeout, 0 = indefinitely)
+        @type int
         """
         if cls._fromEric:
             e5App().getObject("UserInterface").showNotification(
-                icon, heading, text)
+                icon, heading, text, timeout)
         else:
             if Preferences.getUI("NotificationsEnabled"):
                 if cls._notification is None:
@@ -4738,8 +4744,9 @@
                 cls._notification.setPixmap(icon)
                 cls._notification.setHeading(heading)
                 cls._notification.setText(text)
-                cls._notification.setTimeout(
-                    Preferences.getUI("NotificationTimeout"))
+                if timeout is None:
+                    timeout = Preferences.getUI("NotificationTimeout")
+                cls._notification.setTimeout(timeout)
                 cls._notification.move(
                     Preferences.getUI("NotificationPosition"))
                 cls._notification.show()
@@ -4756,6 +4763,29 @@
         else:
             return Preferences.getUI("NotificationsEnabled")
     
+    ######################################
+    ## Support for global status bar below
+    ######################################
+    
+    @classmethod
+    def globalStatusBar(cls):
+        """
+        Class method to get a reference to a global status bar.
+        
+        The global status bar is the status bar of the main window. If
+        no such window exists and the web browser was called from the eric IDE,
+        the status bar of the IDE is returned.
+        
+        @return reference to the global status bar
+        @rtype QStatusBar
+        """
+        if cls.BrowserWindows:
+            return cls.BrowserWindows[0].statusBar()
+        elif cls._fromEric:
+            return e5App().getObject("UserInterface").statusBar()
+        else:
+            return None
+    
     ###################################
     ## Support for download files below
     ###################################

eric ide

mercurial