comparison src/browser/sat_browser/contact_list.py @ 648:6d3142b782c3 frontends_multi_profiles

browser_side: classes reorganisation: - moved widgets in dedicated modules (base, contact, editor, libervia) and a widget module for single classes - same thing for panels (base, main, contact) - libervia_widget mix main panels and widget and drag n drop for technical reasons (see comments) - renamed WebPanel to WebWidget
author Goffi <goffi@goffi.org>
date Thu, 26 Feb 2015 18:10:54 +0100
parents e0021d571eef
children 2df91d0308ac
comparison
equal deleted inserted replaced
647:e0021d571eef 648:6d3142b782c3
29 from pyjamas import Window 29 from pyjamas import Window
30 from pyjamas import DOM 30 from pyjamas import DOM
31 from __pyjamas__ import doc 31 from __pyjamas__ import doc
32 32
33 from constants import Const as C 33 from constants import Const as C
34 import base_widget 34 import libervia_widget
35 import base_panels 35 import contact_panel
36 import blog 36 import blog
37 import chat 37 import chat
38 38
39 unicode = str # XXX: pyjama doesn't manage unicode 39 unicode = str # XXX: pyjama doesn't manage unicode
40 40
68 widget.removeStyleName(widget.presence_style) 68 widget.removeStyleName(widget.presence_style)
69 widget.addStyleName(style) 69 widget.addStyleName(style)
70 widget.presence_style = style 70 widget.presence_style = style
71 71
72 72
73 class GroupLabel(base_widget.DragLabel, Label, ClickHandler): 73 class GroupLabel(libervia_widget.DragLabel, Label, ClickHandler):
74 def __init__(self, host, group): 74 def __init__(self, host, group):
75 """ 75 """
76 76
77 @param host (SatWebFrontend) 77 @param host (SatWebFrontend)
78 @param group (unicode): group name 78 @param group (unicode): group name
79 """ 79 """
80 self.group = group 80 self.group = group
81 Label.__init__(self, group) # , Element=DOM.createElement('div') 81 Label.__init__(self, group) # , Element=DOM.createElement('div')
82 self.setStyleName('group') 82 self.setStyleName('group')
83 base_widget.DragLabel.__init__(self, group, "GROUP", host) 83 libervia_widget.DragLabel.__init__(self, group, "GROUP", host)
84 ClickHandler.__init__(self) 84 ClickHandler.__init__(self)
85 self.addClickListener(self) 85 self.addClickListener(self)
86 86
87 def onClick(self, sender): 87 def onClick(self, sender):
88 self.host.displayWidget(blog.MicroblogPanel, self.group) 88 self.host.displayWidget(blog.MicroblogPanel, self.group)
131 131
132 def getGroups(self): 132 def getGroups(self):
133 return self._groups 133 return self._groups
134 134
135 135
136 class ContactsPanel(base_panels.ContactsPanel): 136 class ContactsPanel(contact_panel.ContactsPanel):
137 """The contact list that is displayed on the left side.""" 137 """The contact list that is displayed on the left side."""
138 138
139 def __init__(self, parent): 139 def __init__(self, parent):
140 def on_click(contact_jid): 140 def on_click(contact_jid):
141 self.host.displayWidget(chat.Chat, contact_jid, type_=C.CHAT_ONE2ONE) 141 self.host.displayWidget(chat.Chat, contact_jid, type_=C.CHAT_ONE2ONE)
142 base_panels.ContactsPanel.__init__(self, parent, on_click=on_click, handle_menu=True) 142 contact_panel.ContactsPanel.__init__(self, parent, on_click=on_click, handle_menu=True)
143 143
144 def setState(self, jid_, type_, state): 144 def setState(self, jid_, type_, state):
145 """Change the appearance of the contact, according to the state 145 """Change the appearance of the contact, according to the state
146 146
147 @param jid_ (jid.JID): jid.JID which need to change state 147 @param jid_ (jid.JID): jid.JID which need to change state
159 setPresenceStyle(contact_box.label, state) 159 setPresenceStyle(contact_box.label, state)
160 elif type_ == 'messageWaiting': 160 elif type_ == 'messageWaiting':
161 contact_box.setAlert(state) 161 contact_box.setAlert(state)
162 162
163 163
164 class ContactTitleLabel(base_widget.DragLabel, Label, ClickHandler): 164 class ContactTitleLabel(libervia_widget.DragLabel, Label, ClickHandler):
165 165
166 def __init__(self, host, text): 166 def __init__(self, host, text):
167 Label.__init__(self, text) # , Element=DOM.createElement('div') 167 Label.__init__(self, text) # , Element=DOM.createElement('div')
168 self.setStyleName('contactTitle') 168 self.setStyleName('contactTitle')
169 base_widget.DragLabel.__init__(self, text, "CONTACT_TITLE", host) 169 libervia_widget.DragLabel.__init__(self, text, "CONTACT_TITLE", host)
170 ClickHandler.__init__(self) 170 ClickHandler.__init__(self)
171 self.addClickListener(self) 171 self.addClickListener(self)
172 172
173 def onClick(self, sender): 173 def onClick(self, sender):
174 self.host.displayWidget(blog.MicroblogPanel, None) 174 self.host.displayWidget(blog.MicroblogPanel, None)