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") go_page_down = string(default="control+win+pagedown")
update_profile = string(default="alt+win+p") update_profile = string(default="alt+win+p")
delete = string(default="control+win+delete") 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") repeat_item = string(default="control+win+space")
copy_to_clipboard = string(default="control+win+c") copy_to_clipboard = string(default="control+win+c")
add_to_list = string(default="control+win+a") add_to_list = string(default="control+win+a")

View File

@ -27,6 +27,8 @@ class bufferController(object):
self.needs_init = True self.needs_init = True
self.invisible = False # False if the buffer will be ignored on the invisible interface. self.invisible = False # False if the buffer will be ignored on the invisible interface.
def clear_list(self): pass
def get_event(self, ev): def get_event(self, ev):
if ev.GetKeyCode() == wx.WXK_RETURN and ev.ControlDown(): event = "audio" if ev.GetKeyCode() == wx.WXK_RETURN and ev.ControlDown(): event = "audio"
elif ev.GetKeyCode() == wx.WXK_RETURN: event = "url" elif ev.GetKeyCode() == wx.WXK_RETURN: event = "url"
@ -229,6 +231,8 @@ class baseBufferController(bufferController):
self.buffer.list.insert_item(False, *tweet) self.buffer.list.insert_item(False, *tweet)
else: else:
self.buffer.list.insert_item(True, *tweet) 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): def bind_events(self):
log.debug("Binding events...") log.debug("Binding events...")
@ -329,28 +333,26 @@ class baseBufferController(bufferController):
webbrowser.open_new_tab(urls_list.get_string()) webbrowser.open_new_tab(urls_list.get_string())
def clear_list(self): 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) dlg = commonMessageDialogs.clear_list()
if dlg.ShowModal() == widgetUtils.YES: if dlg == widgetUtils.YES:
self.session.db[self.name] = [] self.session.db[self.name] = []
self.buffer.list.clear() self.buffer.list.clear()
dlg.Destroy()
def destroy_status(self, *args, **kwargs): def destroy_status(self, *args, **kwargs):
index = self.buffer.list.get_selected() index = self.buffer.list.get_selected()
if self.type == "events" or self.type == "people" or self.type == "empty" or self.type == "account": return if self.type == "events" or self.type == "people" or self.type == "empty" or self.type == "account": return
answer = commonMessageDialogs.delete_tweet_dialog(None) answer = commonMessageDialogs.delete_tweet_dialog(None)
if answer == widgetUtils.YES: if answer == widgetUtils.YES:
# try: try:
if self.name == "direct_messages": if self.name == "direct_messages":
self.session.twitter.twitter.destroy_direct_message(id=self.get_right_tweet()["id"]) self.session.twitter.twitter.destroy_direct_message(id=self.get_right_tweet()["id"])
else: else:
self.session.twitter.twitter.destroy_status(id=self.get_right_tweet()["id"]) self.session.twitter.twitter.destroy_status(id=self.get_right_tweet()["id"])
self.session.db[self.name].pop(index) self.session.db[self.name].pop(index)
self.buffer.list.remove_item(index) self.buffer.list.remove_item(index)
if index > 0: # if index > 0:
self.buffer.list.select_item(index-1) except TwythonError:
# except TwythonError: sound.player.play("error.ogg")
# sound.player.play("error.ogg")
class eventsBufferController(bufferController): class eventsBufferController(bufferController):
def __init__(self, parent, name, session, account, *args, **kwargs): def __init__(self, parent, name, session, account, *args, **kwargs):
@ -378,6 +380,13 @@ class eventsBufferController(bufferController):
self.buffer.list.insert_item(False, *tweet) self.buffer.list.insert_item(False, *tweet)
else: else:
self.buffer.list.insert_item(True, *tweet) 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): class peopleBufferController(baseBufferController):
def __init__(self, parent, function, name, sessionObject, account, bufferType=None, *args, **kwargs): 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) self.buffer.list.insert_item(False, *tweet)
else: else:
self.buffer.list.insert_item(True, *tweet) 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): class searchBufferController(baseBufferController):
def start_stream(self): 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.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.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.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):
@ -544,6 +545,9 @@ class Controller(object):
def get_more_items(self, *args, **kwargs): def get_more_items(self, *args, **kwargs):
self.get_current_buffer().get_more_items() 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): def skip_buffer(self, forward=True):
buff = self.get_current_buffer() buff = self.get_current_buffer()
if buff.invisible == False: if buff.invisible == False:
@ -723,6 +727,7 @@ class Controller(object):
pass pass
def notify(self, session, play_sound=None, message=None, notification=False): def notify(self, session, play_sound=None, message=None, notification=False):
if session.settings["sound"]["global_mute"] == True: return
if play_sound != None: if play_sound != None:
session.sound.play(play_sound) session.sound.play(play_sound)
if message != None: if message != None:
@ -731,46 +736,53 @@ class Controller(object):
def manage_home_timelines(self, data, user): def manage_home_timelines(self, data, user):
buffer = self.search_buffer("home_timeline", user) buffer = self.search_buffer("home_timeline", user)
play_sound = "tweet_received.ogg" 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) self.notify(buffer.session, play_sound=play_sound)
buffer.add_new_item(data)
def manage_mentions(self, data, user): def manage_mentions(self, data, user):
buffer = self.search_buffer("mentions", user) buffer = self.search_buffer("mentions", user)
play_sound = "mention_received.ogg" play_sound = "mention_received.ogg"
buffer.add_new_item(data)
message = _(u"New mention") 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) self.notify(buffer.session, play_sound=play_sound, message=message)
buffer.add_new_item(data)
def manage_direct_messages(self, data, user): def manage_direct_messages(self, data, user):
buffer = self.search_buffer("direct_messages", user) buffer = self.search_buffer("direct_messages", user)
play_sound = "dm_received.ogg" play_sound = "dm_received.ogg"
buffer.add_new_item(data)
message = _(u"New direct message") 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) self.notify(buffer.session, play_sound=play_sound, message=message)
buffer.add_new_item(data)
def manage_sent_dm(self, data, user): def manage_sent_dm(self, data, user):
buffer = self.search_buffer("sent_direct_messages", user) buffer = self.search_buffer("sent_direct_messages", user)
play_sound = "dm_sent.ogg" 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) self.notify(buffer.session, play_sound=play_sound)
buffer.add_new_item(data)
def manage_sent_tweets(self, data, user): def manage_sent_tweets(self, data, user):
buffer = self.search_buffer("sent_tweets", user) buffer = self.search_buffer("sent_tweets", user)
play_sound = "tweet_send.ogg" 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) self.notify(buffer.session, play_sound=play_sound)
buffer.add_new_item(data)
def manage_events(self, data, user): def manage_events(self, data, user):
buffer = self.search_buffer("events", user) buffer = self.search_buffer("events", user)
play_sound = "new_event.ogg" 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) self.notify(buffer.session, play_sound=play_sound)
buffer.add_new_item(data)
def manage_followers(self, data, user): def manage_followers(self, data, user):
buffer = self.search_buffer("followers", user) buffer = self.search_buffer("followers", user)
play_sound = "update_followers.ogg" 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) self.notify(buffer.session, play_sound=play_sound)
buffer.add_new_item(data)
def manage_friend(self, data, user): def manage_friend(self, data, user):
buffer = self.search_buffer("friends", user) buffer = self.search_buffer("friends", user)
@ -778,14 +790,14 @@ class Controller(object):
def manage_unfollowing(self, item, user): def manage_unfollowing(self, item, user):
buffer = self.search_buffer("friends", user) buffer = self.search_buffer("friends", user)
play_sound = "new_event.ogg"
buffer.remove_item(item) buffer.remove_item(item)
def manage_favourite(self, data, user): def manage_favourite(self, data, user):
buffer = self.search_buffer("favourites", user) buffer = self.search_buffer("favourites", user)
play_sound = "favourite.ogg" 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) self.notify(buffer.session, play_sound=play_sound)
buffer.add_new_item(data)
def manage_unfavourite(self, item, user): def manage_unfavourite(self, item, user):
buffer = self.search_buffer("favourites", user) buffer = self.search_buffer("favourites", user)
@ -802,8 +814,9 @@ class Controller(object):
def manage_item_in_timeline(self, data, user, who): def manage_item_in_timeline(self, data, user, who):
buffer = self.search_buffer("%s-timeline" % (who,), user) buffer = self.search_buffer("%s-timeline" % (who,), user)
play_sound = "tweet_timeline.ogg" 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) self.notify(buffer.session, play_sound=play_sound)
buffer.add_new_item(data)
def editing_keystroke(self, action, parentDialog): def editing_keystroke(self, action, parentDialog):
print "i've pressed" 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: if entry.ShowModal() == wx.ID_OK:
return entry.GetValue() return entry.GetValue()
return None 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 = buffer.Append(wx.NewId(), _(u"&Autoread tweets for this buffer"))
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.clear.Enable(False)
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)