Mercurial > libervia-desktop-kivy
diff cagou/plugins/plugin_wid_chat.py @ 186:a826c70beda2
chat: avoid multiple notifications when there are several cloned chats (i.e. with same target)
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 11 May 2018 20:08:09 +0200 |
parents | ab3f5173ef5c |
children | 284cb5c467b0 |
line wrap: on
line diff
--- a/cagou/plugins/plugin_wid_chat.py Fri May 11 20:07:17 2018 +0200 +++ b/cagou/plugins/plugin_wid_chat.py Fri May 11 20:08:09 2018 +0200 @@ -369,8 +369,13 @@ For group chat, note will be added on mention, with a desktop notification if window has not focus. """ + visible_clones = [w for w in G.host.getVisibleList(self.__class__) if w.target == self.target] + if len(visible_clones) > 1 and visible_clones.index(self) > 0: + # to avoid multiple notifications in case of multiple cloned widgets + # we only handle first clone + return + is_visible = bool(visible_clones) if self.type == C.CHAT_ONE2ONE: - is_visible = self.target in [w.target for w in G.host.getVisibleList(self.__class__)] if (not Window.focus or not is_visible) and not mess_data.history: notif_msg = self._get_notif_msg(mess_data) G.host.desktop_notif(