comparison frontends/primitivus/primitivus @ 125:8d611eb9ae48

primitivus: contact list enhancement - primitivus: contact list now display groups and sexy name (instead of bare jid) - primitivus: contact list now show an alert when somebody want to contact you, and its chat window is not on the screen - primitivus: cursor is now visible when going to chat window (useful to go back in logs)
author Goffi <goffi@goffi.org>
date Mon, 12 Jul 2010 17:50:00 +0800
parents 961e0898271f
children 55d3ef84f01f
comparison
equal deleted inserted replaced
124:961e0898271f 125:8d611eb9ae48
58 const_PALETTE = [('title', 'black', 'light gray', 'standout,underline'), 58 const_PALETTE = [('title', 'black', 'light gray', 'standout,underline'),
59 ('selected', 'default', 'dark red'), 59 ('selected', 'default', 'dark red'),
60 ('selected_focus', 'default,bold', 'dark red'), 60 ('selected_focus', 'default,bold', 'dark red'),
61 ('default', 'default', 'default'), 61 ('default', 'default', 'default'),
62 ('default_focus', 'default,bold', 'default'), 62 ('default_focus', 'default,bold', 'default'),
63 ('alert', 'default,underline', 'default'),
64 ('alert_focus', 'default,bold,underline', 'default'),
63 ('date', 'light gray', 'default'), 65 ('date', 'light gray', 'default'),
64 ('my_nick', 'dark red,bold', 'default'), 66 ('my_nick', 'dark red,bold', 'default'),
65 ('other_nick', 'dark cyan,bold', 'default'), 67 ('other_nick', 'dark cyan,bold', 'default'),
66 ] 68 ]
67 69
123 self.center_part.column_types.insert(0, ('weight', 2)) 125 self.center_part.column_types.insert(0, ('weight', 2))
124 except AttributeError: 126 except AttributeError:
125 #The main widget is not built (probably in Profile Manager) 127 #The main widget is not built (probably in Profile Manager)
126 pass 128 pass
127 129
128
129
130 def __buildMainWidget(self): 130 def __buildMainWidget(self):
131 self.contactList = ContactList(self, self.CM, on_click = self.contactSelected, on_change=lambda w: self.redraw()) 131 self.contactList = ContactList(self, self.CM, on_click = self.contactSelected, on_change=lambda w: self.redraw())
132 #self.center_part = urwid.Columns([('weight',2,self.contactList),('weight',8,Chat('',self))]) 132 #self.center_part = urwid.Columns([('weight',2,self.contactList),('weight',8,Chat('',self))])
133 self.center_part = urwid.Columns([('weight',2,self.contactList), ('weight',8,urwid.Filler(urwid.Text('')))]) 133 self.center_part = urwid.Columns([('weight',2,self.contactList), ('weight',8,urwid.Filler(urwid.Text('')))])
134 editBar = AdvancedEdit('> ') 134 editBar = AdvancedEdit('> ')
164 editBar.get_edit_text(), 164 editBar.get_edit_text(),
165 type = "groupchat" if chat.type == 'group' else "chat", 165 type = "groupchat" if chat.type == 'group' else "chat",
166 profile_key=self.profile) 166 profile_key=self.profile)
167 editBar.set_edit_text('') 167 editBar.set_edit_text('')
168 168
169 def newMessage(self, from_jid, msg, type, to_jid, profile):
170 if not self.check_profile(profile):
171 return
172 QuickApp.newMessage(self, from_jid, msg, type, to_jid, profile)
173 sender = JID(from_jid)
174 if JID(self.contactList.selected).short != sender.short:
175 self.contactList.putAlert(sender)
176
169 def onJoinRoom(self, button, edit): 177 def onJoinRoom(self, button, edit):
170 self.removePopUp() 178 self.removePopUp()
171 room_jid = JID(edit.get_edit_text()) 179 room_jid = JID(edit.get_edit_text())
172 if room_jid.is_valid(): 180 if room_jid.is_valid():
173 self.bridge.joinMUC(room_jid.domain, room_jid.node, self.profiles[self.profile]['whoami'].node, self.profile) 181 self.bridge.joinMUC(room_jid.domain, room_jid.node, self.profiles[self.profile]['whoami'].node, self.profile)