Autoreading is now supported

This commit is contained in:
Manuel Cortez 2015-03-11 16:36:22 -06:00
parent eb4301aeb5
commit 4613b7ada1
4 changed files with 14 additions and 4 deletions

View File

@ -324,7 +324,7 @@ class baseBufferController(bufferController):
@_tweets_exist @_tweets_exist
def direct_message(self, *args, **kwargs): def direct_message(self, *args, **kwargs):
tweet = self.get_tweet() tweet = self.get_right_tweet()
if self.type == "dm": if self.type == "dm":
screen_name = tweet["sender"]["screen_name"] screen_name = tweet["sender"]["screen_name"]
users = utils.get_all_users(tweet, self.session.db) users = utils.get_all_users(tweet, self.session.db)
@ -372,7 +372,7 @@ class baseBufferController(bufferController):
urls = utils.find_urls(tweet) urls = utils.find_urls(tweet)
if len(urls) == 1: if len(urls) == 1:
sound.URLPlayer.play(urls[0], self.session.settings["sound"]["volume"]) sound.URLPlayer.play(urls[0], self.session.settings["sound"]["volume"])
else: elif len(urls) > 1:
urls_list = dialogs.urlList.urlList() urls_list = dialogs.urlList.urlList()
urls_list.populate_list(urls) urls_list.populate_list(urls)
if urls_list.get_response() == widgetUtils.OK: if urls_list.get_response() == widgetUtils.OK:

View File

@ -152,6 +152,7 @@ class Controller(object):
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.manage_accounts, self.view.manage_accounts) widgetUtils.connect_event(self.view, widgetUtils.MENU, self.manage_accounts, self.view.manage_accounts)
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.update_profile, menuitem=self.view.updateProfile) widgetUtils.connect_event(self.view, widgetUtils.MENU, self.update_profile, menuitem=self.view.updateProfile)
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.user_details, menuitem=self.view.details) widgetUtils.connect_event(self.view, widgetUtils.MENU, self.user_details, menuitem=self.view.details)
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.toggle_autoread, menuitem=self.view.autoread)
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):
@ -1086,5 +1087,15 @@ class Controller(object):
if hasattr(buffer, "user_details"): if hasattr(buffer, "user_details"):
buffer.user_details() buffer.user_details()
def toggle_autoread(self, *args, **kwargs):
buffer = self.get_current_buffer()
if hasattr(buffer, "session") and buffer.session == None: return
if buffer.name not in buffer.session.settings["other_buffers"]["autoread_buffers"]:
buffer.session.settings["other_buffers"]["autoread_buffers"].append(buffer.name)
output.speak(_(u"The auto-reading of new tweets is enabled for this buffer"))
elif buffer.name in buffer.session.settings["other_buffers"]["autoread_buffers"]:
buffer.session.settings["other_buffers"]["autoread_buffers"].remove(buffer.name)
output.speak(_(u"The auto-reading of new tweets is disabled for this buffer"))
def __del__(self): def __del__(self):
config.app.write() config.app.write()

View File

@ -7,7 +7,7 @@ import sys
speaker = None speaker = None
def speak(text, interrupt=True): def speak(text, interrupt=False):
global speaker global speaker
if not speaker: if not speaker:
setup() setup()

View File

@ -64,7 +64,6 @@ class mainFrame(wx.Frame):
self.mute = buffer.Append(wx.NewId(), _(u"&Mute")) self.mute = buffer.Append(wx.NewId(), _(u"&Mute"))
self.mute.Enable(False) self.mute.Enable(False)
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.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)