def save(self, values): fields = [] if len(values['servicename']) > 0: fields.append(values['servicename']) if len(values['eventname']) > 0: fields.append(values['eventname']) if len(values['comment']) > 0: fields.append(values['comment']) msg = ' - '.join(fields) try: FacebookHelper.FacebookApi().postImage(self.path, msg) except Exception as e: return "Error:" + str(e) return _('Posted to wall')
def buildlist(self): try: friends = FacebookHelper.FacebookApi().getFriendsFormated().data() except Exception as e: self.ErrorException(str(e)) return for x in friends: #uname=x['name'].decode("utf-8") name = x['name'].encode('ascii', 'replace') profile_img = LoadPixmap(FacebookHelper.GetIconPath() + '/dummy.jpg') if x.get('img'): img = FacebookHelper.downloadImg(x.get('img'), self.fetchFinished, {'index':len(self.list)}) if img is not None: profile_img = img self.list.append((name, profile_img, x)) self.setFriendsCount() return self.list
def buildlist(self): #png = boxwrapper.Icon("channellist_list") try: wall = FacebookHelper.FacebookApi().getWall().data() except Exception as e: self.ErrorException(str(e)) return dummy_img = LoadPixmap(FacebookHelper.GetIconPath() + '/dummy.jpg') for x in wall: #name = str(x['name']) msg = x.get('message', '').encode('ascii', 'ignore') name = x.get('name', '').encode('ascii', 'ignore') if str(x.get('type', '')) is 'photo': msg = x.get('story', '').encode('ascii', 'ignore') if str(x.get('type', '')) is 'status': msg = x.get('story', '').encode('ascii', 'ignore') if x.get('from', None): name = x['from'].get('name', '').encode('ascii', 'ignore') if msg is '': msg = x.get('story', '').encode('ascii', 'ignore') img = x.get('picture', None) pixmap = dummy_img if img is not None and img.find("external") == -1: path = FacebookHelper.img_download(str(img)) if path: pixmap = LoadPixmap(path) if img is not None and "external" in img: o = cgi.parse_qs(urlparse(img).query) url = o.get('url')[0].encode("utf-8") if url: path = FacebookHelper.img_download( str(img), FacebookHelper.url_img_ext(url)) if path: pixmap = LoadPixmap(path) print name self.list.append((name, msg, pixmap, x)) #, pixmap, x #list.append([ # msg, # MultiContentEntryText(pos=(60, 0), size=(320, 20), font=0, text=msg), # MultiContentEntryText(pos=(60, 22), size=(320, 17), font=1, text=name), # MultiContentEntryPixmapAlphaTest(pos=(5, 0), size=(50, 40), png = pixmap), # x #]) return self.list