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: if num > 0:
[self.insert(i, False) for i in self.session.db[self.name]["items"][:num]] [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) self.get_items(show_nextpage=True)
def post(self, *args, **kwargs): def post(self, *args, **kwargs):
@ -135,9 +135,6 @@ class feedBuffer(baseBuffer):
else: else:
[self.insert(i) for i in self.session.db[self.name]["items"][:num]] [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): class audioBuffer(feedBuffer):
def create_tab(self, parent): def create_tab(self, parent):
self.tab = home.audioTab(parent) self.tab = home.audioTab(parent)
@ -178,6 +175,9 @@ class audioBuffer(feedBuffer):
return False return False
def get_more_items(self, *args, **kwargs):
output.speak(_(u"This buffer doesn't support getting more items."))
class empty(object): class empty(object):
def __init__(self, name=None, parent=None, *args, **kwargs): def __init__(self, name=None, parent=None, *args, **kwargs):
@ -187,7 +187,7 @@ class empty(object):
def get_items(self, *args, **kwargs): def get_items(self, *args, **kwargs):
pass pass
def update(self, *args, **kwargs): def get_more_items(self, *args, **kwargs):
pass output.speak(_(u"This buffer doesn't support getting more items."))
def remove_buffer(self): return False 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.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.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.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): def disconnect_events(self):
pub.unsubscribe(self.in_post, "posted") pub.unsubscribe(self.in_post, "posted")
@ -134,6 +135,10 @@ class Controller(object):
b = self.get_current_buffer() b = self.get_current_buffer()
b.get_items() 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): def check_for_updates(self, *args, **kwargs):
update = updater.do_update() update = updater.do_update()
if update == False: if update == False:

View File

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