Added friendship requests buffers inside the people buffer
This commit is contained in:
parent
00d7cf48af
commit
38c394581c
@ -531,3 +531,24 @@ class peopleBuffer(feedBuffer):
|
|||||||
|
|
||||||
def pause_audio(self, *args, **kwargs): pass
|
def pause_audio(self, *args, **kwargs): pass
|
||||||
|
|
||||||
|
class requestsBuffer(peopleBuffer):
|
||||||
|
|
||||||
|
def get_items(self, show_nextpage=False):
|
||||||
|
if self.can_get_items == False: return
|
||||||
|
retrieved = True
|
||||||
|
try:
|
||||||
|
ids = self.session.vk.client.friends.getRequests(*self.args, **self.kwargs)
|
||||||
|
except VkAPIMethodError as err:
|
||||||
|
print(u"Error {0}: {1}".format(err.code, err.message))
|
||||||
|
retrieved = err.code
|
||||||
|
return retrieved
|
||||||
|
num = self.session.get_page(name=self.name, show_nextpage=show_nextpage, endpoint="get", parent_endpoint="users", count=1000, user_ids=", ".join([str(i) for i in ids["items"]]), fields="uid, first_name, last_name, last_seen")
|
||||||
|
if show_nextpage == False:
|
||||||
|
if self.tab.list.get_count() > 0 and num > 0:
|
||||||
|
print "inserting a value"
|
||||||
|
v = [i for i in self.session.db[self.name]["items"][:num]]
|
||||||
|
v.reverse()
|
||||||
|
[self.insert(i, True) for i in v]
|
||||||
|
else:
|
||||||
|
[self.insert(i) for i in self.session.db[self.name]["items"][:num]]
|
||||||
|
return retrieved
|
||||||
|
@ -98,6 +98,17 @@ class Controller(object):
|
|||||||
friends = buffers.peopleBuffer(parent=self.window.tb, name="friends_", composefunc="compose_person", session=self.session, endpoint="get", parent_endpoint="friends", count=5000, fields="uid, first_name, last_name, last_seen")
|
friends = buffers.peopleBuffer(parent=self.window.tb, name="friends_", composefunc="compose_person", session=self.session, endpoint="get", parent_endpoint="friends", count=5000, fields="uid, first_name, last_name, last_seen")
|
||||||
self.buffers.append(friends)
|
self.buffers.append(friends)
|
||||||
self.window.insert_buffer(friends.tab, _(u"Friends"), self.window.search("people"))
|
self.window.insert_buffer(friends.tab, _(u"Friends"), self.window.search("people"))
|
||||||
|
|
||||||
|
requests_ = buffers.empty(parent=self.window.tb, name="requests")
|
||||||
|
self.buffers.append(requests_)
|
||||||
|
self.window.insert_buffer(requests_.tab, _(u"Friendship requests"), self.window.search("people"))
|
||||||
|
incoming_requests = buffers.requestsBuffer(parent=self.window.tb, name="friend_requests", composefunc="compose_person", session=self.session, count=1000)
|
||||||
|
self.buffers.append(incoming_requests)
|
||||||
|
self.window.insert_buffer(incoming_requests.tab, _(u"Followers"), self.window.search("requests"))
|
||||||
|
outgoing_requests = buffers.requestsBuffer(parent=self.window.tb, name="friend_requests_sent", composefunc="compose_person", session=self.session, count=1000, out=1)
|
||||||
|
self.buffers.append(outgoing_requests)
|
||||||
|
self.window.insert_buffer(outgoing_requests.tab, _(u"I follow"), self.window.search("requests"))
|
||||||
|
|
||||||
chats = buffers.empty(parent=self.window.tb, name="chats")
|
chats = buffers.empty(parent=self.window.tb, name="chats")
|
||||||
self.buffers.append(chats)
|
self.buffers.append(chats)
|
||||||
self.window.add_buffer(chats.tab, _(u"Chats"))
|
self.window.add_buffer(chats.tab, _(u"Chats"))
|
||||||
|
Loading…
Reference in New Issue
Block a user