Now using VK API 5.45, the most recent version
This commit is contained in:
@@ -30,15 +30,21 @@ class baseBuffer(object):
|
||||
item_ = getattr(session, self.compose_function)(item, self.session)
|
||||
self.tab.list.insert_item(reversed, *item_)
|
||||
|
||||
def get_items(self, no_next=True):
|
||||
num = getattr(self.session, "get_newsfeed")(no_next=no_next, name=self.name, *self.args, **self.kwargs)
|
||||
def get_items(self, show_nextpage=False):
|
||||
num = getattr(self.session, "get_newsfeed")(show_nextpage=show_nextpage, name=self.name, *self.args, **self.kwargs)
|
||||
print num
|
||||
if no_next == True:
|
||||
if show_nextpage == False:
|
||||
if self.tab.list.get_count() > 0 and num > 0:
|
||||
print "inserting a value"
|
||||
[self.insert(i, True) for i in self.session.db[self.name]["items"][:num]]
|
||||
else:
|
||||
[self.insert(i) for i in self.session.db[self.name]["items"][:num]]
|
||||
else:
|
||||
if num > 0:
|
||||
[self.insert(i, False) for i in self.session.db[self.name]["items"][:num]]
|
||||
|
||||
def update(self):
|
||||
self.get_items(show_nextpage=True)
|
||||
|
||||
def post(self, *args, **kwargs):
|
||||
p = messages.post(title=_(u"Write your post"), caption="", text="")
|
||||
@@ -101,10 +107,10 @@ class baseBuffer(object):
|
||||
|
||||
class feedBuffer(baseBuffer):
|
||||
|
||||
def get_items(self, no_next=True):
|
||||
num = getattr(self.session, "get_page")(no_next=no_next, name=self.name, *self.args, **self.kwargs)
|
||||
def get_items(self, show_nextpage=False):
|
||||
num = getattr(self.session, "get_page")(show_nextpage=show_nextpage, name=self.name, *self.args, **self.kwargs)
|
||||
print num
|
||||
if no_next == True:
|
||||
if show_nextpage == False:
|
||||
if self.tab.list.get_count() > 0 and num > 0:
|
||||
print "inserting a value"
|
||||
[self.insert(i, True) for i in self.session.db[self.name]["items"][-num:]]
|
||||
|
@@ -19,6 +19,13 @@ class Controller(object):
|
||||
return self.buffers[i]
|
||||
return False
|
||||
|
||||
def get_current_buffer(self):
|
||||
""" Get the current bufferObject"""
|
||||
buffer = self.window.get_current_buffer()
|
||||
if hasattr(buffer, "name"):
|
||||
buffer = self.search(buffer.name)
|
||||
return buffer
|
||||
|
||||
def __init__(self):
|
||||
super(Controller, self).__init__()
|
||||
self.buffers = []
|
||||
@@ -49,6 +56,7 @@ class Controller(object):
|
||||
pub.subscribe(self.play_audio, "play-audio")
|
||||
pub.subscribe(self.view_post, "open-post")
|
||||
widgetUtils.connect_event(self.window, widgetUtils.CLOSE_EVENT, self.exit)
|
||||
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.update_buffer, menuitem=self.window.update_buffer)
|
||||
|
||||
def disconnect_events(self):
|
||||
pub.unsubscribe(self.in_post, "posted")
|
||||
@@ -93,4 +101,9 @@ class Controller(object):
|
||||
def exit(self, *args, **kwargs):
|
||||
self.disconnect_events()
|
||||
self.window.Destroy()
|
||||
# wx.GetApp().ExitMainloop()
|
||||
# wx.GetApp().ExitMainloop()
|
||||
|
||||
def update_buffer(self, *args, **kwargs):
|
||||
b = self.get_current_buffer()
|
||||
b.update()
|
||||
print "updated"
|
@@ -204,7 +204,7 @@ class audio(postController):
|
||||
|
||||
def add_to_library(self, *args, **kwargs):
|
||||
args = {}
|
||||
args["audio_id"] = self.post["aid"]
|
||||
args["audio_id"] = self.post["id"]
|
||||
if self.post.has_key("album_id"):
|
||||
args["album_id"] = self.post["album_id"]
|
||||
args["owner_id"] = self.post["owner_id"]
|
||||
|
Reference in New Issue
Block a user