Clear buffers is now possible, keys for 64 bits has been added

This commit is contained in:
Manuel Cortez 2015-02-07 10:23:23 -06:00
parent 62b0bc76a8
commit 0ede5bfcb0
6 changed files with 61 additions and 27 deletions

View File

@ -43,7 +43,7 @@ go_page_up = string(default="control+win+pageup")
go_page_down = string(default="control+win+pagedown")
update_profile = string(default="alt+win+p")
delete = string(default="control+win+delete")
clear_list = string(default="control+win+shift+delete")
clear_buffer = string(default="control+win+shift+delete")
repeat_item = string(default="control+win+space")
copy_to_clipboard = string(default="control+win+c")
add_to_list = string(default="control+win+a")

View File

@ -27,6 +27,8 @@ class bufferController(object):
self.needs_init = True
self.invisible = False # False if the buffer will be ignored on the invisible interface.
def clear_list(self): pass
def get_event(self, ev):
if ev.GetKeyCode() == wx.WXK_RETURN and ev.ControlDown(): event = "audio"
elif ev.GetKeyCode() == wx.WXK_RETURN: event = "url"
@ -229,6 +231,8 @@ class baseBufferController(bufferController):
self.buffer.list.insert_item(False, *tweet)
else:
self.buffer.list.insert_item(True, *tweet)
if self.name in self.session.settings["other_buffers"]["autoread_buffers"] and self.session.settings["sound"]["global_mute"] == False:
output.speak(" ".join(tweet[:2]))
def bind_events(self):
log.debug("Binding events...")
@ -329,28 +333,26 @@ class baseBufferController(bufferController):
webbrowser.open_new_tab(urls_list.get_string())
def clear_list(self):
dlg = wx.MessageDialog(None, _(u"Do you really want to empty this buffer? It's tweets will be removed from the list but not from Twitter"), _(u"Empty buffer"), wx.ICON_QUESTION|wx.YES_NO)
if dlg.ShowModal() == widgetUtils.YES:
dlg = commonMessageDialogs.clear_list()
if dlg == widgetUtils.YES:
self.session.db[self.name] = []
self.buffer.list.clear()
dlg.Destroy()
def destroy_status(self, *args, **kwargs):
index = self.buffer.list.get_selected()
if self.type == "events" or self.type == "people" or self.type == "empty" or self.type == "account": return
answer = commonMessageDialogs.delete_tweet_dialog(None)
if answer == widgetUtils.YES:
# try:
if self.name == "direct_messages":
self.session.twitter.twitter.destroy_direct_message(id=self.get_right_tweet()["id"])
else:
self.session.twitter.twitter.destroy_status(id=self.get_right_tweet()["id"])
self.session.db[self.name].pop(index)
self.buffer.list.remove_item(index)
if index > 0:
self.buffer.list.select_item(index-1)
# except TwythonError:
# sound.player.play("error.ogg")
try:
if self.name == "direct_messages":
self.session.twitter.twitter.destroy_direct_message(id=self.get_right_tweet()["id"])
else:
self.session.twitter.twitter.destroy_status(id=self.get_right_tweet()["id"])
self.session.db[self.name].pop(index)
self.buffer.list.remove_item(index)
# if index > 0:
except TwythonError:
sound.player.play("error.ogg")
class eventsBufferController(bufferController):
def __init__(self, parent, name, session, account, *args, **kwargs):
@ -378,6 +380,13 @@ class eventsBufferController(bufferController):
self.buffer.list.insert_item(False, *tweet)
else:
self.buffer.list.insert_item(True, *tweet)
if self.name in self.session.settings["other_buffers"]["autoread_buffers"] and self.session.settings["sound"]["global_mute"] == False:
output.speak(" ".join(tweet))
def clear_list(self):
dlg = commonMessageDialogs.clear_list()
if dlg == widgetUtils.YES:
self.buffer.list.clear()
class peopleBufferController(baseBufferController):
def __init__(self, parent, function, name, sessionObject, account, bufferType=None, *args, **kwargs):
@ -450,6 +459,15 @@ class peopleBufferController(baseBufferController):
self.buffer.list.insert_item(False, *tweet)
else:
self.buffer.list.insert_item(True, *tweet)
if self.name in self.session.settings["other_buffers"]["autoread_buffers"] and self.session.settings["sound"]["global_mute"] == False:
output.speak(" ".join(tweet))
def clear_list(self):
dlg = commonMessageDialogs.clear_list()
if dlg == widgetUtils.YES:
self.session.db[self.name]["items"] = []
self.session.db[self.name]["cursor"] = -1
self.buffer.list.clear()
class searchBufferController(baseBufferController):
def start_stream(self):

View File

