Beispiel #1
0
    def load_community_information(self):
        self.cname = self.com.get('name')
        self.name_label.hide()
        self.name_entry.set_text(self.cname)
        self.name_entry.hide()
        self.peer = self.com.get('peer')
        
        if self.peer:
            ctype = 'Peer'
        else:
            ctype = 'Personal'
            self.personal_cbutton.set_active(True)
            self.checkbutton_clicked(None)

        # Hide checkbutton & label
        self.personal_label.hide()
        self.personal_cbutton.hide()
        
        self.dialog.set_title('Modify %s [%s]' %(self.cname, ctype))

        # number of hops is not currently used
        temp = self.com.get('description')
        if temp != None:
            self.description_tbuffer.set_text(temp)

        self.icon_fname = seek_community_icon_name(self.com)
        self.image.set_from_pixbuf(get_community_icon(self.com))
Beispiel #2
0
 def community_changes(self, com):
     for row in self.itemlist:
         if com == row[self.COL_COM]:
             row[self.COL_ICON] = get_community_icon(com)
             break
     page = self.com_pages.get(com)
     if page != None:
         page.update_community_page()
Beispiel #3
0
 def update_profile_widgets(self):
     image = get_community_icon(self.com)
     self.profile_image.set_from_pixbuf(image)
     n = len(self.community.get_community_members(self.com))
     myself = self.community.get_myself()
     if self.com in self.community.get_user_communities(myself):
         n += 1
     status = '%d member' % n
     if n != 1:
         status += 's'
     self.status_label.set_text(status)
     self.profile_info_label.set_markup(self.construct_profile_info_str())
Beispiel #4
0
    def update_communities(self):
        myself = self.community.get_myself()
        communities = self.community.get_user_communities(myself)
        if self.community.personal_communities:
            communities += self.community.find_communities(peer=False)

        for row in self.itemlist:
            com = row[self.COL_COM]
            if com not in communities:
                self.itemlist.remove(row.iter)
            else:
                communities.remove(com)

        # add new communities to the end
        for com in communities:
            if not com.get('invisible'):
                self.itemlist.append([get_community_icon(com), com, com.get('name')])
Beispiel #5
0
    def add_chat_button(self, conversation):

        (is_community, key, id) = decode_addr(conversation.target_addr)

        if is_community:
            coml = self.community.find_communities(id, peer=True)
            com = None
            if len(coml) > 0:
                com = coml[0]
            name = id
        else:
            user = self.community.get_user(id)
            name = user.get('nick')

        children = self.chatlist.get_children()
        if children:
            button_group = self.chatlist.get_children()[0]
        else:
            button_group = None

        button = gtk.RadioButton(button_group, name)
        button.set_mode(False)
        self.chatlist.pack_start(button, False, True)
        button.show_all()
        button.connect('toggled', self.chat_button_toggled, conversation)

        if is_community:
            image = None
            if com != None:
                image = gtk.image_new_from_pixbuf(get_community_icon(com).scale_simple(48, 48, gtk.gdk.INTERP_BILINEAR))
        else:
            image = gtk.image_new_from_pixbuf(get_user_profile_picture(user, False).scale_simple(48, 48, gtk.gdk.INTERP_BILINEAR))

        if image != None:
            button.set_image(image)

        return button