WebBrowser/WebBrowserWindow.py

changeset 5842
c3f41b959a65
parent 5820
b610cb5b501a
child 5920
e47dd106c3d6
equal deleted inserted replaced
5841:f227183ae1df 5842:c3f41b959a65
4717 ########################################## 4717 ##########################################
4718 ## Support for desktop notifications below 4718 ## Support for desktop notifications below
4719 ########################################## 4719 ##########################################
4720 4720
4721 @classmethod 4721 @classmethod
4722 def showNotification(cls, icon, heading, text): 4722 def showNotification(cls, icon, heading, text, timeout=None):
4723 """ 4723 """
4724 Class method to show a desktop notification. 4724 Class method to show a desktop notification.
4725 4725
4726 @param icon icon to be shown in the notification (QPixmap) 4726 @param icon icon to be shown in the notification
4727 @param heading heading of the notification (string) 4727 @type QPixmap
4728 @param text text of the notification (string) 4728 @param heading heading of the notification
4729 @type str
4730 @param text text of the notification
4731 @type str
4732 @param timeout time in seconds the notification should be shown
4733 (None = use configured timeout, 0 = indefinitely)
4734 @type int
4729 """ 4735 """
4730 if cls._fromEric: 4736 if cls._fromEric:
4731 e5App().getObject("UserInterface").showNotification( 4737 e5App().getObject("UserInterface").showNotification(
4732 icon, heading, text) 4738 icon, heading, text, timeout)
4733 else: 4739 else:
4734 if Preferences.getUI("NotificationsEnabled"): 4740 if Preferences.getUI("NotificationsEnabled"):
4735 if cls._notification is None: 4741 if cls._notification is None:
4736 from UI.NotificationWidget import NotificationWidget 4742 from UI.NotificationWidget import NotificationWidget
4737 cls._notification = NotificationWidget() 4743 cls._notification = NotificationWidget()
4738 cls._notification.setPixmap(icon) 4744 cls._notification.setPixmap(icon)
4739 cls._notification.setHeading(heading) 4745 cls._notification.setHeading(heading)
4740 cls._notification.setText(text) 4746 cls._notification.setText(text)
4741 cls._notification.setTimeout( 4747 if timeout is None:
4742 Preferences.getUI("NotificationTimeout")) 4748 timeout = Preferences.getUI("NotificationTimeout")
4749 cls._notification.setTimeout(timeout)
4743 cls._notification.move( 4750 cls._notification.move(
4744 Preferences.getUI("NotificationPosition")) 4751 Preferences.getUI("NotificationPosition"))
4745 cls._notification.show() 4752 cls._notification.show()
4746 4753
4747 @classmethod 4754 @classmethod
4753 """ 4760 """
4754 if cls._fromEric: 4761 if cls._fromEric:
4755 return e5App().getObject("UserInterface").notificationsEnabled() 4762 return e5App().getObject("UserInterface").notificationsEnabled()
4756 else: 4763 else:
4757 return Preferences.getUI("NotificationsEnabled") 4764 return Preferences.getUI("NotificationsEnabled")
4765
4766 ######################################
4767 ## Support for global status bar below
4768 ######################################
4769
4770 @classmethod
4771 def globalStatusBar(cls):
4772 """
4773 Class method to get a reference to a global status bar.
4774
4775 The global status bar is the status bar of the main window. If
4776 no such window exists and the web browser was called from the eric IDE,
4777 the status bar of the IDE is returned.
4778
4779 @return reference to the global status bar
4780 @rtype QStatusBar
4781 """
4782 if cls.BrowserWindows:
4783 return cls.BrowserWindows[0].statusBar()
4784 elif cls._fromEric:
4785 return e5App().getObject("UserInterface").statusBar()
4786 else:
4787 return None
4758 4788
4759 ################################### 4789 ###################################
4760 ## Support for download files below 4790 ## Support for download files below
4761 ################################### 4791 ###################################
4762 4792

eric ide

mercurial