eric6/UI/NotificationWidget.py

changeset 7996
ce1d288659ae
parent 7961
9a11cf4ca0d6
child 7997
2ca23396c25c
diff -r d570d9aab754 -r ce1d288659ae eric6/UI/NotificationWidget.py
--- a/eric6/UI/NotificationWidget.py	Mon Jan 18 11:43:06 2021 +0100
+++ b/eric6/UI/NotificationWidget.py	Thu Jan 21 19:24:59 2021 +0100
@@ -135,6 +135,7 @@
         self.__timeout = 5000
         self.__dragPosition = QPoint()
         self.__timers = {}
+        self.__notifications = []
         
         self.__settingPosition = setPosition
         
@@ -171,6 +172,7 @@
         notificationFrame = NotificationFrame(
             icon, heading, text, kind=kind, parent=self)
         self.__layout.addWidget(notificationFrame)
+        self.__notifications.append(notificationFrame)
         
         self.show()
         
@@ -178,7 +180,7 @@
         
         if timeout:
             timer = QTimer()
-            self.__timers[repr(notificationFrame)] = timer
+            self.__timers[id(notificationFrame)] = timer
             timer.setSingleShot(True)
             timer.timeout.connect(
                 lambda: self.__removeNotification(notificationFrame)
@@ -225,7 +227,7 @@
         notification.hide()
         
         # delete timer of an auto close notification
-        key = repr(notification)
+        key = id(notification)
         if key in self.__timers:
             self.__timers[key].stop()
             del self.__timers[key]
@@ -233,6 +235,7 @@
         # delete the notification
         index = self.__layout.indexOf(notification)
         self.__layout.takeAt(index)
+        self.__notifications.remove(notification)
         notification.deleteLater()
         
         if self.__layout.count():

eric ide

mercurial