Bugfixes for lists buffers and autocomplete

This commit is contained in:
Manuel Cortez 2014-12-15 09:53:13 -06:00
parent e12f440cf2
commit eb2c315abb
6 changed files with 17 additions and 10 deletions

View File

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
name = 'TW Blue'
snapshot = True
snapshot = False
if snapshot == False:
version = "0.48"
version = "0.50"
update_url = 'http://twblue.com.mx/updates/tw_blue.json'
else:
version = "6"

View File

@ -44,13 +44,13 @@ class autocompletionSettings(object):
def execute_at_startup(window):
database = storage.storage()
if config.main["mysc"]["save_followers_in_autocompletion_db"] == True:
if config.main["mysc"]["save_followers_in_autocompletion_db"] == True and config.main["other_buffers"]["show_followers"] == True:
buffer = window.search_buffer("people", "followers")
for i in buffer.db.settings[buffer.name_buffer]:
database.set_user(i["screen_name"], i["name"], 1)
else:
database.remove_by_buffer(1)
if config.main["mysc"]["save_friends_in_autocompletion_db"] == True:
if config.main["mysc"]["save_friends_in_autocompletion_db"] == True and config.main["other_buffers"]["show_friends"] == True:
buffer = window.search_buffer("people", "friends")
for i in buffer.db.settings[buffer.name_buffer]:
database.set_user(i["screen_name"], i["name"], 2)

View File

@ -127,7 +127,7 @@ class listViewer(wx.Dialog):
output.speak(_(u"This list is arready opened."))
return
listUI = gui.buffers.lists.listPanel(self.nb, self.parent, list_updated["slug"]+"-list", argumento=utils.find_list(list_updated["slug"], self.db.settings["lists"]))
self.nb.AddPage(listUI, _(u"List for %s") % (list_updated["slug"],))
self.nb.InsertSubPage(self.db.settings["buffers"].index("lists"), listUI, _(u"List for %s") % (list_updated["slug"],))
self.db.settings["buffers"].append(list_updated["slug"]+"-list")
num = listUI.start_streams()
listUI.put_items(num)

View File

@ -339,6 +339,7 @@ class mainFrame(wx.Frame):
self.Bind(event.MyEVT_STARTED, self.onInit)
self.Bind(event.EVT_RESULT, self.onMemberAdded)
pub.subscribe(self.listen_streamerror, "streamError")
pub.subscribe(self.listen_for_friends, "friendsReceived")
call_threaded(self.init, run_streams=True)
def init(self, run_streams=False):
@ -1072,12 +1073,15 @@ class mainFrame(wx.Frame):
def listen_streamerror(self):
log.error("There is a connection error")
print "Connection error"
self.stream.disconnect()
if hasattr(self, "stream"):
self.stream.disconnect()
del self.stream
if hasattr(self, "stream2"):
self.stream2.disconnect()
del self.stream2
del self.stream
def listen_for_friends(self):
self.stream2.set_friends(self.stream.friends)
### Close App
def Destroy(self):

View File

@ -42,11 +42,12 @@ class streamer(TwythonStreamer):
except ValueError:
pass
def set_friends(self, friends):
self.friends = friends
def on_success(self, data):
try:
if data.has_key("text") and utils.is_allowed(data):
self.check_tls(data)
elif "friends" in data:
self.friends = data["friends"]
except:
pass

View File

@ -8,6 +8,7 @@ import config
import logging as original_logger
log = original_logger.getLogger("MainStream")
import output
from wx.lib.pubsub import pub
class streamer(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, parent=None):
@ -105,6 +106,7 @@ class streamer(TwythonStreamer):
self.process_dm(data)
elif "friends" in data:
self.friends = data["friends"]
pub.sendMessage("friendsReceived")
elif "text" in data and utils.is_allowed(data) == True:
if data["user"]["id"] in self.muted_users: return
self.check_mentions(data)