comparison frontends/sortilege/sortilege @ 52:6455fb62ff83

Connection/disconnection signals - wix, sortilege: management of this new signals /!\ sortilege is bugged, the contact list window is not updated correctly
author Goffi <goffi@goffi.org>
date Thu, 07 Jan 2010 01:55:30 +1100
parents 8c67ea98ab91
children a5b5fb5fc9fd
comparison
equal deleted inserted replaced
51:8c67ea98ab91 52:6455fb62ff83
43 from quick_frontend.quick_chat_list import QuickChatList 43 from quick_frontend.quick_chat_list import QuickChatList
44 from quick_frontend.quick_contact_list import QuickContactList 44 from quick_frontend.quick_contact_list import QuickContactList
45 from quick_frontend.quick_app import QuickApp 45 from quick_frontend.quick_app import QuickApp
46 from quick_frontend.quick_contact_management import QuickContactManagement 46 from quick_frontend.quick_contact_management import QuickContactManagement
47 47
48
48 ### logging configuration FIXME: put this elsewhere ### 49 ### logging configuration FIXME: put this elsewhere ###
49 logging.basicConfig(level=logging.CRITICAL, #TODO: configure it top put messages in a log file 50 logging.basicConfig(level=logging.CRITICAL, #TODO: configure it top put messages in a log file
50 format='%(message)s') 51 format='%(message)s')
51 ### 52 ###
52 53
76 chat = Chat(name, self.host) 77 chat = Chat(name, self.host)
77 self.sizer.appendColum(0,chat) 78 self.sizer.appendColum(0,chat)
78 self.sizer.update() 79 self.sizer.update()
79 return chat 80 return chat
80 81
81
82 class ContactList(Window, QuickContactList): 82 class ContactList(Window, QuickContactList):
83 83
84 def __init__(self, host, CM): 84 def __init__(self, host, CM):
85 QuickContactList.__init__(self, CM) 85 QuickContactList.__init__(self, CM)
86 self.host = host 86 self.host = host
98 self.resize(stdscr.getmaxyx()[0]-2,const_CONTACT_WIDTH,0,0) 98 self.resize(stdscr.getmaxyx()[0]-2,const_CONTACT_WIDTH,0,0)
99 self.update() 99 self.update()
100 100
101 def registerEnterCB(self, CB): 101 def registerEnterCB(self, CB):
102 self.__enterCB=CB 102 self.__enterCB=CB
103
104 def clear_contacts(self):
105 """clear all the contact list"""
106 del self.jid_list[:]
107 self.__index = 0
108 self.update() #FIXME: window is not updated correctly (contacts are still here until C-L)
103 109
104 def replace(self, jid): 110 def replace(self, jid):
105 """add a contact to the list""" 111 """add a contact to the list"""
106 name = self.CM.getAttr(jid,'name') 112 name = self.CM.getAttr(jid,'name')
107 self.jid_list.append(jid.short) 113 self.jid_list.append(jid.short)
254 ### EVENTS ### 260 ### EVENTS ###
255 261
256 def onContactChoosed(self, jid_txt): 262 def onContactChoosed(self, jid_txt):
257 """Called when a contact is selected in contact list.""" 263 """Called when a contact is selected in contact list."""
258 jid=JID(jid_txt) 264 jid=JID(jid_txt)
259 debug ("contact choose: %s", jid) 265 debug ("contact choosed: %s", jid)
260 self.showChat(jid.short) 266 self.showChat(jid.short)
261 self.statusBar.remove_item(jid.short) 267 self.statusBar.remove_item(jid.short)
262 if len(self.statusBar)==0: 268 if len(self.statusBar)==0:
263 self.statusBar.hide() 269 self.statusBar.hide()
264 self.sizer.update() 270 self.sizer.update()