Mercurial > libervia-desktop-kivy
comparison src/cagou/core/common.py @ 107:f0cf44df8486
JidWidget: first draft
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 15 Jan 2017 21:21:22 +0100 |
parents | 3efca1b10b2f |
children |
comparison
equal
deleted
inserted
replaced
106:9909ed7a7a20 | 107:f0cf44df8486 |
---|---|
19 | 19 |
20 """common widgets, which can be reused everywhere""" | 20 """common widgets, which can be reused everywhere""" |
21 | 21 |
22 from kivy.uix.image import Image | 22 from kivy.uix.image import Image |
23 from kivy.uix.behaviors import ButtonBehavior | 23 from kivy.uix.behaviors import ButtonBehavior |
24 from kivy.uix.boxlayout import BoxLayout | |
25 from cagou import G | |
24 | 26 |
25 | 27 |
26 class IconButton(ButtonBehavior, Image): | 28 class IconButton(ButtonBehavior, Image): |
27 pass | 29 pass |
30 | |
31 | |
32 class JidWidget(ButtonBehavior, BoxLayout): | |
33 | |
34 def __init__(self, jid, profile, **kwargs): | |
35 self.jid = jid | |
36 self.profile = profile | |
37 self.nick = kwargs.get('nick') | |
38 super(JidWidget, self).__init__(**kwargs) | |
39 | |
40 def getImage(self, wid): | |
41 host = G.host | |
42 if host.contact_lists[self.profile].isRoom(self.jid.bare): | |
43 wid.opacity = 0 | |
44 return "" | |
45 else: | |
46 return host.getAvatar(self.jid, profile=self.profile) or host.getDefaultAvatar(self.jid) |