annotate browser/sat_browser/notification.py @ 1182:5cddb52dacbb

server: fixed typo resuling in crash on unknown registering error status
author Goffi <goffi@goffi.org>
date Tue, 14 May 2019 19:19:40 +0200
parents 28e3eb3bb217
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
423
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
1 from __pyjamas__ import JS, wnd
439
d52f529a6d42 browser side: use of new log system (first draft):
Goffi <goffi@goffi.org>
parents: 424
diff changeset
2 from sat.core.log import getLogger
d52f529a6d42 browser side: use of new log system (first draft):
Goffi <goffi@goffi.org>
parents: 424
diff changeset
3 log = getLogger(__name__)
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 439
diff changeset
4 from sat.core.i18n import _
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 439
diff changeset
5
423
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
6 from pyjamas import Window
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
7 from pyjamas.Timer import Timer
714
03e9fe91081c browser_side: use favico.js to display alerts counter
souliane <souliane@mailoo.org>
parents: 591
diff changeset
8 import favico.min.js
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 439
diff changeset
9
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 439
diff changeset
10 import dialog
423
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
11
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
12 TIMER_DELAY = 5000
328
835a8ae799e7 Add notifications support, fixes bug 7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
13
835a8ae799e7 Add notifications support, fixes bug 7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
14
835a8ae799e7 Add notifications support, fixes bug 7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
15 class Notification(object):
835a8ae799e7 Add notifications support, fixes bug 7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
16 """
835a8ae799e7 Add notifications support, fixes bug 7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
17 If the browser supports it, the user allowed it to and the tab is in the
835a8ae799e7 Add notifications support, fixes bug 7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
18 background, send desktop notifications on messages.
835a8ae799e7 Add notifications support, fixes bug 7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
19
835a8ae799e7 Add notifications support, fixes bug 7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
20 Requires both Web Notifications and Page Visibility API.
835a8ae799e7 Add notifications support, fixes bug 7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
21 """
835a8ae799e7 Add notifications support, fixes bug 7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
22
834
2491898b3041 browser (chat, notification): remove the textual alerts counter, merge it with the favicon counter
souliane <souliane@mailoo.org>
parents: 714
diff changeset
23 def __init__(self, alerts_counter):
2491898b3041 browser (chat, notification): remove the textual alerts counter, merge it with the favicon counter
souliane <souliane@mailoo.org>
parents: 714
diff changeset
24 """
2491898b3041 browser (chat, notification): remove the textual alerts counter, merge it with the favicon counter
souliane <souliane@mailoo.org>
parents: 714
diff changeset
25
2491898b3041 browser (chat, notification): remove the textual alerts counter, merge it with the favicon counter
souliane <souliane@mailoo.org>
parents: 714
diff changeset
26 @param alerts_counter (FaviconCounter): counter instance
2491898b3041 browser (chat, notification): remove the textual alerts counter, merge it with the favicon counter
souliane <souliane@mailoo.org>
parents: 714
diff changeset
27 """
2491898b3041 browser (chat, notification): remove the textual alerts counter, merge it with the favicon counter
souliane <souliane@mailoo.org>
parents: 714
diff changeset
28 self.alerts_counter = alerts_counter
423
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
29 self.enabled = False
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
30 user_agent = None
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
31 notif_permission = None
328
835a8ae799e7 Add notifications support, fixes bug 7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
32 JS("""
835a8ae799e7 Add notifications support, fixes bug 7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
33 if (!('hidden' in document))
835a8ae799e7 Add notifications support, fixes bug 7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
34 document.hidden = false;
835a8ae799e7 Add notifications support, fixes bug 7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
35
423
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
36 user_agent = navigator.userAgent
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
37
328
835a8ae799e7 Add notifications support, fixes bug 7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
38 if (!('Notification' in window))
835a8ae799e7 Add notifications support, fixes bug 7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
39 return;
835a8ae799e7 Add notifications support, fixes bug 7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
40
423
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
41 notif_permission = Notification.permission
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
42
328
835a8ae799e7 Add notifications support, fixes bug 7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
43 if (Notification.permission === 'granted')
835a8ae799e7 Add notifications support, fixes bug 7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
44 this.enabled = true;
835a8ae799e7 Add notifications support, fixes bug 7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
45
835a8ae799e7 Add notifications support, fixes bug 7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
46 else if (Notification.permission === 'default') {
835a8ae799e7 Add notifications support, fixes bug 7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
47 Notification.requestPermission(function(permission){
835a8ae799e7 Add notifications support, fixes bug 7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
48 if (permission !== 'granted')
835a8ae799e7 Add notifications support, fixes bug 7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
49 return;
835a8ae799e7 Add notifications support, fixes bug 7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
50
423
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
51 self.enabled = true; //need to use self instead of this
328
835a8ae799e7 Add notifications support, fixes bug 7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
52 });
835a8ae799e7 Add notifications support, fixes bug 7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
53 }
835a8ae799e7 Add notifications support, fixes bug 7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
54 """)
835a8ae799e7 Add notifications support, fixes bug 7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
55
423
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
56 if "Chrome" in user_agent and notif_permission not in ['granted', 'denied']:
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
57 self.user_agent = user_agent
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
58 self._installChromiumWorkaround()
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
59
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
60 wnd().onfocus = self.onFocus
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
61 # wnd().onblur = self.onBlur
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
62
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
63 def _installChromiumWorkaround(self):
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
64 # XXX: Workaround for Chromium behaviour, it's doens't manage requestPermission on onLoad event
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
65 # see https://code.google.com/p/chromium/issues/detail?id=274284
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
66 # FIXME: need to be removed if Chromium behaviour changes
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
67 try:
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
68 version_full = [s for s in self.user_agent.split() if "Chrome" in s][0].split('/')[1]
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
69 version = int(version_full.split('.')[0])
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
70 except (IndexError, ValueError):
439
d52f529a6d42 browser side: use of new log system (first draft):
Goffi <goffi@goffi.org>
parents: 424
diff changeset
71 log.warning("Can't find Chromium version")
423
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
72 version = 0
439
d52f529a6d42 browser side: use of new log system (first draft):
Goffi <goffi@goffi.org>
parents: 424
diff changeset
73 log.info("Chromium version: %d" % (version,))
423
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
74 if version < 22:
439
d52f529a6d42 browser side: use of new log system (first draft):
Goffi <goffi@goffi.org>
parents: 424
diff changeset
75 log.info("Notification use the old prefixed version or are unmanaged")
423
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
76 return
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
77 if version < 32:
424
4ba4b099d266 browser side: notifications: fixed dialog message in Chromium workaround
Goffi <goffi@goffi.org>
parents: 423
diff changeset
78 dialog.InfoDialog(_("Notifications activation for Chromium"), _('You need to activate notifications manually for your Chromium version.<br/>To activate notifications, click on the favicon on the left of the address bar')).show()
423
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
79 return
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
80
439
d52f529a6d42 browser side: use of new log system (first draft):
Goffi <goffi@goffi.org>
parents: 424
diff changeset
81 log.info("==> Installing Chromium notifications request workaround <==")
423
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
82 self._old_click = wnd().onclick
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
83 wnd().onclick = self._chromiumWorkaround
328
835a8ae799e7 Add notifications support, fixes bug 7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
84
423
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
85 def _chromiumWorkaround(self):
439
d52f529a6d42 browser side: use of new log system (first draft):
Goffi <goffi@goffi.org>
parents: 424
diff changeset
86 log.info("Activating workaround")
423
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
87 JS("""
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
88 Notification.requestPermission(function(permission){
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
89 if (permission !== 'granted')
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
90 return;
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
91 self.enabled = true; //need to use self instead of this
328
835a8ae799e7 Add notifications support, fixes bug 7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
92 });
835a8ae799e7 Add notifications support, fixes bug 7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
93 """)
423
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
94 wnd().onclick = self._old_click
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
95
591
e11e34ac0f67 browser_side: fixes Notification.onFocus
souliane <souliane@mailoo.org>
parents: 467
diff changeset
96 def onFocus(self, event=None):
834
2491898b3041 browser (chat, notification): remove the textual alerts counter, merge it with the favicon counter
souliane <souliane@mailoo.org>
parents: 714
diff changeset
97 self.alerts_counter.update(extra=0)
423
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
98
591
e11e34ac0f67 browser_side: fixes Notification.onFocus
souliane <souliane@mailoo.org>
parents: 467
diff changeset
99 # def onBlur(self, event=None):
423
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
100 # pass
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
101
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
102 def isHidden(self):
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
103 JS("""return document.hidden;""")
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
104
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
105 def _notify(self, title, body, icon):
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
106 if not self.enabled:
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
107 return
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
108 notification = None
837
620306b3d5be browser (notification): remove the notification icon (it doesn't work with HTTPS)
souliane <souliane@mailoo.org>
parents: 834
diff changeset
109 # FIXME: icon has been removed because the notification can't display a HTTPS file
423
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
110 JS("""
837
620306b3d5be browser (notification): remove the notification icon (it doesn't work with HTTPS)
souliane <souliane@mailoo.org>
parents: 834
diff changeset
111 notification = new Notification(title, {body: body});
423
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
112 // Probably won’t work, but it doesn’t hurt to try.
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
113 notification.addEventListener('click', function() {
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
114 window.focus();
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
115 });
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
116 """)
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
117 notification.onshow = lambda: Timer(TIMER_DELAY, lambda timer: notification.close())
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
118
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
119 def notify(self, title, body, icon='/media/icons/apps/48/sat.png'):
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
120 if self.isHidden():
f9130176bc8d browser side: notifications enhancements:
Goffi <goffi@goffi.org>
parents: 328
diff changeset
121 self._notify(title, body, icon)
714
03e9fe91081c browser_side: use favico.js to display alerts counter
souliane <souliane@mailoo.org>
parents: 591
diff changeset
122
03e9fe91081c browser_side: use favico.js to display alerts counter
souliane <souliane@mailoo.org>
parents: 591
diff changeset
123
03e9fe91081c browser_side: use favico.js to display alerts counter
souliane <souliane@mailoo.org>
parents: 591
diff changeset
124 class FaviconCounter(object):
03e9fe91081c browser_side: use favico.js to display alerts counter
souliane <souliane@mailoo.org>
parents: 591
diff changeset
125 """Display numbers over the favicon to signal e.g. waiting messages"""
03e9fe91081c browser_side: use favico.js to display alerts counter
souliane <souliane@mailoo.org>
parents: 591
diff changeset
126
03e9fe91081c browser_side: use favico.js to display alerts counter
souliane <souliane@mailoo.org>
parents: 591
diff changeset
127 def __init__(self):
03e9fe91081c browser_side: use favico.js to display alerts counter
souliane <souliane@mailoo.org>
parents: 591
diff changeset
128 # XXX: the file favico.min.js is loaded from public/libervia.html because I get NS_ERROR_FAILURE when it's loaded with Pyjamas. It sounds like a context issue, with the favicon not being found.
03e9fe91081c browser_side: use favico.js to display alerts counter
souliane <souliane@mailoo.org>
parents: 591
diff changeset
129
03e9fe91081c browser_side: use favico.js to display alerts counter
souliane <souliane@mailoo.org>
parents: 591
diff changeset
130 JS("""
03e9fe91081c browser_side: use favico.js to display alerts counter
souliane <souliane@mailoo.org>
parents: 591
diff changeset
131 self.counter = new top.Favico({
03e9fe91081c browser_side: use favico.js to display alerts counter
souliane <souliane@mailoo.org>
parents: 591
diff changeset
132 animation : 'slide',
03e9fe91081c browser_side: use favico.js to display alerts counter
souliane <souliane@mailoo.org>
parents: 591
diff changeset
133 bgColor: '#5CB85C',
03e9fe91081c browser_side: use favico.js to display alerts counter
souliane <souliane@mailoo.org>
parents: 591
diff changeset
134 });
03e9fe91081c browser_side: use favico.js to display alerts counter
souliane <souliane@mailoo.org>
parents: 591
diff changeset
135 """)
03e9fe91081c browser_side: use favico.js to display alerts counter
souliane <souliane@mailoo.org>
parents: 591
diff changeset
136
834
2491898b3041 browser (chat, notification): remove the textual alerts counter, merge it with the favicon counter
souliane <souliane@mailoo.org>
parents: 714
diff changeset
137 self.count = 0 # messages that are not displayed
2491898b3041 browser (chat, notification): remove the textual alerts counter, merge it with the favicon counter
souliane <souliane@mailoo.org>
parents: 714
diff changeset
138 self.extra = 0 # messages that are displayed but the window is hidden
2491898b3041 browser (chat, notification): remove the textual alerts counter, merge it with the favicon counter
souliane <souliane@mailoo.org>
parents: 714
diff changeset
139
2491898b3041 browser (chat, notification): remove the textual alerts counter, merge it with the favicon counter
souliane <souliane@mailoo.org>
parents: 714
diff changeset
140 def update(self, count=None, extra=None):
2491898b3041 browser (chat, notification): remove the textual alerts counter, merge it with the favicon counter
souliane <souliane@mailoo.org>
parents: 714
diff changeset
141 """Update the favicon counter.
2491898b3041 browser (chat, notification): remove the textual alerts counter, merge it with the favicon counter
souliane <souliane@mailoo.org>
parents: 714
diff changeset
142
2491898b3041 browser (chat, notification): remove the textual alerts counter, merge it with the favicon counter
souliane <souliane@mailoo.org>
parents: 714
diff changeset
143 @param count (int): primary counter
2491898b3041 browser (chat, notification): remove the textual alerts counter, merge it with the favicon counter
souliane <souliane@mailoo.org>
parents: 714
diff changeset
144 @param extra (int): extra counter
2491898b3041 browser (chat, notification): remove the textual alerts counter, merge it with the favicon counter
souliane <souliane@mailoo.org>
parents: 714
diff changeset
145 """
2491898b3041 browser (chat, notification): remove the textual alerts counter, merge it with the favicon counter
souliane <souliane@mailoo.org>
parents: 714
diff changeset
146 if count is not None:
2491898b3041 browser (chat, notification): remove the textual alerts counter, merge it with the favicon counter
souliane <souliane@mailoo.org>
parents: 714
diff changeset
147 self.count = count
2491898b3041 browser (chat, notification): remove the textual alerts counter, merge it with the favicon counter
souliane <souliane@mailoo.org>
parents: 714
diff changeset
148 if extra is not None:
2491898b3041 browser (chat, notification): remove the textual alerts counter, merge it with the favicon counter
souliane <souliane@mailoo.org>
parents: 714
diff changeset
149 self.extra = extra
2491898b3041 browser (chat, notification): remove the textual alerts counter, merge it with the favicon counter
souliane <souliane@mailoo.org>
parents: 714
diff changeset
150 self.counter.badge(self.count + self.extra)