From e12f440cf235be66719166e63ea9c61f571c57d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Cort=C3=A9z?= Date: Sun, 14 Dec 2014 19:07:18 -0600 Subject: [PATCH 1/2] Build_installer fixes --- doc/strings.py | 12 ++++++------ src/twitter/compose.py | 6 +++++- tools/{build_installer.sh => build_twblue.sh} | 8 ++++---- 3 files changed, 15 insertions(+), 11 deletions(-) rename tools/{build_installer.sh => build_twblue.sh} (94%) diff --git a/doc/strings.py b/doc/strings.py index f145dc38..4fa72089 100644 --- a/doc/strings.py +++ b/doc/strings.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- documentation = [] -documentation.append(_(u"""Documentation for TW Blue 0.46""")) +documentation.append(_(u"""Documentation for TW Blue 0.50""")) # Translators: This is the new line character, don't change it in the translations. documentation.append(_(u""" """)) @@ -47,16 +47,16 @@ documentation.append(_(u""" documentation.append(_(u"""First off, it's necessary to authorise the program so it can access your Twitter account and act on your behalf. The authorisation process is quite simple, and the program never gets data such as your username and password. In order to authorise the application, you just need to run the main executable file, called TWBlue.exe (on some computers it may appear simply as TWBlue).""")) documentation.append(_(u""" """)) -documentation.append(_(u"""When executed, if you have not previously configured the program, it will show a dialogue box where it tells you'll be taken to Twitter in order to authorise the application as soon as you press OK. To begin the authorisation process, press the only available button on the box.""")) +#$documentation.append(_(u"""When executed, if you have not previously configured the program, it will show a dialogue box where it tells you'll be taken to Twitter in order to authorise the application as soon as you press OK. To begin the authorisation process, press the only available button on the box.""")) documentation.append(_(u""" """)) documentation.append(_(u"""Your default browser will open on the Twitter page to request authorisation. Enter your user name and password if you're not already logged in, look for the authorise button, and press it.""")) documentation.append(_(u""" """)) -documentation.append(_(u"""Read the instructions you will get if the process is successful. In summary, you will be given a numeric code with several digits you must paste on an edit field open by the application on another window.""")) +#$documentation.append(_(u"""Read the instructions you will get if the process is successful. In summary, you will be given a numeric code with several digits you must paste on an edit field open by the application on another window.""")) documentation.append(_(u""" """)) -documentation.append(_(u"""Paste the verification code, and press the enter key. """)) +#$documentation.append(_(u"""Paste the verification code, and press the enter key. """)) documentation.append(_(u""" """)) documentation.append(_(u"""If all went well, the application will start playing sounds, indicating your data are being updated.""")) @@ -65,10 +65,10 @@ documentation.append(_(u""" documentation.append(_(u"""When the process is finished,the program will play another sound, and the screen reader will say "ready".""")) documentation.append(_(u""" """)) -documentation.append(_(u"""## The program's interface {#interface}""")) +documentation.append(_(u"""## The program's interface""")) documentation.append(_(u""" """)) -documentation.append(_(u"""The easiest way to describe the graphical interface of the application is a window with a menu bar with four menus (application, tweet, user and help), a list with several elements, and, in most cases, three buttons: tweet, retweet and reply. The actions available for each element are described below.""")) +documentation.append(_(u"""The easiest way to describe the graphical interface of the application is a window with a menu bar with five menus (application, tweet, user, buffer and help), a list with several elements, and, in most cases, three buttons: tweet, retweet and reply. The actions available for each element are described below.""")) documentation.append(_(u""" """)) documentation.append(_(u"""Elements on the lists may be tweets, direct messages or users. TW Blue creates different tabs for each list, which can be sent tweets, main timeline tweets, favourites, or direct messages, and each tab contains a single type of tweet. These tabs are called lists or buffers.""")) diff --git a/src/twitter/compose.py b/src/twitter/compose.py index 22593f26..d2d17aaa 100644 --- a/src/twitter/compose.py +++ b/src/twitter/compose.py @@ -13,6 +13,8 @@ else: languageHandler.setLanguage("system") import platform system = platform.system() +import logging as original_logger +log = original_logger.getLogger("events") def prettydate(d): """ Converts a string to the relative time.""" @@ -224,7 +226,9 @@ def compose_event(data, username): elif data["event"] == "list_user_unsubscribed": if data["source"]["screen_name"] == username: event = _(u"You've unsubscribed from the list %s, which is owned by %s(@%s)") % (data["target_object"]["name"], data["target"]["name"], data["target"]["screen_name"]) else: event = _("You've been unsubscribed from the list %s, which is owned by %s(@%s)") % (data["target_object"]["name"], data["source"]["name"], data["source"]["screen_name"]) - else: event = _("Unknown") + else: + log.error("event: %s\n target: %s\n source: %s\n" % (data["event"], data["target"], data["source"])) + event = _("Unknown") # output.speak(event) return [time.strftime("%I:%M %p"), event] diff --git a/tools/build_installer.sh b/tools/build_twblue.sh similarity index 94% rename from tools/build_installer.sh rename to tools/build_twblue.sh index 5217c4f2..224529be 100644 --- a/tools/build_installer.sh +++ b/tools/build_twblue.sh @@ -1,7 +1,7 @@ #!/bin/bash # Define paths for a regular use, if there are not paths for python32 or 64, these commands will be taken. -pythonpath32="C:/python27x86" -pythonpath64="C:/python27" +pythonpath32="/C/python27x86" +pythonpath64="/C/python27" nsyspath=$PROGRAMFILES/NSIS help () { @@ -46,10 +46,10 @@ if [ -d dist/ ]; rm -rf dist fi $pythonpath32/python.exe "setup.py" "py2exe" "--quiet" -mv -f dist ../scripts/TWBlue64 +mv -f dist ../scripts/TWBlue rm -rf build $pythonpath64/python.exe "setup.py" "py2exe" "--quiet" -mv -f dist ../scripts/TWBlue +mv -f dist ../scripts/TWBlue64 rm -rf build cd ../scripts $nsispath/Unicode/makensis.exe "twblue.nsi" From eb2c315abbc92250b38cf269a7f848285ceb6077 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Cort=C3=A9z?= Date: Mon, 15 Dec 2014 09:53:13 -0600 Subject: [PATCH 2/2] Bugfixes for lists buffers and autocomplete --- src/application.py | 4 ++-- src/extra/autocompletionUsers/settings.py | 4 ++-- src/gui/dialogs/lists.py | 2 +- src/gui/main.py | 10 +++++++--- src/twitter/buffers/indibidual.py | 5 +++-- src/twitter/buffers/stream.py | 2 ++ 6 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/application.py b/src/application.py index bd10dac8..d9569b3b 100644 --- a/src/application.py +++ b/src/application.py @@ -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" diff --git a/src/extra/autocompletionUsers/settings.py b/src/extra/autocompletionUsers/settings.py index 4d57ed6e..799ae129 100644 --- a/src/extra/autocompletionUsers/settings.py +++ b/src/extra/autocompletionUsers/settings.py @@ -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) diff --git a/src/gui/dialogs/lists.py b/src/gui/dialogs/lists.py index 0b3e3e94..c09c04ff 100644 --- a/src/gui/dialogs/lists.py +++ b/src/gui/dialogs/lists.py @@ -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) diff --git a/src/gui/main.py b/src/gui/main.py index c9747f3b..fab13da1 100644 --- a/src/gui/main.py +++ b/src/gui/main.py @@ -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): diff --git a/src/twitter/buffers/indibidual.py b/src/twitter/buffers/indibidual.py index 80868b0e..435fec53 100644 --- a/src/twitter/buffers/indibidual.py +++ b/src/twitter/buffers/indibidual.py @@ -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 \ No newline at end of file diff --git a/src/twitter/buffers/stream.py b/src/twitter/buffers/stream.py index e6f3dd67..3dc8664c 100644 --- a/src/twitter/buffers/stream.py +++ b/src/twitter/buffers/stream.py @@ -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)