示例#1
0
    def __add_person(self, person, box, map):
        _logger.debug("person added to people stock %s", person.display_name)
        if map.has_key(person):
            return
        
        item = PersonItem(person, themed=True)
        box.insert_sorted(item, hippo.PACK_IF_FITS, lambda a,b: sort_people(a.person, b.person))

        def resort(*args):
            box.remove(item)
            box.insert_sorted(item, hippo.PACK_IF_FITS, lambda a,b: sort_people(a.person, b.person))

        if person.is_contact:
            person.resource.connect(resort, 'status')

        person.connect('online-changed', resort)
        person.connect('display-name-changed', resort)
        
        map[person] = item
        self.__set_item_size(item, self.get_size())
        item.connect('activated', self.__handle_item_pressed)
示例#2
0
    def add_person(self, person, section):
        if person in self.__items[section]:
            return
        
        item = PersonItem(person)
        item.connect("button-press-event", self.__on_item_click)
                
        self.add_column_item(section, item, lambda a,b: sort_people(a.person, b.person))
        self.__section_counts[section] += 1
        if self.__section_counts[section] == 1:
            self.__section_headers[section].set_visible(True)
                    
        def resort(resource):
            self.remove(item)
            self.add_column_item(section, item, lambda a,b: sort_people(a.person, b.person))

        if person.is_contact:
            person.resource.connect(resort, 'status')
        person.connect('display-name-changed', resort)
        
        self.__update_visibility(section, item)

        self.__items[section][person] = item
示例#3
0
 def resort(*args):
     box.remove(item)
     box.insert_sorted(item, hippo.PACK_IF_FITS, lambda a,b: sort_people(a.person, b.person))
示例#4
0
 def resort(resource):
     self.remove(item)
     self.add_column_item(section, item, lambda a,b: sort_people(a.person, b.person))