Final additions for TWBlue 0.50. TWBlue's source code has been frozen

This commit is contained in:
2014-12-11 10:03:02 -06:00
parent 4b98f27968
commit 9502cef251
11 changed files with 1088 additions and 682 deletions

View File

@@ -5,7 +5,7 @@ if snapshot == False:
version = "0.48"
update_url = 'http://twblue.com.mx/updates/tw_blue.json'
else:
version = "5"
version = "6"
update_url = 'http://twblue.com.mx/updates/snapshots.json'
author = u"Manuel Cortéz"
authorEmail = "manuel@manuelcortez.net"

View File

@@ -7,11 +7,11 @@ class autocompletionManageDialog(wx.Dialog):
super(autocompletionManageDialog, self).__init__(parent=None, id=-1, title=_(u"Manage Autocomplete users database"))
panel = wx.Panel(self)
sizer = wx.BoxSizer(wx.VERTICAL)
label = wx.StaticText(panel, -1, _(u"Users in your database"))
label = wx.StaticText(panel, -1, _(u"Editing TWBlue users database"))
self.users = widgets.list(panel, _(u"Username"), _(u"Name"), style=wx.LC_REPORT)
sizer.Add(label, 0, wx.ALL, 5)
sizer.Add(self.users.list, 0, wx.ALL, 5)
self.add = wx.Button(panel, -1, _(u"Add new user"))
self.add = wx.Button(panel, -1, _(u"Add user"))
self.remove = wx.Button(panel, -1, _(u"Remove user"))
optionsBox = wx.BoxSizer(wx.HORIZONTAL)
optionsBox.Add(self.add, 0, wx.ALL, 5)

View File

@@ -10,7 +10,7 @@ class autocompletionSettingsDialog(wx.Dialog):
self.friends_buffer = wx.CheckBox(panel, -1, _(u"Add users from friends buffer"))
sizer.Add(self.followers_buffer, 0, wx.ALL, 5)
sizer.Add(self.friends_buffer, 0, wx.ALL, 5)
self.viewList = wx.Button(panel, -1, _(u"See the user list"))
self.viewList = wx.Button(panel, -1, _(u"See the users list"))
sizer.Add(self.viewList, 0, wx.ALL, 5)
ok = wx.Button(panel, wx.ID_OK)
cancel = wx.Button(panel, wx.ID_CANCEL)

View File

@@ -55,7 +55,7 @@ class general(wx.Panel):
self.ask_at_exit = wx.CheckBox(self, -1, _(U"ask before exiting TwBlue?"))
self.ask_at_exit.SetValue(config.main["general"]["ask_at_exit"])
sizer.Add(self.ask_at_exit, 0, wx.ALL, 5)
self.use_invisible_shorcuts = wx.CheckBox(self, -1, _(u"Use invisible interface's keyboard shorcuts even if the window is displayed"))
self.use_invisible_shorcuts = wx.CheckBox(self, -1, _(u"Use invisible interface's keyboard shorcuts on the GUI"))
self.use_invisible_shorcuts.SetValue(config.main["general"]["use_invisible_keyboard_shorcuts"])
sizer.Add(self.use_invisible_shorcuts, 0, wx.ALL, 5)
self.relative_time = wx.CheckBox(self, -1, _(U"Relative times"))

View File

