Mercurial > libervia-web
comparison src/browser/sat_browser/notification.py @ 714:03e9fe91081c
browser_side: use favico.js to display alerts counter
author | souliane <souliane@mailoo.org> |
---|---|
date | Mon, 20 Jul 2015 10:18:02 +0200 |
parents | e11e34ac0f67 |
children | 2491898b3041 |
comparison
equal
deleted
inserted
replaced
713:d75935e2b279 | 714:03e9fe91081c |
---|---|
3 log = getLogger(__name__) | 3 log = getLogger(__name__) |
4 from sat.core.i18n import _ | 4 from sat.core.i18n import _ |
5 | 5 |
6 from pyjamas import Window | 6 from pyjamas import Window |
7 from pyjamas.Timer import Timer | 7 from pyjamas.Timer import Timer |
8 import favico.min.js | |
8 | 9 |
9 import dialog | 10 import dialog |
10 | 11 |
11 TIMER_DELAY = 5000 | 12 TIMER_DELAY = 5000 |
12 | 13 |
118 | 119 |
119 def notify(self, title, body, icon='/media/icons/apps/48/sat.png'): | 120 def notify(self, title, body, icon='/media/icons/apps/48/sat.png'): |
120 if self.isHidden(): | 121 if self.isHidden(): |
121 self._notify(title, body, icon) | 122 self._notify(title, body, icon) |
122 self.highlightTab() | 123 self.highlightTab() |
124 | |
125 | |
126 class FaviconCounter(object): | |
127 """Display numbers over the favicon to signal e.g. waiting messages""" | |
128 | |
129 def __init__(self): | |
130 # 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. | |
131 | |
132 JS(""" | |
133 self.counter = new top.Favico({ | |
134 animation : 'slide', | |
135 bgColor: '#5CB85C', | |
136 }); | |
137 """) | |
138 | |
139 def update(self, count): | |
140 self.counter.badge(count) |