@@ -76,8 +76,8 @@ def initTrayIcon(self):
76
76
self .trayIconLoading = QIcon ("resources/img/menu_bar_extras_icon__loading.png" )
77
77
self .trayIconLoading .addPixmap ("resources/img/menu_bar_extras_icon__loading_alt.png" , QIcon .Selected )
78
78
79
- self .trayIconUnread = QIcon ("resources/img/menu_bar_extras_icon__unread.png" )
80
- self .trayIconUnread . addPixmap ("resources/img/menu_bar_extras_icon__unread_alt.png" , QIcon . Selected )
79
+ self .trayIconUnreadPixmap = QPixmap ("resources/img/menu_bar_extras_icon__unread.png" )
80
+ self .trayIconUnreadAltPixmap = QPixmap ("resources/img/menu_bar_extras_icon__unread_alt.png" )
81
81
82
82
self .actionQuit = QAction (u"Quit" , self , triggered = self .quit )
83
83
self .actionShowConfigurationDialog = QAction (u"Configuration" , self , triggered = self .showConfigurationDialog )
@@ -101,7 +101,28 @@ def trayIconSetIconLoading(self):
101
101
self .trayIcon .setIcon (self .trayIconLoading )
102
102
103
103
def trayIconSetIconUnread (self , count = 1 ):
104
- self .trayIcon .setIcon (self .trayIconUnread )
104
+ font = QFont ("Tahoma" , 8 , QFont .Bold )
105
+ font .setStyleHint (QFont .SansSerif )
106
+ font .setStyleStrategy (QFont .PreferQuality )
107
+
108
+ new_icon_pixmap = self .trayIconUnreadPixmap .copy ()
109
+ painter = QPainter (new_icon_pixmap )
110
+ painter .setFont (font )
111
+ painter .drawText (0 , 3 , 14 , 16 , QtCore .Qt .AlignRight , str (count ))
112
+ painter .end ()
113
+
114
+ new_icon = QIcon (new_icon_pixmap )
115
+
116
+ new_icon_alt_pixmap = self .trayIconUnreadAltPixmap .copy ()
117
+ painter = QPainter (new_icon_alt_pixmap )
118
+ painter .setFont (font )
119
+ painter .setPen (QPen (QColor (255 , 255 , 255 )))
120
+ painter .drawText (0 , 3 , 15 , 16 , QtCore .Qt .AlignRight , str (count ))
121
+ painter .end ()
122
+
123
+ new_icon .addPixmap (new_icon_alt_pixmap , QIcon .Selected )
124
+
125
+ self .trayIcon .setIcon (new_icon )
105
126
106
127
def updateTrayIconMenu (self ):
107
128
self .trayIconMenu .clear ()
0 commit comments