UI/UserInterface.py

changeset 5842
c3f41b959a65
parent 5841
f227183ae1df
child 5863
0752bdd8db77
child 5899
0516f6548ca6
equal deleted inserted replaced
5841:f227183ae1df 5842:c3f41b959a65
6746 6746
6747 ########################################## 6747 ##########################################
6748 ## Support for desktop notifications below 6748 ## Support for desktop notifications below
6749 ########################################## 6749 ##########################################
6750 6750
6751 def showNotification(self, icon, heading, text): 6751 def showNotification(self, icon, heading, text, timeout=None):
6752 """ 6752 """
6753 Public method to show a desktop notification. 6753 Public method to show a desktop notification.
6754 6754
6755 @param icon icon to be shown in the notification (QPixmap) 6755 @param icon icon to be shown in the notification
6756 @param heading heading of the notification (string) 6756 @type QPixmap
6757 @param text text of the notification (string) 6757 @param heading heading of the notification
6758 @type str
6759 @param text text of the notification
6760 @type str
6761 @param timeout time in seconds the notification should be shown
6762 (None = use configured timeout, 0 = indefinitely)
6763 @type int
6758 """ 6764 """
6759 if Preferences.getUI("NotificationsEnabled"): 6765 if Preferences.getUI("NotificationsEnabled"):
6760 if self.__notification is None: 6766 if self.__notification is None:
6761 from .NotificationWidget import NotificationWidget 6767 from .NotificationWidget import NotificationWidget
6762 self.__notification = NotificationWidget(parent=self) 6768 self.__notification = NotificationWidget(parent=self)
6763 self.__notification.setPixmap(icon) 6769 self.__notification.setPixmap(icon)
6764 self.__notification.setHeading(heading) 6770 self.__notification.setHeading(heading)
6765 self.__notification.setText(text) 6771 self.__notification.setText(text)
6766 self.__notification.setTimeout( 6772 if timeout is None:
6767 Preferences.getUI("NotificationTimeout")) 6773 timeout = Preferences.getUI("NotificationTimeout")
6774 self.__notification.setTimeout(timeout)
6768 self.__notification.move(Preferences.getUI("NotificationPosition")) 6775 self.__notification.move(Preferences.getUI("NotificationPosition"))
6769 self.__notification.show() 6776 self.__notification.show()
6770 6777
6771 def notificationsEnabled(self): 6778 def notificationsEnabled(self):
6772 """ 6779 """

eric ide

mercurial