Added load previous items options for newsfeed. It should work for wall too

This commit is contained in:
Manuel Cortez 2016-03-31 10:33:02 -06:00
parent 0323e0f6a7
commit 27bbfb1443
3 changed files with 12 additions and 7 deletions

View File

@ -57,7 +57,7 @@ class baseBuffer(object):
if num > 0:
[self.insert(i, False) for i in self.session.db[self.name]["items"][:num]]
def update(self):
def get_more_items(self):
self.get_items(show_nextpage=True)
def post(self, *args, **kwargs):
@ -135,9 +135,6 @@ class feedBuffer(baseBuffer):
else:
[self.insert(i) for i in self.session.db[self.name]["items"][:num]]
def update(self):
output.speak(_(u"Wall buffers can't get up to 100 items."))
class audioBuffer(feedBuffer):
def create_tab(self, parent):
self.tab = home.audioTab(parent)
@ -178,6 +175,9 @@ class audioBuffer(feedBuffer):
return False
def get_more_items(self, *args, **kwargs):
output.speak(_(u"This buffer doesn't support getting more items."))
class empty(object):
def __init__(self, name=None, parent=None, *args, **kwargs):
@ -187,7 +187,7 @@ class empty(object):
def get_items(self, *args, **kwargs):
pass
def update(self, *args, **kwargs):
pass
def get_more_items(self, *args, **kwargs):
output.speak(_(u"This buffer doesn't support getting more items."))
def remove_buffer(self): return False

View File

@ -79,6 +79,7 @@ class Controller(object):
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.window.about_dialog, menuitem=self.window.about)
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.search_audios, menuitem=self.window.search_audios)
widgetUtils.connect_event(self.window, widgetUtils.MENU,self.remove_buffer, menuitem=self.window.remove_buffer_)
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.get_more_items, menuitem=self.window.load_previous_items)
def disconnect_events(self):
pub.unsubscribe(self.in_post, "posted")
@ -134,6 +135,10 @@ class Controller(object):
b = self.get_current_buffer()
b.get_items()
def get_more_items(self, *args, **kwargs):
b = self.get_current_buffer()
b.get_more_items()
def check_for_updates(self, *args, **kwargs):
update = updater.do_update()
if update == False:

View File

@ -11,7 +11,7 @@ class mainWindow(wx.Frame):
buffer.AppendMenu(wx.NewId(), _(u"New buffer"), self.new_buffer)
self.update_buffer = buffer.Append(wx.NewId(), _(u"Update current buffer"))
self.load_previous_items = buffer.Append(wx.NewId(), _(u"Load previous items"))
self.load_previous_items.Enable(False)
self.remove_buffer_ = buffer.Append(wx.NewId(), _(u"&Remove buffer"))
mb.Append(buffer, _(u"Buffer"))
help_ = wx.Menu()