Mercurial > libervia-backend
diff frontends/src/primitivus/primitivus @ 501:e9634d2e7b38
core, quick_frontend, primitivus, wix: Contacts List refactoring phase 1:
- QuickContactManagement is not used anymore and will be removed, ContactList + Core are used instead
- disconnected contacts are now displayed in Primitivus (M-d to show/hide them)
- avatars are temporary unavailable in wix
- new bridge method: getContactsFromGroup
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 25 Sep 2012 00:58:34 +0200 |
parents | a726b234d3bf |
children | 10119c2a9d33 |
line wrap: on
line diff
--- a/frontends/src/primitivus/primitivus Wed Sep 05 00:19:32 2012 +0200 +++ b/frontends/src/primitivus/primitivus Tue Sep 25 00:58:34 2012 +0200 @@ -56,7 +56,6 @@ class PrimitivusApp(QuickApp): def __init__(self): - self.CM = QuickContactManagement() #FIXME: not the best place QuickApp.__init__(self) ## main loop setup ## @@ -141,12 +140,12 @@ elif input == 'f2': #user wants to (un)hide the contact_list try: center_widgets = self.center_part.widget_list - if self.contactList in center_widgets: + if self.contact_list in center_widgets: self.center_part.set_focus(0) #necessary as the focus change to the next object, we can go out of range if we are on the last object of self.center_part - center_widgets.remove(self.contactList) + center_widgets.remove(self.contact_list) del self.center_part.column_types[0] else: - center_widgets.insert(0, self.contactList) + center_widgets.insert(0, self.contact_list) self.center_part.column_types.insert(0, ('weight', 2)) except AttributeError: #The main widget is not built (probably in Profile Manager) @@ -196,9 +195,9 @@ return menu_roller def __buildMainWidget(self): - self.contactList = ContactList(self, self.CM, on_click = self.contactSelected, on_change=lambda w: self.redraw()) - #self.center_part = urwid.Columns([('weight',2,self.contactList),('weight',8,Chat('',self))]) - self.center_part = urwid.Columns([('weight',2,self.contactList), ('weight',8,urwid.Filler(urwid.Text('')))]) + self.contact_list = ContactList(self, on_click = self.contactSelected, on_change=lambda w: self.redraw()) + #self.center_part = urwid.Columns([('weight',2,self.contact_list),('weight',8,Chat('',self))]) + self.center_part = urwid.Columns([('weight',2,self.contact_list), ('weight',8,urwid.Filler(urwid.Text('')))]) self.editBar = sat_widgets.AdvancedEdit(u'> ') self.editBar.setCompletionMethod(self._nick_completion) urwid.connect_signal(self.editBar,'click',self.onTextEntered) @@ -209,7 +208,7 @@ def _nick_completion(self, text, completion_data): """Completion method which complete pseudo in group chat for params, see AdvancedEdit""" - contact = self.contactList.get_contact() ###Based on the fact that there is currently only one contact selectable at once + contact = self.contact_list.getContact() ###Based on the fact that there is currently only one contact selectable at once if contact: chat = self.chat_wins[contact] if chat.type != "group": @@ -266,7 +265,7 @@ wid_idx = len(self.center_part.widget_list)-1 self.center_part.widget_list[wid_idx] = widget self.menu_roller.removeMenu(_('Chat menu')) - self.contactList.unselectAll() + self.contact_list.unselectAll() self.redraw() def removeWindow(self): @@ -289,7 +288,7 @@ self.notBar.setProgress(percentage) def contactSelected(self, contact_list): - contact = contact_list.get_contact() + contact = contact_list.getContact() if contact: assert(len(self.center_part.widget_list)==2) self.center_part.widget_list[1] = self.chat_wins[contact] @@ -297,7 +296,7 @@ def onTextEntered(self, editBar): """Called when text is entered in the main edit bar""" - contact = self.contactList.get_contact() ###Based on the fact that there is currently only one contact selectableat once + contact = self.contact_list.getContact() ###Based on the fact that there is currently only one contact selectableat once if contact: chat = self.chat_wins[contact] self.bridge.sendMessage(contact, @@ -311,8 +310,8 @@ return QuickApp.newMessage(self, from_jid, msg, type, to_jid, profile) sender = JID(from_jid) - if JID(self.contactList.selected).short != sender.short: - self.contactList.putAlert(sender) + if JID(self.contact_list.selected).short != sender.short: + self.contact_list.putAlert(sender) def _dialogOkCb(self, widget, data): self.removePopUp() @@ -422,8 +421,8 @@ def onRemoveContact(self, button): self.removePopUp() - info(_("Unsubscribing %s presence"),self.contactList.get_contact()) - self.bridge.delContact(self.contactList.get_contact(), profile_key=self.profile) + info(_("Unsubscribing %s presence"),self.contact_list.getContact()) + self.bridge.delContact(self.contact_list.getContact(), profile_key=self.profile) #MENU EVENTS# def onConnectRequest(self, menu): @@ -460,7 +459,7 @@ self.showPopUp(pop_up_widget) def onRemoveContactRequest(self, menu): - contact = self.contactList.get_contact() + contact = self.contact_list.getContact() if not contact: self.showPopUp(sat_widgets.Alert(_("Error"), _("You have not selected any contact to delete !"), ok_cb=self.removePopUp)) else: