From 462f6fe3959882afdefd55d774fa37209ef33963 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Cort=C3=A9z?= Date: Sat, 7 Mar 2015 20:23:41 -0600 Subject: [PATCH] a minor session bugfix, improvements in the invisible navigation --- README.md | 2 +- src/controller/mainController.py | 8 +++++--- src/sessionmanager/session.py | 12 +++++++++++- src/twitter/buffers/indibidual.py | 2 +- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index a5bee5a1..0da3f5a0 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ TW Blue is an app designed to use Twitter in a simple and fast way and avoiding, * Play various file and URL types which contain audio * and more! -See the [TWBlue's webpage](http://twblue.com.mx) for more details. +See the [TWBlue's webpage](http://twblue.es) for more details. ## Using TWBlue from sources diff --git a/src/controller/mainController.py b/src/controller/mainController.py index 8f44394d..de18c7ab 100644 --- a/src/controller/mainController.py +++ b/src/controller/mainController.py @@ -707,7 +707,9 @@ class Controller(object): def fix_wrong_buffer(self): buffer = self.get_current_buffer() - if buffer.session == None: + if isinstance(buffer, buffersController.accountPanel) and hasattr(buffer, "logged") and buffer.logged == False: + self.next_account() + elif buffer.session == None: self.right() def up(self, *args, **kwargs): @@ -792,7 +794,7 @@ class Controller(object): self.current_account = account buff = self.view.search("home_timeline", account) if buff == None: - output.speak(_(u"This account is not logged in twitter.")) + output.speak(_(u"{0}: This account is not logged in twitter.").format(account)) return self.view.change_buffer(buff) buffer = self.get_current_buffer() @@ -812,7 +814,7 @@ class Controller(object): self.current_account = account buff = self.view.search("home_timeline", account) if buff == None: - output.speak(_(u"This account is not logged in twitter.")) + output.speak(_(u"{0}: This account is not logged in twitter.").format(account)) return self.view.change_buffer(buff) buffer = self.get_current_buffer() diff --git a/src/sessionmanager/session.py b/src/sessionmanager/session.py index 1c88ec6e..f5cdb518 100644 --- a/src/sessionmanager/session.py +++ b/src/sessionmanager/session.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- """ The main session object. Here are the twitter functions to interact with the "model" of TWBlue.""" +import gc import urllib2 import twitter from keys import keyring @@ -93,6 +94,7 @@ class Session(object): self.twitter = twitter.twitter.twitter() self.db = {} self.reconnection_function_active = False + self.counter = 0 @property def is_logged(self): @@ -303,7 +305,8 @@ class Session(object): for i in self.settings["other_buffers"]["timelines"]: ids = ids + "%s, " % (self.db[i+"-timeline"][0]["user"]["id_str"]) # if ids != "": - stream_threaded(self.timelinesStream.statuses.filter, self.session_id, follow=ids) + if ids != "": + stream_threaded(self.timelinesStream.statuses.filter, self.session_id, follow=ids) def listen_stream_error(self): if hasattr(self, "main_stream"): @@ -316,6 +319,13 @@ class Session(object): del self.timelinesStream def check_connection(self): + instan = 0 + self.counter += 1 + if self.counter >= 4: + del self.twitter + self.logged = False + self.twitter = twitter.twitter.twitter() + self.login() if self.reconnection_function_active == True: return self.reconnection_function_active = True if not hasattr(self, "main_stream"): diff --git a/src/twitter/buffers/indibidual.py b/src/twitter/buffers/indibidual.py index 2e3fa899..3bf26914 100644 --- a/src/twitter/buffers/indibidual.py +++ b/src/twitter/buffers/indibidual.py @@ -3,7 +3,7 @@ from twitter import compose, utils from twython import TwythonStreamer from pubsub import pub import logging as original_logger -log = original_logger.getLogger("MainStream") +log = original_logger.getLogger("TimelinesStream") class timelinesStreamer(TwythonStreamer): def __init__(self, app_key, app_secret, oauth_token, oauth_token_secret, timeout=300, retry_count=None, retry_in=10, client_args=None, handlers=None, chunk_size=1, session=None):