Delete timelines is now possible

This commit is contained in:
Manuel Cortez 2015-02-11 16:14:25 -06:00
parent d2cffe65d8
commit 5eb4f74242
6 changed files with 31 additions and 9 deletions

View File

@ -32,7 +32,7 @@ details = string(default="control+win+alt+n")
view_item = string(default="control+win+v") view_item = string(default="control+win+v")
exit = string(default="control+win+f4") exit = string(default="control+win+f4")
open_timeline = string(default="control+win+i") open_timeline = string(default="control+win+i")
delete_buffer = string(default="control+win+shift+i") remove_buffer = string(default="control+win+shift+i")
url = string(default="control+win+return") url = string(default="control+win+return")
audio = string(default="control+win+alt+return") audio = string(default="control+win+alt+return")
volume_up = string(default="control+win+alt+up") volume_up = string(default="control+win+alt+up")

View File

@ -214,6 +214,15 @@ class baseBufferController(bufferController):
self.buffer.list.select_item(selection+elements) self.buffer.list.select_item(selection+elements)
output.speak(_(u"%s items retrieved") % (str(elements))) output.speak(_(u"%s items retrieved") % (str(elements)))
def remove_buffer(self):
if "timeline" in self.name:
dlg = commonMessageDialogs.remove_buffer()
if dlg == widgetUtils.YES:
if self.name[:9] in self.session.settings["other_buffers"]["timelines"]:
self.session.settings["other_buffers"]["timelines"].remove(self.name[:9])
else:
output.speak(_(u"This buffer is not a timeline; it can't be deleted."))
def put_items_on_list(self, number_of_items): def put_items_on_list(self, number_of_items):
log.debug("The list contains %d items " % (self.buffer.list.get_count(),)) log.debug("The list contains %d items " % (self.buffer.list.get_count(),))
log.debug("Putting %d items on the list" % (number_of_items,)) log.debug("Putting %d items on the list" % (number_of_items,))

View File

@ -124,6 +124,7 @@ class Controller(object):
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.unblock, menuitem=self.view.unblock) widgetUtils.connect_event(self.view, widgetUtils.MENU, self.unblock, menuitem=self.view.unblock)
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.get_more_items, menuitem=self.view.load_previous_items) widgetUtils.connect_event(self.view, widgetUtils.MENU, self.get_more_items, menuitem=self.view.load_previous_items)
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.clear_buffer, menuitem=self.view.clear) widgetUtils.connect_event(self.view, widgetUtils.MENU, self.clear_buffer, menuitem=self.view.clear)
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.remove_buffer, self.view.deleteTl)
widgetUtils.connect_event(self.view.nb, widgetUtils.NOTEBOOK_PAGE_CHANGED, self.buffer_changed) widgetUtils.connect_event(self.view.nb, widgetUtils.NOTEBOOK_PAGE_CHANGED, self.buffer_changed)
def __init__(self): def __init__(self):
@ -464,9 +465,6 @@ class Controller(object):
def open_timeline(self, user, timeline_tipe): def open_timeline(self, user, timeline_tipe):
pass pass
def remove_buffer(self):
pass
def show_hide(self, *args, **kwargs): def show_hide(self, *args, **kwargs):
km = self.create_invisible_keyboard_shorcuts() km = self.create_invisible_keyboard_shorcuts()
if self.showing == True: if self.showing == True:
@ -506,7 +504,7 @@ class Controller(object):
def reverse_geocode(self, event=None): def reverse_geocode(self, event=None):
try: try:
tweet = self.get_current_buffer().get_right_tweet() tweet = self.get_current_buffer().get_tweet()
if tweet["coordinates"] != None: if tweet["coordinates"] != None:
x = tweet["coordinates"]["coordinates"][0] x = tweet["coordinates"]["coordinates"][0]
y = tweet["coordinates"]["coordinates"][1] y = tweet["coordinates"]["coordinates"][1]
@ -549,6 +547,16 @@ class Controller(object):
def clear_buffer(self, *args, **kwargs): def clear_buffer(self, *args, **kwargs):
self.get_current_buffer().clear_list() self.get_current_buffer().clear_list()
def remove_buffer(self, *args, **kwargs):
buffer = self.get_current_buffer()
if not hasattr(buffer, "account"): return
buff = self.view.search(buffer.name, buffer.account)
buffer.remove_buffer()
self.view.delete_buffer(buff)
buffer.session.sound.play("delete_timeline.ogg")
self.buffers.remove(buffer)
del buffer
def skip_buffer(self, forward=True): def skip_buffer(self, forward=True):
buff = self.get_current_buffer() buff = self.get_current_buffer()
if buff.invisible == False: if buff.invisible == False:
@ -832,7 +840,7 @@ class Controller(object):
def manage_stream_errors(self, session): def manage_stream_errors(self, session):
log.error("An error ocurred with the stream for the %s session. It will be destroyed" % (session,)) log.error("An error ocurred with the stream for the %s session. It will be destroyed" % (session,))
s = sessions_.session[session] s = session_.sessions[session]
s.listen_stream_error() s.listen_stream_error()
def check_connection(self): def check_connection(self):

View File

@ -24,4 +24,6 @@ def get_ignored_client():
def clear_list(): def clear_list():
dlg = wx.MessageDialog(None, _(u"Do you really want to empty this buffer? It's items will be removed from the list but not from Twitter"), _(u"Empty buffer"), wx.ICON_QUESTION|wx.YES_NO) dlg = wx.MessageDialog(None, _(u"Do you really want to empty this buffer? It's items will be removed from the list but not from Twitter"), _(u"Empty buffer"), wx.ICON_QUESTION|wx.YES_NO)
return dlg.ShowModal() return dlg.ShowModal()
def remove_buffer():
return wx.MessageDialog(None, _(u"Do you really want to delete this timeline?"), _(u"Attention"), style=wx.ICON_QUESTION|wx.YES_NO).ShowModal()

View File

@ -67,7 +67,7 @@ class mainFrame(wx.Frame):
self.autoread.Enable(False) self.autoread.Enable(False)
self.clear = buffer.Append(wx.NewId(), _(u"&Clear buffer")) self.clear = buffer.Append(wx.NewId(), _(u"&Clear buffer"))
self.deleteTl = buffer.Append(wx.NewId(), _(u"&Remove buffer")) self.deleteTl = buffer.Append(wx.NewId(), _(u"&Remove buffer"))
self.deleteTl.Enable(False) # self.deleteTl.Enable(False)
# Help Menu # Help Menu
help = wx.Menu() help = wx.Menu()
@ -169,4 +169,7 @@ class mainFrame(wx.Frame):
self.Show() self.Show()
def show_address(self, address): def show_address(self, address):
wx.MessageDialog(self, address, _(u"Address"), wx.OK).ShowModal() wx.MessageDialog(self, address, _(u"Address"), wx.OK).ShowModal()
def delete_buffer(self, pos):
self.nb.DeletePage(pos)