eric6/UI/NotificationWidget.py

changeset 8265
0090cfa83159
parent 8243
cc717c2ae956
--- a/eric6/UI/NotificationWidget.py	Mon Apr 26 17:33:08 2021 +0200
+++ b/eric6/UI/NotificationWidget.py	Tue Apr 27 17:25:06 2021 +0200
@@ -7,8 +7,8 @@
 Module implementing a Notification widget.
 """
 
-from enum import Enum
 import contextlib
+import enum
 
 from PyQt5.QtCore import Qt, QTimer, QPoint
 from PyQt5.QtWidgets import QFrame, QWidget, QVBoxLayout
@@ -20,14 +20,14 @@
 import UI.PixmapCache
 
 
-class NotificationTypes(Enum):
+class NotificationTypes(enum.Enum):
     """
     Class implementing the notification types.
     """
-    Information = 0
-    Warning = 1             # __IGNORE_WARNING_M131__
-    Critical = 2
-    Other = 99
+    INFORMATION = 0
+    WARNING = 1
+    CRITICAL = 2
+    OTHER = 99
 
 
 class NotificationFrame(QFrame, Ui_NotificationFrame):
@@ -37,7 +37,7 @@
     NotificationStyleSheetTemplate = "color:{0};background-color:{1};"
     
     def __init__(self, icon, heading, text,
-                 kind=NotificationTypes.Information, parent=None):
+                 kind=NotificationTypes.INFORMATION, parent=None):
         """
         Constructor
         
@@ -82,11 +82,11 @@
         @return icon for the notification kind
         @rtype QPixmap
         """
-        if kind == NotificationTypes.Critical:
+        if kind == NotificationTypes.CRITICAL:
             return UI.PixmapCache.getPixmap("notificationCritical48")
-        elif kind == NotificationTypes.Warning:
+        elif kind == NotificationTypes.WARNING:                 # __NO-TASK__
             return UI.PixmapCache.getPixmap("notificationWarning48")
-        elif kind == NotificationTypes.Information:
+        elif kind == NotificationTypes.INFORMATION:
             return UI.PixmapCache.getPixmap("notificationInformation48")
         else:
             return UI.PixmapCache.getPixmap("notification48")
@@ -101,12 +101,12 @@
         @return string containing the style sheet for the notification kind
         @rtype str
         """
-        if kind == NotificationTypes.Critical:
+        if kind == NotificationTypes.CRITICAL:
             return NotificationFrame.NotificationStyleSheetTemplate.format(
                 Preferences.getUI("NotificationCriticalForeground"),
                 Preferences.getUI("NotificationCriticalBackground")
             )
-        elif kind == NotificationTypes.Warning:
+        elif kind == NotificationTypes.WARNING:                 # __NO-TASK__
             return NotificationFrame.NotificationStyleSheetTemplate.format(
                 Preferences.getUI("NotificationWarningForeground"),
                 Preferences.getUI("NotificationWarningBackground")
@@ -156,7 +156,7 @@
             self.setCursor(Qt.CursorShape.OpenHandCursor)
     
     def showNotification(self, icon, heading, text,
-                         kind=NotificationTypes.Information, timeout=0):
+                         kind=NotificationTypes.INFORMATION, timeout=0):
         """
         Public method to show a notification.
         

eric ide

mercurial