a minor session bugfix, improvements in the invisible navigation

This commit is contained in:
Manuel Cortez 2015-03-07 20:23:41 -06:00
parent e65c8ec4a6
commit 462f6fe395
4 changed files with 18 additions and 6 deletions

View File

@ -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 * Play various file and URL types which contain audio
* and more! * 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 ## Using TWBlue from sources

View File

@ -707,7 +707,9 @@ class Controller(object):
def fix_wrong_buffer(self): def fix_wrong_buffer(self):
buffer = self.get_current_buffer() 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() self.right()
def up(self, *args, **kwargs): def up(self, *args, **kwargs):
@ -792,7 +794,7 @@ class Controller(object):
self.current_account = account self.current_account = account
buff = self.view.search("home_timeline", account) buff = self.view.search("home_timeline", account)
if buff == None: 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 return
self.view.change_buffer(buff) self.view.change_buffer(buff)
buffer = self.get_current_buffer() buffer = self.get_current_buffer()
@ -812,7 +814,7 @@ class Controller(object):
self.current_account = account self.current_account = account
buff = self.view.search("home_timeline", account) buff = self.view.search("home_timeline", account)
if buff == None: 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 return
self.view.change_buffer(buff) self.view.change_buffer(buff)
buffer = self.get_current_buffer() buffer = self.get_current_buffer()

View File

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" The main session object. Here are the twitter functions to interact with the "model" of TWBlue.""" """ The main session object. Here are the twitter functions to interact with the "model" of TWBlue."""
import gc
import urllib2 import urllib2
import twitter import twitter
from keys import keyring from keys import keyring
@ -93,6 +94,7 @@ class Session(object):
self.twitter = twitter.twitter.twitter() self.twitter = twitter.twitter.twitter()
self.db = {} self.db = {}
self.reconnection_function_active = False self.reconnection_function_active = False
self.counter = 0
@property @property
def is_logged(self): def is_logged(self):
@ -303,7 +305,8 @@ class Session(object):
for i in self.settings["other_buffers"]["timelines"]: for i in self.settings["other_buffers"]["timelines"]:
ids = ids + "%s, " % (self.db[i+"-timeline"][0]["user"]["id_str"]) ids = ids + "%s, " % (self.db[i+"-timeline"][0]["user"]["id_str"])
# if ids != "": # 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): def listen_stream_error(self):
if hasattr(self, "main_stream"): if hasattr(self, "main_stream"):
@ -316,6 +319,13 @@ class Session(object):
del self.timelinesStream del self.timelinesStream
def check_connection(self): 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 if self.reconnection_function_active == True: return
self.reconnection_function_active = True self.reconnection_function_active = True
if not hasattr(self, "main_stream"): if not hasattr(self, "main_stream"):

View File

@ -3,7 +3,7 @@ from twitter import compose, utils
from twython import TwythonStreamer from twython import TwythonStreamer
from pubsub import pub from pubsub import pub
import logging as original_logger import logging as original_logger
log = original_logger.getLogger("MainStream") log = original_logger.getLogger("TimelinesStream")
class timelinesStreamer(TwythonStreamer): 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): 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):