@@ -33,6 +33,7 @@ import platform
import urllib2
import sysTrayIcon
import switchModule
from pubsub import pub
import languageHandler
from extra.autocompletionUsers import settings as autocompletionUsersSettings
import pygeocoder
@@ -40,7 +41,7 @@ from pygeolib import GeocoderError
from sessionmanager import manager
from issueReporter import gui as issueReporterGUI
from mysc import event
from mysc.thread_utils import call_threaded
from mysc.thread_utils import call_threaded, stream_threaded
from twython import TwythonError
from urllib2 import URLError
from mysc.repeating_timer import RepeatingTimer
@@ -337,6 +338,7 @@ class mainFrame(wx.Frame):
self.SetClientSize(self.sizer.CalcMin())
self.Bind(event.MyEVT_STARTED, self.onInit)
self.Bind(event.EVT_RESULT, self.onMemberAdded)
pub.subscribe(self.listen_streamerror, "streamError")
call_threaded(self.init, run_streams=True)
def init(self, run_streams=False):
@@ -392,21 +394,21 @@ class mainFrame(wx.Frame):
def setup_twitter(self, panel):
""" Setting up the connection for twitter, or authenticate if the config file has valid credentials."""
try:
self.twitter.login(self.user_key, self.user_secret)
self.logging_in_twblue(panel)
log.info("Authorized in Twitter.")
del self.user_key; del self.user_secret
except:
dlg1 = wx.MessageDialog(panel, _(u"Connection error. Try again later."), _(u"Error!"), wx.ICON_ERROR)
dlg1.ShowModal()
self.Close(True)
# try:
self.twitter.login(self.user_key, self.user_secret)
self.logging_in_twblue(panel)
log.info("Authorized in Twitter.")
del self.user_key; del self.user_secret
# except:
# dlg1 = wx.MessageDialog(panel, _(u"Connection error. Try again later."), _(u"Error!"), wx.ICON_ERROR)
# dlg1.ShowModal()
# self.Close(True)
def get_home(self):
""" Gets the home stream, that manages home timeline, mentions, direct messages and sent."""
try:
self.stream = twitter.buffers.stream.streamer(application.app_key, application.app_secret, config.main["twitter"]["user_key"], config.main["twitter"]["user_secret"], parent=self)
call_threaded(self.stream.user)
stream_threaded(self.stream.user)
except:
self.stream.disconnect()
@@ -429,13 +431,16 @@ class mainFrame(wx.Frame):
ids+= str(z)+", "
if ids != "":
# try:
call_threaded(self.stream2.statuses.filter, follow=ids)
stream_threaded(self.stream2.statuses.filter, follow=ids)
# except:
# pass
# except:
# self.stream2.disconnect()
def check_stream_up(self):
if not hasattr(self, "stream") and not hasattr(self, "stream2"):
self.init(run_streams=True)
return
try:
urllib2.urlopen("http://74.125.228.231", timeout=5)
except urllib2.URLError:
@@ -1061,6 +1066,15 @@ class mainFrame(wx.Frame):
config.main["other_buffers"]["trending_topic_buffers"].append(woeid)
buff.put_items(num)
def listen_streamerror(self):
log.error("There is a connection error")
print "Connection error"
self.stream.disconnect()
if hasattr(self, "stream2"):
self.stream2.disconnect()
del self.stream2
del self.stream
### Close App
def Destroy(self):
self.sysTray.Destroy()

View File

@@ -42,7 +42,7 @@ actions = {
"edit_keystrokes": _(u"Shows the keystroke editor"),
"view_user_lists": _(u"Show lists for a specified user"),
"get_more_items": _(u"loads previous items to any buffer"),
"reverse_geocode": _(u"Get the location for tweets"),
"reverse_geocode": _(u"Get location of any tweet"),
"view_reverse_geocode": _(u"Displays the tweet's location in a dialog"),
"get_trending_topics": _(u"Creates a buffer for displaying trends for a desired place"),
}

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -3,6 +3,7 @@ import threading
import wx
from twython import TwythonRateLimitError
import time
from pubsub import pub
def call_threaded(func, *args, **kwargs):
#Call the given function in a daemonized thread and return the thread.
@@ -19,3 +20,14 @@ def call_threaded(func, *args, **kwargs):
thread.daemon = True
thread.start()
return thread
def stream_threaded(func, *args, **kwargs):
def new_func(*a, **k):
try:
func(*a, **k)
except:
pub.sendMessage("streamError")
thread = threading.Thread(target=new_func, args=args, kwargs=kwargs)
thread.daemon = True
thread.start()
return thread