コード例 #1
0
ファイル: community_gui.py プロジェクト: proximate/proximate
    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))
コード例 #2
0
ファイル: gui_user.py プロジェクト: proximate/proximate
def get_community_icon(com):
    fname = proximatestate.seek_community_icon_name(com)
    try:
        com_icon = gtk.gdk.pixbuf_new_from_file(fname)
    except gobject.GError:
        # if we have broken community information (picture missing)
        # we must use default icon
        com_icon = get_default_community_icon(com)
    return com_icon
コード例 #3
0
ファイル: community.py プロジェクト: proximate/proximate
    def handle_icon_request(self, user, request):
        iconid = request.get('iconid')
        if iconid == None or type(iconid) != str:
            return None

        debug('Icon request from %s: %s\n' % (user.get('nick'), iconid))

        if iconid == 'user':
            icon = read_file_contents(seek_face_name(self.myself))
            version = self.myself.get('faceversion')
            limiter = self.iconfetchlimiters['user']

        elif iconid.startswith('c:'):
            cname = iconid[2:]
            if not valid_community(cname):
                return None
            if cname not in self.myself.get('communities'):
                return None
            com = self.get_ordinary_community(cname)
            if com == None:
                return None
            if com.get('myiconversion') != com.get('iconversion'):
                # Do not reply with a old version of the icon!
                return
            icon = read_file_contents(seek_community_icon_name(com))
            version = com.get('iconversion')
            limiter = self.iconfetchlimiters.get(iconid)
            if limiter == None:
                limiter = Rate_Limiter(ICON_PUSH_INTERVAL)
                self.iconfetchlimiters[iconid] = limiter
        else:
            return None

        if icon == None:
            icon = ''
        if version == None:
            version = 0

        request = {'t': 'iconpush', 'iconid': iconid, 'icon': icon, 'version': version}

        if normal_traffic_mode():
            self.fetcher.fetch(user, PLUGIN_TYPE_COMMUNITY, request, None, ack=False)
        elif limiter == None or limiter.check():
            self.fetcher.fetch_community(self.get_default_community(), PLUGIN_TYPE_COMMUNITY, request, None, ack=False)

        return {}
コード例 #4
0
ファイル: community_gui.py プロジェクト: proximate/proximate
 def image_clicked(self, widget, event):
     self.pic_dialog.set_picture(seek_community_icon_name(self.com))
     self.pic_dialog.show()