@ -122,6 +122,7 @@ class Controller(object):
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.block, menuitem=self.view.block)
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.clear_buffer, menuitem=self.view.clear)
widgetUtils.connect_event(self.view.nb, widgetUtils.NOTEBOOK_PAGE_CHANGED, self.buffer_changed)
def __init__(self):
@ -544,6 +545,9 @@ class Controller(object):
def get_more_items(self, *args, **kwargs):
self.get_current_buffer().get_more_items()
def clear_buffer(self, *args, **kwargs):
self.get_current_buffer().clear_list()
def skip_buffer(self, forward=True):
buff = self.get_current_buffer()
if buff.invisible == False:
@ -723,6 +727,7 @@ class Controller(object):
pass
def notify(self, session, play_sound=None, message=None, notification=False):
if session.settings["sound"]["global_mute"] == True: return
if play_sound != None:
session.sound.play(play_sound)
if message != None:
@ -731,46 +736,53 @@ class Controller(object):
def manage_home_timelines(self, data, user):
buffer = self.search_buffer("home_timeline", user)
play_sound = "tweet_received.ogg"
buffer.add_new_item(data)
if "home_timeline" in buffer.session.settings["other_buffers"]["muted_buffers"]: return
self.notify(buffer.session, play_sound=play_sound)
buffer.add_new_item(data)
def manage_mentions(self, data, user):
buffer = self.search_buffer("mentions", user)
play_sound = "mention_received.ogg"
buffer.add_new_item(data)
message = _(u"New mention")
if "mentions" in buffer.session.settings["other_buffers"]["muted_buffers"]: return
self.notify(buffer.session, play_sound=play_sound, message=message)
buffer.add_new_item(data)
def manage_direct_messages(self, data, user):
buffer = self.search_buffer("direct_messages", user)
play_sound = "dm_received.ogg"
buffer.add_new_item(data)
message = _(u"New direct message")
if "direct_messages" in buffer.session.settings["other_buffers"]["muted_buffers"]: return
self.notify(buffer.session, play_sound=play_sound, message=message)
buffer.add_new_item(data)
def manage_sent_dm(self, data, user):
buffer = self.search_buffer("sent_direct_messages", user)
play_sound = "dm_sent.ogg"
buffer.add_new_item(data)
if "sent_direct_messages" in buffer.session.settings["other_buffers"]["muted_buffers"]: return
self.notify(buffer.session, play_sound=play_sound)
buffer.add_new_item(data)
def manage_sent_tweets(self, data, user):
buffer = self.search_buffer("sent_tweets", user)
play_sound = "tweet_send.ogg"
buffer.add_new_item(data)
if "sent_tweets" in buffer.session.settings["other_buffers"]["muted_buffers"]: return
self.notify(buffer.session, play_sound=play_sound)
buffer.add_new_item(data)
def manage_events(self, data, user):
buffer = self.search_buffer("events", user)
play_sound = "new_event.ogg"
buffer.add_new_item(data)
if "events" in buffer.session.settings["other_buffers"]["muted_buffers"]: return
self.notify(buffer.session, play_sound=play_sound)
buffer.add_new_item(data)
def manage_followers(self, data, user):
buffer = self.search_buffer("followers", user)
play_sound = "update_followers.ogg"
buffer.add_new_item(data)
if "followers" in buffer.session.settings["other_buffers"]["muted_buffers"]: return
self.notify(buffer.session, play_sound=play_sound)
buffer.add_new_item(data)
def manage_friend(self, data, user):
buffer = self.search_buffer("friends", user)
@ -778,14 +790,14 @@ class Controller(object):
def manage_unfollowing(self, item, user):
buffer = self.search_buffer("friends", user)
play_sound = "new_event.ogg"
buffer.remove_item(item)
def manage_favourite(self, data, user):
buffer = self.search_buffer("favourites", user)
play_sound = "favourite.ogg"
buffer.add_new_item(data)
if "favourites" in buffer.session.settings["other_buffers"]["muted_buffers"]: return
self.notify(buffer.session, play_sound=play_sound)
buffer.add_new_item(data)
def manage_unfavourite(self, item, user):
buffer = self.search_buffer("favourites", user)
@ -802,8 +814,9 @@ class Controller(object):
def manage_item_in_timeline(self, data, user, who):
buffer = self.search_buffer("%s-timeline" % (who,), user)
play_sound = "tweet_timeline.ogg"
buffer.add_new_item(data)
if "%s-timeline" % (who,) in buffer.session.settings["other_buffers"]["muted_buffers"]: return
self.notify(buffer.session, play_sound=play_sound)
buffer.add_new_item(data)
def editing_keystroke(self, action, parentDialog):
print "i've pressed"

BIN
src/keys/lib/api_keys64.dll Normal file

Binary file not shown.

View File

@ -21,3 +21,7 @@ def get_ignored_client():
if entry.ShowModal() == wx.ID_OK:
return entry.GetValue()
return None
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)
return dlg.ShowModal()

View File

@ -66,7 +66,6 @@ class mainFrame(wx.Frame):
self.autoread = buffer.Append(wx.NewId(), _(u"&Autoread tweets for this buffer"))
self.autoread.Enable(False)
self.clear = buffer.Append(wx.NewId(), _(u"&Clear buffer"))
self.clear.Enable(False)
self.deleteTl = buffer.Append(wx.NewId(), _(u"&Remove buffer"))
self.deleteTl.Enable(False)