From 99ff261d8e0d923999a15421cb7c5a09c0f8cc5f Mon Sep 17 00:00:00 2001 From: Bill Dengler Date: Wed, 21 Jun 2017 19:45:30 +0000 Subject: [PATCH] Automated py3 refactoring. --- src/application.py | 8 +- src/config.py | 54 ++-- src/controller/attach.py | 2 +- src/controller/buffersController.py | 44 +-- src/controller/mainController.py | 180 ++++++------ src/controller/messages.py | 22 +- src/controller/settings.py | 38 +-- src/controller/user.py | 46 +-- src/controller/userActionsController.py | 2 +- src/extra/AudioUploader/audioUploader.py | 36 +-- src/extra/AudioUploader/transfer.py | 4 +- src/extra/AudioUploader/utils.py | 16 +- .../AudioUploader/wx_transfer_dialogs.py | 12 +- src/extra/AudioUploader/wx_ui.py | 156 +++++----- src/extra/SoundsTutorial/__init__.py | 2 +- src/extra/SoundsTutorial/soundsTutorial.py | 2 +- .../soundsTutorial_constants.py | 50 ++-- src/extra/SoundsTutorial/wx_ui.py | 56 ++-- src/extra/SpellChecker/__init__.py | 2 +- src/extra/SpellChecker/spellchecker.py | 6 +- src/extra/SpellChecker/wx_ui.py | 158 +++++----- src/extra/autocompletionUsers/__init__.py | 2 +- src/extra/autocompletionUsers/completion.py | 12 +- src/extra/autocompletionUsers/manage.py | 2 +- src/extra/autocompletionUsers/settings.py | 4 +- src/extra/autocompletionUsers/wx_manage.py | 86 +++--- src/extra/autocompletionUsers/wx_settings.py | 54 ++-- src/extra/ocr/OCRSpace.py | 2 +- src/extra/ocr/__init__.py | 2 +- src/extra/translator/__init__.py | 2 +- src/extra/translator/translator.py | 184 ++++++------ src/extra/translator/wx_ui.py | 8 +- src/fixes/__init__.py | 2 +- src/fixes/fix_requests.py | 2 +- src/issueReporter/issueReporter.py | 8 +- src/issueReporter/wx_ui.py | 186 ++++++------ src/keyboard_handler/__init__.py | 2 +- src/keyboard_handler/global_handler.py | 2 +- src/keyboard_handler/linux.py | 2 +- src/keyboard_handler/osx.py | 4 +- src/keyboard_handler/windows.py | 2 +- src/keyboard_handler/wx_handler.py | 4 +- src/keystrokeEditor/__init__.py | 2 +- src/keystrokeEditor/constants.py | 110 +++---- src/keystrokeEditor/keystrokeEditor.py | 2 +- src/keystrokeEditor/wx_ui.py | 30 +- src/languageHandler.py | 4 +- src/logger.py | 78 ++--- src/long_tweets/twishort.py | 2 +- src/main.py | 198 ++++++------- src/multiplatform_widgets/__init__.py | 2 +- src/multiplatform_widgets/widgets.py | 2 +- src/notifier/__init__.py | 2 +- src/paths.py | 16 +- src/platform_utils/autostart/windows.py | 2 +- .../shell_integration/windows.py | 2 +- src/sessionmanager/manager.py | 2 +- src/sessionmanager/session.py | 12 +- src/sessionmanager/sessionManager.py | 2 +- src/sessionmanager/wxUI.py | 150 +++++----- src/setup.py | 254 ++++++++-------- src/sound.py | 4 +- src/twitter/__init__.py | 2 +- src/twitter/authorisationHandler.py | 2 +- src/twitter/buffers/__init__.py | 2 +- src/twitter/compose.py | 62 ++-- src/twitter/twitter.py | 2 +- src/twitter/utils.py | 8 +- src/update/updater.py | 2 +- src/update/utils.py | 16 +- src/update/wxUpdater.py | 12 +- src/url_shortener/__init__.py | 2 +- src/url_shortener/__main__.py | 2 +- src/url_shortener/shorteners/__init__.py | 2 +- src/url_shortener/shorteners/clckru.py | 2 +- src/url_shortener/shorteners/hkcim.py | 2 +- src/url_shortener/shorteners/isgd.py | 2 +- src/url_shortener/shorteners/onjme.py | 2 +- src/url_shortener/shorteners/tinyarrows.py | 2 +- src/url_shortener/shorteners/tinyurl.py | 2 +- src/url_shortener/shorteners/xedcc.py | 2 +- src/widgetUtils/__init__.py | 2 +- src/wxUI/buffers/__init__.py | 2 +- src/wxUI/buffers/base.py | 88 +++--- src/wxUI/buffers/dm.py | 2 +- src/wxUI/buffers/events.py | 46 +-- src/wxUI/buffers/favourites.py | 2 +- src/wxUI/buffers/lists.py | 2 +- src/wxUI/buffers/panels.py | 70 ++--- src/wxUI/buffers/people.py | 6 +- src/wxUI/buffers/trends.py | 64 ++--- src/wxUI/buffers/tweet_searches.py | 2 +- src/wxUI/buffers/user_searches.py | 4 +- src/wxUI/commonMessageDialogs.py | 164 +++++------ src/wxUI/dialogs/__init__.py | 2 +- src/wxUI/dialogs/attach.py | 94 +++--- src/wxUI/dialogs/configuration.py | 134 ++++----- src/wxUI/dialogs/find.py | 10 +- src/wxUI/dialogs/lists.py | 270 +++++++++--------- src/wxUI/dialogs/message.py | 106 +++---- src/wxUI/dialogs/search.py | 28 +- src/wxUI/dialogs/show_user.py | 8 +- src/wxUI/dialogs/trends.py | 16 +- src/wxUI/dialogs/update_profile.py | 22 +- src/wxUI/dialogs/urlList.py | 68 ++--- src/wxUI/dialogs/userActions.py | 178 ++++++------ src/wxUI/dialogs/userSelection.py | 130 ++++----- src/wxUI/dialogs/utils.py | 10 +- src/wxUI/menus.py | 194 ++++++------- src/wxUI/sysTrayIcon.py | 94 +++--- src/wxUI/view.py | 104 +++---- 111 files changed, 2197 insertions(+), 2197 deletions(-) diff --git a/src/application.py b/src/application.py index a4a183e8..5862811f 100644 --- a/src/application.py +++ b/src/application.py @@ -10,10 +10,10 @@ else: version = "10.99" update_url = 'http://twblue.es/updates/snapshots_ngen.json' mirror_update_url = 'https://raw.githubusercontent.com/manuelcortez/TWBlue/next-gen/updates/snapshots.json' -authors = [u"Manuel Cortéz", u"José Manuel Delicado"] +authors = ["Manuel Cortéz", "José Manuel Delicado"] authorEmail = "manuel@manuelcortez.net" -copyright = u"Copyright (C) 2013-2017, Manuel cortéz." +copyright = "Copyright (C) 2013-2017, Manuel cortéz." description = str(name+" is an app designed to use Twitter simply and efficiently while using minimal system resources. This app provides access to most Twitter features.") -translators = [u"Manuel Cortéz (English)", u"Mohammed Al Shara, Hatoun Felemban (Arabic)", u"Francisco Torres (Catalan)", u"Manuel cortéz (Spanish)", u"Sukil Etxenike Arizaleta (Basque)", u"Jani Kinnunen (finnish)", u"Rémy Ruiz (French)", u"Juan Buño (Galician)", u"Steffen Schultz (German)", u"Zvonimir Stanečić (Croatian)", u"Robert Osztolykan (Hungarian)", u"Christian Leo Mameli (Italian)", u"Riku (Japanese)", u"Paweł Masarczyk (Polish)", u"Odenilton Júnior Santos (Portuguese)", u"Florian Ionașcu, Nicușor Untilă (Romanian)", u"Natalia Hedlund, Valeria Kuznetsova (Russian)", u"Aleksandar Đurić (Serbian)", u"Burak Yüksek (Turkish)"] -url = u"http://twblue.es" +translators = ["Manuel Cortéz (English)", "Mohammed Al Shara, Hatoun Felemban (Arabic)", "Francisco Torres (Catalan)", "Manuel cortéz (Spanish)", "Sukil Etxenike Arizaleta (Basque)", "Jani Kinnunen (finnish)", "Rémy Ruiz (French)", "Juan Buño (Galician)", "Steffen Schultz (German)", "Zvonimir Stanečić (Croatian)", "Robert Osztolykan (Hungarian)", "Christian Leo Mameli (Italian)", "Riku (Japanese)", "Paweł Masarczyk (Polish)", "Odenilton Júnior Santos (Portuguese)", "Florian Ionașcu, Nicușor Untilă (Romanian)", "Natalia Hedlund, Valeria Kuznetsova (Russian)", "Aleksandar Đurić (Serbian)", "Burak Yüksek (Turkish)"] +url = "http://twblue.es" report_bugs_url = "http://twblue.es/bugs/api/soap/mantisconnect.php?wsdl" \ No newline at end of file diff --git a/src/config.py b/src/config.py index e55ec95b..1e263216 100644 --- a/src/config.py +++ b/src/config.py @@ -1,27 +1,27 @@ -# -*- coding: cp1252 -*- -import config_utils -import paths -import logging -import platform - -log = logging.getLogger("config") - -MAINFILE = "twblue.conf" -MAINSPEC = "app-configuration.defaults" -proxyTypes=[u"http", u"https", u"socks4", u"socks5"] -app = None -keymap=None -changed_keymap = False - -def setup (): - global app - log.debug("Loading global app settings...") - app = config_utils.load_config(paths.config_path(MAINFILE), paths.app_path(MAINSPEC)) - log.debug("Loading keymap...") - global keymap - if float(platform.version()[:2]) >= 10 and app["app-settings"]["load_keymap"] == "default.keymap": - app["app-settings"]["load_keymap"] = "Windows 10.keymap" - app.write() - global changed_keymap - changed_keymap = True - keymap = config_utils.load_config(paths.config_path("keymap.keymap"), paths.app_path("keymaps/"+app['app-settings']['load_keymap']), copy=False) +# -*- coding: cp1252 -*- +import config_utils +import paths +import logging +import platform + +log = logging.getLogger("config") + +MAINFILE = "twblue.conf" +MAINSPEC = "app-configuration.defaults" +proxyTypes=["http", "https", "socks4", "socks5"] +app = None +keymap=None +changed_keymap = False + +def setup (): + global app + log.debug("Loading global app settings...") + app = config_utils.load_config(paths.config_path(MAINFILE), paths.app_path(MAINSPEC)) + log.debug("Loading keymap...") + global keymap + if float(platform.version()[:2]) >= 10 and app["app-settings"]["load_keymap"] == "default.keymap": + app["app-settings"]["load_keymap"] = "Windows 10.keymap" + app.write() + global changed_keymap + changed_keymap = True + keymap = config_utils.load_config(paths.config_path("keymap.keymap"), paths.app_path("keymaps/"+app['app-settings']['load_keymap']), copy=False) diff --git a/src/controller/attach.py b/src/controller/attach.py index 784fee62..8c5bc8b1 100644 --- a/src/controller/attach.py +++ b/src/controller/attach.py @@ -21,7 +21,7 @@ class attach(object): imageInfo = {"type": "photo", "file": image, "description": description} log.debug("Image data to upload: %r" % (imageInfo,)) self.attachments.append(imageInfo) - info = [_(u"Photo"), description] + info = [_("Photo"), description] self.dialog.attachments.insert_item(False, *info) self.dialog.remove.Enable(True) diff --git a/src/controller/buffersController.py b/src/controller/buffersController.py index 89e79bac..aa716368 100644 --- a/src/controller/buffersController.py +++ b/src/controller/buffersController.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import + from builtins import str from builtins import range from builtins import object @@ -93,11 +93,11 @@ class bufferController(object): def start_stream(self, mandatory=False): if mandatory == True: - output.speak(_(u"Unable to update this buffer.")) + output.speak(_("Unable to update this buffer.")) pass def get_more_items(self): - output.speak(_(u"This action is not supported for this buffer"), True) + output.speak(_("This action is not supported for this buffer"), True) def put_items_on_list(self, items): pass @@ -138,8 +138,8 @@ class bufferController(object): pass def post_tweet(self, *args, **kwargs): - title = _(u"Tweet") - caption = _(u"Write the tweet here") + title = _("Tweet") + caption = _("Write the tweet here") tweet = messages.tweet(self.session, title, caption, "", twishort_enabled=self.session.settings["mysc"]["twishort_enabled"]) if tweet.message.get_response() == widgetUtils.OK: self.session.settings["mysc"]["twishort_enabled"] = tweet.message.long_tweet.GetValue() @@ -355,7 +355,7 @@ class baseBufferController(bufferController): # self.buffer.list.select_item(selection+elements) # else: self.buffer.list.select_item(selection) - output.speak(_(u"%s items retrieved") % (str(len(elements))), True) + output.speak(_("%s items retrieved") % (str(len(elements))), True) def remove_buffer(self, force=False): if "-timeline" in self.name: @@ -387,11 +387,11 @@ class baseBufferController(bufferController): elif dlg == widgetUtils.NO: return False else: - output.speak(_(u"This buffer is not a timeline; it can't be deleted."), True) + output.speak(_("This buffer is not a timeline; it can't be deleted."), True) return False def remove_tweet(self, id): - if type(self.session.db[self.name]) == dict: return + if isinstance(self.session.db[self.name], dict): return for i in range(0, len(self.session.db[self.name])): if self.session.db[self.name][i]["id"] == id: self.session.db[self.name].pop(i) @@ -516,7 +516,7 @@ class baseBufferController(bufferController): twishort_enabled = "twishort" in tweet users = utils.get_all_mentioned(tweet, self.session.db, field="screen_name") ids = utils.get_all_mentioned(tweet, self.session.db, field="id_str") - message = messages.reply(self.session, _(u"Reply"), _(u"Reply to %s") % (screen_name,), "", twishort_enabled=self.session.settings["mysc"]["twishort_enabled"], users=users, ids=ids) + message = messages.reply(self.session, _("Reply"), _("Reply to %s") % (screen_name,), "", twishort_enabled=self.session.settings["mysc"]["twishort_enabled"], users=users, ids=ids) if message.message.get_response() == widgetUtils.OK: params = {"_sound": "reply_send.ogg", "in_reply_to_status_id": id,} self.session.settings["mysc"]["twishort_enabled"] = message.message.long_tweet.GetValue() @@ -529,7 +529,7 @@ class baseBufferController(bufferController): params["auto_populate_reply_metadata"] =True else: mentioned_people = message.get_people() - text = "@"+screen_name+" "+mentioned_people+u" "+text + text = "@"+screen_name+" "+mentioned_people+" "+text if len(text) > 140 and message.message.get("long_tweet") == True: if message.image == None: text = twishort.create_tweet(self.session.settings["twitter"]["user_key"], self.session.settings["twitter"]["user_secret"], text) @@ -557,7 +557,7 @@ class baseBufferController(bufferController): else: screen_name = tweet["user"]["screen_name"] users = utils.get_all_users(tweet, self.session.db) - dm = messages.dm(self.session, _(u"Direct message to %s") % (screen_name,), _(u"New direct message"), users) + dm = messages.dm(self.session, _("Direct message to %s") % (screen_name,), _("New direct message"), users) if dm.message.get_response() == widgetUtils.OK: val = self.session.api_call(call_name="send_direct_message", text=dm.message.get_text(), screen_name=dm.message.get("cb")) if val != None: @@ -588,7 +588,7 @@ class baseBufferController(bufferController): comments = tweet["full_text"] else: comments = tweet["text"] - retweet = messages.tweet(self.session, _(u"Quote"), _(u"Add your comment to the tweet"), u"“@%s: %s ”" % (tweet["user"]["screen_name"], comments), max=116, messageType="retweet", twishort_enabled=self.session.settings["mysc"]["twishort_enabled"]) + retweet = messages.tweet(self.session, _("Quote"), _("Add your comment to the tweet"), "“@%s: %s ”" % (tweet["user"]["screen_name"], comments), max=116, messageType="retweet", twishort_enabled=self.session.settings["mysc"]["twishort_enabled"]) if comment != '': retweet.message.set_text(comment) if retweet.message.get_response() == widgetUtils.OK: @@ -653,7 +653,7 @@ class baseBufferController(bufferController): if hasattr(urls_list, "destroy"): urls_list.destroy() if url != '': if announce: - output.speak(_(u"Opening URL..."), True) + output.speak(_("Opening URL..."), True) webbrowser.open_new_tab(url) def clear_list(self): @@ -688,7 +688,7 @@ class baseBufferController(bufferController): users = [tweet["screen_name"]] else: users = utils.get_all_users(tweet, self.session.db) - dlg = dialogs.utils.selectUserDialog(title=_(u"User details"), users=users) + dlg = dialogs.utils.selectUserDialog(title=_("User details"), users=users) if dlg.get_response() == widgetUtils.OK: user.profileController(session=self.session, user=dlg.get_user()) if hasattr(dlg, "destroy"): dlg.destroy() @@ -763,7 +763,7 @@ class eventsBufferController(bufferController): self.get_formatted_message = self.get_message def get_message(self): - if self.buffer.list.get_count() == 0: return _(u"Empty") + if self.buffer.list.get_count() == 0: return _("Empty") # fix this: return "%s. %s" % (self.buffer.list.list.GetItemText(self.buffer.list.get_selected()), self.buffer.list.list.GetItemText(self.buffer.list.get_selected(), 1)) @@ -849,7 +849,7 @@ class peopleBufferController(baseBufferController): elif dlg == widgetUtils.NO: return False else: - output.speak(_(u"This buffer is not a timeline; it can't be deleted."), True) + output.speak(_("This buffer is not a timeline; it can't be deleted."), True) return False def onFocus(self, ev): @@ -864,7 +864,7 @@ class peopleBufferController(baseBufferController): def reply(self, *args, **kwargs): tweet = self.get_right_tweet() screen_name = tweet["screen_name"] - message = messages.reply(self.session, _(u"Mention"), _(u"Mention to %s") % (screen_name,), "@%s " % (screen_name,), [screen_name,]) + message = messages.reply(self.session, _("Mention"), _("Mention to %s") % (screen_name,), "@%s " % (screen_name,), [screen_name,]) if message.message.get_response() == widgetUtils.OK: if message.image == None: call_threaded(self.session.api_call, call_name="update_status", _sound="reply_send.ogg", status=message.message.get_text()) @@ -911,7 +911,7 @@ class peopleBufferController(baseBufferController): # self.buffer.list.select_item(selection) # else: # self.buffer.list.select_item(selection-elements) - output.speak(_(u"%s items retrieved") % (len(items)), True) + output.speak(_("%s items retrieved") % (len(items)), True) def put_items_on_list(self, number_of_items): log.debug("The list contains %d items" % (self.buffer.list.get_count(),)) @@ -1037,7 +1037,7 @@ class searchBufferController(baseBufferController): # self.buffer.list.select_item(selection+elements) # else: self.buffer.list.select_item(selection) - output.speak(_(u"%s items retrieved") % (str(len(elements))), True) + output.speak(_("%s items retrieved") % (str(len(elements))), True) class searchPeopleBufferController(peopleBufferController): @@ -1097,7 +1097,7 @@ class searchPeopleBufferController(peopleBufferController): # self.buffer.list.select_item(selection) # else: # self.buffer.list.select_item(selection-elements) - output.speak(_(u"%s items retrieved") % (len(items)), True) + output.speak(_("%s items retrieved") % (len(items)), True) def remove_buffer(self, force=False): @@ -1213,8 +1213,8 @@ class trendsBufferController(bufferController): def tweet_about_this_trend(self, *args, **kwargs): if self.buffer.list.get_count() == 0: return - title = _(u"Tweet") - caption = _(u"Write the tweet here") + title = _("Tweet") + caption = _("Write the tweet here") tweet = messages.tweet(self.session, title, caption, self.get_message()+ " ", twishort_enabled=self.session.settings["mysc"]["twishort_enabled"]) tweet.message.set_cursor_at_end() if tweet.message.get_response() == widgetUtils.OK: diff --git a/src/controller/mainController.py b/src/controller/mainController.py index bba98926..7d9a81f6 100644 --- a/src/controller/mainController.py +++ b/src/controller/mainController.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import + from builtins import str from builtins import range from builtins import object @@ -269,7 +269,7 @@ class Controller(object): if config.app["app-settings"]["play_ready_sound"] == True: session_.sessions[list(session_.sessions.keys())[0]].sound.play("ready.ogg") if config.app["app-settings"]["speak_ready_msg"] == True: - output.speak(_(u"Ready")) + output.speak(_("Ready")) self.started = True def create_ignored_session_buffer(self, session): @@ -302,97 +302,97 @@ class Controller(object): if i == 'home': home = buffersController.baseBufferController(self.view.nb, "get_home_timeline", "home_timeline", session, session.db["user_name"], tweet_mode="extended") self.buffers.append(home) - self.view.insert_buffer(home.buffer, name=_(u"Home"), pos=self.view.search(session.db["user_name"], session.db["user_name"])) + self.view.insert_buffer(home.buffer, name=_("Home"), pos=self.view.search(session.db["user_name"], session.db["user_name"])) elif i == 'mentions': mentions = buffersController.baseBufferController(self.view.nb, "get_mentions_timeline", "mentions", session, session.db["user_name"], sound="mention_received.ogg", tweet_mode="extended") self.buffers.append(mentions) - self.view.insert_buffer(mentions.buffer, name=_(u"Mentions"), pos=self.view.search(session.db["user_name"], session.db["user_name"])) + self.view.insert_buffer(mentions.buffer, name=_("Mentions"), pos=self.view.search(session.db["user_name"], session.db["user_name"])) elif i == 'dm': dm = buffersController.baseBufferController(self.view.nb, "get_direct_messages", "direct_messages", session, session.db["user_name"], bufferType="dmPanel", compose_func="compose_dm", sound="dm_received.ogg", full_text=True) self.buffers.append(dm) - self.view.insert_buffer(dm.buffer, name=_(u"Direct messages"), pos=self.view.search(session.db["user_name"], session.db["user_name"])) + self.view.insert_buffer(dm.buffer, name=_("Direct messages"), pos=self.view.search(session.db["user_name"], session.db["user_name"])) elif i == 'sent_dm': sent_dm = buffersController.baseBufferController(self.view.nb, "get_sent_messages", "sent_direct_messages", session, session.db["user_name"], bufferType="dmPanel", compose_func="compose_dm", full_text=True) self.buffers.append(sent_dm) - self.view.insert_buffer(sent_dm.buffer, name=_(u"Sent direct messages"), pos=self.view.search(session.db["user_name"], session.db["user_name"])) + self.view.insert_buffer(sent_dm.buffer, name=_("Sent direct messages"), pos=self.view.search(session.db["user_name"], session.db["user_name"])) elif i == 'sent_tweets': sent_tweets = buffersController.baseBufferController(self.view.nb, "get_user_timeline", "sent_tweets", session, session.db["user_name"], bufferType="dmPanel", screen_name=session.db["user_name"], tweet_mode="extended") self.buffers.append(sent_tweets) - self.view.insert_buffer(sent_tweets.buffer, name=_(u"Sent tweets"), pos=self.view.search(session.db["user_name"], session.db["user_name"])) + self.view.insert_buffer(sent_tweets.buffer, name=_("Sent tweets"), pos=self.view.search(session.db["user_name"], session.db["user_name"])) elif i == 'favorites': favourites = buffersController.baseBufferController(self.view.nb, "get_favorites", "favourites", session, session.db["user_name"], tweet_mode="extended") self.buffers.append(favourites) - self.view.insert_buffer(favourites.buffer, name=_(u"Likes"), pos=self.view.search(session.db["user_name"], session.db["user_name"])) + self.view.insert_buffer(favourites.buffer, name=_("Likes"), pos=self.view.search(session.db["user_name"], session.db["user_name"])) elif i == 'followers': followers = buffersController.peopleBufferController(self.view.nb, "get_followers_list", "followers", session, session.db["user_name"], screen_name=session.db["user_name"]) self.buffers.append(followers) - self.view.insert_buffer(followers.buffer, name=_(u"Followers"), pos=self.view.search(session.db["user_name"], session.db["user_name"])) + self.view.insert_buffer(followers.buffer, name=_("Followers"), pos=self.view.search(session.db["user_name"], session.db["user_name"])) elif i == 'friends': friends = buffersController.peopleBufferController(self.view.nb, "get_friends_list", "friends", session, session.db["user_name"], screen_name=session.db["user_name"]) self.buffers.append(friends) - self.view.insert_buffer(friends.buffer, name=_(u"Friends"), pos=self.view.search(session.db["user_name"], session.db["user_name"])) + self.view.insert_buffer(friends.buffer, name=_("Friends"), pos=self.view.search(session.db["user_name"], session.db["user_name"])) elif i == 'blocks': blocks = buffersController.peopleBufferController(self.view.nb, "list_blocks", "blocked", session, session.db["user_name"]) self.buffers.append(blocks) - self.view.insert_buffer(blocks.buffer, name=_(u"Blocked users"), pos=self.view.search(session.db["user_name"], session.db["user_name"])) + self.view.insert_buffer(blocks.buffer, name=_("Blocked users"), pos=self.view.search(session.db["user_name"], session.db["user_name"])) elif i == 'muted': muted = buffersController.peopleBufferController(self.view.nb, "list_mutes", "muted", session, session.db["user_name"]) self.buffers.append(muted) - self.view.insert_buffer(muted.buffer, name=_(u"Muted users"), pos=self.view.search(session.db["user_name"], session.db["user_name"])) + self.view.insert_buffer(muted.buffer, name=_("Muted users"), pos=self.view.search(session.db["user_name"], session.db["user_name"])) elif i == 'events': events = buffersController.eventsBufferController(self.view.nb, "events", session, session.db["user_name"], bufferType="dmPanel", screen_name=session.db["user_name"]) self.buffers.append(events) - self.view.insert_buffer(events.buffer, name=_(u"Events"), pos=self.view.search(session.db["user_name"], session.db["user_name"])) + self.view.insert_buffer(events.buffer, name=_("Events"), pos=self.view.search(session.db["user_name"], session.db["user_name"])) timelines = buffersController.emptyPanel(self.view.nb, "timelines", session.db["user_name"]) self.buffers.append(timelines) - self.view.insert_buffer(timelines.buffer , name=_(u"Timelines"), pos=self.view.search(session.db["user_name"], session.db["user_name"])) + self.view.insert_buffer(timelines.buffer , name=_("Timelines"), pos=self.view.search(session.db["user_name"], session.db["user_name"])) for i in session.settings["other_buffers"]["timelines"]: tl = buffersController.baseBufferController(self.view.nb, "get_user_timeline", "%s-timeline" % (i,), session, session.db["user_name"], bufferType=None, user_id=i, tweet_mode="extended") self.buffers.append(tl) - self.view.insert_buffer(tl.buffer, name=_(u"Timeline for {}").format(i,), pos=self.view.search("timelines", session.db["user_name"])) + self.view.insert_buffer(tl.buffer, name=_("Timeline for {}").format(i,), pos=self.view.search("timelines", session.db["user_name"])) favs_timelines = buffersController.emptyPanel(self.view.nb, "favs_timelines", session.db["user_name"]) self.buffers.append(favs_timelines) - self.view.insert_buffer(favs_timelines.buffer , name=_(u"Likes timelines"), pos=self.view.search(session.db["user_name"], session.db["user_name"])) + self.view.insert_buffer(favs_timelines.buffer , name=_("Likes timelines"), pos=self.view.search(session.db["user_name"], session.db["user_name"])) for i in session.settings["other_buffers"]["favourites_timelines"]: tl = buffersController.baseBufferController(self.view.nb, "get_favorites", "%s-favorite" % (i,), session, session.db["user_name"], bufferType=None, user_id=i, tweet_mode="extended") self.buffers.append(tl) - self.view.insert_buffer(tl.buffer, name=_(u"Likes for {}").format(i,), pos=self.view.search("favs_timelines", session.db["user_name"])) + self.view.insert_buffer(tl.buffer, name=_("Likes for {}").format(i,), pos=self.view.search("favs_timelines", session.db["user_name"])) tl.timer = RepeatingTimer(300, tl.start_stream) tl.timer.start() followers_timelines = buffersController.emptyPanel(self.view.nb, "followers_timelines", session.db["user_name"]) self.buffers.append(followers_timelines) - self.view.insert_buffer(followers_timelines.buffer , name=_(u"Followers' Timelines"), pos=self.view.search(session.db["user_name"], session.db["user_name"])) + self.view.insert_buffer(followers_timelines.buffer , name=_("Followers' Timelines"), pos=self.view.search(session.db["user_name"], session.db["user_name"])) for i in session.settings["other_buffers"]["followers_timelines"]: tl = buffersController.peopleBufferController(self.view.nb, "get_followers_list", "%s-followers" % (i,), session, session.db["user_name"], user_id=i) self.buffers.append(tl) - self.view.insert_buffer(tl.buffer, name=_(u"Followers for {}").format(i,), pos=self.view.search("followers_timelines", session.db["user_name"])) + self.view.insert_buffer(tl.buffer, name=_("Followers for {}").format(i,), pos=self.view.search("followers_timelines", session.db["user_name"])) tl.timer = RepeatingTimer(300, tl.start_stream) tl.timer.start() friends_timelines = buffersController.emptyPanel(self.view.nb, "friends_timelines", session.db["user_name"]) self.buffers.append(friends_timelines) - self.view.insert_buffer(friends_timelines.buffer , name=_(u"Friends' Timelines"), pos=self.view.search(session.db["user_name"], session.db["user_name"])) + self.view.insert_buffer(friends_timelines.buffer , name=_("Friends' Timelines"), pos=self.view.search(session.db["user_name"], session.db["user_name"])) for i in session.settings["other_buffers"]["friends_timelines"]: tl = buffersController.peopleBufferController(self.view.nb, "get_friends_list", "%s-friends" % (i,), session, session.db["user_name"], user_id=i) self.buffers.append(tl) - self.view.insert_buffer(tl.buffer, name=_(u"Friends for {}").format(i,), pos=self.view.search("friends_timelines", session.db["user_name"])) + self.view.insert_buffer(tl.buffer, name=_("Friends for {}").format(i,), pos=self.view.search("friends_timelines", session.db["user_name"])) tl.timer = RepeatingTimer(300, tl.start_stream) tl.timer.start() lists = buffersController.emptyPanel(self.view.nb, "lists", session.db["user_name"]) self.buffers.append(lists) - self.view.insert_buffer(lists.buffer , name=_(u"Lists"), pos=self.view.search(session.db["user_name"], session.db["user_name"])) + self.view.insert_buffer(lists.buffer , name=_("Lists"), pos=self.view.search(session.db["user_name"], session.db["user_name"])) for i in session.settings["other_buffers"]["lists"]: tl = buffersController.listBufferController(self.view.nb, "get_list_statuses", "%s-list" % (i,), session, session.db["user_name"], bufferType=None, list_id=utils.find_list(i, session.db["lists"]), tweet_mode="extended") session.lists.append(tl) self.buffers.append(tl) - self.view.insert_buffer(tl.buffer, name=_(u"List for {}").format(i), pos=self.view.search("lists", session.db["user_name"])) + self.view.insert_buffer(tl.buffer, name=_("List for {}").format(i), pos=self.view.search("lists", session.db["user_name"])) searches = buffersController.emptyPanel(self.view.nb, "searches", session.db["user_name"]) self.buffers.append(searches) - self.view.insert_buffer(searches.buffer , name=_(u"Searches"), pos=self.view.search(session.db["user_name"], session.db["user_name"])) + self.view.insert_buffer(searches.buffer , name=_("Searches"), pos=self.view.search(session.db["user_name"], session.db["user_name"])) for i in session.settings["other_buffers"]["tweet_searches"]: tl = buffersController.searchBufferController(self.view.nb, "search", "%s-searchterm" % (i,), session, session.db["user_name"], bufferType="searchPanel", q=i, tweet_mode="extended") self.buffers.append(tl) - self.view.insert_buffer(tl.buffer, name=_(u"Search for {}").format(i), pos=self.view.search("searches", session.db["user_name"])) + self.view.insert_buffer(tl.buffer, name=_("Search for {}").format(i), pos=self.view.search("searches", session.db["user_name"])) tl.timer = RepeatingTimer(180, tl.start_stream) tl.timer.start() for i in session.settings["other_buffers"]["trending_topic_buffers"]: @@ -402,7 +402,7 @@ class Controller(object): self.buffers.append(buffer) buffer.timer = RepeatingTimer(300, buffer.start_stream) buffer.timer.start() - self.view.insert_buffer(buffer.buffer, name=_(u"Trending topics for %s") % (buffer.name_), pos=self.view.search(session.db["user_name"], session.db["user_name"])) + self.view.insert_buffer(buffer.buffer, name=_("Trending topics for %s") % (buffer.name_), pos=self.view.search(session.db["user_name"], session.db["user_name"])) def set_buffer_positions(self, session): "Sets positions for buffers if values exist in the database." @@ -455,7 +455,7 @@ class Controller(object): search.start_stream(mandatory=True) pos=self.view.search("searches", buffer.session.db["user_name"]) self.insert_buffer(search, pos) - self.view.insert_buffer(search.buffer, name=_(u"Search for {}").format(term), pos=pos) + self.view.insert_buffer(search.buffer, name=_("Search for {}").format(term), pos=pos) search.timer = RepeatingTimer(180, search.start_stream) search.timer.start() dlg.Destroy() @@ -474,18 +474,18 @@ class Controller(object): return page = self.get_current_buffer() if not hasattr(page.buffer, "list"): - output.speak(_(u"No session is currently in focus. Focus a session with the next or previous session shortcut."), True) + output.speak(_("No session is currently in focus. Focus a session with the next or previous session shortcut."), True) return count = page.buffer.list.get_count() if count < 1: - output.speak(_(u"Empty buffer."), True) + output.speak(_("Empty buffer."), True) return start = page.buffer.list.get_selected() for i in range(start,count): page.buffer.list.select_item(i) if string.lower() in page.get_message().lower(): return output.speak(page.get_message(), True) - output.speak(_(u"{0} not found.").format(string,), True) + output.speak(_("{0} not found.").format(string,), True) page.buffer.list.select_item(start) def seekLeft(self, *args, **kwargs): @@ -531,7 +531,7 @@ class Controller(object): users = utils.get_all_users(tweet, buff.session.db) else: users = [tweet["screen_name"]] - dlg = dialogs.utils.selectUserDialog(_(u"Select the user"), users) + dlg = dialogs.utils.selectUserDialog(_("Select the user"), users) if dlg.get_response() == widgetUtils.OK: user = dlg.get_user() else: @@ -546,7 +546,7 @@ class Controller(object): users = utils.get_all_users(tweet, buff.session.db) else: users = [tweet["screen_name"]] - dlg = dialogs.utils.selectUserDialog(_(u"Select the user"), users) + dlg = dialogs.utils.selectUserDialog(_("Select the user"), users) if dlg.get_response() == widgetUtils.OK: user = dlg.get_user() else: @@ -573,7 +573,7 @@ class Controller(object): users = utils.get_all_users(tweet, buff.session.db) else: users = [tweet["screen_name"]] - dlg = dialogs.utils.selectUserDialog(_(u"Select the user"), users) + dlg = dialogs.utils.selectUserDialog(_("Select the user"), users) if dlg.get_response() == widgetUtils.OK: user = dlg.get_user() else: @@ -823,7 +823,7 @@ class Controller(object): return pos=self.view.search("timelines", buff.session.db["user_name"]) self.insert_buffer(tl, pos+1) - self.view.insert_buffer(tl.buffer, name=_(u"Timeline for {}").format(dlg.get_user()), pos=pos) + self.view.insert_buffer(tl.buffer, name=_("Timeline for {}").format(dlg.get_user()), pos=pos) buff.session.settings["other_buffers"]["timelines"].append(usr["id_str"]) pub.sendMessage("buffer-title-changed", buffer=tl) pub.sendMessage("restart-streams", streams=["timelinesStream"], session=buff.session) @@ -843,7 +843,7 @@ class Controller(object): return pos=self.view.search("favs_timelines", buff.session.db["user_name"]) self.insert_buffer(tl, pos+1) - self.view.insert_buffer(buffer=tl.buffer, name=_(u"Likes for {}").format(dlg.get_user()), pos=pos) + self.view.insert_buffer(buffer=tl.buffer, name=_("Likes for {}").format(dlg.get_user()), pos=pos) tl.timer = RepeatingTimer(300, tl.start_stream) tl.timer.start() buff.session.settings["other_buffers"]["favourites_timelines"].append(usr["id_str"]) @@ -864,7 +864,7 @@ class Controller(object): return pos=self.view.search("followers_timelines", buff.session.db["user_name"]) self.insert_buffer(tl, pos+1) - self.view.insert_buffer(buffer=tl.buffer, name=_(u"Followers for {}").format(dlg.get_user()), pos=pos) + self.view.insert_buffer(buffer=tl.buffer, name=_("Followers for {}").format(dlg.get_user()), pos=pos) tl.timer = RepeatingTimer(300, tl.start_stream) tl.timer.start() buff.session.settings["other_buffers"]["followers_timelines"].append(usr["id_str"]) @@ -885,7 +885,7 @@ class Controller(object): return pos=self.view.search("friends_timelines", buff.session.db["user_name"]) self.insert_buffer(tl, pos+1) - self.view.insert_buffer(buffer=tl.buffer, name=_(u"Friends for {}").format(dlg.get_user()), pos=pos) + self.view.insert_buffer(buffer=tl.buffer, name=_("Friends for {}").format(dlg.get_user()), pos=pos) tl.timer = RepeatingTimer(300, tl.start_stream) tl.timer.start() buff.session.settings["other_buffers"]["friends_timelines"].append(usr["id_str"]) @@ -905,7 +905,7 @@ class Controller(object): pos=self.view.search("searches", buffer.session.db["user_name"]) # self.buffers.append(search) self.insert_buffer(search, pos) - self.view.insert_buffer(search.buffer, name=_(u"Conversation with {0}").format(user), pos=pos) + self.view.insert_buffer(search.buffer, name=_("Conversation with {0}").format(user), pos=pos) search.timer = RepeatingTimer(300, search.start_stream) search.timer.start() @@ -932,7 +932,7 @@ class Controller(object): buffer = buffersController.trendsBufferController(self.view.nb, "%s_tt" % (woeid,), buff.session, buff.account, woeid) buffer.searchfunction = self.search pos=self.view.search(buff.session.db["user_name"], buff.session.db["user_name"]) - self.view.insert_buffer(buffer.buffer, name=_(u"Trending topics for %s") % (trends.get_string()), pos=pos) + self.view.insert_buffer(buffer.buffer, name=_("Trending topics for %s") % (trends.get_string()), pos=pos) self.buffers.append(buffer) buffer.start_stream() timer = RepeatingTimer(300, buffer.start_stream) @@ -950,11 +950,11 @@ class Controller(object): if event == None: output.speak(address[0].__str__()) else: self.view.show_address(address[0].__str__()) else: - output.speak(_(u"There are no coordinates in this tweet")) + output.speak(_("There are no coordinates in this tweet")) except GeocoderError: - output.speak(_(u"There are no results for the coordinates in this tweet")) + output.speak(_("There are no results for the coordinates in this tweet")) except ValueError: - output.speak(_(u"Error decoding coordinates. Try again later.")) + output.speak(_("Error decoding coordinates. Try again later.")) except KeyError: pass except AttributeError: @@ -969,11 +969,11 @@ class Controller(object): address = geocoder.reverse_geocode(y, x) dlg = commonMessageDialogs.view_geodata(address[0].__str__()) else: - output.speak(_(u"There are no coordinates in this tweet")) + output.speak(_("There are no coordinates in this tweet")) except GeocoderError: - output.speak(_(u"There are no results for the coordinates in this tweet")) + output.speak(_("There are no results for the coordinates in this tweet")) except ValueError: - output.speak(_(u"Error decoding coordinates. Try again later.")) + output.speak(_("Error decoding coordinates. Try again later.")) except KeyError: pass except AttributeError: @@ -1033,7 +1033,7 @@ class Controller(object): def up(self, *args, **kwargs): page = self.get_current_buffer() if not hasattr(page.buffer, "list"): - output.speak(_(u"No session is currently in focus. Focus a session with the next or previous session shortcut."), True) + output.speak(_("No session is currently in focus. Focus a session with the next or previous session shortcut."), True) return position = page.buffer.list.get_selected() index = position-1 @@ -1052,7 +1052,7 @@ class Controller(object): def down(self, *args, **kwargs): page = self.get_current_buffer() if not hasattr(page.buffer, "list"): - output.speak(_(u"No session is currently in focus. Focus a session with the next or previous session shortcut."), True) + output.speak(_("No session is currently in focus. Focus a session with the next or previous session shortcut."), True) return position = page.buffer.list.get_selected() index = position+1 @@ -1071,7 +1071,7 @@ class Controller(object): buff = self.view.get_current_buffer_pos() buffer = self.get_current_buffer() if not hasattr(buffer.buffer, "list"): - output.speak(_(u"No session is currently in focus. Focus a session with the next or previous session shortcut."), True) + output.speak(_("No session is currently in focus. Focus a session with the next or previous session shortcut."), True) return if buff == self.get_first_buffer(buffer.account) or buff == 0: self.view.change_buffer(self.get_last_buffer(buffer.account)) @@ -1081,16 +1081,16 @@ class Controller(object): buffer = self.get_current_buffer() if self.showing == True: buffer.buffer.set_focus_in_list() try: - msg = _(u"%s, %s of %s") % (self.view.get_buffer_text(), buffer.buffer.list.get_selected()+1, buffer.buffer.list.get_count()) + msg = _("%s, %s of %s") % (self.view.get_buffer_text(), buffer.buffer.list.get_selected()+1, buffer.buffer.list.get_count()) except: - msg = _(u"%s. Empty") % (self.view.get_buffer_text(),) + msg = _("%s. Empty") % (self.view.get_buffer_text(),) output.speak(msg, True) def right(self, *args, **kwargs): buff = self.view.get_current_buffer_pos() buffer = self.get_current_buffer() if not hasattr(buffer.buffer, "list"): - output.speak(_(u"No session is currently in focus. Focus a session with the next or previous session shortcut."), True) + output.speak(_("No session is currently in focus. Focus a session with the next or previous session shortcut."), True) return if buff == self.get_last_buffer(buffer.account) or buff+1 == self.view.get_buffer_count(): self.view.change_buffer(self.get_first_buffer(buffer.account)) @@ -1100,9 +1100,9 @@ class Controller(object): buffer = self.get_current_buffer() if self.showing == True: buffer.buffer.set_focus_in_list() try: - msg = _(u"%s, %s of %s") % (self.view.get_buffer_text(), buffer.buffer.list.get_selected()+1, buffer.buffer.list.get_count()) + msg = _("%s, %s of %s") % (self.view.get_buffer_text(), buffer.buffer.list.get_selected()+1, buffer.buffer.list.get_count()) except: - msg = _(u"%s. Empty") % (self.view.get_buffer_text(),) + msg = _("%s. Empty") % (self.view.get_buffer_text(),) output.speak(msg, True) def next_account(self, *args, **kwargs): @@ -1115,15 +1115,15 @@ class Controller(object): self.current_account = account buff = self.view.search("home_timeline", account) if buff == None: - output.speak(_(u"{0}: This account is not logged into Twitter.").format(account), True) + output.speak(_("{0}: This account is not logged into Twitter.").format(account), True) return self.view.change_buffer(buff) buffer = self.get_current_buffer() if self.showing == True: buffer.buffer.set_focus_in_list() try: - msg = _(u"%s. %s, %s of %s") % (buffer.account, self.view.get_buffer_text(), buffer.buffer.list.get_selected()+1, buffer.buffer.list.get_count()) + msg = _("%s. %s, %s of %s") % (buffer.account, self.view.get_buffer_text(), buffer.buffer.list.get_selected()+1, buffer.buffer.list.get_count()) except: - msg = _(u"%s. Empty") % (self.view.get_buffer_text(),) + msg = _("%s. Empty") % (self.view.get_buffer_text(),) output.speak(msg, True) def previous_account(self, *args, **kwargs): @@ -1136,15 +1136,15 @@ class Controller(object): self.current_account = account buff = self.view.search("home_timeline", account) if buff == None: - output.speak(_(u"{0}: This account is not logged into twitter.").format(account), True) + output.speak(_("{0}: This account is not logged into twitter.").format(account), True) return self.view.change_buffer(buff) buffer = self.get_current_buffer() if self.showing == True: buffer.buffer.set_focus_in_list() try: - msg = _(u"%s. %s, %s of %s") % (buffer.account, self.view.get_buffer_text(), buffer.buffer.list.get_selected()+1, buffer.buffer.list.get_count()) + msg = _("%s. %s, %s of %s") % (buffer.account, self.view.get_buffer_text(), buffer.buffer.list.get_selected()+1, buffer.buffer.list.get_count()) except: - msg = _(u"%s. Empty") % (self.view.get_buffer_text(),) + msg = _("%s. Empty") % (self.view.get_buffer_text(),) output.speak(msg, True) def go_home(self): @@ -1239,7 +1239,7 @@ class Controller(object): buffer = self.search_buffer("mentions", user) if buffer == None: return play_sound = "mention_received.ogg" - message = _(u"One mention from %s ") % (data["user"]["name"]) + message = _("One mention from %s ") % (data["user"]["name"]) if "mentions" not in buffer.session.settings["other_buffers"]["muted_buffers"]: self.notify(buffer.session, play_sound=play_sound, message=message) buffer.add_new_item(data) @@ -1248,7 +1248,7 @@ class Controller(object): buffer = self.search_buffer("direct_messages", user) if buffer == None: return play_sound = "dm_received.ogg" - message = _(u"New direct message") + message = _("New direct message") if "direct_messages" not in buffer.session.settings["other_buffers"]["muted_buffers"]: self.notify(buffer.session, play_sound=play_sound, message=message) buffer.add_new_item(data) @@ -1328,7 +1328,7 @@ class Controller(object): play_sound = "tweet_timeline.ogg" if "%s-timeline" % (who,) not in buffer.session.settings["other_buffers"]["muted_buffers"] and buffer.session.settings["sound"]["session_mute"] == False: self.notify(buffer.session, play_sound=play_sound) - output.speak(_(u"One tweet from %s") % (data["user"]["name"])) + output.speak(_("One tweet from %s") % (data["user"]["name"])) buffer.add_new_item(data) def manage_item_in_list(self, data, user, where): @@ -1337,7 +1337,7 @@ class Controller(object): play_sound = "list_tweet.ogg" if "%s" % (where,) not in buffer.session.settings["other_buffers"]["muted_buffers"] and buffer.session.settings["sound"]["session_mute"] == False: self.notify(buffer.session, play_sound=play_sound) - output.speak(_(u"One tweet from %s") % (data["user"]["name"])) + output.speak(_("One tweet from %s") % (data["user"]["name"])) buffer.add_new_item(data) def start_buffers(self, session): @@ -1401,43 +1401,43 @@ class Controller(object): if buffer == "favourites": favourites = buffersController.baseBufferController(self.view.nb, "get_favorites", "favourites", buff.session, buff.session.db["user_name"]) self.buffers.append(favourites) - self.view.insert_buffer(favourites.buffer, name=_(u"Likes"), pos=self.view.search(buff.session.db["user_name"], buff.session.db["user_name"])) + self.view.insert_buffer(favourites.buffer, name=_("Likes"), pos=self.view.search(buff.session.db["user_name"], buff.session.db["user_name"])) favourites.start_stream() if buffer == "followers": followers = buffersController.peopleBufferController(self.view.nb, "get_followers_list", "followers", buff.session, buff.session.db["user_name"], screen_name=buff.session.db["user_name"]) self.buffers.append(followers) - self.view.insert_buffer(followers.buffer, name=_(u"Followers"), pos=self.view.search(buff.session.db["user_name"], buff.session.db["user_name"])) + self.view.insert_buffer(followers.buffer, name=_("Followers"), pos=self.view.search(buff.session.db["user_name"], buff.session.db["user_name"])) followers.start_stream() elif buffer == "friends": friends = buffersController.peopleBufferController(self.view.nb, "get_friends_list", "friends", buff.session, buff.session.db["user_name"], screen_name=buff.session.db["user_name"]) self.buffers.append(friends) - self.view.insert_buffer(friends.buffer, name=_(u"Friends"), pos=self.view.search(buff.session.db["user_name"], buff.session.db["user_name"])) + self.view.insert_buffer(friends.buffer, name=_("Friends"), pos=self.view.search(buff.session.db["user_name"], buff.session.db["user_name"])) friends.start_stream() elif buffer == "blocked": blocks = buffersController.peopleBufferController(self.view.nb, "list_blocks", "blocked", buff.session, buff.session.db["user_name"]) self.buffers.append(blocks) - self.view.insert_buffer(blocks.buffer, name=_(u"Blocked users"), pos=self.view.search(buff.session.db["user_name"], buff.session.db["user_name"])) + self.view.insert_buffer(blocks.buffer, name=_("Blocked users"), pos=self.view.search(buff.session.db["user_name"], buff.session.db["user_name"])) blocks.start_stream() elif buffer == "muted": muted = buffersController.peopleBufferController(self.view.nb, "get_muted_users_list", "muted", buff.session, buff.session.db["user_name"]) self.buffers.append(muted) - self.view.insert_buffer(muted.buffer, name=_(u"Muted users"), pos=self.view.search(buff.session.db["user_name"], buff.session.db["user_name"])) + self.view.insert_buffer(muted.buffer, name=_("Muted users"), pos=self.view.search(buff.session.db["user_name"], buff.session.db["user_name"])) muted.start_stream() elif buffer == "events": events = buffersController.eventsBufferController(self.view.nb, "events", buff.session, buff.session.db["user_name"], bufferType="dmPanel", screen_name=buff.session.db["user_name"]) self.buffers.append(events) - self.view.insert_buffer(events.buffer, name=_(u"Events"), pos=self.view.search(buff.session.db["user_name"], buff.session.db["user_name"])) + self.view.insert_buffer(events.buffer, name=_("Events"), pos=self.view.search(buff.session.db["user_name"], buff.session.db["user_name"])) elif create == False: self.destroy_buffer(buffer, buff.session.db["user_name"]) elif buffer == "list": if create in buff.session.settings["other_buffers"]["lists"]: - output.speak(_(u"This list is already opened"), True) + output.speak(_("This list is already opened"), True) return tl = buffersController.listBufferController(self.view.nb, "get_list_statuses", create+"-list", buff.session, buff.session.db["user_name"], bufferType=None, list_id=utils.find_list(create, buff.session.db["lists"])) buff.session.lists.append(tl) pos=self.view.search("lists", buff.session.db["user_name"]) self.insert_buffer(tl, pos) - self.view.insert_buffer(tl.buffer, name=_(u"List for {}").format(create), pos=self.view.search("lists", buff.session.db["user_name"])) + self.view.insert_buffer(tl.buffer, name=_("List for {}").format(create), pos=self.view.search("lists", buff.session.db["user_name"])) tl.start_stream() buff.session.settings["other_buffers"]["lists"].append(create) buff.session.settings.write() @@ -1491,20 +1491,20 @@ class Controller(object): if hasattr(buffer, "session") and buffer.session == None: return if buffer.name not in buffer.session.settings["other_buffers"]["autoread_buffers"]: buffer.session.settings["other_buffers"]["autoread_buffers"].append(buffer.name) - output.speak(_(u"The auto-reading of new tweets is enabled for this buffer"), True) + output.speak(_("The auto-reading of new tweets is enabled for this buffer"), True) elif buffer.name in buffer.session.settings["other_buffers"]["autoread_buffers"]: buffer.session.settings["other_buffers"]["autoread_buffers"].remove(buffer.name) - output.speak(_(u"The auto-reading of new tweets is disabled for this buffer"), True) + output.speak(_("The auto-reading of new tweets is disabled for this buffer"), True) buffer.session.settings.write() def toggle_session_mute(self, *args, **kwargs): buffer = self.get_best_buffer() if buffer.session.settings["sound"]["session_mute"] == False: buffer.session.settings["sound"]["session_mute"] = True - output.speak(_(u"Session mute on"), True) + output.speak(_("Session mute on"), True) elif buffer.session.settings["sound"]["session_mute"] == True: buffer.session.settings["sound"]["session_mute"] = False - output.speak(_(u"Session mute off"), True) + output.speak(_("Session mute off"), True) buffer.session.settings.write() def toggle_buffer_mute(self, *args, **kwargs): @@ -1512,10 +1512,10 @@ class Controller(object): if hasattr(buffer, "session") and buffer.session == None: return if buffer.name not in buffer.session.settings["other_buffers"]["muted_buffers"]: buffer.session.settings["other_buffers"]["muted_buffers"].append(buffer.name) - output.speak(_(u"Buffer mute on"), True) + output.speak(_("Buffer mute on"), True) elif buffer.name in buffer.session.settings["other_buffers"]["muted_buffers"]: buffer.session.settings["other_buffers"]["muted_buffers"].remove(buffer.name) - output.speak(_(u"Buffer mute off"), True) + output.speak(_("Buffer mute off"), True) buffer.session.settings.write() def view_documentation(self, *args, **kwargs): @@ -1535,7 +1535,7 @@ class Controller(object): def copy_to_clipboard(self, *args, **kwargs): output.copy(self.get_current_buffer().get_message()) - output.speak(_(u"Copied")) + output.speak(_("Copied")) def repeat_item(self, *args, **kwargs): output.speak(self.get_current_buffer().get_message()) @@ -1562,13 +1562,13 @@ class Controller(object): def update_buffer(self, *args, **kwargs): bf = self.get_current_buffer() if not hasattr(bf, "start_stream"): - output.speak(_(u"Unable to update this buffer.")) + output.speak(_("Unable to update this buffer.")) return else: - output.speak(_(u"Updating buffer...")) + output.speak(_("Updating buffer...")) n = bf.start_stream(mandatory=True) if n != None: - output.speak(_(u"{0} items retrieved").format(n,)) + output.speak(_("{0} items retrieved").format(n,)) def on_tweet_deleted(self, data): id = data["delete"]["status"]["id"] @@ -1578,28 +1578,28 @@ class Controller(object): def buffer_title_changed(self, buffer): if "-timeline" in buffer.name: - title = _(u"Timeline for {}").format(buffer.username,) + title = _("Timeline for {}").format(buffer.username,) elif "-favorite" in buffer.name: - title = _(u"Likes for {}").format(buffer.username,) + title = _("Likes for {}").format(buffer.username,) elif "-followers" in buffer.name: - title = _(u"Followers for {}").format(buffer.username,) + title = _("Followers for {}").format(buffer.username,) elif "-friends" in buffer.name: - title = _(u"Friends for {}").format(buffer.username,) + title = _("Friends for {}").format(buffer.username,) buffer_index = self.view.search(buffer.name, buffer.account) self.view.set_page_title(buffer_index, title) def ocr_image(self, *args, **kwargs): buffer = self.get_current_buffer() if hasattr(buffer, "get_right_tweet") == False: - output.speak(_(u"Invalid buffer")) + output.speak(_("Invalid buffer")) return tweet = buffer.get_tweet() if ("entities" in tweet) == False or ("media" in tweet["entities"]) == False: - output.speak(_(u"This tweet doesn't contain images")) + output.speak(_("This tweet doesn't contain images")) return if len(tweet["entities"]["media"]) > 1: - image_list = [_(u"Picture {0}").format(i,) for i in range(0, len(tweet["entities"]["media"]))] - dialog = dialogs.urlList.urlList(title=_(u"Select the picture")) + image_list = [_("Picture {0}").format(i,) for i in range(0, len(tweet["entities"]["media"]))] + dialog = dialogs.urlList.urlList(title=_("Select the picture")) if dialog.get_response() == widgetUtils.OK: img = tweet["entities"]["media"][dialog.get_item()] else: @@ -1615,7 +1615,7 @@ class Controller(object): try: text = api.OCR_URL(img["media_url"], lang=ocr_lang) except ocr.OCRSpace.APIError as er: - output.speak(_(u"Unable to extract text")) + output.speak(_("Unable to extract text")) return msg = messages.viewTweet(text["ParsedText"], [], False) diff --git a/src/controller/messages.py b/src/controller/messages.py index 5bc4cf7b..19c41ea3 100644 --- a/src/controller/messages.py +++ b/src/controller/messages.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import + from builtins import str from builtins import range from builtins import object @@ -50,18 +50,18 @@ class basicTweet(object): self.message.set_text(msg) self.text_processor() self.message.text_focus() - output.speak(_(u"Translated")) + output.speak(_("Translated")) else: return def shorten(self, event=None): urls = utils.find_urls_in_text(self.message.get_text()) if len(urls) == 0: - output.speak(_(u"There's no URL to be shortened")) + output.speak(_("There's no URL to be shortened")) self.message.text_focus() elif len(urls) == 1: self.message.set_text(self.message.get_text().replace(urls[0], url_shortener.shorten(urls[0]))) - output.speak(_(u"URL shortened")) + output.speak(_("URL shortened")) self.text_processor() self.message.text_focus() elif len(urls) > 1: @@ -69,18 +69,18 @@ class basicTweet(object): list_urls.populate_list(urls) if list_urls.get_response() == widgetUtils.OK: self.message.set_text(self.message.get_text().replace(urls[list_urls.get_item()], url_shortener.shorten(list_urls.get_string()))) - output.speak(_(u"URL shortened")) + output.speak(_("URL shortened")) self.text_processor() self.message.text_focus() def unshorten(self, event=None): urls = utils.find_urls_in_text(self.message.get_text()) if len(urls) == 0: - output.speak(_(u"There's no URL to be expanded")) + output.speak(_("There's no URL to be expanded")) self.message.text_focus() elif len(urls) == 1: self.message.set_text(self.message.get_text().replace(urls[0], url_shortener.unshorten(urls[0]))) - output.speak(_(u"URL expanded")) + output.speak(_("URL expanded")) self.text_processor() self.message.text_focus() elif len(urls) > 1: @@ -88,7 +88,7 @@ class basicTweet(object): list_urls.populate_list(urls) if list_urls.get_response() == widgetUtils.OK: self.message.set_text(self.message.get_text().replace(urls[list_urls.get_item()], url_shortener.unshorten(list_urls.get_string()))) - output.speak(_(u"URL expanded")) + output.speak(_("URL expanded")) self.text_processor() self.message.text_focus() @@ -100,11 +100,11 @@ class basicTweet(object): self.message.disable_button("shortenButton") self.message.disable_button("unshortenButton") if self.message.get("long_tweet") == False: - self.message.set_title(_(u"%s - %s of %d characters") % (self.title, len(self.message.get_text()), self.max)) + self.message.set_title(_("%s - %s of %d characters") % (self.title, len(self.message.get_text()), self.max)) if len(self.message.get_text()) > self.max: self.session.sound.play("max_length.ogg") else: - self.message.set_title(_(u"%s - %s characters") % (self.title, len(self.message.get_text()))) + self.message.set_title(_("%s - %s characters") % (self.title, len(self.message.get_text()))) def spellcheck(self, event=None): text = self.message.get_text() @@ -123,7 +123,7 @@ class basicTweet(object): self.message.set_text(self.message.get_text()+url+" #audio") self.text_processor() else: - output.speak(_(u"Unable to upload the audio")) + output.speak(_("Unable to upload the audio")) dlg.cleanup() dlg = audioUploader.audioUploader(self.session.settings, completed_callback) self.message.text_focus() diff --git a/src/controller/settings.py b/src/controller/settings.py index 71af759a..0247fd03 100644 --- a/src/controller/settings.py +++ b/src/controller/settings.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import division + from builtins import str from past.utils import old_div from builtins import object @@ -73,7 +73,7 @@ class globalSettingsController(object): self.dialog.set_value("general", "hide_gui", config.app["app-settings"]["hide_gui"]) self.dialog.set_value("general", "check_for_updates", config.app["app-settings"]["check_for_updates"]) proxyTypes=config.proxyTypes - self.dialog.create_proxy([_(u"Direct connection")]+proxyTypes) + self.dialog.create_proxy([_("Direct connection")]+proxyTypes) if config.app["proxy"]["type"] not in proxyTypes: self.dialog.proxy.type.SetSelection(0) else: @@ -138,11 +138,11 @@ class accountSettingsController(globalSettingsController): self.dialog.set_value("general", "reverse_timelines", self.config["general"]["reverse_timelines"]) rt = self.config["general"]["retweet_mode"] if rt == "ask": - self.dialog.set_value("general", "retweet_mode", _(u"Ask")) + self.dialog.set_value("general", "retweet_mode", _("Ask")) elif rt == "direct": - self.dialog.set_value("general", "retweet_mode", _(u"Retweet without comments")) + self.dialog.set_value("general", "retweet_mode", _("Retweet without comments")) else: - self.dialog.set_value("general", "retweet_mode", _(u"Retweet with comments")) + self.dialog.set_value("general", "retweet_mode", _("Retweet with comments")) self.dialog.set_value("general", "persist_size", str(self.config["general"]["persist_size"])) self.dialog.create_other_buffers() buffer_values = self.get_buffers_list() @@ -174,7 +174,7 @@ class accountSettingsController(globalSettingsController): language_index = OCRSpace.OcrLangs.index(self.config["mysc"]["ocr_language"]) self.dialog.extras.ocr_lang.SetSelection(language_index) self.dialog.realize() - self.dialog.set_title(_(u"Account settings for %s") % (self.user,)) + self.dialog.set_title(_("Account settings for %s") % (self.user,)) self.response = self.dialog.get_response() def save_configuration(self): @@ -198,9 +198,9 @@ class accountSettingsController(globalSettingsController): self.needs_restart = True self.config["general"]["reverse_timelines"] = self.dialog.get_value("general", "reverse_timelines") rt = self.dialog.get_value("general", "retweet_mode") - if rt == _(u"Ask"): + if rt == _("Ask"): self.config["general"]["retweet_mode"] = "ask" - elif rt == _(u"Retweet without comments"): + elif rt == _("Retweet without comments"): self.config["general"]["retweet_mode"] = "direct" else: self.config["general"]["retweet_mode"] = "comment" @@ -271,17 +271,17 @@ class accountSettingsController(globalSettingsController): def get_buffers_list(self): all_buffers=OrderedDict() - all_buffers['home']=_(u"Home") - all_buffers['mentions']=_(u"Mentions") - all_buffers['dm']=_(u"Direct Messages") - all_buffers['sent_dm']=_(u"Sent direct messages") - all_buffers['sent_tweets']=_(u"Sent tweets") - all_buffers['favorites']=_(u"Likes") - all_buffers['followers']=_(u"Followers") - all_buffers['friends']=_(u"Friends") - all_buffers['blocks']=_(u"Blocked users") - all_buffers['muted']=_(u"Muted users") - all_buffers['events']=_(u"Events") + all_buffers['home']=_("Home") + all_buffers['mentions']=_("Mentions") + all_buffers['dm']=_("Direct Messages") + all_buffers['sent_dm']=_("Sent direct messages") + all_buffers['sent_tweets']=_("Sent tweets") + all_buffers['favorites']=_("Likes") + all_buffers['followers']=_("Followers") + all_buffers['friends']=_("Friends") + all_buffers['blocks']=_("Blocked users") + all_buffers['muted']=_("Muted users") + all_buffers['events']=_("Events") list_buffers = [] hidden_buffers=[] for i in list(all_buffers.keys()): diff --git a/src/controller/user.py b/src/controller/user.py index bde78ffb..c5ea59b8 100644 --- a/src/controller/user.py +++ b/src/controller/user.py @@ -26,15 +26,15 @@ class profileController(object): self.get_data(screen_name=self.user) except TwythonError as err: if err.error_code == 404: - wx.MessageDialog(None, _(u"That user does not exist"), _(u"Error"), wx.ICON_ERROR).ShowModal() + wx.MessageDialog(None, _("That user does not exist"), _("Error"), wx.ICON_ERROR).ShowModal() if err.error_code == 403: - wx.MessageDialog(None, _(u"User has been suspended"), _(u"Error"), wx.ICON_ERROR).ShowModal() + wx.MessageDialog(None, _("User has been suspended"), _("Error"), wx.ICON_ERROR).ShowModal() log.error("error %d: %s" % (err.error_code, err.msg)) return self.dialog = show_user.showUserProfile() string = self.get_user_info() self.dialog.set("text", string) - self.dialog.set_title(_(u"Information for %s") % (self.data["screen_name"])) + self.dialog.set_title(_("Information for %s") % (self.data["screen_name"])) if self.data["url"] != None: self.dialog.enable_url() widgetUtils.connect_event(self.dialog.url, widgetUtils.BUTTON_PRESSED, self.visit_url) @@ -64,7 +64,7 @@ class profileController(object): def discard_image(self): self.file = None - output.speak(_(u"Discarded")) + output.speak(_("Discarded")) self.uploaded = False self.dialog.change_upload_button(self.uploaded) @@ -84,43 +84,43 @@ class profileController(object): try: self.session.twitter.twitter.update_profile_image(image=self.file) except TwythonError as e: - output.speak(u"Error %s. %s" % (e.error_code, e.msg)) + output.speak("Error %s. %s" % (e.error_code, e.msg)) try: self.session.twitter.twitter.update_profile(name=name, description=description, location=location, url=url) except TwythonError as e: - output.speak(u"Error %s. %s" % (e.error_code, e.msg)) + output.speak("Error %s. %s" % (e.error_code, e.msg)) def get_user_info(self): - string = u"" - string = string + _(u"Username: @%s\n") % (self.data["screen_name"]) - string = string + _(u"Name: %s\n") % (self.data["name"]) + string = "" + string = string + _("Username: @%s\n") % (self.data["screen_name"]) + string = string + _("Name: %s\n") % (self.data["name"]) if self.data["location"] != "": - string = string + _(u"Location: %s\n") % (self.data["location"]) + string = string + _("Location: %s\n") % (self.data["location"]) if self.data["url"] != None: - string = string+ _(u"URL: %s\n") % (self.data["url"]) + string = string+ _("URL: %s\n") % (self.data["url"]) if self.data["description"] != "": - string = string+ _(u"Bio: %s\n") % (self.data["description"]) - if self.data["protected"] == True: protected = _(u"Yes") - else: protected = _(u"No") - string = string+ _(u"Protected: %s\n") % (protected) + string = string+ _("Bio: %s\n") % (self.data["description"]) + if self.data["protected"] == True: protected = _("Yes") + else: protected = _("No") + string = string+ _("Protected: %s\n") % (protected) if hasattr(self, "friendship_status"): relation = False friendship = "Relationship: " if self.friendship_status["relationship"]["target"]["followed_by"]: - friendship += _(u"You follow {0}. ").format(self.data["name"],) + friendship += _("You follow {0}. ").format(self.data["name"],) relation = True if self.friendship_status["relationship"]["target"]["following"]: - friendship += _(u"{0} is following you.").format(self.data["name"],) + friendship += _("{0} is following you.").format(self.data["name"],) relation = True if relation == True: string = string+friendship+"\n" - string = string+_(u"Followers: %s\n Friends: %s\n") % (self.data["followers_count"], self.data["friends_count"]) - if self.data["verified"] == True: verified = _(u"Yes") - else: verified = _(u"No") - string = string+ _(u"Verified: %s\n") % (verified) - string = string+ _(u"Tweets: %s\n") % (self.data["statuses_count"]) - string = string+ _(u"Likes: %s") % (self.data["favourites_count"]) + string = string+_("Followers: %s\n Friends: %s\n") % (self.data["followers_count"], self.data["friends_count"]) + if self.data["verified"] == True: verified = _("Yes") + else: verified = _("No") + string = string+ _("Verified: %s\n") % (verified) + string = string+ _("Tweets: %s\n") % (self.data["statuses_count"]) + string = string+ _("Likes: %s") % (self.data["favourites_count"]) return string def visit_url(self, *args, **kwargs): diff --git a/src/controller/userActionsController.py b/src/controller/userActionsController.py index 29641efc..35839d93 100644 --- a/src/controller/userActionsController.py +++ b/src/controller/userActionsController.py @@ -73,7 +73,7 @@ class userActionsController(object): def ignore_client(self, user): tweet = self.buffer.get_right_tweet() if "sender" in tweet: - output.speak(_(u"You can't ignore direct messages")) + output.speak(_("You can't ignore direct messages")) return client = re.sub(r"(?s)<.*?>", "", tweet["source"]) if client not in self.session.settings["twitter"]["ignored_clients"]: diff --git a/src/extra/AudioUploader/audioUploader.py b/src/extra/AudioUploader/audioUploader.py index e2716e23..d0a7ccb7 100644 --- a/src/extra/AudioUploader/audioUploader.py +++ b/src/extra/AudioUploader/audioUploader.py @@ -16,7 +16,7 @@ # along with this program. If not, see . # ############################################################ -from __future__ import absolute_import + from builtins import str from builtins import object import widgetUtils @@ -53,7 +53,7 @@ class audioUploader(object): self.postprocess() log.debug("Uploading file %s to %s..." % (self.file, self.dialog.get("services"))) self.uploaderDialog = wx_transfer_dialogs.UploadDialog(self.file) - output.speak(_(u"Attaching...")) + output.speak(_("Attaching...")) if self.dialog.get("services") == "SNDUp": base_url = "http://sndup.net/post.php" if len(self.config["sound"]["sndup_api_key"]) > 0: @@ -70,12 +70,12 @@ class audioUploader(object): return services def on_pause(self, *args, **kwargs): - if self.dialog.get("pause") == _(u"Pause"): + if self.dialog.get("pause") == _("Pause"): self.recording.pause() - self.dialog.set("pause", _(u"&Resume")) - elif self.dialog.get("pause") == _(u"Resume"): + self.dialog.set("pause", _("&Resume")) + elif self.dialog.get("pause") == _("Resume"): self.recording.play() - self.dialog.set("pause", _(U"&Pause")) + self.dialog.set("pause", _("&Pause")) def on_record(self, *args, **kwargs): if self.recording != None: @@ -90,19 +90,19 @@ class audioUploader(object): self.file = tempfile.mktemp(suffix='.wav') self.recording = sound.recording(self.file) self.recording.play() - self.dialog.set("record", _(u"&Stop")) - output.speak(_(u"Recording")) + self.dialog.set("record", _("&Stop")) + output.speak(_("Recording")) def stop_recording(self): self.recording.stop() self.recording.free() - output.speak(_(u"Stopped")) + output.speak(_("Stopped")) self.recorded = True - self.dialog.set("record", _(u"&Record")) + self.dialog.set("record", _("&Record")) self.file_attached() def file_attached(self): - self.dialog.set("pause", _(u"&Pause")) + self.dialog.set("pause", _("&Pause")) self.dialog.disable_control("record") self.dialog.enable_control("play") self.dialog.enable_control("discard") @@ -123,7 +123,7 @@ class audioUploader(object): self.dialog.record.SetFocus() self.dialog.disable_control("discard") self.recording = None - output.speak(_(u"Discarded")) + output.speak(_("Discarded")) def on_play(self, *args, **kwargs): if not self.playing: @@ -132,30 +132,30 @@ class audioUploader(object): self._stop() def _play(self): - output.speak(_(u"Playing...")) + output.speak(_("Playing...")) # try: self.playing = sound_lib.stream.FileStream(file=str(self.file), flags=sound_lib.stream.BASS_UNICODE) self.playing.play() - self.dialog.set("play", _(u"&Stop")) + self.dialog.set("play", _("&Stop")) try: while self.playing.is_playing: pass - self.dialog.set("play", _(u"&Play")) + self.dialog.set("play", _("&Play")) self.playing.free() self.playing = None except: pass def _stop(self): - output.speak(_(u"Stopped")) + output.speak(_("Stopped")) self.playing.stop() self.playing.free() - self.dialog.set("play", _(u"&Play")) + self.dialog.set("play", _("&Play")) self.playing = None def postprocess(self): if self.file.lower().endswith('.wav'): - output.speak(_(u"Recoding audio...")) + output.speak(_("Recoding audio...")) sound.recode_audio(self.file) self.wav_file = self.file self.file = '%s.ogg' % self.file[:-4] diff --git a/src/extra/AudioUploader/transfer.py b/src/extra/AudioUploader/transfer.py index 12da3f23..2c9dc30f 100644 --- a/src/extra/AudioUploader/transfer.py +++ b/src/extra/AudioUploader/transfer.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import -from __future__ import division + + from builtins import object from past.utils import old_div import sys diff --git a/src/extra/AudioUploader/utils.py b/src/extra/AudioUploader/utils.py index 42ee7f4a..a3681c07 100644 --- a/src/extra/AudioUploader/utils.py +++ b/src/extra/AudioUploader/utils.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from __future__ import division + from builtins import str from past.utils import old_div def convert_bytes(n): @@ -27,19 +27,19 @@ def seconds_to_string(seconds, precision=0): sec_string = sec.__format__(sec_spec) string = "" if day == 1: - string += _(u"%d day, ") % day + string += _("%d day, ") % day elif day >= 2: - string += _(u"%d days, ") % day + string += _("%d days, ") % day if (hour == 1): - string += _(u"%d hour, ") % hour + string += _("%d hour, ") % hour elif (hour >= 2): string += _("%d hours, ") % hour if (min == 1): - string += _(u"%d minute, ") % min + string += _("%d minute, ") % min elif (min >= 2): - string += _(u"%d minutes, ") % min + string += _("%d minutes, ") % min if sec >= 0 and sec <= 2: - string += _(u"%s second") % sec_string + string += _("%s second") % sec_string else: - string += _(u"%s seconds") % sec_string + string += _("%s seconds") % sec_string return string \ No newline at end of file diff --git a/src/extra/AudioUploader/wx_transfer_dialogs.py b/src/extra/AudioUploader/wx_transfer_dialogs.py index e8253fdb..31ed8288 100644 --- a/src/extra/AudioUploader/wx_transfer_dialogs.py +++ b/src/extra/AudioUploader/wx_transfer_dialogs.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import + import wx from .utils import * import widgetUtils @@ -11,28 +11,28 @@ class UploadDialog(widgetUtils.BaseDialog): self.pane = wx.Panel(self) self.progress_bar = wx.Gauge(parent=self.pane) fileBox = wx.BoxSizer(wx.HORIZONTAL) - fileLabel = wx.StaticText(self.pane, -1, _(u"File")) + fileLabel = wx.StaticText(self.pane, -1, _("File")) self.file = wx.TextCtrl(self.pane, -1, value=filename, style=wx.TE_READONLY|wx.TE_MULTILINE, size=(200, 100)) self.file.SetFocus() fileBox.Add(fileLabel) fileBox.Add(self.file) currentAmountBox = wx.BoxSizer(wx.HORIZONTAL) - current_amount_label = wx.StaticText(self.pane, -1, _(u"Transferred")) + current_amount_label = wx.StaticText(self.pane, -1, _("Transferred")) self.current_amount = wx.TextCtrl(self.pane, -1, value='0', style=wx.TE_READONLY|wx.TE_MULTILINE) currentAmountBox.Add(current_amount_label) currentAmountBox.Add(self.current_amount) totalSizeBox = wx.BoxSizer(wx.HORIZONTAL) - total_size_label = wx.StaticText(self.pane, -1, _(u"Total file size")) + total_size_label = wx.StaticText(self.pane, -1, _("Total file size")) self.total_size = wx.TextCtrl(self.pane, -1, value='0', style=wx.TE_READONLY|wx.TE_MULTILINE) totalSizeBox.Add(total_size_label) totalSizeBox.Add(self.total_size) speedBox = wx.BoxSizer(wx.HORIZONTAL) - speedLabel = wx.StaticText(self.pane, -1, _(u"Transfer rate")) + speedLabel = wx.StaticText(self.pane, -1, _("Transfer rate")) self.speed = wx.TextCtrl(self.pane, -1, style=wx.TE_READONLY|wx.TE_MULTILINE, value="0 Kb/s") speedBox.Add(speedLabel) speedBox.Add(self.speed) etaBox = wx.BoxSizer(wx.HORIZONTAL) - etaLabel = wx.StaticText(self.pane, -1, _(u"Time left")) + etaLabel = wx.StaticText(self.pane, -1, _("Time left")) self.eta = wx.TextCtrl(self.pane, -1, style=wx.TE_READONLY|wx.TE_MULTILINE, value="Unknown", size=(200, 100)) etaBox.Add(etaLabel) etaBox.Add(self.eta) diff --git a/src/extra/AudioUploader/wx_ui.py b/src/extra/AudioUploader/wx_ui.py index 01d82b58..c61d05f8 100644 --- a/src/extra/AudioUploader/wx_ui.py +++ b/src/extra/AudioUploader/wx_ui.py @@ -1,78 +1,78 @@ -# -*- coding: utf-8 -*- -############################################################ -# Copyright (c) 2013, 2014 Manuel Eduardo Cortéz Vallejo -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -############################################################ -import wx -import widgetUtils -import output -import logging -log = logging.getLogger("extra.AudioUploader.wx_UI") - -class audioDialog(widgetUtils.BaseDialog): - def __init__(self, services): - log.debug("creating audio dialog.") - super(audioDialog, self).__init__(None, -1, _(u"Attach audio")) - panel = wx.Panel(self) - sizer = wx.BoxSizer(wx.VERTICAL) - btnSizer = wx.BoxSizer(wx.HORIZONTAL) - btnSizer2 = wx.BoxSizer(wx.HORIZONTAL) - - self.play = wx.Button(panel, -1, _(u"&Play")) - self.play.Disable() - self.pause = wx.Button(panel, -1, _(u"&Pause")) - self.pause.Disable() - self.record = wx.Button(panel, -1, _(u"&Record")) - self.record.SetFocus() - self.attach_exists = wx.Button(panel, -1, _(u"&Add an existing file")) - self.discard = wx.Button(panel, -1, _(u"&Discard")) - self.discard.Disable() - label = wx.StaticText(panel, -1, _(u"Upload to")) - self.services = wx.ComboBox(panel, -1, choices=services, value=services[0], style=wx.CB_READONLY) - servicesBox = wx.BoxSizer(wx.HORIZONTAL) - servicesBox.Add(label, 0, wx.ALL, 5) - servicesBox.Add(self.services, 0, wx.ALL, 5) - self.attach = wx.Button(panel, wx.ID_OK, _(u"Attach")) - self.attach.Disable() - cancel = wx.Button(panel, wx.ID_CANCEL, _(u"&Cancel")) - btnSizer.Add(self.play, 0, wx.ALL, 5) - btnSizer.Add(self.pause, 0, wx.ALL, 5) - btnSizer.Add(self.record, 0, wx.ALL, 5) - btnSizer2.Add(self.attach_exists, 0, wx.ALL, 5) - btnSizer2.Add(self.discard, 0, wx.ALL, 5) - btnSizer2.Add(self.attach, 0, wx.ALL, 5) - btnSizer2.Add(cancel, 0, wx.ALL, 5) - sizer.Add(servicesBox, 0, wx.ALL, 5) - sizer.Add(btnSizer, 0, wx.ALL, 5) - sizer.Add(btnSizer2, 0, wx.ALL, 5) - panel.SetSizer(sizer) - self.SetClientSize(sizer.CalcMin()) - - def enable_control(self, control): - log.debug("Enabling control %s" % (control,)) - if hasattr(self, control): - getattr(self, control).Enable() - - def disable_control(self, control): - log.debug("Disabling control %s" % (control,)) - if hasattr(self, control): - getattr(self, control).Disable() - - def get_file(self): - openFileDialog = wx.FileDialog(self, _(u"Select the audio file to be uploaded"), "", "", _("Audio Files (*.mp3, *.ogg, *.wav)|*.mp3; *.ogg; *.wav"), wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) - if openFileDialog.ShowModal() == wx.ID_CANCEL: - return False - return openFileDialog.GetPath() +# -*- coding: utf-8 -*- +############################################################ +# Copyright (c) 2013, 2014 Manuel Eduardo Cortéz Vallejo +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +############################################################ +import wx +import widgetUtils +import output +import logging +log = logging.getLogger("extra.AudioUploader.wx_UI") + +class audioDialog(widgetUtils.BaseDialog): + def __init__(self, services): + log.debug("creating audio dialog.") + super(audioDialog, self).__init__(None, -1, _("Attach audio")) + panel = wx.Panel(self) + sizer = wx.BoxSizer(wx.VERTICAL) + btnSizer = wx.BoxSizer(wx.HORIZONTAL) + btnSizer2 = wx.BoxSizer(wx.HORIZONTAL) + + self.play = wx.Button(panel, -1, _("&Play")) + self.play.Disable() + self.pause = wx.Button(panel, -1, _("&Pause")) + self.pause.Disable() + self.record = wx.Button(panel, -1, _("&Record")) + self.record.SetFocus() + self.attach_exists = wx.Button(panel, -1, _("&Add an existing file")) + self.discard = wx.Button(panel, -1, _("&Discard")) + self.discard.Disable() + label = wx.StaticText(panel, -1, _("Upload to")) + self.services = wx.ComboBox(panel, -1, choices=services, value=services[0], style=wx.CB_READONLY) + servicesBox = wx.BoxSizer(wx.HORIZONTAL) + servicesBox.Add(label, 0, wx.ALL, 5) + servicesBox.Add(self.services, 0, wx.ALL, 5) + self.attach = wx.Button(panel, wx.ID_OK, _("Attach")) + self.attach.Disable() + cancel = wx.Button(panel, wx.ID_CANCEL, _("&Cancel")) + btnSizer.Add(self.play, 0, wx.ALL, 5) + btnSizer.Add(self.pause, 0, wx.ALL, 5) + btnSizer.Add(self.record, 0, wx.ALL, 5) + btnSizer2.Add(self.attach_exists, 0, wx.ALL, 5) + btnSizer2.Add(self.discard, 0, wx.ALL, 5) + btnSizer2.Add(self.attach, 0, wx.ALL, 5) + btnSizer2.Add(cancel, 0, wx.ALL, 5) + sizer.Add(servicesBox, 0, wx.ALL, 5) + sizer.Add(btnSizer, 0, wx.ALL, 5) + sizer.Add(btnSizer2, 0, wx.ALL, 5) + panel.SetSizer(sizer) + self.SetClientSize(sizer.CalcMin()) + + def enable_control(self, control): + log.debug("Enabling control %s" % (control,)) + if hasattr(self, control): + getattr(self, control).Enable() + + def disable_control(self, control): + log.debug("Disabling control %s" % (control,)) + if hasattr(self, control): + getattr(self, control).Disable() + + def get_file(self): + openFileDialog = wx.FileDialog(self, _("Select the audio file to be uploaded"), "", "", _("Audio Files (*.mp3, *.ogg, *.wav)|*.mp3; *.ogg; *.wav"), wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) + if openFileDialog.ShowModal() == wx.ID_CANCEL: + return False + return openFileDialog.GetPath() diff --git a/src/extra/SoundsTutorial/__init__.py b/src/extra/SoundsTutorial/__init__.py index 950f0a16..015584de 100644 --- a/src/extra/SoundsTutorial/__init__.py +++ b/src/extra/SoundsTutorial/__init__.py @@ -1,2 +1,2 @@ -from __future__ import absolute_import + from .soundsTutorial import soundsTutorial diff --git a/src/extra/SoundsTutorial/soundsTutorial.py b/src/extra/SoundsTutorial/soundsTutorial.py index a01ca803..c607b6bf 100644 --- a/src/extra/SoundsTutorial/soundsTutorial.py +++ b/src/extra/SoundsTutorial/soundsTutorial.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import + from builtins import object import platform import widgetUtils diff --git a/src/extra/SoundsTutorial/soundsTutorial_constants.py b/src/extra/SoundsTutorial/soundsTutorial_constants.py index bed91d68..e4f79ed8 100644 --- a/src/extra/SoundsTutorial/soundsTutorial_constants.py +++ b/src/extra/SoundsTutorial/soundsTutorial_constants.py @@ -1,30 +1,30 @@ #-*- coding: utf-8 -*- -from __future__ import absolute_import + #-*- coding: utf-8 -*- from . import reverse_sort import application -actions = reverse_sort.reverse_sort([ ("audio", _(u"Audio tweet.")), - ("create_timeline", _(u"User timeline buffer created.")), - ("delete_timeline", _(u"Buffer destroied.")), - ("dm_received", _(u"Direct message received.")), - ("dm_sent", _(u"Direct message sent.")), - ("error", _(u"Error.")), - ("favourite", _(u"Tweet liked.")), - ("favourites_timeline_updated", _(u"Likes buffer updated.")), - ("geo", _(u"Geotweet.")), +actions = reverse_sort.reverse_sort([ ("audio", _("Audio tweet.")), + ("create_timeline", _("User timeline buffer created.")), + ("delete_timeline", _("Buffer destroied.")), + ("dm_received", _("Direct message received.")), + ("dm_sent", _("Direct message sent.")), + ("error", _("Error.")), + ("favourite", _("Tweet liked.")), + ("favourites_timeline_updated", _("Likes buffer updated.")), + ("geo", _("Geotweet.")), ("image", _("Tweet contains one or more images")), -("limit", _(u"Boundary reached.")), - ("list_tweet", _(u"List updated.")), - ("max_length", _(u"Too many characters.")), - ("mention_received", _(u"Mention received.")), - ("new_event", _(u"New event.")), - ("ready", _(u"{0} is ready.").format(application.name,)), - ("reply_send", _(u"Mention sent.")), - ("retweet_send", _(u"Tweet retweeted.")), - ("search_updated", _(u"Search buffer updated.")), - ("tweet_received", _(u"Tweet received.")), - ("tweet_send", _(u"Tweet sent.")), - ("trends_updated", _(u"Trending topics buffer updated.")), - ("tweet_timeline", _(u"New tweet in user timeline buffer.")), - ("update_followers", _(u"New follower.")), - ("volume_changed", _(u"Volume changed."))]) +("limit", _("Boundary reached.")), + ("list_tweet", _("List updated.")), + ("max_length", _("Too many characters.")), + ("mention_received", _("Mention received.")), + ("new_event", _("New event.")), + ("ready", _("{0} is ready.").format(application.name,)), + ("reply_send", _("Mention sent.")), + ("retweet_send", _("Tweet retweeted.")), + ("search_updated", _("Search buffer updated.")), + ("tweet_received", _("Tweet received.")), + ("tweet_send", _("Tweet sent.")), + ("trends_updated", _("Trending topics buffer updated.")), + ("tweet_timeline", _("New tweet in user timeline buffer.")), + ("update_followers", _("New follower.")), + ("volume_changed", _("Volume changed."))]) diff --git a/src/extra/SoundsTutorial/wx_ui.py b/src/extra/SoundsTutorial/wx_ui.py index d3480add..cd8cc994 100644 --- a/src/extra/SoundsTutorial/wx_ui.py +++ b/src/extra/SoundsTutorial/wx_ui.py @@ -1,29 +1,29 @@ -# -*- coding: utf-8 -*- -import wx -import widgetUtils - -class soundsTutorialDialog(widgetUtils.BaseDialog): - def __init__(self, actions): - super(soundsTutorialDialog, self).__init__(None, -1) - self.SetTitle(_(u"Sounds tutorial")) - panel = wx.Panel(self) - sizer = wx.BoxSizer(wx.VERTICAL) - label = wx.StaticText(panel, -1, _(u"Press enter to listen to the sound for the selected event")) - self.items = wx.ListBox(panel, 1, choices=actions, style=wx.LB_SINGLE) - self.items.SetSelection(0) - listBox = wx.BoxSizer(wx.HORIZONTAL) - listBox.Add(label) - listBox.Add(self.items) - self.play = wx.Button(panel, 1, (u"Play")) - self.play.SetDefault() - close = wx.Button(panel, wx.ID_CANCEL) - btnBox = wx.BoxSizer(wx.HORIZONTAL) - btnBox.Add(self.play) - btnBox.Add(close) - sizer.Add(listBox) - sizer.Add(btnBox) - panel.SetSizer(sizer) - self.SetClientSize(sizer.CalcMin()) - - def get_selection(self): +# -*- coding: utf-8 -*- +import wx +import widgetUtils + +class soundsTutorialDialog(widgetUtils.BaseDialog): + def __init__(self, actions): + super(soundsTutorialDialog, self).__init__(None, -1) + self.SetTitle(_("Sounds tutorial")) + panel = wx.Panel(self) + sizer = wx.BoxSizer(wx.VERTICAL) + label = wx.StaticText(panel, -1, _("Press enter to listen to the sound for the selected event")) + self.items = wx.ListBox(panel, 1, choices=actions, style=wx.LB_SINGLE) + self.items.SetSelection(0) + listBox = wx.BoxSizer(wx.HORIZONTAL) + listBox.Add(label) + listBox.Add(self.items) + self.play = wx.Button(panel, 1, ("Play")) + self.play.SetDefault() + close = wx.Button(panel, wx.ID_CANCEL) + btnBox = wx.BoxSizer(wx.HORIZONTAL) + btnBox.Add(self.play) + btnBox.Add(close) + sizer.Add(listBox) + sizer.Add(btnBox) + panel.SetSizer(sizer) + self.SetClientSize(sizer.CalcMin()) + + def get_selection(self): return self.items.GetSelection() \ No newline at end of file diff --git a/src/extra/SpellChecker/__init__.py b/src/extra/SpellChecker/__init__.py index 7cae11b7..235df169 100644 --- a/src/extra/SpellChecker/__init__.py +++ b/src/extra/SpellChecker/__init__.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from . import spellchecker import platform if platform.system() == "Windows": diff --git a/src/extra/SpellChecker/spellchecker.py b/src/extra/SpellChecker/spellchecker.py index 67a9b90a..b0024f9d 100644 --- a/src/extra/SpellChecker/spellchecker.py +++ b/src/extra/SpellChecker/spellchecker.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import + from builtins import next from builtins import object import logging @@ -45,8 +45,8 @@ class spellChecker(object): def check(self): try: next(self.checker) - textToSay = _(u"Misspelled word: %s") % (self.checker.word,) - context = u"... %s %s %s" % (self.checker.leading_context(10), self.checker.word, self.checker.trailing_context(10)) + textToSay = _("Misspelled word: %s") % (self.checker.word,) + context = "... %s %s %s" % (self.checker.leading_context(10), self.checker.word, self.checker.trailing_context(10)) self.dialog.set_title(textToSay) output.speak(textToSay) self.dialog.set_word_and_suggestions(word=self.checker.word, context=context, suggestions=self.checker.suggest()) diff --git a/src/extra/SpellChecker/wx_ui.py b/src/extra/SpellChecker/wx_ui.py index 407c0119..74d1a32a 100644 --- a/src/extra/SpellChecker/wx_ui.py +++ b/src/extra/SpellChecker/wx_ui.py @@ -1,79 +1,79 @@ -# -*- coding: utf-8 -*- -############################################################ -# Copyright (c) 2013, 2014 Manuel Eduardo Cortéz Vallejo -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -############################################################ -import wx -import application -class spellCheckerDialog(wx.Dialog): - def __init__(self): - super(spellCheckerDialog, self).__init__(None, 1) - panel = wx.Panel(self) - sizer = wx.BoxSizer(wx.VERTICAL) - word = wx.StaticText(panel, -1, _(u"Misspelled word")) - self.word = wx.TextCtrl(panel, -1) - wordBox = wx.BoxSizer(wx.HORIZONTAL) - wordBox.Add(word, 0, wx.ALL, 5) - wordBox.Add(self.word, 0, wx.ALL, 5) - context = wx.StaticText(panel, -1, _(u"Context")) - self.context = wx.TextCtrl(panel, -1) - contextBox = wx.BoxSizer(wx.HORIZONTAL) - contextBox.Add(context, 0, wx.ALL, 5) - contextBox.Add(self.context, 0, wx.ALL, 5) - suggest = wx.StaticText(panel, -1, _(u"Suggestions")) - self.suggestions = wx.ListBox(panel, -1, choices=[], style=wx.LB_SINGLE) - suggestionsBox = wx.BoxSizer(wx.HORIZONTAL) - suggestionsBox.Add(suggest, 0, wx.ALL, 5) - suggestionsBox.Add(self.suggestions, 0, wx.ALL, 5) - self.ignore = wx.Button(panel, -1, _(u"Ignore")) - self.ignoreAll = wx.Button(panel, -1, _(u"Ignore all")) - self.replace = wx.Button(panel, -1, _(u"Replace")) - self.replaceAll = wx.Button(panel, -1, _(u"Replace all")) - close = wx.Button(panel, wx.ID_CANCEL) - btnBox = wx.BoxSizer(wx.HORIZONTAL) - btnBox.Add(self.ignore, 0, wx.ALL, 5) - btnBox.Add(self.ignoreAll, 0, wx.ALL, 5) - btnBox.Add(self.replace, 0, wx.ALL, 5) - btnBox.Add(self.replaceAll, 0, wx.ALL, 5) - btnBox.Add(close, 0, wx.ALL, 5) - sizer.Add(wordBox, 0, wx.ALL, 5) - sizer.Add(contextBox, 0, wx.ALL, 5) - sizer.Add(suggestionsBox, 0, wx.ALL, 5) - sizer.Add(btnBox, 0, wx.ALL, 5) - panel.SetSizer(sizer) - self.SetClientSize(sizer.CalcMin()) - - - def get_response(self): - return self.ShowModal() - - def set_title(self, title): - return self.SetTitle(title) - - def set_word_and_suggestions(self, word, context, suggestions): - self.word.SetValue(word) - self.context.ChangeValue(context) - self.suggestions.Set(suggestions) - self.suggestions.SetFocus() - - def get_selected_suggestion(self): - return self.suggestions.GetStringSelection() - -def dict_not_found_error(): - wx.MessageDialog(None, _(u"An error has occurred. There are no dictionaries available for the selected language in {0}").format(application.name,), _(u"Error"), wx.ICON_ERROR).ShowModal() - -def finished(): - wx.MessageDialog(None, _(u"Spell check complete."), application.name, style=wx.OK).ShowModal() +# -*- coding: utf-8 -*- +############################################################ +# Copyright (c) 2013, 2014 Manuel Eduardo Cortéz Vallejo +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +############################################################ +import wx +import application +class spellCheckerDialog(wx.Dialog): + def __init__(self): + super(spellCheckerDialog, self).__init__(None, 1) + panel = wx.Panel(self) + sizer = wx.BoxSizer(wx.VERTICAL) + word = wx.StaticText(panel, -1, _("Misspelled word")) + self.word = wx.TextCtrl(panel, -1) + wordBox = wx.BoxSizer(wx.HORIZONTAL) + wordBox.Add(word, 0, wx.ALL, 5) + wordBox.Add(self.word, 0, wx.ALL, 5) + context = wx.StaticText(panel, -1, _("Context")) + self.context = wx.TextCtrl(panel, -1) + contextBox = wx.BoxSizer(wx.HORIZONTAL) + contextBox.Add(context, 0, wx.ALL, 5) + contextBox.Add(self.context, 0, wx.ALL, 5) + suggest = wx.StaticText(panel, -1, _("Suggestions")) + self.suggestions = wx.ListBox(panel, -1, choices=[], style=wx.LB_SINGLE) + suggestionsBox = wx.BoxSizer(wx.HORIZONTAL) + suggestionsBox.Add(suggest, 0, wx.ALL, 5) + suggestionsBox.Add(self.suggestions, 0, wx.ALL, 5) + self.ignore = wx.Button(panel, -1, _("Ignore")) + self.ignoreAll = wx.Button(panel, -1, _("Ignore all")) + self.replace = wx.Button(panel, -1, _("Replace")) + self.replaceAll = wx.Button(panel, -1, _("Replace all")) + close = wx.Button(panel, wx.ID_CANCEL) + btnBox = wx.BoxSizer(wx.HORIZONTAL) + btnBox.Add(self.ignore, 0, wx.ALL, 5) + btnBox.Add(self.ignoreAll, 0, wx.ALL, 5) + btnBox.Add(self.replace, 0, wx.ALL, 5) + btnBox.Add(self.replaceAll, 0, wx.ALL, 5) + btnBox.Add(close, 0, wx.ALL, 5) + sizer.Add(wordBox, 0, wx.ALL, 5) + sizer.Add(contextBox, 0, wx.ALL, 5) + sizer.Add(suggestionsBox, 0, wx.ALL, 5) + sizer.Add(btnBox, 0, wx.ALL, 5) + panel.SetSizer(sizer) + self.SetClientSize(sizer.CalcMin()) + + + def get_response(self): + return self.ShowModal() + + def set_title(self, title): + return self.SetTitle(title) + + def set_word_and_suggestions(self, word, context, suggestions): + self.word.SetValue(word) + self.context.ChangeValue(context) + self.suggestions.Set(suggestions) + self.suggestions.SetFocus() + + def get_selected_suggestion(self): + return self.suggestions.GetStringSelection() + +def dict_not_found_error(): + wx.MessageDialog(None, _("An error has occurred. There are no dictionaries available for the selected language in {0}").format(application.name,), _("Error"), wx.ICON_ERROR).ShowModal() + +def finished(): + wx.MessageDialog(None, _("Spell check complete."), application.name, style=wx.OK).ShowModal() diff --git a/src/extra/autocompletionUsers/__init__.py b/src/extra/autocompletionUsers/__init__.py index 02a417fc..58d6be9e 100644 --- a/src/extra/autocompletionUsers/__init__.py +++ b/src/extra/autocompletionUsers/__init__.py @@ -1,4 +1,4 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import + # -*- coding: utf-8 -*- from . import completion, settings \ No newline at end of file diff --git a/src/extra/autocompletionUsers/completion.py b/src/extra/autocompletionUsers/completion.py index 341d70ba..5f384598 100644 --- a/src/extra/autocompletionUsers/completion.py +++ b/src/extra/autocompletionUsers/completion.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import + from builtins import object import output from . import storage @@ -19,7 +19,7 @@ class autocompletionUsers(object): try: pattern = text.split()[-1] except IndexError: - output.speak(_(u"You have to start writing")) + output.speak(_("You have to start writing")) return if pattern.startswith("@") == True: menu = wx_menu.menu(self.window.text, pattern[1:], mode=mode) @@ -29,15 +29,15 @@ class autocompletionUsers(object): self.window.popup_menu(menu) menu.destroy() else: - output.speak(_(u"There are no results in your users database")) + output.speak(_("There are no results in your users database")) else: - output.speak(_(u"Autocompletion only works for users.")) + output.speak(_("Autocompletion only works for users.")) elif mode == "dm": text = self.window.get_user() try: pattern = text.split()[-1] except IndexError: - output.speak(_(u"You have to start writing")) + output.speak(_("You have to start writing")) return menu = wx_menu.menu(self.window.cb, pattern, mode=mode) users = self.db.get_users(pattern) @@ -46,4 +46,4 @@ class autocompletionUsers(object): self.window.popup_menu(menu) menu.destroy() else: - output.speak(_(u"There are no results in your users database")) \ No newline at end of file + output.speak(_("There are no results in your users database")) \ No newline at end of file diff --git a/src/extra/autocompletionUsers/manage.py b/src/extra/autocompletionUsers/manage.py index 3ecbbbe8..85cc1a05 100644 --- a/src/extra/autocompletionUsers/manage.py +++ b/src/extra/autocompletionUsers/manage.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import + # -*- coding: utf-8 -*- from builtins import object from . import storage diff --git a/src/extra/autocompletionUsers/settings.py b/src/extra/autocompletionUsers/settings.py index 6783ccfe..13a28ec7 100644 --- a/src/extra/autocompletionUsers/settings.py +++ b/src/extra/autocompletionUsers/settings.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import + # -*- coding: utf-8 -*- from builtins import object from . import storage @@ -25,7 +25,7 @@ class autocompletionSettings(object): def add_users_to_database(self): self.config["mysc"]["save_friends_in_autocompletion_db"] = self.dialog.get("friends_buffer") self.config["mysc"]["save_followers_in_autocompletion_db"] = self.dialog.get("followers_buffer") - output.speak(_(u"Updating database... You can close this window now. A message will tell you when the process finishes.")) + output.speak(_("Updating database... You can close this window now. A message will tell you when the process finishes.")) database = storage.storage(self.buffer.session.session_id) if self.dialog.get("followers_buffer") == True: buffer = self.window.search_buffer("followers", self.config["twitter"]["user_name"]) diff --git a/src/extra/autocompletionUsers/wx_manage.py b/src/extra/autocompletionUsers/wx_manage.py index 789d2419..f725fbda 100644 --- a/src/extra/autocompletionUsers/wx_manage.py +++ b/src/extra/autocompletionUsers/wx_manage.py @@ -1,43 +1,43 @@ -# -*- coding: utf-8 -*- -import wx -import widgetUtils -from multiplatform_widgets import widgets -import application -class autocompletionManageDialog(widgetUtils.BaseDialog): - def __init__(self): - super(autocompletionManageDialog, self).__init__(parent=None, id=-1, title=_(u"Manage Autocompletion database")) - panel = wx.Panel(self) - sizer = wx.BoxSizer(wx.VERTICAL) - label = wx.StaticText(panel, -1, _(u"Editing {0} users database").format(application.name,)) - 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 user")) - self.remove = wx.Button(panel, -1, _(u"Remove user")) - optionsBox = wx.BoxSizer(wx.HORIZONTAL) - optionsBox.Add(self.add, 0, wx.ALL, 5) - optionsBox.Add(self.remove, 0, wx.ALL, 5) - sizer.Add(optionsBox, 0, wx.ALL, 5) - ok = wx.Button(panel, wx.ID_OK) - cancel = wx.Button(panel, wx.ID_CANCEL) - sizerBtn = wx.BoxSizer(wx.HORIZONTAL) - sizerBtn.Add(ok, 0, wx.ALL, 5) - sizer.Add(cancel, 0, wx.ALL, 5) - sizer.Add(sizerBtn, 0, wx.ALL, 5) - panel.SetSizer(sizer) - self.SetClientSize(sizer.CalcMin()) - - def put_users(self, users): - for i in users: - j = [i[0], i[1]] - self.users.insert_item(False, *j) - - def get_user(self): - usr = False - userDlg = wx.TextEntryDialog(None, _(u"Twitter username"), _(u"Add user to database")) - if userDlg.ShowModal() == wx.ID_OK: - usr = userDlg.GetValue() - return usr - - def show_invalid_user_error(self): - wx.MessageDialog(None, _(u"The user does not exist"), _(u"Error!"), wx.ICON_ERROR).ShowModal() \ No newline at end of file +# -*- coding: utf-8 -*- +import wx +import widgetUtils +from multiplatform_widgets import widgets +import application +class autocompletionManageDialog(widgetUtils.BaseDialog): + def __init__(self): + super(autocompletionManageDialog, self).__init__(parent=None, id=-1, title=_("Manage Autocompletion database")) + panel = wx.Panel(self) + sizer = wx.BoxSizer(wx.VERTICAL) + label = wx.StaticText(panel, -1, _("Editing {0} users database").format(application.name,)) + self.users = widgets.list(panel, _("Username"), _("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, _("Add user")) + self.remove = wx.Button(panel, -1, _("Remove user")) + optionsBox = wx.BoxSizer(wx.HORIZONTAL) + optionsBox.Add(self.add, 0, wx.ALL, 5) + optionsBox.Add(self.remove, 0, wx.ALL, 5) + sizer.Add(optionsBox, 0, wx.ALL, 5) + ok = wx.Button(panel, wx.ID_OK) + cancel = wx.Button(panel, wx.ID_CANCEL) + sizerBtn = wx.BoxSizer(wx.HORIZONTAL) + sizerBtn.Add(ok, 0, wx.ALL, 5) + sizer.Add(cancel, 0, wx.ALL, 5) + sizer.Add(sizerBtn, 0, wx.ALL, 5) + panel.SetSizer(sizer) + self.SetClientSize(sizer.CalcMin()) + + def put_users(self, users): + for i in users: + j = [i[0], i[1]] + self.users.insert_item(False, *j) + + def get_user(self): + usr = False + userDlg = wx.TextEntryDialog(None, _("Twitter username"), _("Add user to database")) + if userDlg.ShowModal() == wx.ID_OK: + usr = userDlg.GetValue() + return usr + + def show_invalid_user_error(self): + wx.MessageDialog(None, _("The user does not exist"), _("Error!"), wx.ICON_ERROR).ShowModal() \ No newline at end of file diff --git a/src/extra/autocompletionUsers/wx_settings.py b/src/extra/autocompletionUsers/wx_settings.py index 068decf6..26c7a512 100644 --- a/src/extra/autocompletionUsers/wx_settings.py +++ b/src/extra/autocompletionUsers/wx_settings.py @@ -1,27 +1,27 @@ -# -*- coding: utf-8 -*- -import wx -import widgetUtils -import application - -class autocompletionSettingsDialog(widgetUtils.BaseDialog): - def __init__(self): - super(autocompletionSettingsDialog, self).__init__(parent=None, id=-1, title=_(u"Autocomplete users' settings")) - panel = wx.Panel(self) - sizer = wx.BoxSizer(wx.VERTICAL) - self.followers_buffer = wx.CheckBox(panel, -1, _(u"Add users from followers buffer")) - 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"Manage database...")) - sizer.Add(self.viewList, 0, wx.ALL, 5) - ok = wx.Button(panel, wx.ID_OK) - cancel = wx.Button(panel, wx.ID_CANCEL) - sizerBtn = wx.BoxSizer(wx.HORIZONTAL) - sizerBtn.Add(ok, 0, wx.ALL, 5) - sizer.Add(cancel, 0, wx.ALL, 5) - sizer.Add(sizerBtn, 0, wx.ALL, 5) - panel.SetSizer(sizer) - self.SetClientSize(sizer.CalcMin()) - -def show_success_dialog(): - wx.MessageDialog(None, _(u"{0}'s database of users has been updated.").format(application.name,), _(u"Done"), wx.OK).ShowModal() \ No newline at end of file +# -*- coding: utf-8 -*- +import wx +import widgetUtils +import application + +class autocompletionSettingsDialog(widgetUtils.BaseDialog): + def __init__(self): + super(autocompletionSettingsDialog, self).__init__(parent=None, id=-1, title=_("Autocomplete users' settings")) + panel = wx.Panel(self) + sizer = wx.BoxSizer(wx.VERTICAL) + self.followers_buffer = wx.CheckBox(panel, -1, _("Add users from followers buffer")) + self.friends_buffer = wx.CheckBox(panel, -1, _("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, _("Manage database...")) + sizer.Add(self.viewList, 0, wx.ALL, 5) + ok = wx.Button(panel, wx.ID_OK) + cancel = wx.Button(panel, wx.ID_CANCEL) + sizerBtn = wx.BoxSizer(wx.HORIZONTAL) + sizerBtn.Add(ok, 0, wx.ALL, 5) + sizer.Add(cancel, 0, wx.ALL, 5) + sizer.Add(sizerBtn, 0, wx.ALL, 5) + panel.SetSizer(sizer) + self.SetClientSize(sizer.CalcMin()) + +def show_success_dialog(): + wx.MessageDialog(None, _("{0}'s database of users has been updated.").format(application.name,), _("Done"), wx.OK).ShowModal() \ No newline at end of file diff --git a/src/extra/ocr/OCRSpace.py b/src/extra/ocr/OCRSpace.py index a88a92f7..7fc7e18d 100644 --- a/src/extra/ocr/OCRSpace.py +++ b/src/extra/ocr/OCRSpace.py @@ -3,7 +3,7 @@ from builtins import object import requests -translatable_langs = [_(u"Detect automatically"), _(u"Danish"), _(u"Dutch"), _(u"English"), _(u"Finnish"), _(u"French"), _(u"German"), _(u"Hungarian"), _(u"Korean"), _(u"Italian"), _(u"Japanese"), _(u"Polish"), _(u"Portuguese"), _(u"Russian"), _(u"Spanish"), _(u"Turkish")] +translatable_langs = [_("Detect automatically"), _("Danish"), _("Dutch"), _("English"), _("Finnish"), _("French"), _("German"), _("Hungarian"), _("Korean"), _("Italian"), _("Japanese"), _("Polish"), _("Portuguese"), _("Russian"), _("Spanish"), _("Turkish")] short_langs = ["", "da", "du", "en", "fi", "fr", "de", "hu", "ko", "it", "ja", "pl", "pt", "ru", "es", "tr"] OcrLangs = ["", "dan", "dut", "eng", "fin", "fre", "ger", "hun", "kor", "ita", "jpn", "pol", "por", "rus", "spa", "tur"] diff --git a/src/extra/ocr/__init__.py b/src/extra/ocr/__init__.py index 00b69bd8..6ae0c53d 100644 --- a/src/extra/ocr/__init__.py +++ b/src/extra/ocr/__init__.py @@ -1,4 +1,4 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import + # -*- coding: utf-8 -*- from . import OCRSpace \ No newline at end of file diff --git a/src/extra/translator/__init__.py b/src/extra/translator/__init__.py index 41de421d..9012b939 100644 --- a/src/extra/translator/__init__.py +++ b/src/extra/translator/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import + from . import translator import platform if platform.system() == "Windows": diff --git a/src/extra/translator/translator.py b/src/extra/translator/translator.py index 01dd51ef..f2c39a6d 100644 --- a/src/extra/translator/translator.py +++ b/src/extra/translator/translator.py @@ -8,102 +8,102 @@ def translate(text="", source="auto", target="en"): languages = { - "af": _(u"Afrikaans"), - "sq": _(u"Albanian"), - "am": _(u"Amharic"), - "ar": _(u"Arabic"), - "hy": _(u"Armenian"), - "az": _(u"Azerbaijani"), - "eu": _(u"Basque"), - "be": _(u"Belarusian"), - "bn": _(u"Bengali"), - "bh": _(u"Bihari"), - "bg": _(u"Bulgarian"), - "my": _(u"Burmese"), - "ca": _(u"Catalan"), - "chr": _(u"Cherokee"), - "zh": _(u"Chinese"), - "zh-CN": _(u"Chinese_simplified"), - "zh-TW": _(u"Chinese_traditional"), - "hr": _(u"Croatian"), - "cs": _(u"Czech"), - "da": _(u"Danish"), - "dv": _(u"Dhivehi"), - "nl": _(u"Dutch"), - "en": _(u"English"), - "eo": _(u"Esperanto"), - "et": _(u"Estonian"), - "tl": _(u"Filipino"), - "fi": _(u"Finnish"), - "fr": _(u"French"), - "gl": _(u"Galician"), - "ka": _(u"Georgian"), - "de": _(u"German"), - "el": _(u"Greek"), - "gn": _(u"Guarani"), - "gu": _(u"Gujarati"), - "iw": _(u"Hebrew"), - "hi": _(u"Hindi"), - "hu": _(u"Hungarian"), - "is": _(u"Icelandic"), - "id": _(u"Indonesian"), - "iu": _(u"Inuktitut"), - "ga": _(u"Irish"), - "it": _(u"Italian"), - "ja": _(u"Japanese"), - "kn": _(u"Kannada"), - "kk": _(u"Kazakh"), - "km": _(u"Khmer"), - "ko": _(u"Korean"), - "ku": _(u"Kurdish"), - "ky": _(u"Kyrgyz"), - "lo": _(u"Laothian"), - "lv": _(u"Latvian"), - "lt": _(u"Lithuanian"), - "mk": _(u"Macedonian"), - "ms": _(u"Malay"), - "ml": _(u"Malayalam"), - "mt": _(u"Maltese"), - "mr": _(u"Marathi"), - "mn": _(u"Mongolian"), - "ne": _(u"Nepali"), - "no": _(u"Norwegian"), - "or": _(u"Oriya"), - "ps": _(u"Pashto"), - "fa": _(u"Persian"), - "pl": _(u"Polish"), - "pt-PT": _(u"Portuguese"), - "pa": _(u"Punjabi"), - "ro": _(u"Romanian"), - "ru": _(u"Russian"), - "sa": _(u"Sanskrit"), - "sr": _(u"Serbian"), - "sd": _(u"Sindhi"), - "si": _(u"Sinhalese"), - "sk": _(u"Slovak"), - "sl": _(u"Slovenian"), - "es": _(u"Spanish"), - "sw": _(u"Swahili"), - "sv": _(u"Swedish"), - "tg": _(u"Tajik"), - "ta": _(u"Tamil"), - "tl": _(u"Tagalog"), - "te": _(u"Telugu"), - "th": _(u"Thai"), - "bo": _(u"Tibetan"), - "tr": _(u"Turkish"), - "uk": _(u"Ukrainian"), - "ur": _(u"Urdu"), - "uz": _(u"Uzbek"), - "ug": _(u"Uighur"), - "vi": _(u"Vietnamese"), - "cy": _(u"Welsh"), - "yi": _(u"Yiddish") + "af": _("Afrikaans"), + "sq": _("Albanian"), + "am": _("Amharic"), + "ar": _("Arabic"), + "hy": _("Armenian"), + "az": _("Azerbaijani"), + "eu": _("Basque"), + "be": _("Belarusian"), + "bn": _("Bengali"), + "bh": _("Bihari"), + "bg": _("Bulgarian"), + "my": _("Burmese"), + "ca": _("Catalan"), + "chr": _("Cherokee"), + "zh": _("Chinese"), + "zh-CN": _("Chinese_simplified"), + "zh-TW": _("Chinese_traditional"), + "hr": _("Croatian"), + "cs": _("Czech"), + "da": _("Danish"), + "dv": _("Dhivehi"), + "nl": _("Dutch"), + "en": _("English"), + "eo": _("Esperanto"), + "et": _("Estonian"), + "tl": _("Filipino"), + "fi": _("Finnish"), + "fr": _("French"), + "gl": _("Galician"), + "ka": _("Georgian"), + "de": _("German"), + "el": _("Greek"), + "gn": _("Guarani"), + "gu": _("Gujarati"), + "iw": _("Hebrew"), + "hi": _("Hindi"), + "hu": _("Hungarian"), + "is": _("Icelandic"), + "id": _("Indonesian"), + "iu": _("Inuktitut"), + "ga": _("Irish"), + "it": _("Italian"), + "ja": _("Japanese"), + "kn": _("Kannada"), + "kk": _("Kazakh"), + "km": _("Khmer"), + "ko": _("Korean"), + "ku": _("Kurdish"), + "ky": _("Kyrgyz"), + "lo": _("Laothian"), + "lv": _("Latvian"), + "lt": _("Lithuanian"), + "mk": _("Macedonian"), + "ms": _("Malay"), + "ml": _("Malayalam"), + "mt": _("Maltese"), + "mr": _("Marathi"), + "mn": _("Mongolian"), + "ne": _("Nepali"), + "no": _("Norwegian"), + "or": _("Oriya"), + "ps": _("Pashto"), + "fa": _("Persian"), + "pl": _("Polish"), + "pt-PT": _("Portuguese"), + "pa": _("Punjabi"), + "ro": _("Romanian"), + "ru": _("Russian"), + "sa": _("Sanskrit"), + "sr": _("Serbian"), + "sd": _("Sindhi"), + "si": _("Sinhalese"), + "sk": _("Slovak"), + "sl": _("Slovenian"), + "es": _("Spanish"), + "sw": _("Swahili"), + "sv": _("Swedish"), + "tg": _("Tajik"), + "ta": _("Tamil"), + "tl": _("Tagalog"), + "te": _("Telugu"), + "th": _("Thai"), + "bo": _("Tibetan"), + "tr": _("Turkish"), + "uk": _("Ukrainian"), + "ur": _("Urdu"), + "uz": _("Uzbek"), + "ug": _("Uighur"), + "vi": _("Vietnamese"), + "cy": _("Welsh"), + "yi": _("Yiddish") } def available_languages(): l = list(languages.keys()) d = list(languages.values()) l.insert(0, '') - d.insert(0, _(u"autodetect")) + d.insert(0, _("autodetect")) return sorted(zip(l, d)) diff --git a/src/extra/translator/wx_ui.py b/src/extra/translator/wx_ui.py index 29032146..4c145bd5 100644 --- a/src/extra/translator/wx_ui.py +++ b/src/extra/translator/wx_ui.py @@ -16,7 +16,7 @@ # along with this program. If not, see . # ############################################################ -from __future__ import absolute_import + # -*- coding: utf-8 -*- ############################################################ # Copyright (c) 2013, 2014 Manuel Eduardo Cortéz Vallejo @@ -41,13 +41,13 @@ from wxUI.dialogs import baseDialog class translateDialog(baseDialog.BaseWXDialog): def __init__(self): - super(translateDialog, self).__init__(None, -1, title=_(u"Translate message")) + super(translateDialog, self).__init__(None, -1, title=_("Translate message")) panel = wx.Panel(self) sizer = wx.BoxSizer(wx.VERTICAL) - staticSource = wx.StaticText(panel, -1, _(u"Source language")) + staticSource = wx.StaticText(panel, -1, _("Source language")) self.source_lang = wx.ComboBox(panel, -1, choices=[x[1] for x in translator.available_languages()], style = wx.CB_READONLY) self.source_lang.SetFocus() - staticDest = wx.StaticText(panel, -1, _(u"Target language")) + staticDest = wx.StaticText(panel, -1, _("Target language")) self.source_lang.SetSelection(0) self.dest_lang = wx.ComboBox(panel, -1, choices=[x[1] for x in translator.available_languages()], style = wx.CB_READONLY) listSizer = wx.BoxSizer(wx.HORIZONTAL) diff --git a/src/fixes/__init__.py b/src/fixes/__init__.py index 9c80907f..bf07cfb6 100644 --- a/src/fixes/__init__.py +++ b/src/fixes/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- """ This module contains some bugfixes for packages used in TWBlue.""" -from __future__ import absolute_import + import sys from . import fix_arrow # A few new locales for Three languages in arrow. from . import fix_urllib3_warnings # Avoiding some SSL warnings related to Twython. diff --git a/src/fixes/fix_requests.py b/src/fixes/fix_requests.py index ec63e741..091b2e90 100644 --- a/src/fixes/fix_requests.py +++ b/src/fixes/fix_requests.py @@ -5,7 +5,7 @@ import requests.sessions orig_session_init=requests.sessions.Session.__init__ def patched_where(): - return paths.app_path(u"cacert.pem") + return paths.app_path("cacert.pem") def fix(frozen): if frozen==True: diff --git a/src/issueReporter/issueReporter.py b/src/issueReporter/issueReporter.py index 68698597..a8b928a5 100644 --- a/src/issueReporter/issueReporter.py +++ b/src/issueReporter/issueReporter.py @@ -16,7 +16,7 @@ # along with this program. If not, see . # ############################################################ -from __future__ import absolute_import + from builtins import object import keys import wx @@ -29,9 +29,9 @@ from . import constants class reportBug(object): def __init__(self, user_name): self.user_name = user_name - self.categories = [_(u"General")] - self.reproducibilities = [_(u"always"), _(u"sometimes"), _(u"random"), _(u"have not tried"), _(u"unable to duplicate")] - self.severities = [_(u"block"), _(u"crash"), _(u"major"), _(u"minor"), _(u"tweak"), _(u"text"), _(u"trivial"), _(u"feature")] + self.categories = [_("General")] + self.reproducibilities = [_("always"), _("sometimes"), _("random"), _("have not tried"), _("unable to duplicate")] + self.severities = [_("block"), _("crash"), _("major"), _("minor"), _("tweak"), _("text"), _("trivial"), _("feature")] self.dialog = wx_ui.reportBugDialog(self.categories, self.reproducibilities, self.severities) widgetUtils.connect_event(self.dialog.ok, widgetUtils.BUTTON_PRESSED, self.send) self.dialog.get_response() diff --git a/src/issueReporter/wx_ui.py b/src/issueReporter/wx_ui.py index 3d2855e6..36d43871 100644 --- a/src/issueReporter/wx_ui.py +++ b/src/issueReporter/wx_ui.py @@ -1,94 +1,94 @@ -# -*- coding: utf-8 -*- -############################################################ -# Copyright (c) 2013, 2014 Manuel Eduardo Cortéz Vallejo -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -############################################################ -import wx -import widgetUtils -import application -class reportBugDialog(widgetUtils.BaseDialog): - def __init__(self, categories, reproducibilities, severities): - super(reportBugDialog, self).__init__(parent=None, id=wx.NewId()) - self.SetTitle(_(u"Report an error")) - panel = wx.Panel(self) - sizer = wx.BoxSizer(wx.VERTICAL) - categoryLabel = wx.StaticText(panel, -1, _(u"Select a category"), size=wx.DefaultSize) - self.category = wx.ComboBox(panel, -1, choices=categories, style=wx.CB_READONLY) - self.category.SetSelection(0) - categoryB = wx.BoxSizer(wx.HORIZONTAL) - categoryB.Add(categoryLabel, 0, wx.ALL, 5) - categoryB.Add(self.category, 0, wx.ALL, 5) - self.category.SetFocus() - sizer.Add(categoryB, 0, wx.ALL, 5) - summaryLabel = wx.StaticText(panel, -1, _(u"Briefly describe what happened. You will be able to thoroughly explain it later"), size=wx.DefaultSize) - self.summary = wx.TextCtrl(panel, -1) - dc = wx.WindowDC(self.summary) - dc.SetFont(self.summary.GetFont()) - self.summary.SetSize(dc.GetTextExtent("a"*80)) - summaryB = wx.BoxSizer(wx.HORIZONTAL) - summaryB.Add(summaryLabel, 0, wx.ALL, 5) - summaryB.Add(self.summary, 0, wx.ALL, 5) - sizer.Add(summaryB, 0, wx.ALL, 5) - descriptionLabel = wx.StaticText(panel, -1, _(u"Here, you can describe the bug in detail"), size=wx.DefaultSize) - self.description = wx.TextCtrl(panel, -1, style=wx.TE_MULTILINE) - dc = wx.WindowDC(self.description) - dc.SetFont(self.description.GetFont()) - (x, y, z) = dc.GetMultiLineTextExtent("0"*2000) - self.description.SetSize((x, y)) - descBox = wx.BoxSizer(wx.HORIZONTAL) - descBox.Add(descriptionLabel, 0, wx.ALL, 5) - descBox.Add(self.description, 0, wx.ALL, 5) - sizer.Add(descBox, 0, wx.ALL, 5) - reproducibilityLabel = wx.StaticText(panel, -1, _(u"how often does this bug happen?"), size=wx.DefaultSize) - self.reproducibility = wx.ComboBox(panel, -1, choices=reproducibilities, style=wx.CB_READONLY) - self.reproducibility.SetSelection(3) - reprB = wx.BoxSizer(wx.HORIZONTAL) - reprB.Add(reproducibilityLabel, 0, wx.ALL, 5) - reprB.Add(self.reproducibility, 0, wx.ALL, 5) - sizer.Add(reprB, 0, wx.ALL, 5) - severityLabel = wx.StaticText(panel, -1, _(u"Select the importance that you think this bug has")) - self.severity = wx.ComboBox(panel, -1, choices=severities, style=wx.CB_READONLY) - self.severity.SetSelection(3) - severityB = wx.BoxSizer(wx.HORIZONTAL) - severityB.Add(severityLabel, 0, wx.ALL, 5) - severityB.Add(self.severity, 0, wx.ALL, 5) - sizer.Add(severityB, 0, wx.ALL, 5) - self.agree = wx.CheckBox(panel, -1, _(u"I know that the {0} bug system will get my Twitter username to contact me and fix the bug quickly").format(application.name,)) - self.agree.SetValue(False) - sizer.Add(self.agree, 0, wx.ALL, 5) - self.ok = wx.Button(panel, wx.ID_OK, _(u"Send report")) - self.ok.SetDefault() - cancel = wx.Button(panel, wx.ID_CANCEL, _(u"Cancel")) - btnBox = wx.BoxSizer(wx.HORIZONTAL) - btnBox.Add(self.ok, 0, wx.ALL, 5) - btnBox.Add(cancel, 0, wx.ALL, 5) - sizer.Add(btnBox, 0, wx.ALL, 5) - panel.SetSizer(sizer) - self.SetClientSize(sizer.CalcMin()) - - def no_filled(self): - wx.MessageDialog(self, _(u"You must fill out both fields"), _(u"Error"), wx.OK|wx.ICON_ERROR).ShowModal() - - def no_checkbox(self): - wx.MessageDialog(self, _(u"You need to mark the checkbox to provide us your twitter username to contact you if it is necessary."), _(u"Error"), wx.ICON_ERROR).ShowModal() - - def success(self, id): - wx.MessageDialog(self, _(u"Thanks for reporting this bug! In future versions, you may be able to find it in the changes list. You've reported the bug number %i") % (id), _(u"reported"), wx.OK).ShowModal() - self.EndModal(wx.ID_OK) - - def error(self): - wx.MessageDialog(self, _(u"Something unexpected occurred while trying to report the bug. Please, try again later"), _(u"Error while reporting"), wx.ICON_ERROR|wx.OK).ShowModal() +# -*- coding: utf-8 -*- +############################################################ +# Copyright (c) 2013, 2014 Manuel Eduardo Cortéz Vallejo +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +############################################################ +import wx +import widgetUtils +import application +class reportBugDialog(widgetUtils.BaseDialog): + def __init__(self, categories, reproducibilities, severities): + super(reportBugDialog, self).__init__(parent=None, id=wx.NewId()) + self.SetTitle(_("Report an error")) + panel = wx.Panel(self) + sizer = wx.BoxSizer(wx.VERTICAL) + categoryLabel = wx.StaticText(panel, -1, _("Select a category"), size=wx.DefaultSize) + self.category = wx.ComboBox(panel, -1, choices=categories, style=wx.CB_READONLY) + self.category.SetSelection(0) + categoryB = wx.BoxSizer(wx.HORIZONTAL) + categoryB.Add(categoryLabel, 0, wx.ALL, 5) + categoryB.Add(self.category, 0, wx.ALL, 5) + self.category.SetFocus() + sizer.Add(categoryB, 0, wx.ALL, 5) + summaryLabel = wx.StaticText(panel, -1, _("Briefly describe what happened. You will be able to thoroughly explain it later"), size=wx.DefaultSize) + self.summary = wx.TextCtrl(panel, -1) + dc = wx.WindowDC(self.summary) + dc.SetFont(self.summary.GetFont()) + self.summary.SetSize(dc.GetTextExtent("a"*80)) + summaryB = wx.BoxSizer(wx.HORIZONTAL) + summaryB.Add(summaryLabel, 0, wx.ALL, 5) + summaryB.Add(self.summary, 0, wx.ALL, 5) + sizer.Add(summaryB, 0, wx.ALL, 5) + descriptionLabel = wx.StaticText(panel, -1, _("Here, you can describe the bug in detail"), size=wx.DefaultSize) + self.description = wx.TextCtrl(panel, -1, style=wx.TE_MULTILINE) + dc = wx.WindowDC(self.description) + dc.SetFont(self.description.GetFont()) + (x, y, z) = dc.GetMultiLineTextExtent("0"*2000) + self.description.SetSize((x, y)) + descBox = wx.BoxSizer(wx.HORIZONTAL) + descBox.Add(descriptionLabel, 0, wx.ALL, 5) + descBox.Add(self.description, 0, wx.ALL, 5) + sizer.Add(descBox, 0, wx.ALL, 5) + reproducibilityLabel = wx.StaticText(panel, -1, _("how often does this bug happen?"), size=wx.DefaultSize) + self.reproducibility = wx.ComboBox(panel, -1, choices=reproducibilities, style=wx.CB_READONLY) + self.reproducibility.SetSelection(3) + reprB = wx.BoxSizer(wx.HORIZONTAL) + reprB.Add(reproducibilityLabel, 0, wx.ALL, 5) + reprB.Add(self.reproducibility, 0, wx.ALL, 5) + sizer.Add(reprB, 0, wx.ALL, 5) + severityLabel = wx.StaticText(panel, -1, _("Select the importance that you think this bug has")) + self.severity = wx.ComboBox(panel, -1, choices=severities, style=wx.CB_READONLY) + self.severity.SetSelection(3) + severityB = wx.BoxSizer(wx.HORIZONTAL) + severityB.Add(severityLabel, 0, wx.ALL, 5) + severityB.Add(self.severity, 0, wx.ALL, 5) + sizer.Add(severityB, 0, wx.ALL, 5) + self.agree = wx.CheckBox(panel, -1, _("I know that the {0} bug system will get my Twitter username to contact me and fix the bug quickly").format(application.name,)) + self.agree.SetValue(False) + sizer.Add(self.agree, 0, wx.ALL, 5) + self.ok = wx.Button(panel, wx.ID_OK, _("Send report")) + self.ok.SetDefault() + cancel = wx.Button(panel, wx.ID_CANCEL, _("Cancel")) + btnBox = wx.BoxSizer(wx.HORIZONTAL) + btnBox.Add(self.ok, 0, wx.ALL, 5) + btnBox.Add(cancel, 0, wx.ALL, 5) + sizer.Add(btnBox, 0, wx.ALL, 5) + panel.SetSizer(sizer) + self.SetClientSize(sizer.CalcMin()) + + def no_filled(self): + wx.MessageDialog(self, _("You must fill out both fields"), _("Error"), wx.OK|wx.ICON_ERROR).ShowModal() + + def no_checkbox(self): + wx.MessageDialog(self, _("You need to mark the checkbox to provide us your twitter username to contact you if it is necessary."), _("Error"), wx.ICON_ERROR).ShowModal() + + def success(self, id): + wx.MessageDialog(self, _("Thanks for reporting this bug! In future versions, you may be able to find it in the changes list. You've reported the bug number %i") % (id), _("reported"), wx.OK).ShowModal() + self.EndModal(wx.ID_OK) + + def error(self): + wx.MessageDialog(self, _("Something unexpected occurred while trying to report the bug. Please, try again later"), _("Error while reporting"), wx.ICON_ERROR|wx.OK).ShowModal() self.EndModal(wx.ID_CANCEL) \ No newline at end of file diff --git a/src/keyboard_handler/__init__.py b/src/keyboard_handler/__init__.py index 6b20bb25..81415f19 100644 --- a/src/keyboard_handler/__init__.py +++ b/src/keyboard_handler/__init__.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from .main import KeyboardHandler, KeyboardHandlerError #from wx_handler import WXKeyboardHandler __all__ = ["KeyboardHandler", "KeyboardHandlerError", "WXKeyboardHandler", "WXPanelKeyboardHandler"] diff --git a/src/keyboard_handler/global_handler.py b/src/keyboard_handler/global_handler.py index fa21f12f..f03006e4 100644 --- a/src/keyboard_handler/global_handler.py +++ b/src/keyboard_handler/global_handler.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + import platform if platform.system() == 'Linux': from .linux import LinuxKeyboardHandler as GlobalKeyboardHandler diff --git a/src/keyboard_handler/linux.py b/src/keyboard_handler/linux.py index af249502..d7c71125 100644 --- a/src/keyboard_handler/linux.py +++ b/src/keyboard_handler/linux.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from future import standard_library standard_library.install_aliases() from builtins import chr diff --git a/src/keyboard_handler/osx.py b/src/keyboard_handler/osx.py index 52f13038..f60b0634 100644 --- a/src/keyboard_handler/osx.py +++ b/src/keyboard_handler/osx.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from builtins import str from AppKit import * from PyObjCTools import AppHelper @@ -53,6 +53,6 @@ class KeyboardCapturingNSApplication(NSApplication): def sendEvent_(self, theEvent): if theEvent.type() == NSSystemDefined and theEvent.subtype() == kEventHotKeyPressedSubtype: self.activateIgnoringOtherApps_(True) - NSRunAlertPanel(u'Hot Key Pressed', u'Hot Key Pressed', None, None, None) + NSRunAlertPanel('Hot Key Pressed', 'Hot Key Pressed', None, None, None) super(NSApplication, self).sendEvent_(theEvent) diff --git a/src/keyboard_handler/windows.py b/src/keyboard_handler/windows.py index c12b6e9f..8dea491e 100644 --- a/src/keyboard_handler/windows.py +++ b/src/keyboard_handler/windows.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from builtins import str import win32api import win32con diff --git a/src/keyboard_handler/wx_handler.py b/src/keyboard_handler/wx_handler.py index 00e50f27..fb30b99f 100644 --- a/src/keyboard_handler/wx_handler.py +++ b/src/keyboard_handler/wx_handler.py @@ -1,5 +1,5 @@ -from __future__ import print_function -from __future__ import absolute_import + + from builtins import chr import functools import wx diff --git a/src/keystrokeEditor/__init__.py b/src/keystrokeEditor/__init__.py index 5b846034..535705f2 100644 --- a/src/keystrokeEditor/__init__.py +++ b/src/keystrokeEditor/__init__.py @@ -1,2 +1,2 @@ -from __future__ import absolute_import + from .keystrokeEditor import KeystrokeEditor \ No newline at end of file diff --git a/src/keystrokeEditor/constants.py b/src/keystrokeEditor/constants.py index c6d5c2fe..fa9548ce 100644 --- a/src/keystrokeEditor/constants.py +++ b/src/keystrokeEditor/constants.py @@ -1,56 +1,56 @@ -# -*- coding: utf-8 -*- -actions = { -"up": _(u"Go up in the current buffer"), -"down": _(u"Go down in the current buffer"), -"left": _(u"Go to the previous buffer"), -"right": _(u"Go to the next buffer"), -"next_account": _(u"Focus the next session"), -"previous_account": _(u"Focus the previous session"), -"show_hide": _(u"Show or hide the GUI"), -"post_tweet": _(u"New tweet"), -"post_reply": _(u"Reply"), -"post_retweet": _(u"Retweet"), -"send_dm": _(u"Send direct message"), -"add_to_favourites": _(u"Like a tweet"), -"remove_from_favourites": _(u"Unlike a tweet"), -"follow": _(u"Open the user actions dialogue"), -"user_details": _(u"See user details"), -"view_item": _(u"Show tweet"), -"exit": _(u"Quit"), -"open_timeline": _(u"Open user timeline"), -"remove_buffer": _(u"Destroy buffer"), -"interact": _(u"Interact with the currently focused tweet."), -"url": _(u"Open URL"), -"volume_up": _(u"Increase volume by 5%"), -"volume_down": _(u"Decrease volume by 5%"), -"go_home": _(u"Jump to the first element of a buffer"), -"go_end": _(u"Jump to the last element of the current buffer"), -"go_page_up": _(u"Jump 20 elements up in the current buffer"), -"go_page_down": _(u"Jump 20 elements down in the current buffer"), -"update_profile": _(u"Edit profile"), -"delete": _(u"Delete a tweet or direct message"), -"clear_buffer": _(u"Empty the current buffer"), -"repeat_item": _(u"Repeat last item"), -"copy_to_clipboard": _(u"Copy to clipboard"), -"add_to_list": _(u"Add to list"), -"remove_from_list": _(u"Remove from list"), -"toggle_buffer_mute": _(u"Mute/unmute the active buffer"), -"toggle_session_mute": _(u"Mute/unmute the current session"), -"toggle_autoread": _(u"toggle the automatic reading of incoming tweets in the active buffer"), -"search": _(u"Search on twitter"), -"find": _(u"Find a string in the currently focused buffer"), -"edit_keystrokes": _(u"Show the keystroke editor"), -"view_user_lists": _(u"Show lists for a specified user"), -"get_more_items": _(u"load previous items"), -"reverse_geocode": _(u"Get geolocation"), -"view_reverse_geocode": _(u"Display the tweet's geolocation in a dialog"), -"get_trending_topics": _(u"Create a trending topics buffer"), -"open_conversation": _(u"View conversation"), -"check_for_updates": _(u"Check and download updates"), -"lists_manager": _(u"Opens the list manager, which allows you to create, edit, delete and open lists in buffers."), -"configuration": _(u"Opens the global settings dialogue"), -"accountConfiguration": _(u"Opens the account settings dialogue"), -"audio": _(u"Try to play an audio file"), -"update_buffer": _(u"Updates the buffer and retrieves possible lost items there."), -"ocr_image": _(u"Extracts the text from a picture and displays the result in a dialog."), +# -*- coding: utf-8 -*- +actions = { +"up": _("Go up in the current buffer"), +"down": _("Go down in the current buffer"), +"left": _("Go to the previous buffer"), +"right": _("Go to the next buffer"), +"next_account": _("Focus the next session"), +"previous_account": _("Focus the previous session"), +"show_hide": _("Show or hide the GUI"), +"post_tweet": _("New tweet"), +"post_reply": _("Reply"), +"post_retweet": _("Retweet"), +"send_dm": _("Send direct message"), +"add_to_favourites": _("Like a tweet"), +"remove_from_favourites": _("Unlike a tweet"), +"follow": _("Open the user actions dialogue"), +"user_details": _("See user details"), +"view_item": _("Show tweet"), +"exit": _("Quit"), +"open_timeline": _("Open user timeline"), +"remove_buffer": _("Destroy buffer"), +"interact": _("Interact with the currently focused tweet."), +"url": _("Open URL"), +"volume_up": _("Increase volume by 5%"), +"volume_down": _("Decrease volume by 5%"), +"go_home": _("Jump to the first element of a buffer"), +"go_end": _("Jump to the last element of the current buffer"), +"go_page_up": _("Jump 20 elements up in the current buffer"), +"go_page_down": _("Jump 20 elements down in the current buffer"), +"update_profile": _("Edit profile"), +"delete": _("Delete a tweet or direct message"), +"clear_buffer": _("Empty the current buffer"), +"repeat_item": _("Repeat last item"), +"copy_to_clipboard": _("Copy to clipboard"), +"add_to_list": _("Add to list"), +"remove_from_list": _("Remove from list"), +"toggle_buffer_mute": _("Mute/unmute the active buffer"), +"toggle_session_mute": _("Mute/unmute the current session"), +"toggle_autoread": _("toggle the automatic reading of incoming tweets in the active buffer"), +"search": _("Search on twitter"), +"find": _("Find a string in the currently focused buffer"), +"edit_keystrokes": _("Show the keystroke editor"), +"view_user_lists": _("Show lists for a specified user"), +"get_more_items": _("load previous items"), +"reverse_geocode": _("Get geolocation"), +"view_reverse_geocode": _("Display the tweet's geolocation in a dialog"), +"get_trending_topics": _("Create a trending topics buffer"), +"open_conversation": _("View conversation"), +"check_for_updates": _("Check and download updates"), +"lists_manager": _("Opens the list manager, which allows you to create, edit, delete and open lists in buffers."), +"configuration": _("Opens the global settings dialogue"), +"accountConfiguration": _("Opens the account settings dialogue"), +"audio": _("Try to play an audio file"), +"update_buffer": _("Updates the buffer and retrieves possible lost items there."), +"ocr_image": _("Extracts the text from a picture and displays the result in a dialog."), } \ No newline at end of file diff --git a/src/keystrokeEditor/keystrokeEditor.py b/src/keystrokeEditor/keystrokeEditor.py index 97bda2fe..c483e9fa 100644 --- a/src/keystrokeEditor/keystrokeEditor.py +++ b/src/keystrokeEditor/keystrokeEditor.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import + from builtins import object import widgetUtils import config diff --git a/src/keystrokeEditor/wx_ui.py b/src/keystrokeEditor/wx_ui.py index 3a725a90..76f012f1 100644 --- a/src/keystrokeEditor/wx_ui.py +++ b/src/keystrokeEditor/wx_ui.py @@ -5,20 +5,20 @@ from wxUI.dialogs import baseDialog class keystrokeEditorDialog(baseDialog.BaseWXDialog): def __init__(self): - super(keystrokeEditorDialog, self).__init__(parent=None, id=-1, title=_(u"Keystroke editor")) + super(keystrokeEditorDialog, self).__init__(parent=None, id=-1, title=_("Keystroke editor")) panel = wx.Panel(self) self.actions = [] sizer = wx.BoxSizer(wx.VERTICAL) - keysText = wx.StaticText(panel, -1, _(u"Select a keystroke to edit")) - self.keys = widgets.list(self, _(u"Action"), _(u"Keystroke"), style=wx.LC_REPORT|wx.LC_SINGLE_SEL, size=(400, 450)) + keysText = wx.StaticText(panel, -1, _("Select a keystroke to edit")) + self.keys = widgets.list(self, _("Action"), _("Keystroke"), style=wx.LC_REPORT|wx.LC_SINGLE_SEL, size=(400, 450)) self.keys.list.SetFocus() firstSizer = wx.BoxSizer(wx.HORIZONTAL) firstSizer.Add(keysText, 0, wx.ALL, 5) firstSizer.Add(self.keys.list, 0, wx.ALL, 5) - self.edit = wx.Button(panel, -1, _(u"Edit")) + self.edit = wx.Button(panel, -1, _("Edit")) self.edit.SetDefault() - self.execute = wx.Button(panel, -1, _(u"Execute action")) - close = wx.Button(panel, wx.ID_CANCEL, _(u"Close")) + self.execute = wx.Button(panel, -1, _("Execute action")) + close = wx.Button(panel, wx.ID_CANCEL, _("Close")) secondSizer = wx.BoxSizer(wx.HORIZONTAL) secondSizer.Add(self.edit, 0, wx.ALL, 5) secondSizer.Add(self.execute, 0, wx.ALL, 5) @@ -45,24 +45,24 @@ class keystrokeEditorDialog(baseDialog.BaseWXDialog): class editKeystrokeDialog(baseDialog.BaseWXDialog): def __init__(self): - super(editKeystrokeDialog, self).__init__(parent=None, id=-1, title=_(u"Editing keystroke")) + super(editKeystrokeDialog, self).__init__(parent=None, id=-1, title=_("Editing keystroke")) panel = wx.Panel(self) sizer = wx.BoxSizer(wx.VERTICAL) - self.control = wx.CheckBox(panel, -1, _(u"Control")) - self.alt = wx.CheckBox(panel, -1, _(u"Alt")) - self.shift = wx.CheckBox(panel, -1, _(u"Shift")) - self.win = wx.CheckBox(panel, -1, _(u"Windows")) + self.control = wx.CheckBox(panel, -1, _("Control")) + self.alt = wx.CheckBox(panel, -1, _("Alt")) + self.shift = wx.CheckBox(panel, -1, _("Shift")) + self.win = wx.CheckBox(panel, -1, _("Windows")) sizer1 = wx.BoxSizer(wx.HORIZONTAL) sizer1.Add(self.control) sizer1.Add(self.alt) sizer1.Add(self.shift) sizer1.Add(self.win) - charLabel = wx.StaticText(panel, -1, _(u"Key")) + charLabel = wx.StaticText(panel, -1, _("Key")) self.key = wx.TextCtrl(panel, -1) sizer2 = wx.BoxSizer(wx.HORIZONTAL) sizer2.Add(charLabel) sizer2.Add(self.key) - ok = wx.Button(panel, wx.ID_OK, _(u"OK")) + ok = wx.Button(panel, wx.ID_OK, _("OK")) ok.SetDefault() cancel = wx.Button(panel, wx.ID_CANCEL) sizer3 = wx.BoxSizer(wx.HORIZONTAL) @@ -75,7 +75,7 @@ class editKeystrokeDialog(baseDialog.BaseWXDialog): def no_win_message(): - return wx.MessageDialog(None, _(u"You need to use the Windows key"), _(u"Invalid keystroke"), wx.OK|wx.ICON_ERROR).ShowModal() + return wx.MessageDialog(None, _("You need to use the Windows key"), _("Invalid keystroke"), wx.OK|wx.ICON_ERROR).ShowModal() def no_key(): - return wx.MessageDialog(None, _(u"You must provide a character for the keystroke"), _(u"Invalid keystroke"), wx.ICON_ERROR).ShowModal() \ No newline at end of file + return wx.MessageDialog(None, _("You must provide a character for the keystroke"), _("Invalid keystroke"), wx.ICON_ERROR).ShowModal() \ No newline at end of file diff --git a/src/languageHandler.py b/src/languageHandler.py index 0c0d60f2..aeae24d3 100644 --- a/src/languageHandler.py +++ b/src/languageHandler.py @@ -36,7 +36,7 @@ def localeNameToWindowsLCID(localeName): localeName=locale.normalize(localeName) if '.' in localeName: localeName=localeName.split('.')[0] - LCList=[x[0] for x in locale.windows_locale.items() if x[1]==localeName] + LCList=[x[0] for x in list(locale.windows_locale.items()) if x[1]==localeName] if len(LCList)>0: LCID=LCList[0] else: @@ -113,7 +113,7 @@ def makePgettext(translations): message = str(message) try: # Look up the message with its context. - return translations._catalog[u"%s\x04%s" % (context, message)] + return translations._catalog["%s\x04%s" % (context, message)] except KeyError: return message else: diff --git a/src/logger.py b/src/logger.py index d3548600..77ea1d87 100644 --- a/src/logger.py +++ b/src/logger.py @@ -1,39 +1,39 @@ -# -*- coding: utf-8 -*- -import logging -from logging.handlers import RotatingFileHandler -import paths -import sys - -APP_LOG_FILE = 'debug.log' -ERROR_LOG_FILE = "error.log" -MESSAGE_FORMAT = "%(asctime)s %(name)s %(levelname)s: %(message)s" -DATE_FORMAT = u"%d/%m/%Y %H:%M:%S" - -formatter = logging.Formatter(MESSAGE_FORMAT, datefmt=DATE_FORMAT) - -requests_log = logging.getLogger("requests") -requests_log.setLevel(logging.WARNING) -oauthlib_log = logging.getLogger("oauthlib") -oauthlib_log.setLevel(logging.WARNING) -requests_oauthlib_log = logging.getLogger("requests_oauthlib") -requests_oauthlib_log.setLevel(logging.WARNING) -suds_log = logging.getLogger("suds") -suds_log.setLevel(logging.WARNING) -server_log = logging.getLogger("BaseHTTPServer") -server_log.setLevel(logging.WARNING) - - -logger = logging.getLogger() -logger.setLevel(logging.DEBUG) - -#handlers - -app_handler = RotatingFileHandler(paths.logs_path(APP_LOG_FILE), mode="w") -app_handler.setFormatter(formatter) -app_handler.setLevel(logging.DEBUG) -logger.addHandler(app_handler) - -error_handler = logging.FileHandler(paths.logs_path(ERROR_LOG_FILE), mode="w") -error_handler.setFormatter(formatter) -error_handler.setLevel(logging.ERROR) -logger.addHandler(error_handler) +# -*- coding: utf-8 -*- +import logging +from logging.handlers import RotatingFileHandler +import paths +import sys + +APP_LOG_FILE = 'debug.log' +ERROR_LOG_FILE = "error.log" +MESSAGE_FORMAT = "%(asctime)s %(name)s %(levelname)s: %(message)s" +DATE_FORMAT = "%d/%m/%Y %H:%M:%S" + +formatter = logging.Formatter(MESSAGE_FORMAT, datefmt=DATE_FORMAT) + +requests_log = logging.getLogger("requests") +requests_log.setLevel(logging.WARNING) +oauthlib_log = logging.getLogger("oauthlib") +oauthlib_log.setLevel(logging.WARNING) +requests_oauthlib_log = logging.getLogger("requests_oauthlib") +requests_oauthlib_log.setLevel(logging.WARNING) +suds_log = logging.getLogger("suds") +suds_log.setLevel(logging.WARNING) +server_log = logging.getLogger("BaseHTTPServer") +server_log.setLevel(logging.WARNING) + + +logger = logging.getLogger() +logger.setLevel(logging.DEBUG) + +#handlers + +app_handler = RotatingFileHandler(paths.logs_path(APP_LOG_FILE), mode="w") +app_handler.setFormatter(formatter) +app_handler.setLevel(logging.DEBUG) +logger.addHandler(app_handler) + +error_handler = logging.FileHandler(paths.logs_path(ERROR_LOG_FILE), mode="w") +error_handler.setFormatter(formatter) +error_handler.setLevel(logging.ERROR) +logger.addHandler(error_handler) diff --git a/src/long_tweets/twishort.py b/src/long_tweets/twishort.py index 72d7c794..60010ae7 100644 --- a/src/long_tweets/twishort.py +++ b/src/long_tweets/twishort.py @@ -16,7 +16,7 @@ # along with this program. If not, see . # ############################################################ -from __future__ import print_function + from builtins import range import requests import keys diff --git a/src/main.py b/src/main.py index e1aca92f..2dd0e7ff 100644 --- a/src/main.py +++ b/src/main.py @@ -1,99 +1,99 @@ -# -*- coding: utf-8 -*- -import platform -""" there are lots of things not implemented for Gtk+ yet. - We've started this effort 1 Apr 2015 so it isn't fully functional. We will remove the ifs statements when are no needed""" - -system = platform.system() -if system == "Windows": - import sys - import os - #redirect the original stdout and stderr - stdout=sys.stdout - stderr=sys.stderr - sys.stdout = open(os.path.join(os.getenv("temp"), "stdout.log"), "w") - sys.stderr = open(os.path.join(os.getenv("temp"), "stderr.log"), "w") -import languageHandler -import paths -#check if TWBlue is installed (Windows only) -if os.path.exists(paths.app_path(u"Uninstall.exe")): - paths.mode="installed" -import commandline -import config -import sound -import output -import logging -import application -import keys -from mysc.thread_utils import call_threaded -import fixes -#extra variables to control the temporary stdout and stderr, while the final files are opened. We understand that some errors could happen while all outputs are closed, so let's try to avoid it. -import widgetUtils -import webbrowser -from wxUI import commonMessageDialogs -if system == "Windows": - from logger import logger - from update import updater - stdout_temp=sys.stdout - stderr_temp=sys.stderr -#if it's a binary version - if hasattr(sys, 'frozen'): - sys.stderr = open(paths.logs_path("stderr.log"), 'w') - sys.stdout = open(paths.logs_path("stdout.log"), 'w') - else: - sys.stdout=stdout - sys.stderr=stderr - #the final log files have been opened succesfully, let's close the temporal files - stdout_temp.close() - stderr_temp.close() - #finally, remove the temporal files. TW Blue doesn't need them anymore, and we will get more free space on the harddrive - os.remove(stdout_temp.name) - os.remove(stderr_temp.name) -if system == "Linux": - from gi.repository import Gdk, GObject, GLib - -log = logging.getLogger("main") - -def setup(): - log.debug("Starting " + application.name + " %s" % (application.version,)) - config.setup() - log.debug("Using %s %s" % (platform.system(), platform.architecture()[0])) - log.debug("Application path is %s" % (paths.app_path(),)) - log.debug("config path is %s" % (paths.config_path(),)) - sound.setup() - output.setup() - languageHandler.setLanguage(config.app["app-settings"]["language"]) - fixes.setup() - keys.setup() - from controller import mainController - from sessionmanager import sessionManager - app = widgetUtils.mainLoopObject() - if system == "Windows": - if config.app["app-settings"]["donation_dialog_displayed"] == False: - donation() - if config.app['app-settings']['check_for_updates']: - updater.do_update() - sm = sessionManager.sessionManagerController() - sm.fill_list() - if len(sm.sessions) == 0: sm.show() - else: - sm.do_ok() - if hasattr(sm.view, "destroy"): - sm.view.destroy() - del sm - r = mainController.Controller() - r.view.show() - r.do_work() - r.check_invisible_at_startup() - if system == "Windows": - call_threaded(r.start) - elif system == "Linux": - GLib.idle_add(r.start) - app.run() - -def donation(): - dlg = commonMessageDialogs.donation() - if dlg == widgetUtils.YES: - webbrowser.open_new_tab(_("https://twblue.es/donate")) - config.app["app-settings"]["donation_dialog_displayed"] = True - -setup() +# -*- coding: utf-8 -*- +import platform +""" there are lots of things not implemented for Gtk+ yet. + We've started this effort 1 Apr 2015 so it isn't fully functional. We will remove the ifs statements when are no needed""" + +system = platform.system() +if system == "Windows": + import sys + import os + #redirect the original stdout and stderr + stdout=sys.stdout + stderr=sys.stderr + sys.stdout = open(os.path.join(os.getenv("temp"), "stdout.log"), "w") + sys.stderr = open(os.path.join(os.getenv("temp"), "stderr.log"), "w") +import languageHandler +import paths +#check if TWBlue is installed (Windows only) +if os.path.exists(paths.app_path("Uninstall.exe")): + paths.mode="installed" +import commandline +import config +import sound +import output +import logging +import application +import keys +from mysc.thread_utils import call_threaded +import fixes +#extra variables to control the temporary stdout and stderr, while the final files are opened. We understand that some errors could happen while all outputs are closed, so let's try to avoid it. +import widgetUtils +import webbrowser +from wxUI import commonMessageDialogs +if system == "Windows": + from logger import logger + from update import updater + stdout_temp=sys.stdout + stderr_temp=sys.stderr +#if it's a binary version + if hasattr(sys, 'frozen'): + sys.stderr = open(paths.logs_path("stderr.log"), 'w') + sys.stdout = open(paths.logs_path("stdout.log"), 'w') + else: + sys.stdout=stdout + sys.stderr=stderr + #the final log files have been opened succesfully, let's close the temporal files + stdout_temp.close() + stderr_temp.close() + #finally, remove the temporal files. TW Blue doesn't need them anymore, and we will get more free space on the harddrive + os.remove(stdout_temp.name) + os.remove(stderr_temp.name) +if system == "Linux": + from gi.repository import Gdk, GObject, GLib + +log = logging.getLogger("main") + +def setup(): + log.debug("Starting " + application.name + " %s" % (application.version,)) + config.setup() + log.debug("Using %s %s" % (platform.system(), platform.architecture()[0])) + log.debug("Application path is %s" % (paths.app_path(),)) + log.debug("config path is %s" % (paths.config_path(),)) + sound.setup() + output.setup() + languageHandler.setLanguage(config.app["app-settings"]["language"]) + fixes.setup() + keys.setup() + from controller import mainController + from sessionmanager import sessionManager + app = widgetUtils.mainLoopObject() + if system == "Windows": + if config.app["app-settings"]["donation_dialog_displayed"] == False: + donation() + if config.app['app-settings']['check_for_updates']: + updater.do_update() + sm = sessionManager.sessionManagerController() + sm.fill_list() + if len(sm.sessions) == 0: sm.show() + else: + sm.do_ok() + if hasattr(sm.view, "destroy"): + sm.view.destroy() + del sm + r = mainController.Controller() + r.view.show() + r.do_work() + r.check_invisible_at_startup() + if system == "Windows": + call_threaded(r.start) + elif system == "Linux": + GLib.idle_add(r.start) + app.run() + +def donation(): + dlg = commonMessageDialogs.donation() + if dlg == widgetUtils.YES: + webbrowser.open_new_tab(_("https://twblue.es/donate")) + config.app["app-settings"]["donation_dialog_displayed"] = True + +setup() diff --git a/src/multiplatform_widgets/__init__.py b/src/multiplatform_widgets/__init__.py index 1f4fb8e1..630cb0d5 100644 --- a/src/multiplatform_widgets/__init__.py +++ b/src/multiplatform_widgets/__init__.py @@ -1,2 +1,2 @@ -from __future__ import absolute_import + from . import widgets \ No newline at end of file diff --git a/src/multiplatform_widgets/widgets.py b/src/multiplatform_widgets/widgets.py index 81174747..044f0de8 100644 --- a/src/multiplatform_widgets/widgets.py +++ b/src/multiplatform_widgets/widgets.py @@ -31,7 +31,7 @@ class list(object): if self.system == "Windows": self.list = wx.ListCtrl(parent, -1, **self.listArguments) for i in range(0, len(self.columns)): - self.list.InsertColumn(i, u"%s" % (self.columns[i])) + self.list.InsertColumn(i, "%s" % (self.columns[i])) else: self.list = wx.ListBox(parent, -1, choices=[]) diff --git a/src/notifier/__init__.py b/src/notifier/__init__.py index 5d95e458..643ab543 100644 --- a/src/notifier/__init__.py +++ b/src/notifier/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ A cross platform notification system. Under Linux, the wx.NotificationMessage does not show a notification on the taskbar, so we decided to use dbus for showing notifications for linux and wx for Windows.""" -from __future__ import absolute_import + import platform notify = None diff --git a/src/paths.py b/src/paths.py index 6ecd4669..373f0876 100644 --- a/src/paths.py +++ b/src/paths.py @@ -28,9 +28,9 @@ def config_path(): global mode, directory if mode == "portable": if directory != None: path = os.path.join(directory, "config") - elif directory == None: path = app_path(u"config") + elif directory == None: path = app_path("config") elif mode == "installed": - path = data_path(u"config") + path = data_path("config") if not os.path.exists(path): log.debug("%s path does not exist, creating..." % (path,)) os.mkdir(path) @@ -41,9 +41,9 @@ def logs_path(): global mode, directory if mode == "portable": if directory != None: path = os.path.join(directory, "logs") - elif directory == None: path = app_path(u"logs") + elif directory == None: path = app_path("logs") elif mode == "installed": - path = data_path(u"logs") + path = data_path("logs") if not os.path.exists(path): log.debug("%s path does not exist, creating..." % (path,)) os.mkdir(path) @@ -66,20 +66,20 @@ def data_path(app_name='TW blue'): @merge_paths def locale_path(): - return app_path(u"locales") + return app_path("locales") @merge_paths def sound_path(): - return app_path(u"sounds") + return app_path("sounds") @merge_paths def com_path(): global mode, directory if mode == "portable": if directory != None: path = os.path.join(directory, "com_cache") - elif directory == None: path = app_path(u"com_cache") + elif directory == None: path = app_path("com_cache") elif mode == "installed": - path = data_path(u"com_cache") + path = data_path("com_cache") if not os.path.exists(path): log.debug("%s path does not exist, creating..." % (path,)) os.mkdir(path) diff --git a/src/platform_utils/autostart/windows.py b/src/platform_utils/autostart/windows.py index 019eff3f..292ea64d 100644 --- a/src/platform_utils/autostart/windows.py +++ b/src/platform_utils/autostart/windows.py @@ -1,4 +1,4 @@ -from __future__ import print_function + from builtins import str import winreg import os diff --git a/src/platform_utils/shell_integration/windows.py b/src/platform_utils/shell_integration/windows.py index fc124f63..1e4b7083 100644 --- a/src/platform_utils/shell_integration/windows.py +++ b/src/platform_utils/shell_integration/windows.py @@ -2,7 +2,7 @@ from future import standard_library standard_library.install_aliases() import winreg -SHELL_REGKEY = ur"Directory\shell" +SHELL_REGKEY = r"Directory\shell" def context_menu_integrate(item_key_name, item_display_text, item_command): app_menu_key = winreg.OpenKey(winreg.HKEY_CLASSES_ROOT, SHELL_REGKEY, 0, winreg.KEY_WRITE) diff --git a/src/sessionmanager/manager.py b/src/sessionmanager/manager.py index 0a626914..3c9dda23 100644 --- a/src/sessionmanager/manager.py +++ b/src/sessionmanager/manager.py @@ -1,6 +1,6 @@ # -*- coding: cp1252 -*- #from config_utils import Configuration, ConfigurationResetException -from __future__ import absolute_import + from builtins import object import config import paths diff --git a/src/sessionmanager/session.py b/src/sessionmanager/session.py index 70d50dd9..7a344df4 100644 --- a/src/sessionmanager/session.py +++ b/src/sessionmanager/session.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- """ The main session object. Here are the twitter functions to interact with the "model" of TWBlue.""" -from __future__ import absolute_import + from future import standard_library standard_library.install_aliases() from builtins import str @@ -178,10 +178,10 @@ class Session(object): results = [] data = getattr(self.twitter.twitter, update_function)(*args, **kwargs) if users == True: - if type(data) == dict and "cursor" in data: + if isinstance(data, dict) and "cursor" in data: self.db[name]["cursor"] = data["next_cursor"] for i in data["users"]: results.append(i) - elif type(data) == list: + elif isinstance(data, list): results.extend(data[1:]) else: results.extend(data[1:]) @@ -414,11 +414,11 @@ class Session(object): output.speak("Generating database, this might take a while.",True) shelf=shelve.open(paths.config_path(shelfname),'c') for key,value in list(self.db.items()): - if type(key) != str and type(key) != str: + if not isinstance(key, str) and not isinstance(key, str): output.speak("Uh oh, while shelving the database, a key of type " + str(type(key)) + " has been found. It will be converted to type str, but this will cause all sorts of problems on deshelve. Please bring this to the attention of the " + application.name + " developers immediately. More information about the error will be written to the error log.",True) log.error("Uh oh, " + str(key) + " is of type " + str(type(key)) + "!") # Convert unicode objects to UTF-8 strings before shelve these objects. - if type(value) == list and self.settings["general"]["persist_size"] != -1 and len(value) > self.settings["general"]["persist_size"]: + if isinstance(value, list) and self.settings["general"]["persist_size"] != -1 and len(value) > self.settings["general"]["persist_size"]: shelf[str(key.encode("utf-8"))]=value[self.settings["general"]["persist_size"]:] else: shelf[str(key.encode("utf-8"))]=value @@ -484,5 +484,5 @@ class Session(object): if "@%s" % (i["screen_name"]) not in tweet["message"] and i["screen_name"] != tweet["user"]["screen_name"]: if "retweeted_status" in tweet and tweet["retweeted_status"]["user"]["screen_name"] == i["screen_name"]: continue - tweet["message"] = u"@%s %s" % (i["screen_name"], tweet["message"]) + tweet["message"] = "@%s %s" % (i["screen_name"], tweet["message"]) return tweet \ No newline at end of file diff --git a/src/sessionmanager/sessionManager.py b/src/sessionmanager/sessionManager.py index e9537673..1417458b 100644 --- a/src/sessionmanager/sessionManager.py +++ b/src/sessionmanager/sessionManager.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import + from builtins import str from builtins import object import shutil diff --git a/src/sessionmanager/wxUI.py b/src/sessionmanager/wxUI.py index c57e1910..84ab5d89 100644 --- a/src/sessionmanager/wxUI.py +++ b/src/sessionmanager/wxUI.py @@ -1,76 +1,76 @@ -# -*- coding: utf-8 -*- -import wx -from multiplatform_widgets import widgets -import application -class sessionManagerWindow(wx.Dialog): - def __init__(self): - super(sessionManagerWindow, self).__init__(parent=None, title=_(u"Session manager"), size=wx.DefaultSize) - panel = wx.Panel(self) - sizer = wx.BoxSizer(wx.VERTICAL) - label = wx.StaticText(panel, -1, _(u"Accounts list"), size=wx.DefaultSize) - listSizer = wx.BoxSizer(wx.HORIZONTAL) - self.list = widgets.list(panel, _(u"Account"), style=wx.LC_SINGLE_SEL|wx.LC_REPORT) - listSizer.Add(label, 0, wx.ALL, 5) - listSizer.Add(self.list.list, 0, wx.ALL, 5) - sizer.Add(listSizer, 0, wx.ALL, 5) - self.new = wx.Button(panel, -1, _(u"New account"), size=wx.DefaultSize) - self.remove = wx.Button(panel, -1, _(u"Remove account")) - self.configuration = wx.Button(panel, -1, _(u"Global Settings")) - ok = wx.Button(panel, wx.ID_OK, size=wx.DefaultSize) - ok.SetDefault() - cancel = wx.Button(panel, wx.ID_CANCEL, size=wx.DefaultSize) - buttons = wx.BoxSizer(wx.HORIZONTAL) - buttons.Add(self.new, 0, wx.ALL, 5) - buttons.Add(self.configuration, 0, wx.ALL, 5) - buttons.Add(ok, 0, wx.ALL, 5) - buttons.Add(cancel, 0, wx.ALL, 5) - sizer.Add(buttons, 0, wx.ALL, 5) - panel.SetSizer(sizer) - min = sizer.CalcMin() - self.SetClientSize(min) - - def fill_list(self, sessionsList): - for i in sessionsList: - self.list.insert_item(False, i) - if self.list.get_count() > 0: - self.list.select_item(0) - self.list.list.SetSize(self.list.list.GetBestSize()) - - def ok(self, ev): - if self.list.get_count() == 0: - wx.MessageDialog(None, _(u"You need to configure an account."), _(u"Account Error"), wx.ICON_ERROR).ShowModal() - return - self.controller.do_ok() - self.EndModal(wx.ID_OK) - - def new_account_dialog(self): - return wx.MessageDialog(self, _(u"The request to authorize your Twitter account will be opened in your browser. You only need to do this once. Would you like to continue?"), _(u"Authorization"), wx.YES_NO).ShowModal() - - def add_new_session_to_list(self): - total = self.list.get_count() - name = _(u"Authorized account %d") % (total+1) - self.list.insert_item(False, name) - if self.list.get_count() == 1: - self.list.select_item(0) - - def show_unauthorised_error(self): - wx.MessageDialog(None, _(u"Your access token is invalid or the authorization has failed. Please try again."), _(u"Invalid user token"), wx.ICON_ERROR).ShowModal() - - def get_response(self): - return self.ShowModal() - - def remove_account_dialog(self): - return wx.MessageDialog(self, _(u"Do you really want to delete this account?"), _(u"Remove account"), wx.YES_NO).ShowModal() - - def get_selected(self): - return self.list.get_selected() - - def remove_session(self, sessionID): - self.list.remove_item(sessionID) - - - def hide_configuration(self): - self.configuration.Hide() - - def destroy(self): +# -*- coding: utf-8 -*- +import wx +from multiplatform_widgets import widgets +import application +class sessionManagerWindow(wx.Dialog): + def __init__(self): + super(sessionManagerWindow, self).__init__(parent=None, title=_("Session manager"), size=wx.DefaultSize) + panel = wx.Panel(self) + sizer = wx.BoxSizer(wx.VERTICAL) + label = wx.StaticText(panel, -1, _("Accounts list"), size=wx.DefaultSize) + listSizer = wx.BoxSizer(wx.HORIZONTAL) + self.list = widgets.list(panel, _("Account"), style=wx.LC_SINGLE_SEL|wx.LC_REPORT) + listSizer.Add(label, 0, wx.ALL, 5) + listSizer.Add(self.list.list, 0, wx.ALL, 5) + sizer.Add(listSizer, 0, wx.ALL, 5) + self.new = wx.Button(panel, -1, _("New account"), size=wx.DefaultSize) + self.remove = wx.Button(panel, -1, _("Remove account")) + self.configuration = wx.Button(panel, -1, _("Global Settings")) + ok = wx.Button(panel, wx.ID_OK, size=wx.DefaultSize) + ok.SetDefault() + cancel = wx.Button(panel, wx.ID_CANCEL, size=wx.DefaultSize) + buttons = wx.BoxSizer(wx.HORIZONTAL) + buttons.Add(self.new, 0, wx.ALL, 5) + buttons.Add(self.configuration, 0, wx.ALL, 5) + buttons.Add(ok, 0, wx.ALL, 5) + buttons.Add(cancel, 0, wx.ALL, 5) + sizer.Add(buttons, 0, wx.ALL, 5) + panel.SetSizer(sizer) + min = sizer.CalcMin() + self.SetClientSize(min) + + def fill_list(self, sessionsList): + for i in sessionsList: + self.list.insert_item(False, i) + if self.list.get_count() > 0: + self.list.select_item(0) + self.list.list.SetSize(self.list.list.GetBestSize()) + + def ok(self, ev): + if self.list.get_count() == 0: + wx.MessageDialog(None, _("You need to configure an account."), _("Account Error"), wx.ICON_ERROR).ShowModal() + return + self.controller.do_ok() + self.EndModal(wx.ID_OK) + + def new_account_dialog(self): + return wx.MessageDialog(self, _("The request to authorize your Twitter account will be opened in your browser. You only need to do this once. Would you like to continue?"), _("Authorization"), wx.YES_NO).ShowModal() + + def add_new_session_to_list(self): + total = self.list.get_count() + name = _("Authorized account %d") % (total+1) + self.list.insert_item(False, name) + if self.list.get_count() == 1: + self.list.select_item(0) + + def show_unauthorised_error(self): + wx.MessageDialog(None, _("Your access token is invalid or the authorization has failed. Please try again."), _("Invalid user token"), wx.ICON_ERROR).ShowModal() + + def get_response(self): + return self.ShowModal() + + def remove_account_dialog(self): + return wx.MessageDialog(self, _("Do you really want to delete this account?"), _("Remove account"), wx.YES_NO).ShowModal() + + def get_selected(self): + return self.list.get_selected() + + def remove_session(self, sessionID): + self.list.remove_item(sessionID) + + + def hide_configuration(self): + self.configuration.Hide() + + def destroy(self): self.Destroy() \ No newline at end of file diff --git a/src/setup.py b/src/setup.py index ff385eb7..0205c45f 100644 --- a/src/setup.py +++ b/src/setup.py @@ -1,127 +1,127 @@ -# -*- coding: utf-8 -*- -""" Setup file to create executables and distribute the source code of this application. Don't forget this file! """ -############################################################ -# Copyright (c) 2014 José Manuel Delicado Alcolea -# Copyright (c) 2013, 2014 Manuel Eduardo Cortéz Vallejo -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -############################################################ -from setuptools import setup, find_packages -import py2exe -import os -import gettext -import application -import platform -from glob import glob -import wx -from requests import certs - -def get_architecture_files(): - if platform.architecture()[0][:2] == "32": - return [ - ("", ["../windows-dependencies/x86/oggenc2.exe", "../windows-dependencies/x86/bootstrap.exe"]), - ("Microsoft.VC90.CRT", glob("../windows-dependencies/x86/Microsoft.VC90.CRT/*")), - ("Microsoft.VC90.MFC", glob("../windows-dependencies/x86/Microsoft.VC90.MFC/*")),] - elif platform.architecture()[0][:2] == "64": - return [ - ("", ["../windows-dependencies/x64/oggenc2.exe", "../windows-dependencies/x64/bootstrap.exe"]), - ("Microsoft.VC90.CRT", glob("../windows-dependencies/x64/Microsoft.VC90.CRT/*")), - ("Microsoft.VC90.MFC", glob("../windows-dependencies/x64/Microsoft.VC90.MFC/*")),] - -def get_data(): - import sound_lib - import enchant - return [ - ("", ["conf.defaults", "app-configuration.defaults", "icon.ico"]), - ("", [certs.where()]), - ("accessible_output2/lib", glob("accessible_output2/lib/*.dll")), - ("keys/lib", glob("keys/lib/*.dll")), -("keymaps", glob("keymaps/*.keymap")), -("share/enchant/myspell", glob("../windows-dependencies/dictionaries/*")), -]+get_sounds()+get_locales()+get_documentation()+sound_lib.find_datafiles()+enchant.utils.win32_data_files()+get_architecture_files()+wx_files() - -def get_documentation (): - answer = [("documentation", ["documentation/license.txt"])] - depth = 10 - for root, dirs, files in os.walk('documentation'): - if depth == 0: - break - new = (root, glob(os.path.join(root, "*.html"))) - answer.append(new) - depth -= 1 - return answer - -def get_sounds(): - answer = [] - depth = 6 - for root, dirs, files in os.walk('sounds'): - if depth == 0: - break - new = (root, glob(os.path.join(root, "*.ogg"))) - answer.append(new) - depth -= 1 - return answer - -def get_locales(): - answer = [] - for root, dirs, files in os.walk('locales'): - new = (root, glob(os.path.join(root, '*.mo'))) - answer.append(new) - return answer - -def wx_files(): - wxDir=wx.__path__[0] - localeMoFiles=set() - for f in glob("locales/*/LC_MESSAGES"): - g=f.replace("locales", "locale") - wxMoFile=os.path.join(wxDir,g,"wxstd.mo") - if os.path.isfile(wxMoFile): - localeMoFiles.add((f,(wxMoFile,))) - lang=os.path.split(os.path.split(f)[0])[1] - if '_' in lang: - lang=lang.split('_')[0] - f=os.path.join('locale',lang,'lc_messages') - g=f.replace("locale", "locales") - wxMoFile=os.path.join(wxDir,f,"wxstd.mo") - if os.path.isfile(wxMoFile): - localeMoFiles.add((g,(wxMoFile,))) - return list(localeMoFiles) - -if __name__ == '__main__': - setup( - name = application.name, - author = u", ".join(application.authors), - author_email = application.authorEmail, - version = application.version, - url = application.url, -packages= find_packages(), -data_files = get_data(), -options = { - 'py2exe': { - 'optimize':2, - 'packages': ["pubsub", "pubsub.core", "pubsub.core.kwargs", "dbhash"], - 'dll_excludes': ["MPR.dll", "api-ms-win-core-apiquery-l1-1-0.dll", "api-ms-win-core-console-l1-1-0.dll", "api-ms-win-core-delayload-l1-1-1.dll", "api-ms-win-core-errorhandling-l1-1-1.dll", "api-ms-win-core-file-l1-2-0.dll", "api-ms-win-core-handle-l1-1-0.dll", "api-ms-win-core-heap-obsolete-l1-1-0.dll", "api-ms-win-core-libraryloader-l1-1-1.dll", "api-ms-win-core-localization-l1-2-0.dll", "api-ms-win-core-processenvironment-l1-2-0.dll", "api-ms-win-core-processthreads-l1-1-1.dll", "api-ms-win-core-profile-l1-1-0.dll", "api-ms-win-core-registry-l1-1-0.dll", "api-ms-win-core-synch-l1-2-0.dll", "api-ms-win-core-sysinfo-l1-2-0.dll", "api-ms-win-security-base-l1-2-0.dll", "api-ms-win-core-heap-l1-2-0.dll", "api-ms-win-core-interlocked-l1-2-0.dll", "api-ms-win-core-localization-obsolete-l1-1-0.dll", "api-ms-win-core-string-l1-1-0.dll", "api-ms-win-core-string-obsolete-l1-1-0.dll", "WLDAP32.dll", "MSVCP90.dll", "CRYPT32.dll", "mfc90.dll"], - 'compressed': True - }, - }, - windows = [ - { - 'script': 'main.py', - 'dest_base': 'TWBlue', -} - ], - install_requires = [ - ] - ) +# -*- coding: utf-8 -*- +""" Setup file to create executables and distribute the source code of this application. Don't forget this file! """ +############################################################ +# Copyright (c) 2014 José Manuel Delicado Alcolea +# Copyright (c) 2013, 2014 Manuel Eduardo Cortéz Vallejo +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +############################################################ +from setuptools import setup, find_packages +import py2exe +import os +import gettext +import application +import platform +from glob import glob +import wx +from requests import certs + +def get_architecture_files(): + if platform.architecture()[0][:2] == "32": + return [ + ("", ["../windows-dependencies/x86/oggenc2.exe", "../windows-dependencies/x86/bootstrap.exe"]), + ("Microsoft.VC90.CRT", glob("../windows-dependencies/x86/Microsoft.VC90.CRT/*")), + ("Microsoft.VC90.MFC", glob("../windows-dependencies/x86/Microsoft.VC90.MFC/*")),] + elif platform.architecture()[0][:2] == "64": + return [ + ("", ["../windows-dependencies/x64/oggenc2.exe", "../windows-dependencies/x64/bootstrap.exe"]), + ("Microsoft.VC90.CRT", glob("../windows-dependencies/x64/Microsoft.VC90.CRT/*")), + ("Microsoft.VC90.MFC", glob("../windows-dependencies/x64/Microsoft.VC90.MFC/*")),] + +def get_data(): + import sound_lib + import enchant + return [ + ("", ["conf.defaults", "app-configuration.defaults", "icon.ico"]), + ("", [certs.where()]), + ("accessible_output2/lib", glob("accessible_output2/lib/*.dll")), + ("keys/lib", glob("keys/lib/*.dll")), +("keymaps", glob("keymaps/*.keymap")), +("share/enchant/myspell", glob("../windows-dependencies/dictionaries/*")), +]+get_sounds()+get_locales()+get_documentation()+sound_lib.find_datafiles()+enchant.utils.win32_data_files()+get_architecture_files()+wx_files() + +def get_documentation (): + answer = [("documentation", ["documentation/license.txt"])] + depth = 10 + for root, dirs, files in os.walk('documentation'): + if depth == 0: + break + new = (root, glob(os.path.join(root, "*.html"))) + answer.append(new) + depth -= 1 + return answer + +def get_sounds(): + answer = [] + depth = 6 + for root, dirs, files in os.walk('sounds'): + if depth == 0: + break + new = (root, glob(os.path.join(root, "*.ogg"))) + answer.append(new) + depth -= 1 + return answer + +def get_locales(): + answer = [] + for root, dirs, files in os.walk('locales'): + new = (root, glob(os.path.join(root, '*.mo'))) + answer.append(new) + return answer + +def wx_files(): + wxDir=wx.__path__[0] + localeMoFiles=set() + for f in glob("locales/*/LC_MESSAGES"): + g=f.replace("locales", "locale") + wxMoFile=os.path.join(wxDir,g,"wxstd.mo") + if os.path.isfile(wxMoFile): + localeMoFiles.add((f,(wxMoFile,))) + lang=os.path.split(os.path.split(f)[0])[1] + if '_' in lang: + lang=lang.split('_')[0] + f=os.path.join('locale',lang,'lc_messages') + g=f.replace("locale", "locales") + wxMoFile=os.path.join(wxDir,f,"wxstd.mo") + if os.path.isfile(wxMoFile): + localeMoFiles.add((g,(wxMoFile,))) + return list(localeMoFiles) + +if __name__ == '__main__': + setup( + name = application.name, + author = ", ".join(application.authors), + author_email = application.authorEmail, + version = application.version, + url = application.url, +packages= find_packages(), +data_files = get_data(), +options = { + 'py2exe': { + 'optimize':2, + 'packages': ["pubsub", "pubsub.core", "pubsub.core.kwargs", "dbhash"], + 'dll_excludes': ["MPR.dll", "api-ms-win-core-apiquery-l1-1-0.dll", "api-ms-win-core-console-l1-1-0.dll", "api-ms-win-core-delayload-l1-1-1.dll", "api-ms-win-core-errorhandling-l1-1-1.dll", "api-ms-win-core-file-l1-2-0.dll", "api-ms-win-core-handle-l1-1-0.dll", "api-ms-win-core-heap-obsolete-l1-1-0.dll", "api-ms-win-core-libraryloader-l1-1-1.dll", "api-ms-win-core-localization-l1-2-0.dll", "api-ms-win-core-processenvironment-l1-2-0.dll", "api-ms-win-core-processthreads-l1-1-1.dll", "api-ms-win-core-profile-l1-1-0.dll", "api-ms-win-core-registry-l1-1-0.dll", "api-ms-win-core-synch-l1-2-0.dll", "api-ms-win-core-sysinfo-l1-2-0.dll", "api-ms-win-security-base-l1-2-0.dll", "api-ms-win-core-heap-l1-2-0.dll", "api-ms-win-core-interlocked-l1-2-0.dll", "api-ms-win-core-localization-obsolete-l1-1-0.dll", "api-ms-win-core-string-l1-1-0.dll", "api-ms-win-core-string-obsolete-l1-1-0.dll", "WLDAP32.dll", "MSVCP90.dll", "CRYPT32.dll", "mfc90.dll"], + 'compressed': True + }, + }, + windows = [ + { + 'script': 'main.py', + 'dest_base': 'TWBlue', +} + ], + install_requires = [ + ] + ) diff --git a/src/sound.py b/src/sound.py index b523b359..1ff834a9 100644 --- a/src/sound.py +++ b/src/sound.py @@ -139,7 +139,7 @@ class URLStream(object): def play(self, url=None, volume=1.0, stream=None,announce=True): if announce: - output.speak(_(u"Playing...")) + output.speak(_("Playing...")) log.debug("Attempting to play an URL...") if url != None: self.prepare(url) @@ -155,7 +155,7 @@ class URLStream(object): def stop_audio(self,delete=False): if hasattr(self, "stream"): - output.speak(_(u"Stopped."), True) + output.speak(_("Stopped."), True) try: self.stream.stop() log.debug("Stopped audio stream.") diff --git a/src/twitter/__init__.py b/src/twitter/__init__.py index 06e9015c..b5f0110a 100644 --- a/src/twitter/__init__.py +++ b/src/twitter/__init__.py @@ -1,2 +1,2 @@ -from __future__ import absolute_import + from . import buffers, utils, compose, twitter diff --git a/src/twitter/authorisationHandler.py b/src/twitter/authorisationHandler.py index 389e1176..3c71be4c 100644 --- a/src/twitter/authorisationHandler.py +++ b/src/twitter/authorisationHandler.py @@ -19,5 +19,5 @@ class handler(http.server.BaseHTTPRequestHandler): params = parse_qs(urlparse(self.path).query) global verifier verifier = params.get('oauth_verifier', [None])[0] - self.wfile.write(u"You have successfully logged into Twitter with {0}. You can close this window now.".format(application.name)) + self.wfile.write("You have successfully logged into Twitter with {0}. You can close this window now.".format(application.name)) self.finish() diff --git a/src/twitter/buffers/__init__.py b/src/twitter/buffers/__init__.py index 6bdd7a95..1926cd20 100644 --- a/src/twitter/buffers/__init__.py +++ b/src/twitter/buffers/__init__.py @@ -1,2 +1,2 @@ -from __future__ import absolute_import + from . import stream, indibidual \ No newline at end of file diff --git a/src/twitter/compose.py b/src/twitter/compose.py index 83c380e1..f2e63620 100644 --- a/src/twitter/compose.py +++ b/src/twitter/compose.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import + from future import standard_library standard_library.install_aliases() from builtins import str @@ -41,7 +41,7 @@ def compose_tweet(tweet, db, relative_times, show_screen_names=False): if relative_times == True: ts = original_date.humanize(locale=languageHandler.getLanguage()) else: - ts = original_date.replace(seconds=db["utc_offset"]).format(_(u"dddd, MMMM D, YYYY H:m:s"), locale=languageHandler.getLanguage()) + ts = original_date.replace(seconds=db["utc_offset"]).format(_("dddd, MMMM D, YYYY H:m:s"), locale=languageHandler.getLanguage()) else: ts = tweet["created_at"] if "message" in tweet: @@ -82,16 +82,16 @@ def compose_dm(tweet, db, relative_times, show_screen_names=False): if relative_times == True: ts = original_date.humanize(locale=languageHandler.getLanguage()) else: - ts = original_date.replace(seconds=db["utc_offset"]).format(_(u"dddd, MMMM D, YYYY H:m:s"), locale=languageHandler.getLanguage()) + ts = original_date.replace(seconds=db["utc_offset"]).format(_("dddd, MMMM D, YYYY H:m:s"), locale=languageHandler.getLanguage()) else: ts = tweet["created_at"] text = StripChars(tweet["text"]) source = "DM" if db["user_name"] == tweet["sender"]["screen_name"]: if show_screen_names: - user = _(u"Dm to %s ") % (tweet["recipient"]["screen_name"],) + user = _("Dm to %s ") % (tweet["recipient"]["screen_name"],) else: - user = _(u"Dm to %s ") % (tweet["recipient"]["name"],) + user = _("Dm to %s ") % (tweet["recipient"]["name"],) else: if show_screen_names: user = tweet["sender"]["screen_name"] @@ -126,7 +126,7 @@ def compose_quoted_tweet(quoted_tweet, original_tweet, show_screen_names=False): original_text = StripChars(original_tweet["full_text"]) else: original_text = StripChars(original_tweet["text"]) - quoted_tweet["message"] = _(u"{0}. Quoted tweet from @{1}: {2}").format( quoted_tweet[value], original_user, original_text) + quoted_tweet["message"] = _("{0}. Quoted tweet from @{1}: {2}").format( quoted_tweet[value], original_user, original_text) quoted_tweet = tweets.clear_url(quoted_tweet) return quoted_tweet @@ -136,7 +136,7 @@ def compose_followers_list(tweet, db, relative_times=True, show_screen_names=Fal if relative_times == True: ts = original_date.humanize(locale=languageHandler.getLanguage()) else: - ts = original_date.replace(seconds=db["utc_offset"]).format(_(u"dddd, MMMM D, YYYY H:m:s"), locale=languageHandler.getLanguage()) + ts = original_date.replace(seconds=db["utc_offset"]).format(_("dddd, MMMM D, YYYY H:m:s"), locale=languageHandler.getLanguage()) else: ts = tweet["created_at"] if "status" in tweet: @@ -145,12 +145,12 @@ def compose_followers_list(tweet, db, relative_times=True, show_screen_names=Fal if relative_times: ts2 = original_date2.humanize(locale=languageHandler.getLanguage()) else: - ts2 = original_date2.replace(seconds=db["utc_offset"]).format(_(u"dddd, MMMM D, YYYY H:m:s"), locale=languageHandler.getLanguage()) + ts2 = original_date2.replace(seconds=db["utc_offset"]).format(_("dddd, MMMM D, YYYY H:m:s"), locale=languageHandler.getLanguage()) else: ts2 = _("Unavailable") else: ts2 = _("Unavailable") - return [_(u"%s (@%s). %s followers, %s friends, %s tweets. Last tweeted %s. Joined Twitter %s") % (tweet["name"], tweet["screen_name"], tweet["followers_count"], tweet["friends_count"], tweet["statuses_count"], ts2, ts)] + return [_("%s (@%s). %s followers, %s friends, %s tweets. Last tweeted %s. Joined Twitter %s") % (tweet["name"], tweet["screen_name"], tweet["followers_count"], tweet["friends_count"], tweet["statuses_count"], ts2, ts)] def compose_event(data, username, show_screen_names=False): if show_screen_names: @@ -160,45 +160,45 @@ def compose_event(data, username, show_screen_names=False): if data["event"] == "block": event = _("You've blocked %s") % (data["target"][value]) elif data["event"] == "unblock": - event = _(u"You've unblocked %s") % (data["target"][value]) + event = _("You've unblocked %s") % (data["target"][value]) elif data["event"] == "follow": if data["target"]["screen_name"] == username: - event = _(u"%s(@%s) has followed you") % (data["source"]["name"], data["source"]["screen_name"]) + event = _("%s(@%s) has followed you") % (data["source"]["name"], data["source"]["screen_name"]) elif data["source"]["screen_name"] == username: - event = _(u"You've followed %s(@%s)") % (data["target"]["name"], data["target"]["screen_name"]) + event = _("You've followed %s(@%s)") % (data["target"]["name"], data["target"]["screen_name"]) elif data["event"] == "unfollow": - event = _(u"You've unfollowed %s (@%s)") % (data["target"]["name"], data["target"]["screen_name"]) + event = _("You've unfollowed %s (@%s)") % (data["target"]["name"], data["target"]["screen_name"]) elif data["event"] == "favorite": if data["source"]["screen_name"] == username: - event = _(u"You've liked: %s, %s") % (data["target"][value], data["target_object"]["text"]) + event = _("You've liked: %s, %s") % (data["target"][value], data["target_object"]["text"]) else: - event = _(u"%s(@%s) has liked: %s") % (data["source"]["name"], data["source"]["screen_name"], data["target_object"]["text"]) + event = _("%s(@%s) has liked: %s") % (data["source"]["name"], data["source"]["screen_name"], data["target_object"]["text"]) elif data["event"] == "unfavorite": - if data["source"]["screen_name"] == username: event = _(u"You've unliked: %s, %s") % (data["target"][value], data["target_object"]["text"]) - else: event = _(u"%s(@%s) has unliked: %s") % (data["source"]["name"], data["source"]["screen_name"], data["target_object"]["text"]) + if data["source"]["screen_name"] == username: event = _("You've unliked: %s, %s") % (data["target"][value], data["target_object"]["text"]) + else: event = _("%s(@%s) has unliked: %s") % (data["source"]["name"], data["source"]["screen_name"], data["target_object"]["text"]) elif data["event"] == "list_created": - event = _(u"You've created the list %s") % (data["target_object"]["name"]) + event = _("You've created the list %s") % (data["target_object"]["name"]) elif data["event"] == "list_destroyed": event = _("You've deleted the list %s") % (data["target_object"]["name"]) elif data["event"] == "list_updated": event = _("You've updated the list %s") % (data["target_object"]["name"]) elif data["event"] == "list_member_added": - if data["source"]["screen_name"] == username: event = _(u"You've added %s(@%s) to the list %s") % (data["target"]["name"], data["target"]["screen_name"], data["target_object"]["name"]) - else: event = _(u"%s(@%s) has added you to the list %s") % (data["source"]["name"], data["source"]["screen_name"], data["target_object"]["name"]) + if data["source"]["screen_name"] == username: event = _("You've added %s(@%s) to the list %s") % (data["target"]["name"], data["target"]["screen_name"], data["target_object"]["name"]) + else: event = _("%s(@%s) has added you to the list %s") % (data["source"]["name"], data["source"]["screen_name"], data["target_object"]["name"]) elif data["event"] == "list_member_removed": - if data["source"]["screen_name"] == username: event = _(u"You'be removed %s(@%s) from the list %s") % (data["target"]["name"], data["target"]["screen_name"], data["target_object"]["name"]) - else: event = _(u"%s(@%s) has removed you from the list %s") % (data["source"]["name"], data["source"]["screen_name"], data["target_object"]["name"]) + if data["source"]["screen_name"] == username: event = _("You'be removed %s(@%s) from the list %s") % (data["target"]["name"], data["target"]["screen_name"], data["target_object"]["name"]) + else: event = _("%s(@%s) has removed you from the list %s") % (data["source"]["name"], data["source"]["screen_name"], data["target_object"]["name"]) elif data["event"] == "list_user_subscribed": - if data["source"]["screen_name"] == username: event = _(u"You've subscribed to the list %s, which is owned by %s(@%s)") % (data["target_object"]["name"], data["target"]["name"], data["target"]["screen_name"]) - else: event = _(u"%s(@%s) has suscribed you to the list %s") % (data["source"]["name"], data["source"]["screen_name"], data["target_object"]["name"]) + if data["source"]["screen_name"] == username: event = _("You've subscribed to the list %s, which is owned by %s(@%s)") % (data["target_object"]["name"], data["target"]["name"], data["target"]["screen_name"]) + else: event = _("%s(@%s) has suscribed you to the list %s") % (data["source"]["name"], data["source"]["screen_name"], data["target_object"]["name"]) 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"]) + if data["source"]["screen_name"] == username: event = _("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"]) elif data["event"] == "retweeted_retweet": - if data["source"]["screen_name"] == username: event = _(u"You have retweeted a retweet from %s(@%s): %s") % (data["target"]["name"], data["target"]["screen_name"], data["target_object"]["retweeted_status"]["text"]) - else: event = _(u"%s(@%s) has retweeted your retweet: %s") % (data["source"]["name"], data["source"]["screen_name"], data["target_object"]["retweeted_status"]["text"]) + if data["source"]["screen_name"] == username: event = _("You have retweeted a retweet from %s(@%s): %s") % (data["target"]["name"], data["target"]["screen_name"], data["target_object"]["retweeted_status"]["text"]) + else: event = _("%s(@%s) has retweeted your retweet: %s") % (data["source"]["name"], data["source"]["screen_name"], data["target_object"]["retweeted_status"]["text"]) elif data["event"] == "quoted_tweet": - event = _(u"@{0} quoted your tweet: {1}").format(data["source"]["screen_name"], data["target_object"]["text"]) + event = _("@{0} quoted your tweet: {1}").format(data["source"]["screen_name"], data["target_object"]["text"]) else: event = _("Unknown") log.error("event: %s\n target: %s\n source: %s\n target_object: %s" % (data["event"], data["target"], data["source"], data["target_object"])) @@ -206,10 +206,10 @@ def compose_event(data, username, show_screen_names=False): def compose_list(list): name = list["name"] - if list["description"] == None: description = _(u"No description available") + if list["description"] == None: description = _("No description available") else: description = list["description"] user = list["user"]["name"] members = str(list["member_count"]) - if list["mode"] == "private": status = _(u"private") - else: status = _(u"public") + if list["mode"] == "private": status = _("private") + else: status = _("public") return [name, description, user, members, status] diff --git a/src/twitter/twitter.py b/src/twitter/twitter.py index ab0740bd..60b97770 100644 --- a/src/twitter/twitter.py +++ b/src/twitter/twitter.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import + from future import standard_library standard_library.install_aliases() from builtins import object diff --git a/src/twitter/utils.py b/src/twitter/utils.py index 0d24332f..cf5aca22 100644 --- a/src/twitter/utils.py +++ b/src/twitter/utils.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import print_function + from builtins import str from builtins import range import url_shortener, re @@ -139,9 +139,9 @@ def is_allowed(tweet, clients): def twitter_error(error): if error.error_code == 403: - msg = _(u"Sorry, you are not authorised to see this status.") + msg = _("Sorry, you are not authorised to see this status.") elif error.error_code == 404: - msg = _(u"No status found with that ID") + msg = _("No status found with that ID") else: - msg = _(u"Error code {0}").format(error.error_code,) + msg = _("Error code {0}").format(error.error_code,) output.speak(msg) \ No newline at end of file diff --git a/src/update/updater.py b/src/update/updater.py index 6d6d2c7b..42b57ba8 100644 --- a/src/update/updater.py +++ b/src/update/updater.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import + import application from . import update import platform diff --git a/src/update/utils.py b/src/update/utils.py index 42ee7f4a..a3681c07 100644 --- a/src/update/utils.py +++ b/src/update/utils.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from __future__ import division + from builtins import str from past.utils import old_div def convert_bytes(n): @@ -27,19 +27,19 @@ def seconds_to_string(seconds, precision=0): sec_string = sec.__format__(sec_spec) string = "" if day == 1: - string += _(u"%d day, ") % day + string += _("%d day, ") % day elif day >= 2: - string += _(u"%d days, ") % day + string += _("%d days, ") % day if (hour == 1): - string += _(u"%d hour, ") % hour + string += _("%d hour, ") % hour elif (hour >= 2): string += _("%d hours, ") % hour if (min == 1): - string += _(u"%d minute, ") % min + string += _("%d minute, ") % min elif (min >= 2): - string += _(u"%d minutes, ") % min + string += _("%d minutes, ") % min if sec >= 0 and sec <= 2: - string += _(u"%s second") % sec_string + string += _("%s second") % sec_string else: - string += _(u"%s seconds") % sec_string + string += _("%s seconds") % sec_string return string \ No newline at end of file diff --git a/src/update/wxUpdater.py b/src/update/wxUpdater.py index 3cd20d87..84aa2508 100644 --- a/src/update/wxUpdater.py +++ b/src/update/wxUpdater.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import -from __future__ import division + + from builtins import str from past.utils import old_div import wx @@ -10,7 +10,7 @@ from . import utils progress_dialog = None def available_update_dialog(version, description, date): - dialog = wx.MessageDialog(None, _(u"There's a new %s version available, released on %s. Would you like to download it now?\n\n %s version: %s\n\nChanges:\n%s") % (application.name, date, application.name, version, description), _(u"New version for %s") % application.name, style=wx.YES|wx.NO|wx.ICON_WARNING) + dialog = wx.MessageDialog(None, _("There's a new %s version available, released on %s. Would you like to download it now?\n\n %s version: %s\n\nChanges:\n%s") % (application.name, date, application.name, version, description), _("New version for %s") % application.name, style=wx.YES|wx.NO|wx.ICON_WARNING) if dialog.ShowModal() == wx.ID_YES: return True else: @@ -18,7 +18,7 @@ def available_update_dialog(version, description, date): def create_progress_dialog(): - return wx.ProgressDialog(_(u"Download in Progress"), _(u"Downloading the new version..."), parent=None, maximum=100) + return wx.ProgressDialog(_("Download in Progress"), _("Downloading the new version..."), parent=None, maximum=100) def progress_callback(total_downloaded, total_size): global progress_dialog @@ -28,7 +28,7 @@ def progress_callback(total_downloaded, total_size): if total_downloaded == total_size: progress_dialog.Destroy() else: - progress_dialog.Update(old_div((total_downloaded*100),total_size), _(u"Updating... %s of %s") % (str(utils.convert_bytes(total_downloaded)), str(utils.convert_bytes(total_size)))) + progress_dialog.Update(old_div((total_downloaded*100),total_size), _("Updating... %s of %s") % (str(utils.convert_bytes(total_downloaded)), str(utils.convert_bytes(total_size)))) def update_finished(): - ms = wx.MessageDialog(None, _(u"The update has been downloaded and installed successfully. Press OK to continue."), _(u"Done!")).ShowModal() \ No newline at end of file + ms = wx.MessageDialog(None, _("The update has been downloaded and installed successfully. Press OK to continue."), _("Done!")).ShowModal() \ No newline at end of file diff --git a/src/url_shortener/__init__.py b/src/url_shortener/__init__.py index d9556030..02152e8c 100644 --- a/src/url_shortener/__init__.py +++ b/src/url_shortener/__init__.py @@ -1,3 +1,3 @@ -from __future__ import absolute_import + from . import shorteners from .__main__ import * diff --git a/src/url_shortener/__main__.py b/src/url_shortener/__main__.py index 2f5b28b8..fb43dd68 100644 --- a/src/url_shortener/__main__.py +++ b/src/url_shortener/__main__.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from functools import wraps from . import shorteners diff --git a/src/url_shortener/shorteners/__init__.py b/src/url_shortener/shorteners/__init__.py index ba9dafc5..4316679d 100644 --- a/src/url_shortener/shorteners/__init__.py +++ b/src/url_shortener/shorteners/__init__.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from .url_shortener import URLShortener from .hkcim import HKCShortener from .isgd import IsgdShortener diff --git a/src/url_shortener/shorteners/clckru.py b/src/url_shortener/shorteners/clckru.py index 131f934b..571adcb9 100644 --- a/src/url_shortener/shorteners/clckru.py +++ b/src/url_shortener/shorteners/clckru.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from future import standard_library standard_library.install_aliases() import urllib.request, urllib.parse, urllib.error diff --git a/src/url_shortener/shorteners/hkcim.py b/src/url_shortener/shorteners/hkcim.py index 2f984cf4..9a24e115 100644 --- a/src/url_shortener/shorteners/hkcim.py +++ b/src/url_shortener/shorteners/hkcim.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from future import standard_library standard_library.install_aliases() import urllib.request, urllib.parse, urllib.error diff --git a/src/url_shortener/shorteners/isgd.py b/src/url_shortener/shorteners/isgd.py index 8ac65902..90b2dca7 100644 --- a/src/url_shortener/shorteners/isgd.py +++ b/src/url_shortener/shorteners/isgd.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from future import standard_library standard_library.install_aliases() import urllib.request, urllib.parse, urllib.error diff --git a/src/url_shortener/shorteners/onjme.py b/src/url_shortener/shorteners/onjme.py index d9f1e8fa..5ec9d43f 100644 --- a/src/url_shortener/shorteners/onjme.py +++ b/src/url_shortener/shorteners/onjme.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from future import standard_library standard_library.install_aliases() import urllib.request, urllib.parse, urllib.error diff --git a/src/url_shortener/shorteners/tinyarrows.py b/src/url_shortener/shorteners/tinyarrows.py index 7fc30207..a6ec53b3 100644 --- a/src/url_shortener/shorteners/tinyarrows.py +++ b/src/url_shortener/shorteners/tinyarrows.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from future import standard_library standard_library.install_aliases() import urllib.request, urllib.parse, urllib.error diff --git a/src/url_shortener/shorteners/tinyurl.py b/src/url_shortener/shorteners/tinyurl.py index 08e2637e..d14dce9b 100644 --- a/src/url_shortener/shorteners/tinyurl.py +++ b/src/url_shortener/shorteners/tinyurl.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from future import standard_library standard_library.install_aliases() from .url_shortener import URLShortener diff --git a/src/url_shortener/shorteners/xedcc.py b/src/url_shortener/shorteners/xedcc.py index a02e2ef8..0002c798 100644 --- a/src/url_shortener/shorteners/xedcc.py +++ b/src/url_shortener/shorteners/xedcc.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from future import standard_library standard_library.install_aliases() import urllib.request, urllib.parse, urllib.error diff --git a/src/widgetUtils/__init__.py b/src/widgetUtils/__init__.py index 673ab67c..14bde12b 100644 --- a/src/widgetUtils/__init__.py +++ b/src/widgetUtils/__init__.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + import platform if platform.system() == "Windows": from .wxUtils import * diff --git a/src/wxUI/buffers/__init__.py b/src/wxUI/buffers/__init__.py index adf383df..339ed52c 100644 --- a/src/wxUI/buffers/__init__.py +++ b/src/wxUI/buffers/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import + from .base import basePanel from .dm import dmPanel from .events import eventsPanel diff --git a/src/wxUI/buffers/base.py b/src/wxUI/buffers/base.py index 03c74e85..ff7ea095 100644 --- a/src/wxUI/buffers/base.py +++ b/src/wxUI/buffers/base.py @@ -1,45 +1,45 @@ -# -*- coding: utf-8 -*- -import wx -from multiplatform_widgets import widgets - -class basePanel(wx.Panel): - - def set_focus_function(self, f): - self.list.list.Bind(wx.EVT_LIST_ITEM_FOCUSED, f) - - def create_list(self): - self.list = widgets.list(self, _(u"User"), _(u"Text"), _(u"Date"), _(u"Client"), style=wx.LC_REPORT|wx.LC_SINGLE_SEL|wx.LC_VRULES) - self.list.set_windows_size(0, 60) - self.list.set_windows_size(1, 320) - self.list.set_windows_size(2, 110) - self.list.set_windows_size(3, 84) - self.list.set_size() - - def __init__(self, parent, name): - super(basePanel, self).__init__(parent) - self.name = name - self.type = "baseBuffer" - self.sizer = wx.BoxSizer(wx.VERTICAL) - self.create_list() - self.tweet = wx.Button(self, -1, _(u"Tweet")) - self.retweet = wx.Button(self, -1, _(u"Retweet")) - self.reply = wx.Button(self, -1, _(u"Reply")) - self.dm = wx.Button(self, -1, _(u"Direct message")) - btnSizer = wx.BoxSizer(wx.HORIZONTAL) - btnSizer.Add(self.tweet, 0, wx.ALL, 5) - btnSizer.Add(self.retweet, 0, wx.ALL, 5) - btnSizer.Add(self.reply, 0, wx.ALL, 5) - btnSizer.Add(self.dm, 0, wx.ALL, 5) - self.sizer.Add(btnSizer, 0, wx.ALL, 5) - self.sizer.Add(self.list.list, 0, wx.ALL|wx.EXPAND, 5) - self.SetSizer(self.sizer) - self.SetClientSize(self.sizer.CalcMin()) - - def set_position(self, reversed=False): - if reversed == False: - self.list.select_item(self.list.get_count()-1) - else: - self.list.select_item(0) - - def set_focus_in_list(self): +# -*- coding: utf-8 -*- +import wx +from multiplatform_widgets import widgets + +class basePanel(wx.Panel): + + def set_focus_function(self, f): + self.list.list.Bind(wx.EVT_LIST_ITEM_FOCUSED, f) + + def create_list(self): + self.list = widgets.list(self, _("User"), _("Text"), _("Date"), _("Client"), style=wx.LC_REPORT|wx.LC_SINGLE_SEL|wx.LC_VRULES) + self.list.set_windows_size(0, 60) + self.list.set_windows_size(1, 320) + self.list.set_windows_size(2, 110) + self.list.set_windows_size(3, 84) + self.list.set_size() + + def __init__(self, parent, name): + super(basePanel, self).__init__(parent) + self.name = name + self.type = "baseBuffer" + self.sizer = wx.BoxSizer(wx.VERTICAL) + self.create_list() + self.tweet = wx.Button(self, -1, _("Tweet")) + self.retweet = wx.Button(self, -1, _("Retweet")) + self.reply = wx.Button(self, -1, _("Reply")) + self.dm = wx.Button(self, -1, _("Direct message")) + btnSizer = wx.BoxSizer(wx.HORIZONTAL) + btnSizer.Add(self.tweet, 0, wx.ALL, 5) + btnSizer.Add(self.retweet, 0, wx.ALL, 5) + btnSizer.Add(self.reply, 0, wx.ALL, 5) + btnSizer.Add(self.dm, 0, wx.ALL, 5) + self.sizer.Add(btnSizer, 0, wx.ALL, 5) + self.sizer.Add(self.list.list, 0, wx.ALL|wx.EXPAND, 5) + self.SetSizer(self.sizer) + self.SetClientSize(self.sizer.CalcMin()) + + def set_position(self, reversed=False): + if reversed == False: + self.list.select_item(self.list.get_count()-1) + else: + self.list.select_item(0) + + def set_focus_in_list(self): self.list.list.SetFocus() \ No newline at end of file diff --git a/src/wxUI/buffers/dm.py b/src/wxUI/buffers/dm.py index 26bddc31..73adecfd 100644 --- a/src/wxUI/buffers/dm.py +++ b/src/wxUI/buffers/dm.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import + import wx from .base import basePanel diff --git a/src/wxUI/buffers/events.py b/src/wxUI/buffers/events.py index 929d5c91..2e0c1b1a 100644 --- a/src/wxUI/buffers/events.py +++ b/src/wxUI/buffers/events.py @@ -1,24 +1,24 @@ -# -*- coding: utf-8 -*- -import wx -from multiplatform_widgets import widgets - -class eventsPanel(wx.Panel): - """ Buffer to show events. Different than tweets or people.""" - - def __init__(self, parent, name): - self.type = "event" - super(eventsPanel, self).__init__(parent) - self.name = name - sizer = wx.BoxSizer() - self.list = widgets.list(self, _(u"Date"), _(u"Event"), size=(600,600), style=wx.LC_REPORT|wx.LC_SINGLE_SEL|wx.LC_VRULES) - self.tweet = wx.Button(self, -1, _(u"Tweet")) - self.delete_event = wx.Button(self, -1, _(u"Remove event")) - - def set_position(self, reversed=False): - if reversed == False: - self.list.select_item(self.list.get_count()-1) - else: - self.list.select_item(0) - - def set_focus_in_list(self): +# -*- coding: utf-8 -*- +import wx +from multiplatform_widgets import widgets + +class eventsPanel(wx.Panel): + """ Buffer to show events. Different than tweets or people.""" + + def __init__(self, parent, name): + self.type = "event" + super(eventsPanel, self).__init__(parent) + self.name = name + sizer = wx.BoxSizer() + self.list = widgets.list(self, _("Date"), _("Event"), size=(600,600), style=wx.LC_REPORT|wx.LC_SINGLE_SEL|wx.LC_VRULES) + self.tweet = wx.Button(self, -1, _("Tweet")) + self.delete_event = wx.Button(self, -1, _("Remove event")) + + def set_position(self, reversed=False): + if reversed == False: + self.list.select_item(self.list.get_count()-1) + else: + self.list.select_item(0) + + def set_focus_in_list(self): self.list.list.SetFocus() \ No newline at end of file diff --git a/src/wxUI/buffers/favourites.py b/src/wxUI/buffers/favourites.py index c665bed4..f3dfa56d 100644 --- a/src/wxUI/buffers/favourites.py +++ b/src/wxUI/buffers/favourites.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import + import wx from .base import basePanel diff --git a/src/wxUI/buffers/lists.py b/src/wxUI/buffers/lists.py index c2e02fbc..cfa8a1ab 100644 --- a/src/wxUI/buffers/lists.py +++ b/src/wxUI/buffers/lists.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import + import wx from .base import basePanel diff --git a/src/wxUI/buffers/panels.py b/src/wxUI/buffers/panels.py index ce96d1f7..00946ff0 100644 --- a/src/wxUI/buffers/panels.py +++ b/src/wxUI/buffers/panels.py @@ -1,35 +1,35 @@ -# -*- coding: utf-8 -*- -import wx -from multiplatform_widgets import widgets - -class accountPanel(wx.Panel): - def __init__(self, parent, name=None): - super(accountPanel, self).__init__(parent=parent) - self.name = name - self.type = "account" - sizer = wx.BoxSizer(wx.VERTICAL) - self.login = wx.Button(self, -1, _(u"Login")) - sizer.Add(self.login, 0, wx.ALL, 5) - self.autostart_account = wx.CheckBox(self, -1, _(u"Log in automatically")) - sizer.Add(self.autostart_account, 0, wx.ALL, 5) - self.SetSizer(sizer) - - def change_login(self, login=True): - if login == True: - self.login.SetLabel(_(u"Login")) - else: - self.login.SetLabel(_(u"Logout")) - - def change_autostart(self, autostart=True): - self.autostart_account.SetValue(autostart) - - def get_autostart(self): - return self.autostart_account.GetValue() - -class emptyPanel(wx.Panel): - def __init__(self, parent, name): - super(emptyPanel, self).__init__(parent=parent, name=name) - self.name = name - self.type = "account" - sizer = wx.BoxSizer(wx.VERTICAL) - self.SetSizer(sizer) +# -*- coding: utf-8 -*- +import wx +from multiplatform_widgets import widgets + +class accountPanel(wx.Panel): + def __init__(self, parent, name=None): + super(accountPanel, self).__init__(parent=parent) + self.name = name + self.type = "account" + sizer = wx.BoxSizer(wx.VERTICAL) + self.login = wx.Button(self, -1, _("Login")) + sizer.Add(self.login, 0, wx.ALL, 5) + self.autostart_account = wx.CheckBox(self, -1, _("Log in automatically")) + sizer.Add(self.autostart_account, 0, wx.ALL, 5) + self.SetSizer(sizer) + + def change_login(self, login=True): + if login == True: + self.login.SetLabel(_("Login")) + else: + self.login.SetLabel(_("Logout")) + + def change_autostart(self, autostart=True): + self.autostart_account.SetValue(autostart) + + def get_autostart(self): + return self.autostart_account.GetValue() + +class emptyPanel(wx.Panel): + def __init__(self, parent, name): + super(emptyPanel, self).__init__(parent=parent, name=name) + self.name = name + self.type = "account" + sizer = wx.BoxSizer(wx.VERTICAL) + self.SetSizer(sizer) diff --git a/src/wxUI/buffers/people.py b/src/wxUI/buffers/people.py index e1b4e566..605e5e09 100644 --- a/src/wxUI/buffers/people.py +++ b/src/wxUI/buffers/people.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import + import wx from multiplatform_widgets import widgets from .base import basePanel @@ -8,10 +8,10 @@ class peoplePanel(basePanel): """ Buffer used to show people.""" def create_list(self): - self.list = widgets.list(self, _(u"User"), style=wx.LC_REPORT|wx.LC_SINGLE_SEL, size=(800, 800)) + self.list = widgets.list(self, _("User"), style=wx.LC_REPORT|wx.LC_SINGLE_SEL, size=(800, 800)) def __init__(self, parent, name): super(peoplePanel, self).__init__(parent, name) self.type = "people" - self.reply.SetLabel(_(u"Mention")) + self.reply.SetLabel(_("Mention")) self.retweet.Disable() diff --git a/src/wxUI/buffers/trends.py b/src/wxUI/buffers/trends.py index f055ce69..b8cf71f7 100644 --- a/src/wxUI/buffers/trends.py +++ b/src/wxUI/buffers/trends.py @@ -1,33 +1,33 @@ -# -*- coding: utf-8 -*- -import wx -from multiplatform_widgets import widgets - -class trendsPanel(wx.Panel): - def create_list(self): - """ Returns the list for put the tweets here.""" - self.list = widgets.list(self, _(u"Trending topic"), style=wx.LC_REPORT|wx.LC_SINGLE_SEL|wx.LC_VRULES) - self.list.set_windows_size(0, 30) - self.list.set_size() - - def __init__(self, parent, name): - super(trendsPanel, self).__init__(parent) - self.type = "trends" - self.sizer = wx.BoxSizer(wx.VERTICAL) - self.create_list() - self.tweet = wx.Button(self, -1, _(u"Tweet")) - self.tweetTrendBtn = wx.Button(self, -1, _(u"Tweet about this trend")) - self.search_topic = wx.Button(self, -1, _(u"Search topic")) - btnSizer = wx.BoxSizer(wx.HORIZONTAL) - btnSizer.Add(self.tweet, 0, wx.ALL, 5) - btnSizer.Add(self.tweetTrendBtn, 0, wx.ALL, 5) - btnSizer.Add(self.search_topic, 0, wx.ALL, 5) - self.sizer.Add(btnSizer, 0, wx.ALL, 5) - self.sizer.Add(self.list.list, 0, wx.ALL, 5) - self.SetSizer(self.sizer) - - def set_position(self, reversed=False): - if reversed == False: - self.list.select_item(self.list.get_count()-1) - else: - self.list.select_item(0) +# -*- coding: utf-8 -*- +import wx +from multiplatform_widgets import widgets + +class trendsPanel(wx.Panel): + def create_list(self): + """ Returns the list for put the tweets here.""" + self.list = widgets.list(self, _("Trending topic"), style=wx.LC_REPORT|wx.LC_SINGLE_SEL|wx.LC_VRULES) + self.list.set_windows_size(0, 30) + self.list.set_size() + + def __init__(self, parent, name): + super(trendsPanel, self).__init__(parent) + self.type = "trends" + self.sizer = wx.BoxSizer(wx.VERTICAL) + self.create_list() + self.tweet = wx.Button(self, -1, _("Tweet")) + self.tweetTrendBtn = wx.Button(self, -1, _("Tweet about this trend")) + self.search_topic = wx.Button(self, -1, _("Search topic")) + btnSizer = wx.BoxSizer(wx.HORIZONTAL) + btnSizer.Add(self.tweet, 0, wx.ALL, 5) + btnSizer.Add(self.tweetTrendBtn, 0, wx.ALL, 5) + btnSizer.Add(self.search_topic, 0, wx.ALL, 5) + self.sizer.Add(btnSizer, 0, wx.ALL, 5) + self.sizer.Add(self.list.list, 0, wx.ALL, 5) + self.SetSizer(self.sizer) + + def set_position(self, reversed=False): + if reversed == False: + self.list.select_item(self.list.get_count()-1) + else: + self.list.select_item(0) \ No newline at end of file diff --git a/src/wxUI/buffers/tweet_searches.py b/src/wxUI/buffers/tweet_searches.py index cb6b797c..ba88ed8c 100644 --- a/src/wxUI/buffers/tweet_searches.py +++ b/src/wxUI/buffers/tweet_searches.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import + import wx from .base import basePanel diff --git a/src/wxUI/buffers/user_searches.py b/src/wxUI/buffers/user_searches.py index e68fec2f..c7e55f2e 100644 --- a/src/wxUI/buffers/user_searches.py +++ b/src/wxUI/buffers/user_searches.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import + import wx from .tweet_searches import searchPanel from multiplatform_widgets import widgets @@ -7,7 +7,7 @@ from multiplatform_widgets import widgets class searchUsersPanel(searchPanel): def create_list(self): """ Returns the list for put the tweets here.""" - self.list = widgets.list(self, _(u"User"), style=wx.LC_REPORT|wx.LC_SINGLE_SEL, size=(800, 800)) + self.list = widgets.list(self, _("User"), style=wx.LC_REPORT|wx.LC_SINGLE_SEL, size=(800, 800)) def __init__(self, parent, name): super(searchUsersPanel, self).__init__(parent, name) diff --git a/src/wxUI/commonMessageDialogs.py b/src/wxUI/commonMessageDialogs.py index b643a3e6..eb1e179c 100644 --- a/src/wxUI/commonMessageDialogs.py +++ b/src/wxUI/commonMessageDialogs.py @@ -1,82 +1,82 @@ -# -*- coding: utf-8 -*- -import wx -import application - -def retweet_as_link(parent): - return wx.MessageDialog(parent, _(u"This retweet is over 140 characters. Would you like to post it as a mention to the poster with your comments and a link to the original tweet?"), application.name, wx.YES_NO|wx.ICON_QUESTION).ShowModal() - -def retweet_question(parent): - return wx.MessageDialog(parent, _(u"Would you like to add a comment to this tweet?"), _("Retweet"), wx.YES_NO|wx.CANCEL|wx.ICON_QUESTION).ShowModal() - -def delete_tweet_dialog(parent): - return wx.MessageDialog(parent, _(u"Do you really want to delete this tweet? It will be deleted from Twitter as well."), _(u"Delete"), wx.ICON_QUESTION|wx.YES_NO).ShowModal() - -def exit_dialog(parent): - dlg = wx.MessageDialog(parent, _(u"Do you really want to close {0}?").format(application.name,), _(u"Exit"), wx.YES_NO|wx.ICON_QUESTION) - return dlg.ShowModal() - -def needs_restart(): - wx.MessageDialog(None, _(u" {0} must be restarted for these changes to take effect.").format(application.name,), _("Restart {0} ").format(application.name,), wx.OK).ShowModal() - -def delete_user_from_db(): - return wx.MessageDialog(None, _(u"Are you sure you want to delete this user from the database? This user will not appear in autocomplete results anymore."), _(u"Confirm"), wx.YES_NO|wx.ICON_QUESTION).ShowModal() - -def get_ignored_client(): - entry = wx.TextEntryDialog(None, _(u"Enter the name of the client : "), _(u"Add client")) - if entry.ShowModal() == wx.ID_OK: - return entry.GetValue() - return None - -def clear_list(): - dlg = wx.MessageDialog(None, _(u"Do you really want to empty this buffer? It's items will be removed from the list but not from Twitter"), _(u"Empty buffer"), wx.ICON_QUESTION|wx.YES_NO) - return dlg.ShowModal() - -def remove_buffer(): - return wx.MessageDialog(None, _(u"Do you really want to destroy this buffer?"), _(u"Attention"), style=wx.ICON_QUESTION|wx.YES_NO).ShowModal() - -def user_not_exist(): - return wx.MessageDialog(None, _(u"That user does not exist"), _(u"Error"), wx.ICON_ERROR).ShowModal() - -def timeline_exist(): - return wx.MessageDialog(None, _(u"A timeline for this user already exists. You can't open another"), _(u"Existing timeline"), wx.ICON_ERROR).ShowModal() - -def no_tweets(): - return wx.MessageDialog(None, _(u"This user has no tweets, so you can't open a timeline for them."), _(u"Error!"), wx.ICON_ERROR).ShowModal() - -def protected_user(): - return wx.MessageDialog(None, _(u"This is a protected Twitter user, which means you can't open a timeline using the Streaming API. The user's tweets will not update due to a twitter policy. Do you want to continue?"), _(u"Warning"), wx.ICON_WARNING|wx.YES_NO).ShowModal() - -def no_following(): - return wx.MessageDialog(None, _(u"This is a protected user account, you need to follow this user to view their tweets or likes."), _(u"Error"), wx.ICON_ERROR).ShowModal() - -def donation(): - dlg = wx.MessageDialog(None, _(u"If you like {0} we need your help to keep it going. Help us by donating to the project. This will help us pay for the server, the domain and some other things to ensure that {0} will be actively maintained. Your donation will give us the means to continue the development of {0}, and to keep {0} free. Would you like to donate now?").format(application.name), _(u"We need your help"), wx.ICON_QUESTION|wx.YES_NO) - return dlg.ShowModal() - -def no_tweets(): - return wx.MessageDialog(None, _(u"This user has no tweets. {0} can't create a timeline.").format(application.name), _(u"Error"), wx.ICON_ERROR).ShowModal() - -def no_favs(): - return wx.MessageDialog(None, _(u"This user has no favorited tweets. {0} can't create a timeline.").format(application.name), _(u"Error"), wx.ICON_ERROR).ShowModal() - -def no_followers(): - return wx.MessageDialog(None, _(u"This user has no followers. {0} can't create a timeline.").format(application.name), _(u"Error"), wx.ICON_ERROR).ShowModal() - -def no_friends(): - return wx.MessageDialog(None, _(u"This user has no friends. {0} can't create a timeline.").format(application.name), _(u"Error"), wx.ICON_ERROR).ShowModal() - -def view_geodata(geotext): - """Specific message dialog to display geolocation data""" - return wx.MessageDialog(None, _(u"Geolocation data: {0}").format(geotext), _(u"Geo data for this tweet")).ShowModal() - -def changed_keymap(): - return wx.MessageDialog(None, _(u"TWBlue has detected that you're running windows 10 and has changed the default keymap to the Windows 10 keymap. It means that some keyboard shorcuts could be different. Please check the keystroke editor by pressing Alt+Win+K to see all available keystrokes for this keymap."), _(u"Information"), wx.OK).ShowModal() - -def unauthorized(): - return wx.MessageDialog(None, _(u"You have been blocked from viewing this content"), _(u"Error"), wx.OK).ShowModal() - -def blocked_timeline(): - return wx.MessageDialog(None, _(u"You have been blocked from viewing someone's content. In order to avoid conflicts with the full session, TWBlue will remove the affected timeline."), _(u"Error"), wx.OK).ShowModal() - -def suspended_user(): - return wx.MessageDialog(None, _(u"TWBlue cannot load this timeline because the user has been suspended from Twitter."), _(u"Error"), wx.OK).ShowModal() \ No newline at end of file +# -*- coding: utf-8 -*- +import wx +import application + +def retweet_as_link(parent): + return wx.MessageDialog(parent, _("This retweet is over 140 characters. Would you like to post it as a mention to the poster with your comments and a link to the original tweet?"), application.name, wx.YES_NO|wx.ICON_QUESTION).ShowModal() + +def retweet_question(parent): + return wx.MessageDialog(parent, _("Would you like to add a comment to this tweet?"), _("Retweet"), wx.YES_NO|wx.CANCEL|wx.ICON_QUESTION).ShowModal() + +def delete_tweet_dialog(parent): + return wx.MessageDialog(parent, _("Do you really want to delete this tweet? It will be deleted from Twitter as well."), _("Delete"), wx.ICON_QUESTION|wx.YES_NO).ShowModal() + +def exit_dialog(parent): + dlg = wx.MessageDialog(parent, _("Do you really want to close {0}?").format(application.name,), _("Exit"), wx.YES_NO|wx.ICON_QUESTION) + return dlg.ShowModal() + +def needs_restart(): + wx.MessageDialog(None, _(" {0} must be restarted for these changes to take effect.").format(application.name,), _("Restart {0} ").format(application.name,), wx.OK).ShowModal() + +def delete_user_from_db(): + return wx.MessageDialog(None, _("Are you sure you want to delete this user from the database? This user will not appear in autocomplete results anymore."), _("Confirm"), wx.YES_NO|wx.ICON_QUESTION).ShowModal() + +def get_ignored_client(): + entry = wx.TextEntryDialog(None, _("Enter the name of the client : "), _("Add client")) + if entry.ShowModal() == wx.ID_OK: + return entry.GetValue() + return None + +def clear_list(): + dlg = wx.MessageDialog(None, _("Do you really want to empty this buffer? It's items will be removed from the list but not from Twitter"), _("Empty buffer"), wx.ICON_QUESTION|wx.YES_NO) + return dlg.ShowModal() + +def remove_buffer(): + return wx.MessageDialog(None, _("Do you really want to destroy this buffer?"), _("Attention"), style=wx.ICON_QUESTION|wx.YES_NO).ShowModal() + +def user_not_exist(): + return wx.MessageDialog(None, _("That user does not exist"), _("Error"), wx.ICON_ERROR).ShowModal() + +def timeline_exist(): + return wx.MessageDialog(None, _("A timeline for this user already exists. You can't open another"), _("Existing timeline"), wx.ICON_ERROR).ShowModal() + +def no_tweets(): + return wx.MessageDialog(None, _("This user has no tweets, so you can't open a timeline for them."), _("Error!"), wx.ICON_ERROR).ShowModal() + +def protected_user(): + return wx.MessageDialog(None, _("This is a protected Twitter user, which means you can't open a timeline using the Streaming API. The user's tweets will not update due to a twitter policy. Do you want to continue?"), _("Warning"), wx.ICON_WARNING|wx.YES_NO).ShowModal() + +def no_following(): + return wx.MessageDialog(None, _("This is a protected user account, you need to follow this user to view their tweets or likes."), _("Error"), wx.ICON_ERROR).ShowModal() + +def donation(): + dlg = wx.MessageDialog(None, _("If you like {0} we need your help to keep it going. Help us by donating to the project. This will help us pay for the server, the domain and some other things to ensure that {0} will be actively maintained. Your donation will give us the means to continue the development of {0}, and to keep {0} free. Would you like to donate now?").format(application.name), _("We need your help"), wx.ICON_QUESTION|wx.YES_NO) + return dlg.ShowModal() + +def no_tweets(): + return wx.MessageDialog(None, _("This user has no tweets. {0} can't create a timeline.").format(application.name), _("Error"), wx.ICON_ERROR).ShowModal() + +def no_favs(): + return wx.MessageDialog(None, _("This user has no favorited tweets. {0} can't create a timeline.").format(application.name), _("Error"), wx.ICON_ERROR).ShowModal() + +def no_followers(): + return wx.MessageDialog(None, _("This user has no followers. {0} can't create a timeline.").format(application.name), _("Error"), wx.ICON_ERROR).ShowModal() + +def no_friends(): + return wx.MessageDialog(None, _("This user has no friends. {0} can't create a timeline.").format(application.name), _("Error"), wx.ICON_ERROR).ShowModal() + +def view_geodata(geotext): + """Specific message dialog to display geolocation data""" + return wx.MessageDialog(None, _("Geolocation data: {0}").format(geotext), _("Geo data for this tweet")).ShowModal() + +def changed_keymap(): + return wx.MessageDialog(None, _("TWBlue has detected that you're running windows 10 and has changed the default keymap to the Windows 10 keymap. It means that some keyboard shorcuts could be different. Please check the keystroke editor by pressing Alt+Win+K to see all available keystrokes for this keymap."), _("Information"), wx.OK).ShowModal() + +def unauthorized(): + return wx.MessageDialog(None, _("You have been blocked from viewing this content"), _("Error"), wx.OK).ShowModal() + +def blocked_timeline(): + return wx.MessageDialog(None, _("You have been blocked from viewing someone's content. In order to avoid conflicts with the full session, TWBlue will remove the affected timeline."), _("Error"), wx.OK).ShowModal() + +def suspended_user(): + return wx.MessageDialog(None, _("TWBlue cannot load this timeline because the user has been suspended from Twitter."), _("Error"), wx.OK).ShowModal() \ No newline at end of file diff --git a/src/wxUI/dialogs/__init__.py b/src/wxUI/dialogs/__init__.py index 0e267e1f..7bb1c921 100644 --- a/src/wxUI/dialogs/__init__.py +++ b/src/wxUI/dialogs/__init__.py @@ -1,2 +1,2 @@ -from __future__ import absolute_import + from . import baseDialog, trends, configuration, lists, message, search, find, show_user, update_profile, urlList, userSelection, utils diff --git a/src/wxUI/dialogs/attach.py b/src/wxUI/dialogs/attach.py index b3e97376..a9d49966 100644 --- a/src/wxUI/dialogs/attach.py +++ b/src/wxUI/dialogs/attach.py @@ -1,47 +1,47 @@ -# -*- coding: utf-8 -*- -""" Attach dialog. Taken from socializer: https://github.com/manuelcortez/socializer""" -import wx -import widgetUtils -from multiplatform_widgets import widgets - -class attachDialog(widgetUtils.BaseDialog): - def __init__(self): - super(attachDialog, self).__init__(None, title=_(u"Add an attachment")) - panel = wx.Panel(self) - sizer = wx.BoxSizer(wx.VERTICAL) - lbl1 = wx.StaticText(panel, wx.NewId(), _(u"Attachments")) - self.attachments = widgets.list(panel, _(u"Type"), _(u"Title"), style=wx.LC_REPORT) - box = wx.BoxSizer(wx.HORIZONTAL) - box.Add(lbl1, 0, wx.ALL, 5) - box.Add(self.attachments.list, 0, wx.ALL, 5) - sizer.Add(box, 0, wx.ALL, 5) - static = wx.StaticBox(panel, label=_(u"Add attachments")) - self.photo = wx.Button(panel, wx.NewId(), _(u"&Photo")) - self.remove = wx.Button(panel, wx.NewId(), _(u"Remove attachment")) - self.remove.Enable(False) - btnsizer = wx.StaticBoxSizer(static, wx.HORIZONTAL) - btnsizer.Add(self.photo, 0, wx.ALL, 5) - sizer.Add(btnsizer, 0, wx.ALL, 5) - ok = wx.Button(panel, wx.ID_OK) - ok.SetDefault() - cancelBtn = wx.Button(panel, wx.ID_CANCEL) - btnSizer = wx.BoxSizer() - btnSizer.Add(ok, 0, wx.ALL, 5) - btnSizer.Add(cancelBtn, 0, wx.ALL, 5) - sizer.Add(btnSizer, 0, wx.ALL, 5) - panel.SetSizer(sizer) - self.SetClientSize(sizer.CalcMin()) - - def get_image(self): - openFileDialog = wx.FileDialog(self, _(u"Select the picture to be uploaded"), "", "", _("Image files (*.png, *.jpg, *.gif)|*.png; *.jpg; *.gif"), wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) - if openFileDialog.ShowModal() == wx.ID_CANCEL: - return (None, None) - dsc = self.ask_description() - return (openFileDialog.GetPath(), dsc) - - def ask_description(self): - dlg = wx.TextEntryDialog(self, _(u"please provide a description"), _(u"Description"), defaultValue="") - dlg.ShowModal() - result = dlg.GetValue() - dlg.Destroy() - return result +# -*- coding: utf-8 -*- +""" Attach dialog. Taken from socializer: https://github.com/manuelcortez/socializer""" +import wx +import widgetUtils +from multiplatform_widgets import widgets + +class attachDialog(widgetUtils.BaseDialog): + def __init__(self): + super(attachDialog, self).__init__(None, title=_("Add an attachment")) + panel = wx.Panel(self) + sizer = wx.BoxSizer(wx.VERTICAL) + lbl1 = wx.StaticText(panel, wx.NewId(), _("Attachments")) + self.attachments = widgets.list(panel, _("Type"), _("Title"), style=wx.LC_REPORT) + box = wx.BoxSizer(wx.HORIZONTAL) + box.Add(lbl1, 0, wx.ALL, 5) + box.Add(self.attachments.list, 0, wx.ALL, 5) + sizer.Add(box, 0, wx.ALL, 5) + static = wx.StaticBox(panel, label=_("Add attachments")) + self.photo = wx.Button(panel, wx.NewId(), _("&Photo")) + self.remove = wx.Button(panel, wx.NewId(), _("Remove attachment")) + self.remove.Enable(False) + btnsizer = wx.StaticBoxSizer(static, wx.HORIZONTAL) + btnsizer.Add(self.photo, 0, wx.ALL, 5) + sizer.Add(btnsizer, 0, wx.ALL, 5) + ok = wx.Button(panel, wx.ID_OK) + ok.SetDefault() + cancelBtn = wx.Button(panel, wx.ID_CANCEL) + btnSizer = wx.BoxSizer() + btnSizer.Add(ok, 0, wx.ALL, 5) + btnSizer.Add(cancelBtn, 0, wx.ALL, 5) + sizer.Add(btnSizer, 0, wx.ALL, 5) + panel.SetSizer(sizer) + self.SetClientSize(sizer.CalcMin()) + + def get_image(self): + openFileDialog = wx.FileDialog(self, _("Select the picture to be uploaded"), "", "", _("Image files (*.png, *.jpg, *.gif)|*.png; *.jpg; *.gif"), wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) + if openFileDialog.ShowModal() == wx.ID_CANCEL: + return (None, None) + dsc = self.ask_description() + return (openFileDialog.GetPath(), dsc) + + def ask_description(self): + dlg = wx.TextEntryDialog(self, _("please provide a description"), _("Description"), defaultValue="") + dlg.ShowModal() + result = dlg.GetValue() + dlg.Destroy() + return result diff --git a/src/wxUI/dialogs/configuration.py b/src/wxUI/dialogs/configuration.py index 9e661449..444fb300 100644 --- a/src/wxUI/dialogs/configuration.py +++ b/src/wxUI/dialogs/configuration.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import + # -*- coding: utf-8 -*- from builtins import range from . import baseDialog @@ -14,36 +14,36 @@ class general(wx.Panel, baseDialog.BaseWXDialog): def __init__(self, parent, languages,keymaps): super(general, self).__init__(parent) sizer = wx.BoxSizer(wx.VERTICAL) - language = wx.StaticText(self, -1, _(u"Language")) + language = wx.StaticText(self, -1, _("Language")) self.language = wx.ListBox(self, -1, choices=languages) self.language.SetSize(self.language.GetBestSize()) langBox = wx.BoxSizer(wx.HORIZONTAL) langBox.Add(language, 0, wx.ALL, 5) langBox.Add(self.language, 0, wx.ALL, 5) sizer.Add(langBox, 0, wx.ALL, 5) - self.autostart = wx.CheckBox(self, -1, _(u"Run {0} at Windows startup").format(application.name,)) - self.ask_at_exit = wx.CheckBox(self, -1, _(U"ask before exiting {0}").format(application.name,)) + self.autostart = wx.CheckBox(self, -1, _("Run {0} at Windows startup").format(application.name,)) + self.ask_at_exit = wx.CheckBox(self, -1, _("ask before exiting {0}").format(application.name,)) sizer.Add(self.autostart, 0, wx.ALL, 5) sizer.Add(self.ask_at_exit, 0, wx.ALL, 5) - self.play_ready_sound = wx.CheckBox(self, -1, _(U"Play a sound when {0} launches").format(application.name,)) + self.play_ready_sound = wx.CheckBox(self, -1, _("Play a sound when {0} launches").format(application.name,)) sizer.Add(self.play_ready_sound, 0, wx.ALL, 5) - self.speak_ready_msg = wx.CheckBox(self, -1, _(U"Speak a message when {0} launches").format(application.name,)) + self.speak_ready_msg = wx.CheckBox(self, -1, _("Speak a message when {0} launches").format(application.name,)) sizer.Add(self.speak_ready_msg, 0, wx.ALL, 5) - self.use_invisible_shorcuts = wx.CheckBox(self, -1, _(u"Use invisible interface's keyboard shortcuts while GUI is visible")) + self.use_invisible_shorcuts = wx.CheckBox(self, -1, _("Use invisible interface's keyboard shortcuts while GUI is visible")) sizer.Add(self.use_invisible_shorcuts, 0, wx.ALL, 5) - self.disable_sapi5 = wx.CheckBox(self, -1, _(u"Activate Sapi5 when any other screen reader is not being run")) + self.disable_sapi5 = wx.CheckBox(self, -1, _("Activate Sapi5 when any other screen reader is not being run")) sizer.Add(self.disable_sapi5, 0, wx.ALL, 5) - self.hide_gui = wx.CheckBox(self, -1, _(u"Hide GUI on launch")) + self.hide_gui = wx.CheckBox(self, -1, _("Hide GUI on launch")) sizer.Add(self.hide_gui, 0, wx.ALL, 5) - self.handle_longtweets = wx.CheckBox(self, wx.NewId(), _(u"Use Codeofdusk's longtweet handlers (may decrease client performance)")) + self.handle_longtweets = wx.CheckBox(self, wx.NewId(), _("Use Codeofdusk's longtweet handlers (may decrease client performance)")) sizer.Add(self.handle_longtweets, 0, wx.ALL, 5) kmbox = wx.BoxSizer(wx.VERTICAL) - km_label = wx.StaticText(self, -1, _(u"Keymap")) + km_label = wx.StaticText(self, -1, _("Keymap")) self.km = wx.ComboBox(self, -1, choices=keymaps, style=wx.CB_READONLY) self.km.SetSize(self.km.GetBestSize()) kmbox.Add(km_label, 0, wx.ALL, 5) kmbox.Add(self.km, 0, wx.ALL, 5) - self.check_for_updates = wx.CheckBox(self, -1, _(U"Check for updates when {0} launches").format(application.name,)) + self.check_for_updates = wx.CheckBox(self, -1, _("Check for updates when {0} launches").format(application.name,)) sizer.Add(self.check_for_updates, 0, wx.ALL, 5) sizer.Add(kmbox, 0, wx.ALL, 5) self.SetSizer(sizer) @@ -53,32 +53,32 @@ class proxy(wx.Panel, baseDialog.BaseWXDialog): def __init__(self, parent, proxyTypes): super(proxy, self).__init__(parent) sizer = wx.BoxSizer(wx.VERTICAL) - type=wx.StaticText(self, wx.NewId(), _(u"Proxy type: ")) + type=wx.StaticText(self, wx.NewId(), _("Proxy type: ")) self.type=wx.ComboBox(self, -1, choices=proxyTypes, style=wx.CB_READONLY) self.type.SetSize(self.type.GetBestSize()) typeBox = wx.BoxSizer(wx.HORIZONTAL) typeBox.Add(type, 0, wx.ALL, 5) typeBox.Add(self.type, 0, wx.ALL, 5) sizer.Add(typeBox, 0, wx.ALL, 5) - lbl = wx.StaticText(self, wx.NewId(), _(u"Proxy server: ")) + lbl = wx.StaticText(self, wx.NewId(), _("Proxy server: ")) self.server = wx.TextCtrl(self, -1) serverBox = wx.BoxSizer(wx.HORIZONTAL) serverBox.Add(lbl, 0, wx.ALL, 5) serverBox.Add(self.server, 0, wx.ALL, 5) sizer.Add(serverBox, 0, wx.ALL, 5) - lbl = wx.StaticText(self, wx.NewId(), _(u"Port: ")) + lbl = wx.StaticText(self, wx.NewId(), _("Port: ")) self.port = wx.TextCtrl(self, wx.NewId()) portBox = wx.BoxSizer(wx.HORIZONTAL) portBox.Add(lbl, 0, wx.ALL, 5) portBox.Add(self.port, 0, wx.ALL, 5) sizer.Add(portBox, 0, wx.ALL, 5) - lbl = wx.StaticText(self, wx.NewId(), _(u"User: ")) + lbl = wx.StaticText(self, wx.NewId(), _("User: ")) self.user = wx.TextCtrl(self, wx.NewId()) userBox = wx.BoxSizer(wx.HORIZONTAL) userBox.Add(lbl, 0, wx.ALL, 5) userBox.Add(self.user, 0, wx.ALL, 5) sizer.Add(userBox, 0, wx.ALL, 5) - lbl = wx.StaticText(self, wx.NewId(), _(u"Password: ")) + lbl = wx.StaticText(self, wx.NewId(), _("Password: ")) self.password = wx.TextCtrl(self, wx.NewId(), style=wx.TE_PASSWORD) passwordBox = wx.BoxSizer(wx.HORIZONTAL) passwordBox.Add(lbl, 0, wx.ALL, 5) @@ -90,35 +90,35 @@ class generalAccount(wx.Panel, baseDialog.BaseWXDialog): def __init__(self, parent): super(generalAccount, self).__init__(parent) sizer = wx.BoxSizer(wx.VERTICAL) - self.au = wx.Button(self, wx.NewId(), _(u"Autocompletion settings...")) + self.au = wx.Button(self, wx.NewId(), _("Autocompletion settings...")) sizer.Add(self.au, 0, wx.ALL, 5) - self.relative_time = wx.CheckBox(self, wx.NewId(), _(U"Relative timestamps")) + self.relative_time = wx.CheckBox(self, wx.NewId(), _("Relative timestamps")) sizer.Add(self.relative_time, 0, wx.ALL, 5) apiCallsBox = wx.BoxSizer(wx.HORIZONTAL) - apiCallsBox.Add(wx.StaticText(self, -1, _(u"API calls (One API call = 200 tweets, two API calls = 400 tweets, etc):")), 0, wx.ALL, 5) + apiCallsBox.Add(wx.StaticText(self, -1, _("API calls (One API call = 200 tweets, two API calls = 400 tweets, etc):")), 0, wx.ALL, 5) self.apiCalls = wx.SpinCtrl(self, wx.NewId()) self.apiCalls.SetRange(1, 10) self.apiCalls.SetSize(self.apiCalls.GetBestSize()) apiCallsBox.Add(self.apiCalls, 0, wx.ALL, 5) sizer.Add(apiCallsBox, 0, wx.ALL, 5) tweetsPerCallBox = wx.BoxSizer(wx.HORIZONTAL) - tweetsPerCallBox.Add(wx.StaticText(self, -1, _(u"Items on each API call")), 0, wx.ALL, 5) + tweetsPerCallBox.Add(wx.StaticText(self, -1, _("Items on each API call")), 0, wx.ALL, 5) self.itemsPerApiCall = wx.SpinCtrl(self, wx.NewId()) self.itemsPerApiCall.SetRange(0, 200) self.itemsPerApiCall.SetSize(self.itemsPerApiCall.GetBestSize()) tweetsPerCallBox.Add(self.itemsPerApiCall, 0, wx.ALL, 5) sizer.Add(tweetsPerCallBox, 0, wx.ALL, 5) - self.reverse_timelines = wx.CheckBox(self, wx.NewId(), _(u"Inverted buffers: The newest tweets will be shown at the beginning while the oldest at the end")) + self.reverse_timelines = wx.CheckBox(self, wx.NewId(), _("Inverted buffers: The newest tweets will be shown at the beginning while the oldest at the end")) sizer.Add(self.reverse_timelines, 0, wx.ALL, 5) - lbl = wx.StaticText(self, wx.NewId(), _(u"Retweet mode")) - self.retweet_mode = wx.ComboBox(self, wx.NewId(), choices=[_(u"Ask"), _(u"Retweet without comments"), _(u"Retweet with comments")], style=wx.CB_READONLY) + lbl = wx.StaticText(self, wx.NewId(), _("Retweet mode")) + self.retweet_mode = wx.ComboBox(self, wx.NewId(), choices=[_("Ask"), _("Retweet without comments"), _("Retweet with comments")], style=wx.CB_READONLY) rMode = wx.BoxSizer(wx.HORIZONTAL) rMode.Add(lbl, 0, wx.ALL, 5) rMode.Add(self.retweet_mode, 0, wx.ALL, 5) sizer.Add(rMode, 0, wx.ALL, 5) - self.show_screen_names = wx.CheckBox(self, wx.NewId(), _(U"Show screen names instead of full names")) + self.show_screen_names = wx.CheckBox(self, wx.NewId(), _("Show screen names instead of full names")) sizer.Add(self.show_screen_names, 0, wx.ALL, 5) - PersistSizeLabel = wx.StaticText(self, -1, _(u"Number of items per buffer to cache in database (0 to disable caching, blank for unlimited)")) + PersistSizeLabel = wx.StaticText(self, -1, _("Number of items per buffer to cache in database (0 to disable caching, blank for unlimited)")) self.persist_size = wx.TextCtrl(self, -1) sizer.Add(PersistSizeLabel, 0, wx.ALL, 5) sizer.Add(self.persist_size, 0, wx.ALL, 5) @@ -128,12 +128,12 @@ class other_buffers(wx.Panel): def __init__(self, parent): super(other_buffers, self).__init__(parent) sizer = wx.BoxSizer(wx.VERTICAL) - self.buffers = widgets.list(self, _(u"Buffer"), _(u"Name"), _(u"Status"), style=wx.LC_SINGLE_SEL|wx.LC_REPORT) + self.buffers = widgets.list(self, _("Buffer"), _("Name"), _("Status"), style=wx.LC_SINGLE_SEL|wx.LC_REPORT) sizer.Add(self.buffers.list, 0, wx.ALL, 5) btnSizer = wx.BoxSizer(wx.HORIZONTAL) - self.toggle_state = wx.Button(self, -1, _(u"Show/hide")) - self.up = wx.Button(self, -1, _(u"Move up")) - self.down = wx.Button(self, -1, _(u"Move down")) + self.toggle_state = wx.Button(self, -1, _("Show/hide")) + self.up = wx.Button(self, -1, _("Move up")) + self.down = wx.Button(self, -1, _("Move down")) btnSizer.Add(self.toggle_state, 0, wx.ALL, 5) btnSizer.Add(self.up, 0, wx.ALL, 5) btnSizer.Add(self.down, 0, wx.ALL, 5) @@ -143,9 +143,9 @@ class other_buffers(wx.Panel): def insert_buffers(self, buffers): for i in buffers: if i[2] == True: - self.buffers.insert_item(False, *[i[0], i[1], _(u"Show")]) + self.buffers.insert_item(False, *[i[0], i[1], _("Show")]) else: - self.buffers.insert_item(False, *[i[0], i[1], _(u"Hide")]) + self.buffers.insert_item(False, *[i[0], i[1], _("Hide")]) def connect_hook_func(self, func): self.buffers.list.Bind(wx.EVT_CHAR_HOOK, func) @@ -153,13 +153,13 @@ class other_buffers(wx.Panel): def move_up(self, *args, **kwargs): current = self.buffers.get_selected() if current == -1: - output.speak(_(u"Select a buffer first."), True) + output.speak(_("Select a buffer first."), True) return False - if self.buffers.get_text_column(current, 2) == _(u"Hide"): - output.speak(_(u"The buffer is hidden, show it first."), True) + if self.buffers.get_text_column(current, 2) == _("Hide"): + output.speak(_("The buffer is hidden, show it first."), True) return False if current <= 0: - output.speak(_(u"The buffer is already at the top of the list."), True) + output.speak(_("The buffer is already at the top of the list."), True) return False current_text = self.buffers.get_text_column(self.buffers.get_selected(), 0) current_name = self.buffers.get_text_column(self.buffers.get_selected(), 1) @@ -177,13 +177,13 @@ class other_buffers(wx.Panel): def move_down(self, *args, **kwargs): current = self.buffers.get_selected() if current == -1: - output.speak(_(u"Select a buffer first."), True) + output.speak(_("Select a buffer first."), True) return False - if self.buffers.get_text_column(current, 2) == _(u"Hide"): - output.speak(_(u"The buffer is hidden, show it first."), True) + if self.buffers.get_text_column(current, 2) == _("Hide"): + output.speak(_("The buffer is hidden, show it first."), True) return False if current+1 >= self.buffers.get_count(): - output.speak(_(u"The buffer is already at the bottom of the list."), True) + output.speak(_("The buffer is already at the bottom of the list."), True) return False current_text = self.buffers.get_text_column(self.buffers.get_selected(), 0) current_name = self.buffers.get_text_column(self.buffers.get_selected(), 1) @@ -208,15 +208,15 @@ class other_buffers(wx.Panel): def change_selected_item(self): current = self.buffers.get_selected() text = self.buffers.get_text_column(current, 2) - if text == _(u"Show"): - self.buffers.set_text_column(current, 2, _(u"Hide")) + if text == _("Show"): + self.buffers.set_text_column(current, 2, _("Hide")) else: - self.buffers.set_text_column(current, 2, _(u"Show")) + self.buffers.set_text_column(current, 2, _("Show")) output.speak(self.buffers.get_text_column(current, 2),True) def get_list(self): buffers_list = [] for i in range(0, self.buffers.get_count()): - if self.buffers.get_text_column(i, 2) == _(u"Show"): + if self.buffers.get_text_column(i, 2) == _("Show"): buffers_list.append(self.buffers.get_text_column(i, 0)) return buffers_list @@ -224,14 +224,14 @@ class ignoredClients(wx.Panel): def __init__(self, parent, choices): super(ignoredClients, self).__init__(parent=parent) sizer = wx.BoxSizer(wx.VERTICAL) - label = wx.StaticText(self, -1, _(u"Ignored clients")) + label = wx.StaticText(self, -1, _("Ignored clients")) self.clients = wx.ListBox(self, -1, choices=choices) self.clients.SetSize(self.clients.GetBestSize()) clientsBox = wx.BoxSizer(wx.HORIZONTAL) clientsBox.Add(label, 0, wx.ALL, 5) clientsBox.Add(self.clients, 0, wx.ALL, 5) - self.add = wx.Button(self, -1, _(u"Add client")) - self.remove = wx.Button(self, -1, _(u"Remove client")) + self.add = wx.Button(self, -1, _("Add client")) + self.remove = wx.Button(self, -1, _("Remove client")) btnBox = wx.BoxSizer(wx.HORIZONTAL) btnBox.Add(self.add, 0, wx.ALL, 5) btnBox.Add(self.remove, 0, wx.ALL, 5) @@ -255,7 +255,7 @@ class sound(wx.Panel): def __init__(self, parent, input_devices, output_devices, soundpacks): wx.Panel.__init__(self, parent) sizer = wx.BoxSizer(wx.VERTICAL) - volume = wx.StaticText(self, -1, _(u"Volume")) + volume = wx.StaticText(self, -1, _("Volume")) self.volumeCtrl = wx.Slider(self) self.volumeCtrl.SetRange(0, 100) self.volumeCtrl.SetSize(self.volumeCtrl.GetBestSize()) @@ -263,16 +263,16 @@ class sound(wx.Panel): volumeBox.Add(volume, 0, wx.ALL, 5) volumeBox.Add(self.volumeCtrl, 0, wx.ALL, 5) sizer.Add(volumeBox, 0, wx.ALL, 5) - self.session_mute = wx.CheckBox(self, -1, _(u"Session mute")) + self.session_mute = wx.CheckBox(self, -1, _("Session mute")) sizer.Add(self.session_mute, 0, wx.ALL, 5) - output_label = wx.StaticText(self, -1, _(u"Output device")) + output_label = wx.StaticText(self, -1, _("Output device")) self.output = wx.ComboBox(self, -1, choices=output_devices, style=wx.CB_READONLY) self.output.SetSize(self.output.GetBestSize()) outputBox = wx.BoxSizer(wx.HORIZONTAL) outputBox.Add(output_label, 0, wx.ALL, 5) outputBox.Add(self.output, 0, wx.ALL, 5) sizer.Add(outputBox, 0, wx.ALL, 5) - input_label = wx.StaticText(self, -1, _(u"Input device")) + input_label = wx.StaticText(self, -1, _("Input device")) self.input = wx.ComboBox(self, -1, choices=input_devices, style=wx.CB_READONLY) self.input.SetSize(self.input.GetBestSize()) inputBox = wx.BoxSizer(wx.HORIZONTAL) @@ -280,17 +280,17 @@ class sound(wx.Panel): inputBox.Add(self.input, 0, wx.ALL, 5) sizer.Add(inputBox, 0, wx.ALL, 5) soundBox = wx.BoxSizer(wx.VERTICAL) - soundpack_label = wx.StaticText(self, -1, _(u"Sound pack")) + soundpack_label = wx.StaticText(self, -1, _("Sound pack")) self.soundpack = wx.ComboBox(self, -1, choices=soundpacks, style=wx.CB_READONLY) self.soundpack.SetSize(self.soundpack.GetBestSize()) soundBox.Add(soundpack_label, 0, wx.ALL, 5) soundBox.Add(self.soundpack, 0, wx.ALL, 5) sizer.Add(soundBox, 0, wx.ALL, 5) - self.indicate_audio = wx.CheckBox(self, -1, _(u"Indicate audio tweets with sound")) + self.indicate_audio = wx.CheckBox(self, -1, _("Indicate audio tweets with sound")) sizer.Add(self.indicate_audio, 0, wx.ALL, 5) - self.indicate_geo = wx.CheckBox(self, -1, _(u"Indicate geotweets with sound")) + self.indicate_geo = wx.CheckBox(self, -1, _("Indicate geotweets with sound")) sizer.Add(self.indicate_geo, 0, wx.ALL, 5) - self.indicate_img = wx.CheckBox(self, -1, _(u"Indicate tweets containing images with sound")) + self.indicate_img = wx.CheckBox(self, -1, _("Indicate tweets containing images with sound")) sizer.Add(self.indicate_img, 0, wx.ALL, 5) self.SetSizer(sizer) @@ -301,13 +301,13 @@ class extrasPanel(wx.Panel): def __init__(self, parent, ocr_languages=[], translation_languages=[]): super(extrasPanel, self).__init__(parent) mainSizer = wx.BoxSizer(wx.VERTICAL) - OCRBox = wx.StaticBox(self, label=_(u"Language for OCR")) + OCRBox = wx.StaticBox(self, label=_("Language for OCR")) self.ocr_lang = wx.ListBox(self, -1, choices=ocr_languages) self.ocr_lang.SetSize(self.ocr_lang.GetBestSize()) ocrLanguageSizer = wx.StaticBoxSizer(OCRBox, wx.HORIZONTAL) ocrLanguageSizer.Add(self.ocr_lang, 0, wx.ALL, 5) mainSizer.Add(ocrLanguageSizer, 0, wx.ALL, 5) - lbl = wx.StaticText(self, wx.NewId(), _(u"API Key for SndUp")) + lbl = wx.StaticText(self, wx.NewId(), _("API Key for SndUp")) self.sndup_apiKey = wx.TextCtrl(self, -1) sndupBox = wx.BoxSizer(wx.HORIZONTAL) sndupBox.Add(lbl, 0, wx.ALL, 5) @@ -322,46 +322,46 @@ class configurationDialog(baseDialog.BaseWXDialog): def __init__(self): super(configurationDialog, self).__init__(None, -1) self.panel = wx.Panel(self) - self.SetTitle(_(u"{0} preferences").format(application.name,)) + self.SetTitle(_("{0} preferences").format(application.name,)) self.sizer = wx.BoxSizer(wx.VERTICAL) self.notebook = wx.Notebook(self.panel) def create_general(self, languageList,keymaps): self.general = general(self.notebook, languageList,keymaps) - self.notebook.AddPage(self.general, _(u"General")) + self.notebook.AddPage(self.general, _("General")) self.general.SetFocus() def create_proxy(self, proxyTypes): self.proxy = proxy(self.notebook, proxyTypes) - self.notebook.AddPage(self.proxy, _(u"Proxy")) + self.notebook.AddPage(self.proxy, _("Proxy")) def create_general_account(self): self.general = generalAccount(self.notebook) - self.notebook.AddPage(self.general, _(u"General")) + self.notebook.AddPage(self.general, _("General")) self.general.SetFocus() def create_other_buffers(self): self.buffers = other_buffers(self.notebook) - self.notebook.AddPage(self.buffers, _(u"Buffers")) + self.notebook.AddPage(self.buffers, _("Buffers")) def create_ignored_clients(self, ignored_clients_list): self.ignored_clients = ignoredClients(self.notebook, ignored_clients_list) - self.notebook.AddPage(self.ignored_clients, _(u"Ignored clients")) + self.notebook.AddPage(self.ignored_clients, _("Ignored clients")) def create_sound(self, output_devices, input_devices, soundpacks): self.sound = sound(self.notebook, output_devices, input_devices, soundpacks) - self.notebook.AddPage(self.sound, _(u"Sound")) + self.notebook.AddPage(self.sound, _("Sound")) def create_extras(self, ocr_languages=[], translator_languages=[]): self.extras = extrasPanel(self.notebook, ocr_languages, translator_languages) - self.notebook.AddPage(self.extras, _(u"Extras")) + self.notebook.AddPage(self.extras, _("Extras")) def realize(self): self.sizer.Add(self.notebook, 0, wx.ALL, 5) ok_cancel_box = wx.BoxSizer(wx.HORIZONTAL) - ok = wx.Button(self.panel, wx.ID_OK, _(u"Save")) + ok = wx.Button(self.panel, wx.ID_OK, _("Save")) ok.SetDefault() - cancel = wx.Button(self.panel, wx.ID_CANCEL, _(u"Close")) + cancel = wx.Button(self.panel, wx.ID_CANCEL, _("Close")) self.SetEscapeId(cancel.GetId()) ok_cancel_box.Add(ok, 0, wx.ALL, 5) ok_cancel_box.Add(cancel, 0, wx.ALL, 5) diff --git a/src/wxUI/dialogs/find.py b/src/wxUI/dialogs/find.py index a88b91f3..7c0e4a2f 100644 --- a/src/wxUI/dialogs/find.py +++ b/src/wxUI/dialogs/find.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import + # -*- coding: utf-8 -*- from . import baseDialog import wx @@ -9,17 +9,17 @@ class findDialog(baseDialog.BaseWXDialog): super(findDialog, self).__init__(None, -1) panel = wx.Panel(self) sizer = wx.BoxSizer(wx.VERTICAL) - self.SetTitle(_(u"Find in current buffer")) - label = wx.StaticText(panel, -1, _(u"String")) + self.SetTitle(_("Find in current buffer")) + label = wx.StaticText(panel, -1, _("String")) self.string = wx.TextCtrl(panel, -1, value) dc = wx.WindowDC(self.string) dc.SetFont(self.string.GetFont()) self.string.SetSize(dc.GetTextExtent("0"*40)) sizer.Add(label, 0, wx.ALL, 5) sizer.Add(self.string, 0, wx.ALL, 5) - ok = wx.Button(panel, wx.ID_OK, _(u"OK")) + ok = wx.Button(panel, wx.ID_OK, _("OK")) ok.SetDefault() - cancel = wx.Button(panel, wx.ID_CANCEL, _(u"Cancel")) + cancel = wx.Button(panel, wx.ID_CANCEL, _("Cancel")) btnsizer = wx.BoxSizer() btnsizer.Add(ok, 0, wx.ALL, 5) btnsizer.Add(cancel, 0, wx.ALL, 5) diff --git a/src/wxUI/dialogs/lists.py b/src/wxUI/dialogs/lists.py index 3e5e0d74..93a598f7 100644 --- a/src/wxUI/dialogs/lists.py +++ b/src/wxUI/dialogs/lists.py @@ -1,135 +1,135 @@ -# -*- coding: utf-8 -*- -import wx -import widgetUtils -from multiplatform_widgets import widgets - -class listViewer(widgetUtils.BaseDialog): - - def __init__(self, *args, **kwargs): - super(listViewer, self).__init__(parent=None, *args, **kwargs) - self.SetTitle(_(u"Lists manager")) - panel = wx.Panel(self) - label = wx.StaticText(panel, -1, _(u"Lists")) - self.lista = widgets.list(panel, _(u"List"), _(u"Description"), _(u"Owner"), _(u"Members"), _(u"mode"), size=(800, 800), style=wx.LC_REPORT|wx.LC_SINGLE_SEL) - self.lista.list.SetFocus() - sizer = wx.BoxSizer(wx.VERTICAL) - sizer.Add(label) - sizer.Add(self.lista.list) - self.createBtn = wx.Button(panel, wx.NewId(), _(u"Create a new list")) - self.editBtn = wx.Button(panel, -1, _(u"Edit")) - self.deleteBtn = wx.Button(panel, -1, _(u"Remove")) - self.view = wx.Button(panel, -1, _(u"Open in buffer")) -# self.members = wx.Button(panel, -1, _(u"View members")) -# self.members.Disable() -# self.subscriptors = wx.Button(panel, -1, _(u"View subscribers")) -# self.subscriptors.Disable() -# self.get_linkBtn = wx.Button(panel, -1, _(u"Get link for the list")) -# self.get_linkBtn.Bind(wx.EVT_BUTTON, self.onGetLink) - self.cancelBtn = wx.Button(panel, wx.ID_CANCEL) - btnSizer = wx.BoxSizer() - btnSizer.Add(self.createBtn) - btnSizer.Add(self.editBtn) - btnSizer.Add(self.cancelBtn) - panel.SetSizer(sizer) - - def populate_list(self, lists, clear=False): - if clear == True: - self.clear() - for item in lists: - self.lista.insert_item(False, *item) - - def get_item(self): - return self.lista.get_selected() - - def clear(self): - self.lista.clear() - -class userListViewer(listViewer): - def __init__(self, username, *args, **kwargs): - self.username = username - super(userListViewer, self).__init__(*args, **kwargs) - self.SetTitle(_(u"Viewing lists for %s") % (self.username)) - self.createBtn.SetLabel(_(u"Subscribe")) - self.deleteBtn.SetLabel(_(u"Unsubscribe")) - self.editBtn.Disable() - self.view.Disable() - -class createListDialog(widgetUtils.BaseDialog): - - def __init__(self, *args, **kwargs): - super(createListDialog, self).__init__(parent=None, *args, **kwargs) - self.SetTitle(_(u"Create a new list")) - panel = wx.Panel(self) - sizer = wx.BoxSizer(wx.VERTICAL) - name = wx.StaticText(panel, -1, _(u"Name (20 characters maximun)")) - self.name = wx.TextCtrl(panel, -1) - nameSizer = wx.BoxSizer(wx.HORIZONTAL) - nameSizer.Add(name) - nameSizer.Add(self.name) - description = wx.StaticText(panel, -1, _(u"Description")) - self.description = wx.TextCtrl(panel, -1) - descriptionSizer = wx.BoxSizer(wx.HORIZONTAL) - descriptionSizer.Add(description) - descriptionSizer.Add(self.description) - mode = wx.StaticText(panel, -1, _(u"Mode")) - self.public = wx.RadioButton(panel, -1, _(u"Public"), style=wx.RB_GROUP) - self.private = wx.RadioButton(panel, -1, _(u"Private")) - modeBox = wx.BoxSizer(wx.HORIZONTAL) - modeBox.Add(mode) - modeBox.Add(self.public) - modeBox.Add(self.private) - ok = wx.Button(panel, wx.ID_OK) - ok.SetDefault() - cancel = wx.Button(panel, wx.ID_CANCEL) - btnBox = wx.BoxSizer(wx.HORIZONTAL) - btnBox.Add(ok) - btnBox.Add(cancel) - sizer.Add(nameSizer) - sizer.Add(descriptionSizer) - sizer.Add(modeBox) - sizer.Add(btnBox) - -class editListDialog(createListDialog): - - def __init__(self, list, *args, **kwargs): - super(editListDialog, self).__init__(*args, **kwargs) - self.SetTitle(_(u"Editing the list %s") % (list["name"])) - self.name.ChangeValue(list["name"]) - self.description.ChangeValue(list["description"]) - if list["mode"] == "public": - self.public.SetValue(True) - else: - self.private.SetValue(True) - -class addUserListDialog(listViewer): - def __init__(self, *args, **kwargs): - super(addUserListDialog, self).__init__(*args, **kwargs) - self.SetTitle(_(u"Select a list to add the user")) - self.createBtn.SetLabel(_(u"Add")) - self.createBtn.SetDefault() - self.createBtn.Bind(wx.EVT_BUTTON, self.ok) - self.editBtn.Disable() - self.view.Disable() -# self.subscriptors.Disable() -# self.members.Disable() - self.deleteBtn.Disable() - - def ok(self, *args, **kwargs): - self.EndModal(wx.ID_OK) - -class removeUserListDialog(listViewer): - def __init__(self, *args, **kwargs): - super(removeUserListDialog, self).__init__(*args, **kwargs) - self.SetTitle(_(u"Select a list to remove the user")) - self.createBtn.SetLabel(_(u"Remove")) - self.createBtn.SetDefault() - self.createBtn.SetId(wx.ID_OK) - self.editBtn.Disable() - self.view.Disable() -# self.subscriptors.Disable() -# self.members.Disable() - self.deleteBtn.Disable() - -def remove_list(): - return wx.MessageDialog(None, _("Do you really want to delete this list?"), _("Delete"), wx.YES_NO).ShowModal() - +# -*- coding: utf-8 -*- +import wx +import widgetUtils +from multiplatform_widgets import widgets + +class listViewer(widgetUtils.BaseDialog): + + def __init__(self, *args, **kwargs): + super(listViewer, self).__init__(parent=None, *args, **kwargs) + self.SetTitle(_("Lists manager")) + panel = wx.Panel(self) + label = wx.StaticText(panel, -1, _("Lists")) + self.lista = widgets.list(panel, _("List"), _("Description"), _("Owner"), _("Members"), _("mode"), size=(800, 800), style=wx.LC_REPORT|wx.LC_SINGLE_SEL) + self.lista.list.SetFocus() + sizer = wx.BoxSizer(wx.VERTICAL) + sizer.Add(label) + sizer.Add(self.lista.list) + self.createBtn = wx.Button(panel, wx.NewId(), _("Create a new list")) + self.editBtn = wx.Button(panel, -1, _("Edit")) + self.deleteBtn = wx.Button(panel, -1, _("Remove")) + self.view = wx.Button(panel, -1, _("Open in buffer")) +# self.members = wx.Button(panel, -1, _(u"View members")) +# self.members.Disable() +# self.subscriptors = wx.Button(panel, -1, _(u"View subscribers")) +# self.subscriptors.Disable() +# self.get_linkBtn = wx.Button(panel, -1, _(u"Get link for the list")) +# self.get_linkBtn.Bind(wx.EVT_BUTTON, self.onGetLink) + self.cancelBtn = wx.Button(panel, wx.ID_CANCEL) + btnSizer = wx.BoxSizer() + btnSizer.Add(self.createBtn) + btnSizer.Add(self.editBtn) + btnSizer.Add(self.cancelBtn) + panel.SetSizer(sizer) + + def populate_list(self, lists, clear=False): + if clear == True: + self.clear() + for item in lists: + self.lista.insert_item(False, *item) + + def get_item(self): + return self.lista.get_selected() + + def clear(self): + self.lista.clear() + +class userListViewer(listViewer): + def __init__(self, username, *args, **kwargs): + self.username = username + super(userListViewer, self).__init__(*args, **kwargs) + self.SetTitle(_("Viewing lists for %s") % (self.username)) + self.createBtn.SetLabel(_("Subscribe")) + self.deleteBtn.SetLabel(_("Unsubscribe")) + self.editBtn.Disable() + self.view.Disable() + +class createListDialog(widgetUtils.BaseDialog): + + def __init__(self, *args, **kwargs): + super(createListDialog, self).__init__(parent=None, *args, **kwargs) + self.SetTitle(_("Create a new list")) + panel = wx.Panel(self) + sizer = wx.BoxSizer(wx.VERTICAL) + name = wx.StaticText(panel, -1, _("Name (20 characters maximun)")) + self.name = wx.TextCtrl(panel, -1) + nameSizer = wx.BoxSizer(wx.HORIZONTAL) + nameSizer.Add(name) + nameSizer.Add(self.name) + description = wx.StaticText(panel, -1, _("Description")) + self.description = wx.TextCtrl(panel, -1) + descriptionSizer = wx.BoxSizer(wx.HORIZONTAL) + descriptionSizer.Add(description) + descriptionSizer.Add(self.description) + mode = wx.StaticText(panel, -1, _("Mode")) + self.public = wx.RadioButton(panel, -1, _("Public"), style=wx.RB_GROUP) + self.private = wx.RadioButton(panel, -1, _("Private")) + modeBox = wx.BoxSizer(wx.HORIZONTAL) + modeBox.Add(mode) + modeBox.Add(self.public) + modeBox.Add(self.private) + ok = wx.Button(panel, wx.ID_OK) + ok.SetDefault() + cancel = wx.Button(panel, wx.ID_CANCEL) + btnBox = wx.BoxSizer(wx.HORIZONTAL) + btnBox.Add(ok) + btnBox.Add(cancel) + sizer.Add(nameSizer) + sizer.Add(descriptionSizer) + sizer.Add(modeBox) + sizer.Add(btnBox) + +class editListDialog(createListDialog): + + def __init__(self, list, *args, **kwargs): + super(editListDialog, self).__init__(*args, **kwargs) + self.SetTitle(_("Editing the list %s") % (list["name"])) + self.name.ChangeValue(list["name"]) + self.description.ChangeValue(list["description"]) + if list["mode"] == "public": + self.public.SetValue(True) + else: + self.private.SetValue(True) + +class addUserListDialog(listViewer): + def __init__(self, *args, **kwargs): + super(addUserListDialog, self).__init__(*args, **kwargs) + self.SetTitle(_("Select a list to add the user")) + self.createBtn.SetLabel(_("Add")) + self.createBtn.SetDefault() + self.createBtn.Bind(wx.EVT_BUTTON, self.ok) + self.editBtn.Disable() + self.view.Disable() +# self.subscriptors.Disable() +# self.members.Disable() + self.deleteBtn.Disable() + + def ok(self, *args, **kwargs): + self.EndModal(wx.ID_OK) + +class removeUserListDialog(listViewer): + def __init__(self, *args, **kwargs): + super(removeUserListDialog, self).__init__(*args, **kwargs) + self.SetTitle(_("Select a list to remove the user")) + self.createBtn.SetLabel(_("Remove")) + self.createBtn.SetDefault() + self.createBtn.SetId(wx.ID_OK) + self.editBtn.Disable() + self.view.Disable() +# self.subscriptors.Disable() +# self.members.Disable() + self.deleteBtn.Disable() + +def remove_list(): + return wx.MessageDialog(None, _("Do you really want to delete this list?"), _("Delete"), wx.YES_NO).ShowModal() + diff --git a/src/wxUI/dialogs/message.py b/src/wxUI/dialogs/message.py index c5ef7aeb..635e8581 100644 --- a/src/wxUI/dialogs/message.py +++ b/src/wxUI/dialogs/message.py @@ -71,20 +71,20 @@ class tweet(textLimited): self.mainBox = wx.BoxSizer(wx.VERTICAL) self.createTextArea(message, text) self.mainBox.Add(self.textBox, 0, wx.ALL, 5) - self.long_tweet = wx.CheckBox(self.panel, -1, _(u"&Long tweet")) + self.long_tweet = wx.CheckBox(self.panel, -1, _("&Long tweet")) self.long_tweet.SetValue(True) - self.upload_image = wx.Button(self.panel, -1, _(u"&Upload image..."), size=wx.DefaultSize) + self.upload_image = wx.Button(self.panel, -1, _("&Upload image..."), size=wx.DefaultSize) self.spellcheck = wx.Button(self.panel, -1, _("Check &spelling..."), size=wx.DefaultSize) - self.attach = wx.Button(self.panel, -1, _(u"&Attach audio..."), size=wx.DefaultSize) - self.shortenButton = wx.Button(self.panel, -1, _(u"Sh&orten URL"), size=wx.DefaultSize) - self.unshortenButton = wx.Button(self.panel, -1, _(u"&Expand URL"), size=wx.DefaultSize) + self.attach = wx.Button(self.panel, -1, _("&Attach audio..."), size=wx.DefaultSize) + self.shortenButton = wx.Button(self.panel, -1, _("Sh&orten URL"), size=wx.DefaultSize) + self.unshortenButton = wx.Button(self.panel, -1, _("&Expand URL"), size=wx.DefaultSize) self.shortenButton.Disable() self.unshortenButton.Disable() - self.translateButton = wx.Button(self.panel, -1, _(u"&Translate..."), size=wx.DefaultSize) - self.autocompletionButton = wx.Button(self.panel, -1, _(u"Auto&complete users")) - self.okButton = wx.Button(self.panel, wx.ID_OK, _(u"Sen&d"), size=wx.DefaultSize) + self.translateButton = wx.Button(self.panel, -1, _("&Translate..."), size=wx.DefaultSize) + self.autocompletionButton = wx.Button(self.panel, -1, _("Auto&complete users")) + self.okButton = wx.Button(self.panel, wx.ID_OK, _("Sen&d"), size=wx.DefaultSize) self.okButton.SetDefault() - cancelButton = wx.Button(self.panel, wx.ID_CANCEL, _(u"C&lose"), size=wx.DefaultSize) + cancelButton = wx.Button(self.panel, wx.ID_CANCEL, _("C&lose"), size=wx.DefaultSize) self.buttonsBox1 = wx.BoxSizer(wx.HORIZONTAL) self.buttonsBox1.Add(self.upload_image, 0, wx.ALL, 10) self.buttonsBox1.Add(self.spellcheck, 0, wx.ALL, 10) @@ -115,7 +115,7 @@ class tweet(textLimited): self.SetClientSize(self.mainBox.CalcMin()) def get_image(self): - openFileDialog = wx.FileDialog(self, _(u"Select the picture to be uploaded"), "", "", _("Image files (*.png, *.jpg, *.gif)|*.png; *.jpg; *.gif"), wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) + openFileDialog = wx.FileDialog(self, _("Select the picture to be uploaded"), "", "", _("Image files (*.png, *.jpg, *.gif)|*.png; *.jpg; *.gif"), wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) if openFileDialog.ShowModal() == wx.ID_CANCEL: return None return open(openFileDialog.GetPath(), "rb") @@ -125,25 +125,25 @@ class retweet(tweet): def createControls(self, title, message, text): self.mainBox = wx.BoxSizer(wx.VERTICAL) self.createTextArea(message, "") - label = wx.StaticText(self.panel, -1, _(u"Retweet")) + label = wx.StaticText(self.panel, -1, _("Retweet")) self.text2 = wx.TextCtrl(self.panel, -1, text, size=(439, -1), style=wx.TE_MULTILINE|wx.TE_READONLY) self.retweetBox = wx.BoxSizer(wx.HORIZONTAL) self.retweetBox.Add(label, 0, wx.ALL, 5) self.retweetBox.Add(self.text2, 0, wx.ALL, 5) self.mainBox.Add(self.textBox, 0, wx.ALL, 5) self.mainBox.Add(self.retweetBox, 0, wx.ALL, 5) - self.upload_image = wx.Button(self.panel, -1, _(u"&Upload image..."), size=wx.DefaultSize) + self.upload_image = wx.Button(self.panel, -1, _("&Upload image..."), size=wx.DefaultSize) self.spellcheck = wx.Button(self.panel, -1, _("Check &spelling..."), size=wx.DefaultSize) - self.attach = wx.Button(self.panel, -1, _(u"&Attach audio..."), size=wx.DefaultSize) - self.shortenButton = wx.Button(self.panel, -1, _(u"Sh&orten URL"), size=wx.DefaultSize) - self.unshortenButton = wx.Button(self.panel, -1, _(u"&Expand URL"), size=wx.DefaultSize) + self.attach = wx.Button(self.panel, -1, _("&Attach audio..."), size=wx.DefaultSize) + self.shortenButton = wx.Button(self.panel, -1, _("Sh&orten URL"), size=wx.DefaultSize) + self.unshortenButton = wx.Button(self.panel, -1, _("&Expand URL"), size=wx.DefaultSize) self.shortenButton.Disable() self.unshortenButton.Disable() - self.translateButton = wx.Button(self.panel, -1, _(u"&Translate..."), size=wx.DefaultSize) - self.autocompletionButton = wx.Button(self.panel, -1, _(u"Auto&complete users")) - self.okButton = wx.Button(self.panel, wx.ID_OK, _(u"Sen&d"), size=wx.DefaultSize) + self.translateButton = wx.Button(self.panel, -1, _("&Translate..."), size=wx.DefaultSize) + self.autocompletionButton = wx.Button(self.panel, -1, _("Auto&complete users")) + self.okButton = wx.Button(self.panel, wx.ID_OK, _("Sen&d"), size=wx.DefaultSize) self.okButton.SetDefault() - cancelButton = wx.Button(self.panel, wx.ID_CANCEL, _(u"C&lose"), size=wx.DefaultSize) + cancelButton = wx.Button(self.panel, wx.ID_CANCEL, _("C&lose"), size=wx.DefaultSize) self.buttonsBox1 = wx.BoxSizer(wx.HORIZONTAL) self.buttonsBox1.Add(self.upload_image, 0, wx.ALL, 10) self.buttonsBox1.Add(self.spellcheck, 0, wx.ALL, 10) @@ -174,7 +174,7 @@ class retweet(tweet): self.SetClientSize(self.mainBox.CalcMin()) def get_image(self): - openFileDialog = wx.FileDialog(self, _(u"Select the picture to be uploaded"), "", "", _("Image files (*.png, *.jpg, *.gif)|*.png; *.jpg; *.gif"), wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) + openFileDialog = wx.FileDialog(self, _("Select the picture to be uploaded"), "", "", _("Image files (*.png, *.jpg, *.gif)|*.png; *.jpg; *.gif"), wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) if openFileDialog.ShowModal() == wx.ID_CANCEL: return None return open(openFileDialog.GetPath(), "rb") @@ -183,9 +183,9 @@ class dm(textLimited): def createControls(self, title, message, users): self.panel = wx.Panel(self) self.mainBox = wx.BoxSizer(wx.VERTICAL) - label = wx.StaticText(self.panel, -1, _(u"&Recipient")) + label = wx.StaticText(self.panel, -1, _("&Recipient")) self.cb = wx.ComboBox(self.panel, -1, choices=users, value=users[0], size=wx.DefaultSize) - self.autocompletionButton = wx.Button(self.panel, -1, _(u"Auto&complete users")) + self.autocompletionButton = wx.Button(self.panel, -1, _("Auto&complete users")) self.createTextArea(message, text="") userBox = wx.BoxSizer(wx.HORIZONTAL) userBox.Add(label, 0, wx.ALL, 5) @@ -194,15 +194,15 @@ class dm(textLimited): self.mainBox.Add(userBox, 0, wx.ALL, 5) self.mainBox.Add(self.textBox, 0, wx.ALL, 5) self.spellcheck = wx.Button(self.panel, -1, _("Check &spelling..."), size=wx.DefaultSize) - self.attach = wx.Button(self.panel, -1, _(u"&Attach audio..."), size=wx.DefaultSize) - self.shortenButton = wx.Button(self.panel, -1, _(u"Sh&orten URL"), size=wx.DefaultSize) - self.unshortenButton = wx.Button(self.panel, -1, _(u"&Expand URL"), size=wx.DefaultSize) + self.attach = wx.Button(self.panel, -1, _("&Attach audio..."), size=wx.DefaultSize) + self.shortenButton = wx.Button(self.panel, -1, _("Sh&orten URL"), size=wx.DefaultSize) + self.unshortenButton = wx.Button(self.panel, -1, _("&Expand URL"), size=wx.DefaultSize) self.shortenButton.Disable() self.unshortenButton.Disable() - self.translateButton = wx.Button(self.panel, -1, _(u"&Translate..."), size=wx.DefaultSize) - self.okButton = wx.Button(self.panel, wx.ID_OK, _(u"Sen&d"), size=wx.DefaultSize) + self.translateButton = wx.Button(self.panel, -1, _("&Translate..."), size=wx.DefaultSize) + self.okButton = wx.Button(self.panel, wx.ID_OK, _("Sen&d"), size=wx.DefaultSize) self.okButton.SetDefault() - cancelButton = wx.Button(self.panel, wx.ID_CANCEL, _(u"C&lose"), size=wx.DefaultSize) + cancelButton = wx.Button(self.panel, wx.ID_CANCEL, _("C&lose"), size=wx.DefaultSize) self.buttonsBox = wx.BoxSizer(wx.HORIZONTAL) self.buttonsBox.Add(self.spellcheck, 0, wx.ALL, 5) self.buttonsBox.Add(self.attach, 0, wx.ALL, 5) @@ -234,7 +234,7 @@ class dm(textLimited): class reply(textLimited): def get_image(self): - openFileDialog = wx.FileDialog(self, _(u"Select the picture to be uploaded"), "", "", _("Image files (*.png, *.jpg, *.gif)|*.png; *.jpg; *.gif"), wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) + openFileDialog = wx.FileDialog(self, _("Select the picture to be uploaded"), "", "", _("Image files (*.png, *.jpg, *.gif)|*.png; *.jpg; *.gif"), wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) if openFileDialog.ShowModal() == wx.ID_CANCEL: return None return open(openFileDialog.GetPath(), "rb") @@ -244,7 +244,7 @@ class reply(textLimited): self.createTextArea(message, text) self.mainBox.Add(self.textBox, 0, wx.ALL, 5) self.usersbox = wx.BoxSizer(wx.VERTICAL) - self.mentionAll = wx.CheckBox(self.panel, -1, _(u"&Mention to all"), size=wx.DefaultSize) + self.mentionAll = wx.CheckBox(self.panel, -1, _("&Mention to all"), size=wx.DefaultSize) self.mentionAll.Disable() self.usersbox.Add(self.mentionAll, 0, wx.ALL, 5) self.checkboxes = [] @@ -253,20 +253,20 @@ class reply(textLimited): self.checkboxes.append(user_checkbox) self.usersbox.Add(self.checkboxes[-1], 0, wx.ALL, 5) self.mainBox.Add(self.usersbox, 0, wx.ALL, 10) - self.long_tweet = wx.CheckBox(self.panel, -1, _(u"&Long tweet")) + self.long_tweet = wx.CheckBox(self.panel, -1, _("&Long tweet")) self.long_tweet.SetValue(True) - self.upload_image = wx.Button(self.panel, -1, _(u"&Upload image..."), size=wx.DefaultSize) + self.upload_image = wx.Button(self.panel, -1, _("&Upload image..."), size=wx.DefaultSize) self.spellcheck = wx.Button(self.panel, -1, _("Check &spelling..."), size=wx.DefaultSize) - self.attach = wx.Button(self.panel, -1, _(u"&Attach audio..."), size=wx.DefaultSize) - self.shortenButton = wx.Button(self.panel, -1, _(u"Sh&orten URL"), size=wx.DefaultSize) - self.unshortenButton = wx.Button(self.panel, -1, _(u"&Expand URL"), size=wx.DefaultSize) + self.attach = wx.Button(self.panel, -1, _("&Attach audio..."), size=wx.DefaultSize) + self.shortenButton = wx.Button(self.panel, -1, _("Sh&orten URL"), size=wx.DefaultSize) + self.unshortenButton = wx.Button(self.panel, -1, _("&Expand URL"), size=wx.DefaultSize) self.shortenButton.Disable() self.unshortenButton.Disable() - self.translateButton = wx.Button(self.panel, -1, _(u"&Translate..."), size=wx.DefaultSize) - self.autocompletionButton = wx.Button(self.panel, -1, _(u"Auto&complete users")) - self.okButton = wx.Button(self.panel, wx.ID_OK, _(u"Sen&d"), size=wx.DefaultSize) + self.translateButton = wx.Button(self.panel, -1, _("&Translate..."), size=wx.DefaultSize) + self.autocompletionButton = wx.Button(self.panel, -1, _("Auto&complete users")) + self.okButton = wx.Button(self.panel, wx.ID_OK, _("Sen&d"), size=wx.DefaultSize) self.okButton.SetDefault() - cancelButton = wx.Button(self.panel, wx.ID_CANCEL, _(u"C&lose"), size=wx.DefaultSize) + cancelButton = wx.Button(self.panel, wx.ID_CANCEL, _("C&lose"), size=wx.DefaultSize) self.buttonsBox1 = wx.BoxSizer(wx.HORIZONTAL) self.buttonsBox1.Add(self.upload_image, 0, wx.ALL, 10) self.buttonsBox1.Add(self.spellcheck, 0, wx.ALL, 10) @@ -299,12 +299,12 @@ class reply(textLimited): class viewTweet(widgetUtils.BaseDialog): def set_title(self, lenght): - self.SetTitle(_(u"Tweet - %i characters ") % (lenght,)) + self.SetTitle(_("Tweet - %i characters ") % (lenght,)) def __init__(self, text, rt_count, favs_count,source, *args, **kwargs): super(viewTweet, self).__init__(None, size=(850,850)) panel = wx.Panel(self) - label = wx.StaticText(panel, -1, _(u"Tweet")) + label = wx.StaticText(panel, -1, _("Tweet")) self.text = wx.TextCtrl(panel, -1, text, style=wx.TE_READONLY|wx.TE_MULTILINE, size=(250, 180)) dc = wx.WindowDC(self.text) dc.SetFont(self.text.GetFont()) @@ -316,7 +316,7 @@ class viewTweet(widgetUtils.BaseDialog): textBox.Add(self.text, 1, wx.EXPAND, 5) mainBox = wx.BoxSizer(wx.VERTICAL) mainBox.Add(textBox, 0, wx.ALL, 5) - label2 = wx.StaticText(panel, -1, _(u"Image description")) + label2 = wx.StaticText(panel, -1, _("Image description")) self.image_description = wx.TextCtrl(panel, -1, style=wx.TE_READONLY|wx.TE_MULTILINE, size=(250, 180)) dc = wx.WindowDC(self.image_description) dc.SetFont(self.image_description.GetFont()) @@ -327,17 +327,17 @@ class viewTweet(widgetUtils.BaseDialog): iBox.Add(label2, 0, wx.ALL, 5) iBox.Add(self.image_description, 1, wx.EXPAND, 5) mainBox.Add(iBox, 0, wx.ALL, 5) - rtCountLabel = wx.StaticText(panel, -1, _(u"Retweets: ")) + rtCountLabel = wx.StaticText(panel, -1, _("Retweets: ")) rtCount = wx.TextCtrl(panel, -1, rt_count, size=wx.DefaultSize, style=wx.TE_READONLY|wx.TE_MULTILINE) rtBox = wx.BoxSizer(wx.HORIZONTAL) rtBox.Add(rtCountLabel, 0, wx.ALL, 5) rtBox.Add(rtCount, 0, wx.ALL, 5) - favsCountLabel = wx.StaticText(panel, -1, _(u"Likes: ")) + favsCountLabel = wx.StaticText(panel, -1, _("Likes: ")) favsCount = wx.TextCtrl(panel, -1, favs_count, size=wx.DefaultSize, style=wx.TE_READONLY|wx.TE_MULTILINE) favsBox = wx.BoxSizer(wx.HORIZONTAL) favsBox.Add(favsCountLabel, 0, wx.ALL, 5) favsBox.Add(favsCount, 0, wx.ALL, 5) - sourceLabel = wx.StaticText(panel, -1, _(u"Source: ")) + sourceLabel = wx.StaticText(panel, -1, _("Source: ")) sourceTweet = wx.TextCtrl(panel, -1, source, size=wx.DefaultSize, style=wx.TE_READONLY|wx.TE_MULTILINE) sourceBox = wx.BoxSizer(wx.HORIZONTAL) sourceBox.Add(sourceLabel, 0, wx.ALL, 5) @@ -348,10 +348,10 @@ class viewTweet(widgetUtils.BaseDialog): infoBox.Add(sourceBox, 0, wx.ALL, 5) mainBox.Add(infoBox, 0, wx.ALL, 5) self.spellcheck = wx.Button(panel, -1, _("Check &spelling..."), size=wx.DefaultSize) - self.unshortenButton = wx.Button(panel, -1, _(u"&Expand URL"), size=wx.DefaultSize) + self.unshortenButton = wx.Button(panel, -1, _("&Expand URL"), size=wx.DefaultSize) self.unshortenButton.Disable() - self.translateButton = wx.Button(panel, -1, _(u"&Translate..."), size=wx.DefaultSize) - cancelButton = wx.Button(panel, wx.ID_CANCEL, _(u"C&lose"), size=wx.DefaultSize) + self.translateButton = wx.Button(panel, -1, _("&Translate..."), size=wx.DefaultSize) + cancelButton = wx.Button(panel, wx.ID_CANCEL, _("C&lose"), size=wx.DefaultSize) cancelButton.SetDefault() buttonsBox = wx.BoxSizer(wx.HORIZONTAL) buttonsBox.Add(self.spellcheck, 0, wx.ALL, 5) @@ -395,9 +395,9 @@ class viewNonTweet(widgetUtils.BaseDialog): def __init__(self, text, *args, **kwargs): super(viewNonTweet, self).__init__(None, size=(850,850)) - self.SetTitle(_(u"View")) + self.SetTitle(_("View")) panel = wx.Panel(self) - label = wx.StaticText(panel, -1, _(u"Item")) + label = wx.StaticText(panel, -1, _("Item")) self.text = wx.TextCtrl(parent=panel, id=-1, value=text, style=wx.TE_READONLY|wx.TE_MULTILINE, size=(250, 180)) dc = wx.WindowDC(self.text) dc.SetFont(self.text.GetFont()) @@ -410,10 +410,10 @@ class viewNonTweet(widgetUtils.BaseDialog): mainBox = wx.BoxSizer(wx.VERTICAL) mainBox.Add(textBox, 0, wx.ALL, 5) self.spellcheck = wx.Button(panel, -1, _("Check &spelling..."), size=wx.DefaultSize) - self.unshortenButton = wx.Button(panel, -1, _(u"&Expand URL"), size=wx.DefaultSize) + self.unshortenButton = wx.Button(panel, -1, _("&Expand URL"), size=wx.DefaultSize) self.unshortenButton.Disable() - self.translateButton = wx.Button(panel, -1, _(u"&Translate..."), size=wx.DefaultSize) - cancelButton = wx.Button(panel, wx.ID_CANCEL, _(u"C&lose"), size=wx.DefaultSize) + self.translateButton = wx.Button(panel, -1, _("&Translate..."), size=wx.DefaultSize) + cancelButton = wx.Button(panel, wx.ID_CANCEL, _("C&lose"), size=wx.DefaultSize) cancelButton.SetDefault() buttonsBox = wx.BoxSizer(wx.HORIZONTAL) buttonsBox.Add(self.spellcheck, 0, wx.ALL, 5) diff --git a/src/wxUI/dialogs/search.py b/src/wxUI/dialogs/search.py index a3f9eacf..19a85c6a 100644 --- a/src/wxUI/dialogs/search.py +++ b/src/wxUI/dialogs/search.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import + import widgetUtils from . import baseDialog import wx @@ -10,40 +10,40 @@ class searchDialog(baseDialog.BaseWXDialog): super(searchDialog, self).__init__(None, -1) panel = wx.Panel(self) sizer = wx.BoxSizer(wx.VERTICAL) - self.SetTitle(_(u"Search on Twitter")) - label = wx.StaticText(panel, -1, _(u"&Search")) + self.SetTitle(_("Search on Twitter")) + label = wx.StaticText(panel, -1, _("&Search")) self.term = wx.TextCtrl(panel, -1, value) dc = wx.WindowDC(self.term) dc.SetFont(self.term.GetFont()) self.term.SetSize(dc.GetTextExtent("0"*40)) sizer.Add(label, 0, wx.ALL, 5) sizer.Add(self.term, 0, wx.ALL, 5) - self.tweets = wx.RadioButton(panel, -1, _(u"Tweets"), style=wx.RB_GROUP) - self.users = wx.RadioButton(panel, -1, _(u"Users")) + self.tweets = wx.RadioButton(panel, -1, _("Tweets"), style=wx.RB_GROUP) + self.users = wx.RadioButton(panel, -1, _("Users")) widgetUtils.connect_event(self.tweets, widgetUtils.RADIOBUTTON, self.show_advanced_search) widgetUtils.connect_event(self.users, widgetUtils.RADIOBUTTON, self.hide_advanced_search) radioSizer = wx.BoxSizer(wx.HORIZONTAL) radioSizer.Add(self.tweets, 0, wx.ALL, 5) radioSizer.Add(self.users, 0, wx.ALL, 5) sizer.Add(radioSizer, 0, wx.ALL, 5) - lang = wx.StaticText(panel, -1, _(u"&Language for results: ")) + lang = wx.StaticText(panel, -1, _("&Language for results: ")) langs = [x[1] for x in translator.translator.available_languages()] langs[:] = langs[1:] - langs.insert(0, _(u"any")) + langs.insert(0, _("any")) self.lang = wx.ComboBox(panel, -1, choices=langs, value=langs[0], style = wx.CB_READONLY) langBox = wx.BoxSizer(wx.HORIZONTAL) langBox.Add(lang, 0, wx.ALL, 5) langBox.Add(self.lang, 0, wx.ALL, 5) sizer.Add(langBox, 0, wx.ALL, 5) - resulttype = wx.StaticText(panel, -1, _(U"Results &type: ")) - self.resultstype = wx.ComboBox(panel, -1, choices=[_(u"Mixed"), _(u"Recent"), _(u"Popular")], value=_(u"Mixed"), style=wx.CB_READONLY) + resulttype = wx.StaticText(panel, -1, _("Results &type: ")) + self.resultstype = wx.ComboBox(panel, -1, choices=[_("Mixed"), _("Recent"), _("Popular")], value=_("Mixed"), style=wx.CB_READONLY) rBox = wx.BoxSizer(wx.HORIZONTAL) rBox.Add(resulttype, 0, wx.ALL, 5) rBox.Add(self.resultstype, 0, wx.ALL, 5) sizer.Add(rBox, 0, wx.ALL, 5) - ok = wx.Button(panel, wx.ID_OK, _(u"&OK")) + ok = wx.Button(panel, wx.ID_OK, _("&OK")) ok.SetDefault() - cancel = wx.Button(panel, wx.ID_CANCEL, _(u"&Close")) + cancel = wx.Button(panel, wx.ID_CANCEL, _("&Close")) btnsizer = wx.BoxSizer() btnsizer.Add(ok, 0, wx.ALL, 5) btnsizer.Add(cancel, 0, wx.ALL, 5) @@ -56,9 +56,9 @@ class searchDialog(baseDialog.BaseWXDialog): def get_result_type(self): r = self.resultstype.GetValue() - if r == _(u"Mixed"): return "mixed" - elif r == _(u"Recent"): return "recent" - elif r == _(u"Popular"): return "popular" + if r == _("Mixed"): return "mixed" + elif r == _("Recent"): return "recent" + elif r == _("Popular"): return "popular" def hide_advanced_search(self, *args, **kwargs): self.lang.Hide() diff --git a/src/wxUI/dialogs/show_user.py b/src/wxUI/dialogs/show_user.py index 6406e1dc..a6d5e3b6 100644 --- a/src/wxUI/dialogs/show_user.py +++ b/src/wxUI/dialogs/show_user.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import + import wx from . import baseDialog @@ -8,14 +8,14 @@ class showUserProfile(baseDialog.BaseWXDialog): super(showUserProfile, self).__init__(parent=None, id=wx.NewId()) panel = wx.Panel(self) sizer = wx.BoxSizer(wx.VERTICAL) - static = wx.StaticText(panel, -1, _(u"Details")) + static = wx.StaticText(panel, -1, _("Details")) sizer.Add(static, 0, wx.ALL, 5) self.text = wx.TextCtrl(panel, -1, style=wx.TE_MULTILINE|wx.TE_READONLY, size=(350, 250)) self.text.SetFocus() sizer.Add(self.text, 0, wx.ALL|wx.EXPAND, 5) - self.url = wx.Button(panel, -1, _(u"&Go to URL"), size=wx.DefaultSize) + self.url = wx.Button(panel, -1, _("&Go to URL"), size=wx.DefaultSize) self.url.Disable() - close = wx.Button(panel, wx.ID_CANCEL, _(u"&Close")) + close = wx.Button(panel, wx.ID_CANCEL, _("&Close")) btnSizer = wx.BoxSizer(wx.HORIZONTAL) btnSizer.Add(self.url, 0, wx.ALL, 5) btnSizer.Add(close, 0, wx.ALL, 5) diff --git a/src/wxUI/dialogs/trends.py b/src/wxUI/dialogs/trends.py index 20753345..32dd8094 100644 --- a/src/wxUI/dialogs/trends.py +++ b/src/wxUI/dialogs/trends.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import + # -*- coding: utf-8 -*- from . import baseDialog import wx @@ -9,25 +9,25 @@ class trendingTopicsDialog(baseDialog.BaseWXDialog): super(trendingTopicsDialog, self).__init__(None, -1) panel = wx.Panel(self) sizer = wx.BoxSizer(wx.VERTICAL) - self.SetTitle(_(u"View trending topics")) - label = wx.StaticText(panel, -1, _(u"Trending topics by")) + self.SetTitle(_("View trending topics")) + label = wx.StaticText(panel, -1, _("Trending topics by")) sizer.Add(label, 0, wx.ALL, 5) - self.country = wx.RadioButton(panel, -1, _(u"Country"), style=wx.RB_GROUP) - self.city = wx.RadioButton(panel, -1, _(u"City")) + self.country = wx.RadioButton(panel, -1, _("Country"), style=wx.RB_GROUP) + self.city = wx.RadioButton(panel, -1, _("City")) radioSizer = wx.BoxSizer(wx.HORIZONTAL) radioSizer.Add(label, 0, wx.ALL, 5) radioSizer.Add(self.country, 0, wx.ALL, 5) radioSizer.Add(self.city, 0, wx.ALL, 5) sizer.Add(radioSizer, 0, wx.ALL, 5) - label = wx.StaticText(panel, -1, _(u"&Location")) + label = wx.StaticText(panel, -1, _("&Location")) self.location = wx.ListBox(panel, -1, choices=[], style=wx.CB_READONLY) locationBox = wx.BoxSizer(wx.HORIZONTAL) locationBox.Add(label, 0, wx.ALL, 5) locationBox.Add(self.location, 0, wx.ALL, 5) sizer.Add(locationBox, 0, wx.ALL, 5) - ok = wx.Button(panel, wx.ID_OK, _(u"&OK")) + ok = wx.Button(panel, wx.ID_OK, _("&OK")) ok.SetDefault() - cancel = wx.Button(panel, wx.ID_CANCEL, _(u"&Close")) + cancel = wx.Button(panel, wx.ID_CANCEL, _("&Close")) btnsizer = wx.BoxSizer() btnsizer.Add(ok, 0, wx.ALL, 5) btnsizer.Add(cancel, 0, wx.ALL, 5) diff --git a/src/wxUI/dialogs/update_profile.py b/src/wxUI/dialogs/update_profile.py index 770cec2c..31823313 100644 --- a/src/wxUI/dialogs/update_profile.py +++ b/src/wxUI/dialogs/update_profile.py @@ -1,37 +1,37 @@ # -*- coding: utf-8 -*- -from __future__ import absolute_import + import wx from . import baseDialog class updateProfileDialog(baseDialog.BaseWXDialog): def __init__(self): super(updateProfileDialog, self).__init__(parent=None, id=-1) - self.SetTitle(_(u"Update your profile")) + self.SetTitle(_("Update your profile")) panel = wx.Panel(self) - labelName = wx.StaticText(panel, -1, _(u"&Name (20 characters maximum)")) + labelName = wx.StaticText(panel, -1, _("&Name (20 characters maximum)")) self.name = wx.TextCtrl(panel, -1) self.name.SetFocus() dc = wx.WindowDC(self.name) dc.SetFont(self.name.GetFont()) self.name.SetSize(dc.GetTextExtent("0"*20)) - labelLocation = wx.StaticText(panel, -1, _(u"&Location")) + labelLocation = wx.StaticText(panel, -1, _("&Location")) self.location = wx.TextCtrl(panel, -1) dc = wx.WindowDC(self.location) dc.SetFont(self.location.GetFont()) self.location.SetSize(dc.GetTextExtent("0"*35)) - labelUrl = wx.StaticText(panel, -1, _(u"&Website")) + labelUrl = wx.StaticText(panel, -1, _("&Website")) self.url = wx.TextCtrl(panel, -1) dc = wx.WindowDC(self.url) dc.SetFont(self.url.GetFont()) self.url.SetSize(dc.GetTextExtent("0"*22)) - labelDescription = wx.StaticText(panel, -1, _(u"&Bio (160 characters maximum)")) + labelDescription = wx.StaticText(panel, -1, _("&Bio (160 characters maximum)")) self.description = wx.TextCtrl(panel, -1, size=(400, 400)) dc = wx.WindowDC(self.description) dc.SetFont(self.description.GetFont()) self.description.SetSize(dc.GetTextExtent("0"*160)) self.image = None - self.upload_image = wx.Button(panel, -1, _(u"Upload a &picture")) - self.ok = wx.Button(panel, wx.ID_OK, _(u"&Update profile")) + self.upload_image = wx.Button(panel, -1, _("Upload a &picture")) + self.ok = wx.Button(panel, wx.ID_OK, _("&Update profile")) self.ok.SetDefault() close = wx.Button(panel, wx.ID_CANCEL, _("&Close")) sizer = wx.BoxSizer(wx.VERTICAL) @@ -73,12 +73,12 @@ class updateProfileDialog(baseDialog.BaseWXDialog): def change_upload_button(self, uploaded=False): if uploaded == False: - self.upload_image.SetLabel(_(u"Upload a picture")) + self.upload_image.SetLabel(_("Upload a picture")) else: - self.upload_image.SetLabel(_(u"Discard image")) + self.upload_image.SetLabel(_("Discard image")) def upload_picture(self): - openFileDialog = wx.FileDialog(self, _(u"Select the picture to be uploaded"), "", "", _("Image files (*.png, *.jpg, *.gif)|*.png; *.jpg; *.gif"), wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) + openFileDialog = wx.FileDialog(self, _("Select the picture to be uploaded"), "", "", _("Image files (*.png, *.jpg, *.gif)|*.png; *.jpg; *.gif"), wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) if openFileDialog.ShowModal() == wx.ID_CANCEL: return None return openFileDialog.GetPath() diff --git a/src/wxUI/dialogs/urlList.py b/src/wxUI/dialogs/urlList.py index ee5f0fdc..3502058e 100644 --- a/src/wxUI/dialogs/urlList.py +++ b/src/wxUI/dialogs/urlList.py @@ -1,35 +1,35 @@ -# -*- coding: utf-8 -*- -import wx - -class urlList(wx.Dialog): - def __init__(self, title=_(u"Select URL")): - super(urlList, self).__init__(parent=None, title=title) - panel = wx.Panel(self) - self.lista = wx.ListBox(panel, -1) - self.lista.SetFocus() - self.lista.SetSize(self.lista.GetBestSize()) - sizer = wx.BoxSizer(wx.VERTICAL) - sizer.Add(self.lista, 0, wx.ALL, 5) - goBtn = wx.Button(panel, wx.ID_OK) - goBtn.SetDefault() - cancelBtn = wx.Button(panel, wx.ID_CANCEL) - btnSizer = wx.BoxSizer() - btnSizer.Add(goBtn, 0, wx.ALL, 5) - btnSizer.Add(cancelBtn, 0, wx.ALL, 5) - sizer.Add(btnSizer, 0, wx.ALL, 5) - panel.SetSizer(sizer) - self.SetClientSize(sizer.CalcMin()) - - def populate_list(self, urls): - for i in urls: - self.lista.Append(i) - self.lista.SetSelection(0) - - def get_string(self): - return self.lista.GetStringSelection() - - def get_item(self): - return self.lista.GetSelection() - - def get_response(self): +# -*- coding: utf-8 -*- +import wx + +class urlList(wx.Dialog): + def __init__(self, title=_("Select URL")): + super(urlList, self).__init__(parent=None, title=title) + panel = wx.Panel(self) + self.lista = wx.ListBox(panel, -1) + self.lista.SetFocus() + self.lista.SetSize(self.lista.GetBestSize()) + sizer = wx.BoxSizer(wx.VERTICAL) + sizer.Add(self.lista, 0, wx.ALL, 5) + goBtn = wx.Button(panel, wx.ID_OK) + goBtn.SetDefault() + cancelBtn = wx.Button(panel, wx.ID_CANCEL) + btnSizer = wx.BoxSizer() + btnSizer.Add(goBtn, 0, wx.ALL, 5) + btnSizer.Add(cancelBtn, 0, wx.ALL, 5) + sizer.Add(btnSizer, 0, wx.ALL, 5) + panel.SetSizer(sizer) + self.SetClientSize(sizer.CalcMin()) + + def populate_list(self, urls): + for i in urls: + self.lista.Append(i) + self.lista.SetSelection(0) + + def get_string(self): + return self.lista.GetStringSelection() + + def get_item(self): + return self.lista.GetSelection() + + def get_response(self): return self.ShowModal() \ No newline at end of file diff --git a/src/wxUI/dialogs/userActions.py b/src/wxUI/dialogs/userActions.py index e0fecb6c..b7156a19 100644 --- a/src/wxUI/dialogs/userActions.py +++ b/src/wxUI/dialogs/userActions.py @@ -1,89 +1,89 @@ -# -*- coding: utf-8 -*- -import wx - -class UserActionsDialog(wx.Dialog): - def __init__(self, users=[], default="follow", *args, **kwargs): - super(UserActionsDialog, self).__init__(parent=None, *args, **kwargs) - panel = wx.Panel(self) - userSizer = wx.BoxSizer() - self.SetTitle(_(u"Action")) - userLabel = wx.StaticText(panel, -1, _(u"&User")) - self.cb = wx.ComboBox(panel, -1, choices=users, value=users[0]) - self.cb.SetFocus() - self.autocompletion = wx.Button(panel, -1, _(u"&Autocomplete users")) - userSizer.Add(userLabel, 0, wx.ALL, 5) - userSizer.Add(self.cb, 0, wx.ALL, 5) - userSizer.Add(self.autocompletion, 0, wx.ALL, 5) - actionSizer = wx.BoxSizer(wx.VERTICAL) - label2 = wx.StaticText(panel, -1, _(u"Action")) - self.follow = wx.RadioButton(panel, -1, _(u"&Follow"), name=_(u"Action"), style=wx.RB_GROUP) - self.unfollow = wx.RadioButton(panel, -1, _(u"U&nfollow")) - self.mute = wx.RadioButton(panel, -1, _(u"&Mute")) - self.unmute = wx.RadioButton(panel, -1, _(u"Unmu&te")) - self.block = wx.RadioButton(panel, -1, _(u"&Block")) - self.unblock = wx.RadioButton(panel, -1, _(u"Unbl&ock")) - self.reportSpam = wx.RadioButton(panel, -1, _(u"&Report as spam")) - self.ignore_client = wx.RadioButton(panel, -1, _(u"&Ignore tweets from this client")) - self.setup_default(default) - hSizer = wx.BoxSizer(wx.HORIZONTAL) - hSizer.Add(label2, 0, wx.ALL, 5) - actionSizer.Add(self.follow, 0, wx.ALL, 5) - actionSizer.Add(self.unfollow, 0, wx.ALL, 5) - actionSizer.Add(self.mute, 0, wx.ALL, 5) - actionSizer.Add(self.unmute, 0, wx.ALL, 5) - actionSizer.Add(self.block, 0, wx.ALL, 5) - actionSizer.Add(self.unblock, 0, wx.ALL, 5) - actionSizer.Add(self.reportSpam, 0, wx.ALL, 5) - actionSizer.Add(self.ignore_client, 0, wx.ALL, 5) - hSizer.Add(actionSizer, 0, wx.ALL, 5) - sizer = wx.BoxSizer(wx.VERTICAL) - ok = wx.Button(panel, wx.ID_OK, _(u"&OK")) - ok.SetDefault() - cancel = wx.Button(panel, wx.ID_CANCEL, _(u"&Close")) - btnsizer = wx.BoxSizer() - btnsizer.Add(ok) - btnsizer.Add(cancel) - sizer.Add(userSizer) - sizer.Add(hSizer, 0, wx.ALL, 5) - sizer.Add(btnsizer) - panel.SetSizer(sizer) - - def get_action(self): - if self.follow.GetValue() == True: return "follow" - elif self.unfollow.GetValue() == True: return "unfollow" - elif self.mute.GetValue() == True: return "mute" - elif self.unmute.GetValue() == True: return "unmute" - elif self.reportSpam.GetValue() == True: return "report" - elif self.block.GetValue() == True: return "block" - elif self.unblock.GetValue() == True: return "unblock" - elif self.ignore_client.GetValue() == True: return "ignore_client" - - def setup_default(self, default): - if default == "follow": - self.follow.SetValue(True) - elif default == "unfollow": - self.unfollow.SetValue(True) - elif default == "mute": - self.mute.SetValue(True) - elif default == "unmute": - self.unmute.SetValue(True) - elif default == "report": - self.reportSpam.SetValue(True) - elif default == "block": - self.block.SetValue(True) - elif default == "unblock": - self.unblock.SetValue(True) - elif default == "ignore_client": - self.ignore_client.SetValue(True) - - def get_response(self): - return self.ShowModal() - - def get_user(self): - return self.cb.GetValue() - - def get_position(self): - return self.cb.GetPosition() - - def popup_menu(self, menu): - self.PopupMenu(menu, self.cb.GetPosition()) +# -*- coding: utf-8 -*- +import wx + +class UserActionsDialog(wx.Dialog): + def __init__(self, users=[], default="follow", *args, **kwargs): + super(UserActionsDialog, self).__init__(parent=None, *args, **kwargs) + panel = wx.Panel(self) + userSizer = wx.BoxSizer() + self.SetTitle(_("Action")) + userLabel = wx.StaticText(panel, -1, _("&User")) + self.cb = wx.ComboBox(panel, -1, choices=users, value=users[0]) + self.cb.SetFocus() + self.autocompletion = wx.Button(panel, -1, _("&Autocomplete users")) + userSizer.Add(userLabel, 0, wx.ALL, 5) + userSizer.Add(self.cb, 0, wx.ALL, 5) + userSizer.Add(self.autocompletion, 0, wx.ALL, 5) + actionSizer = wx.BoxSizer(wx.VERTICAL) + label2 = wx.StaticText(panel, -1, _("Action")) + self.follow = wx.RadioButton(panel, -1, _("&Follow"), name=_("Action"), style=wx.RB_GROUP) + self.unfollow = wx.RadioButton(panel, -1, _("U&nfollow")) + self.mute = wx.RadioButton(panel, -1, _("&Mute")) + self.unmute = wx.RadioButton(panel, -1, _("Unmu&te")) + self.block = wx.RadioButton(panel, -1, _("&Block")) + self.unblock = wx.RadioButton(panel, -1, _("Unbl&ock")) + self.reportSpam = wx.RadioButton(panel, -1, _("&Report as spam")) + self.ignore_client = wx.RadioButton(panel, -1, _("&Ignore tweets from this client")) + self.setup_default(default) + hSizer = wx.BoxSizer(wx.HORIZONTAL) + hSizer.Add(label2, 0, wx.ALL, 5) + actionSizer.Add(self.follow, 0, wx.ALL, 5) + actionSizer.Add(self.unfollow, 0, wx.ALL, 5) + actionSizer.Add(self.mute, 0, wx.ALL, 5) + actionSizer.Add(self.unmute, 0, wx.ALL, 5) + actionSizer.Add(self.block, 0, wx.ALL, 5) + actionSizer.Add(self.unblock, 0, wx.ALL, 5) + actionSizer.Add(self.reportSpam, 0, wx.ALL, 5) + actionSizer.Add(self.ignore_client, 0, wx.ALL, 5) + hSizer.Add(actionSizer, 0, wx.ALL, 5) + sizer = wx.BoxSizer(wx.VERTICAL) + ok = wx.Button(panel, wx.ID_OK, _("&OK")) + ok.SetDefault() + cancel = wx.Button(panel, wx.ID_CANCEL, _("&Close")) + btnsizer = wx.BoxSizer() + btnsizer.Add(ok) + btnsizer.Add(cancel) + sizer.Add(userSizer) + sizer.Add(hSizer, 0, wx.ALL, 5) + sizer.Add(btnsizer) + panel.SetSizer(sizer) + + def get_action(self): + if self.follow.GetValue() == True: return "follow" + elif self.unfollow.GetValue() == True: return "unfollow" + elif self.mute.GetValue() == True: return "mute" + elif self.unmute.GetValue() == True: return "unmute" + elif self.reportSpam.GetValue() == True: return "report" + elif self.block.GetValue() == True: return "block" + elif self.unblock.GetValue() == True: return "unblock" + elif self.ignore_client.GetValue() == True: return "ignore_client" + + def setup_default(self, default): + if default == "follow": + self.follow.SetValue(True) + elif default == "unfollow": + self.unfollow.SetValue(True) + elif default == "mute": + self.mute.SetValue(True) + elif default == "unmute": + self.unmute.SetValue(True) + elif default == "report": + self.reportSpam.SetValue(True) + elif default == "block": + self.block.SetValue(True) + elif default == "unblock": + self.unblock.SetValue(True) + elif default == "ignore_client": + self.ignore_client.SetValue(True) + + def get_response(self): + return self.ShowModal() + + def get_user(self): + return self.cb.GetValue() + + def get_position(self): + return self.cb.GetPosition() + + def popup_menu(self, menu): + self.PopupMenu(menu, self.cb.GetPosition()) diff --git a/src/wxUI/dialogs/userSelection.py b/src/wxUI/dialogs/userSelection.py index 76924cb5..a7ef2422 100644 --- a/src/wxUI/dialogs/userSelection.py +++ b/src/wxUI/dialogs/userSelection.py @@ -1,65 +1,65 @@ -# -*- coding: utf-8 -*- -import wx - -class selectUserDialog(wx.Dialog): - def __init__(self, users=[], default="tweets", *args, **kwargs): - super(selectUserDialog, self).__init__(parent=None, *args, **kwargs) - panel = wx.Panel(self) - userSizer = wx.BoxSizer() - self.SetTitle(_(u"Timeline for %s") % (users[0])) - userLabel = wx.StaticText(panel, -1, _(u"User")) - self.cb = wx.ComboBox(panel, -1, choices=users, value=users[0]) - self.cb.SetFocus() - self.autocompletion = wx.Button(panel, -1, _(u"&Autocomplete users")) - userSizer.Add(userLabel, 0, wx.ALL, 5) - userSizer.Add(self.cb, 0, wx.ALL, 5) - userSizer.Add(self.autocompletion, 0, wx.ALL, 5) - actionSizer = wx.BoxSizer(wx.VERTICAL) - label2 = wx.StaticText(panel, -1, _(u"Buffer type")) - self.tweets = wx.RadioButton(panel, -1, _(u"&Tweets"), style=wx.RB_GROUP) - self.favourites = wx.RadioButton(panel, -1, _(u"&Likes")) - self.followers = wx.RadioButton(panel, -1, _(u"&Followers")) - self.friends = wx.RadioButton(panel, -1, _(u"F&riends")) - self.setup_default(default) - hSizer = wx.BoxSizer(wx.HORIZONTAL) - hSizer.Add(label2, 0, wx.ALL, 5) - actionSizer.Add(self.tweets, 0, wx.ALL, 5) - actionSizer.Add(self.favourites, 0, wx.ALL, 5) - actionSizer.Add(self.followers, 0, wx.ALL, 5) - actionSizer.Add(self.friends, 0, wx.ALL, 5) - hSizer.Add(actionSizer, 0, wx.ALL, 5) - sizer = wx.BoxSizer(wx.VERTICAL) - ok = wx.Button(panel, wx.ID_OK, _(u"&OK")) - ok.SetDefault() - cancel = wx.Button(panel, wx.ID_CANCEL, _(u"&Close")) - btnsizer = wx.BoxSizer() - btnsizer.Add(ok) - btnsizer.Add(cancel) - sizer.Add(userSizer) - sizer.Add(hSizer, 0, wx.ALL, 5) - sizer.Add(btnsizer) - panel.SetSizer(sizer) - - def get_action(self): - if self.tweets.GetValue() == True: return "tweets" - elif self.favourites.GetValue() == True: return "favourites" - elif self.followers.GetValue() == True: return "followers" - elif self.friends.GetValue() == True: return "friends" - - def setup_default(self, default): - if default == "tweets": - self.tweets.SetValue(True) - elif default == "favourites": - self.favourites.SetValue(True) - - def get_response(self): - return self.ShowModal() - - def get_user(self): - return self.cb.GetValue() - - def get_position(self): - return self.cb.GetPosition() - - def popup_menu(self, menu): - self.PopupMenu(menu, self.cb.GetPosition()) +# -*- coding: utf-8 -*- +import wx + +class selectUserDialog(wx.Dialog): + def __init__(self, users=[], default="tweets", *args, **kwargs): + super(selectUserDialog, self).__init__(parent=None, *args, **kwargs) + panel = wx.Panel(self) + userSizer = wx.BoxSizer() + self.SetTitle(_("Timeline for %s") % (users[0])) + userLabel = wx.StaticText(panel, -1, _("User")) + self.cb = wx.ComboBox(panel, -1, choices=users, value=users[0]) + self.cb.SetFocus() + self.autocompletion = wx.Button(panel, -1, _("&Autocomplete users")) + userSizer.Add(userLabel, 0, wx.ALL, 5) + userSizer.Add(self.cb, 0, wx.ALL, 5) + userSizer.Add(self.autocompletion, 0, wx.ALL, 5) + actionSizer = wx.BoxSizer(wx.VERTICAL) + label2 = wx.StaticText(panel, -1, _("Buffer type")) + self.tweets = wx.RadioButton(panel, -1, _("&Tweets"), style=wx.RB_GROUP) + self.favourites = wx.RadioButton(panel, -1, _("&Likes")) + self.followers = wx.RadioButton(panel, -1, _("&Followers")) + self.friends = wx.RadioButton(panel, -1, _("F&riends")) + self.setup_default(default) + hSizer = wx.BoxSizer(wx.HORIZONTAL) + hSizer.Add(label2, 0, wx.ALL, 5) + actionSizer.Add(self.tweets, 0, wx.ALL, 5) + actionSizer.Add(self.favourites, 0, wx.ALL, 5) + actionSizer.Add(self.followers, 0, wx.ALL, 5) + actionSizer.Add(self.friends, 0, wx.ALL, 5) + hSizer.Add(actionSizer, 0, wx.ALL, 5) + sizer = wx.BoxSizer(wx.VERTICAL) + ok = wx.Button(panel, wx.ID_OK, _("&OK")) + ok.SetDefault() + cancel = wx.Button(panel, wx.ID_CANCEL, _("&Close")) + btnsizer = wx.BoxSizer() + btnsizer.Add(ok) + btnsizer.Add(cancel) + sizer.Add(userSizer) + sizer.Add(hSizer, 0, wx.ALL, 5) + sizer.Add(btnsizer) + panel.SetSizer(sizer) + + def get_action(self): + if self.tweets.GetValue() == True: return "tweets" + elif self.favourites.GetValue() == True: return "favourites" + elif self.followers.GetValue() == True: return "followers" + elif self.friends.GetValue() == True: return "friends" + + def setup_default(self, default): + if default == "tweets": + self.tweets.SetValue(True) + elif default == "favourites": + self.favourites.SetValue(True) + + def get_response(self): + return self.ShowModal() + + def get_user(self): + return self.cb.GetValue() + + def get_position(self): + return self.cb.GetPosition() + + def popup_menu(self, menu): + self.PopupMenu(menu, self.cb.GetPosition()) diff --git a/src/wxUI/dialogs/utils.py b/src/wxUI/dialogs/utils.py index 334b20f6..d3a140b7 100644 --- a/src/wxUI/dialogs/utils.py +++ b/src/wxUI/dialogs/utils.py @@ -16,7 +16,7 @@ # along with this program. If not, see . # ############################################################ -from __future__ import absolute_import + import wx from . import baseDialog @@ -27,15 +27,15 @@ class selectUserDialog(baseDialog.BaseWXDialog): userSizer = wx.BoxSizer() self.cb = wx.ComboBox(panel, -1, choices=users, value=users[0], size=wx.DefaultSize) self.cb.SetFocus() - self.autocompletion = wx.Button(panel, -1, _(u"&Autocomplete users")) - userSizer.Add(wx.StaticText(panel, -1, _(u"User")), 0, wx.ALL, 5) + self.autocompletion = wx.Button(panel, -1, _("&Autocomplete users")) + userSizer.Add(wx.StaticText(panel, -1, _("User")), 0, wx.ALL, 5) userSizer.Add(self.cb, 0, wx.ALL, 5) userSizer.Add(self.autocompletion, 0, wx.ALL, 5) sizer = wx.BoxSizer(wx.VERTICAL) - ok = wx.Button(panel, wx.ID_OK, _(u"OK")) + ok = wx.Button(panel, wx.ID_OK, _("OK")) ok.SetDefault() # ok.Bind(wx.EVT_BUTTON, self.onok) - cancel = wx.Button(panel, wx.ID_CANCEL, _(u"Close")) + cancel = wx.Button(panel, wx.ID_CANCEL, _("Close")) btnsizer = wx.BoxSizer() btnsizer.Add(ok, 0, wx.ALL, 5) btnsizer.Add(cancel, 0, wx.ALL, 5) diff --git a/src/wxUI/menus.py b/src/wxUI/menus.py index 866816e7..ac42299a 100644 --- a/src/wxUI/menus.py +++ b/src/wxUI/menus.py @@ -1,97 +1,97 @@ -# -*- coding: utf-8 -*- -import wx - -class basePanelMenu(wx.Menu): - def __init__(self): - super(basePanelMenu, self).__init__() - self.retweet = wx.MenuItem(self, wx.NewId(), _(u"&Retweet")) - self.Append(self.retweet) - self.reply = wx.MenuItem(self, wx.NewId(), _(u"Re&ply")) - self.Append(self.reply) - self.fav = wx.MenuItem(self, wx.NewId(), _(u"&Like")) - self.Append(self.fav) - self.unfav = wx.MenuItem(self, wx.NewId(), _(u"&Unlike")) - self.Append(self.unfav) - self.openUrl = wx.MenuItem(self, wx.NewId(), _(u"&Open URL")) - self.Append(self.openUrl) - self.play = wx.MenuItem(self, wx.NewId(), _(u"&Play audio")) - self.Append(self.play) - self.view = wx.MenuItem(self, wx.NewId(), _(u"&Show tweet")) - self.Append(self.view) - self.copy = wx.MenuItem(self, wx.NewId(), _(u"&Copy to clipboard")) - self.Append(self.copy) - self.remove = wx.MenuItem(self, wx.NewId(), _(u"&Delete")) - self.Append(self.remove) - self.userActions = wx.MenuItem(self, wx.NewId(), _(u"&User actions...")) - self.Append(self.userActions) - -class dmPanelMenu(wx.Menu): - def __init__(self): - super(dmPanelMenu, self).__init__() - self.reply = wx.MenuItem(self, wx.NewId(), _(u"Re&ply")) - self.Append(self.reply) - self.openUrl = wx.MenuItem(self, wx.NewId(), _(u"&Open URL")) - self.Append(self.openUrl) - self.play = wx.MenuItem(self, wx.NewId(), _(u"&Play audio")) - self.Append(self.play) - self.view = wx.MenuItem(self, wx.NewId(), _(u"&Show direct message")) - self.Append(self.view) - self.copy = wx.MenuItem(self, wx.NewId(), _(u"&Copy to clipboard")) - self.Append(self.copy) - self.remove = wx.MenuItem(self, wx.NewId(), _(u"&Delete")) - self.Append(self.remove) - self.userActions = wx.MenuItem(self, wx.NewId(), _(u"&User actions...")) - self.Append(self.userActions) - -class sentPanelMenu(wx.Menu): - def __init__(self): - super(sentPanelMenu, self).__init__() - self.openUrl = wx.MenuItem(self, wx.NewId(), _(u"&Open URL")) - self.Append(self.openUrl) - self.play = wx.MenuItem(self, wx.NewId(), _(u"&Play audio")) - self.Append(self.play) - self.view = wx.MenuItem(self, wx.NewId(), _(u"&Show tweet")) - self.Append(self.view) - self.copy = wx.MenuItem(self, wx.NewId(), _(u"&Copy to clipboard")) - self.Append(self.copy) - self.remove = wx.MenuItem(self, wx.NewId(), _(u"&Delete")) - self.Append(self.remove) - -class eventsPanelMenu(wx.Menu): - def __init__(self): - super(eventsPanelMenu, self).__init__() - self.view = wx.MenuItem(self, wx.NewId(), _(u"&Show event")) - self.Append(self.view) - self.copy = wx.MenuItem(self, wx.NewId(), _(u"&Copy to clipboard")) - self.Append(self.copy) - self.remove = wx.MenuItem(self, wx.NewId(), _(u"&Delete")) - self.Append(self.remove) - -class peoplePanelMenu(wx.Menu): - def __init__(self): - super(peoplePanelMenu, self).__init__() - self.reply = wx.MenuItem(self, wx.NewId(), _(u"Direct &message")) - self.Append(self.reply) - self.lists = wx.MenuItem(self, wx.NewId(), _(u"&View lists")) - self.Append(self.lists) - self.lists.Enable(False) - self.details = wx.MenuItem(self, wx.NewId(), _(u"Show user &profile")) - self.Append(self.details) - self.view = wx.MenuItem(self, wx.NewId(), _(u"&Show user")) - self.Append(self.view) - self.copy = wx.MenuItem(self, wx.NewId(), _(u"&Copy to clipboard")) - self.Append(self.copy) - self.userActions = wx.MenuItem(self, wx.NewId(), _(u"&User actions...")) - self.Append(self.userActions) - -class trendsPanelMenu(wx.Menu): - def __init__(self): - super(trendsPanelMenu, self).__init__() - self.search_topic = wx.MenuItem(self, wx.NewId(), _(u"Search topic")) - self.Append(self.search_topic) - self.tweetThisTrend = wx.MenuItem(self, wx.NewId(), _(u"&Tweet about this trend")) - self.Append(self.tweetThisTrend) - self.view = wx.MenuItem(self, wx.NewId(), _(u"&Show item")) - self.Append(self.view) - self.copy = wx.MenuItem(self, wx.NewId(), _(u"&Copy to clipboard")) - self.Append(self.copy) +# -*- coding: utf-8 -*- +import wx + +class basePanelMenu(wx.Menu): + def __init__(self): + super(basePanelMenu, self).__init__() + self.retweet = wx.MenuItem(self, wx.NewId(), _("&Retweet")) + self.Append(self.retweet) + self.reply = wx.MenuItem(self, wx.NewId(), _("Re&ply")) + self.Append(self.reply) + self.fav = wx.MenuItem(self, wx.NewId(), _("&Like")) + self.Append(self.fav) + self.unfav = wx.MenuItem(self, wx.NewId(), _("&Unlike")) + self.Append(self.unfav) + self.openUrl = wx.MenuItem(self, wx.NewId(), _("&Open URL")) + self.Append(self.openUrl) + self.play = wx.MenuItem(self, wx.NewId(), _("&Play audio")) + self.Append(self.play) + self.view = wx.MenuItem(self, wx.NewId(), _("&Show tweet")) + self.Append(self.view) + self.copy = wx.MenuItem(self, wx.NewId(), _("&Copy to clipboard")) + self.Append(self.copy) + self.remove = wx.MenuItem(self, wx.NewId(), _("&Delete")) + self.Append(self.remove) + self.userActions = wx.MenuItem(self, wx.NewId(), _("&User actions...")) + self.Append(self.userActions) + +class dmPanelMenu(wx.Menu): + def __init__(self): + super(dmPanelMenu, self).__init__() + self.reply = wx.MenuItem(self, wx.NewId(), _("Re&ply")) + self.Append(self.reply) + self.openUrl = wx.MenuItem(self, wx.NewId(), _("&Open URL")) + self.Append(self.openUrl) + self.play = wx.MenuItem(self, wx.NewId(), _("&Play audio")) + self.Append(self.play) + self.view = wx.MenuItem(self, wx.NewId(), _("&Show direct message")) + self.Append(self.view) + self.copy = wx.MenuItem(self, wx.NewId(), _("&Copy to clipboard")) + self.Append(self.copy) + self.remove = wx.MenuItem(self, wx.NewId(), _("&Delete")) + self.Append(self.remove) + self.userActions = wx.MenuItem(self, wx.NewId(), _("&User actions...")) + self.Append(self.userActions) + +class sentPanelMenu(wx.Menu): + def __init__(self): + super(sentPanelMenu, self).__init__() + self.openUrl = wx.MenuItem(self, wx.NewId(), _("&Open URL")) + self.Append(self.openUrl) + self.play = wx.MenuItem(self, wx.NewId(), _("&Play audio")) + self.Append(self.play) + self.view = wx.MenuItem(self, wx.NewId(), _("&Show tweet")) + self.Append(self.view) + self.copy = wx.MenuItem(self, wx.NewId(), _("&Copy to clipboard")) + self.Append(self.copy) + self.remove = wx.MenuItem(self, wx.NewId(), _("&Delete")) + self.Append(self.remove) + +class eventsPanelMenu(wx.Menu): + def __init__(self): + super(eventsPanelMenu, self).__init__() + self.view = wx.MenuItem(self, wx.NewId(), _("&Show event")) + self.Append(self.view) + self.copy = wx.MenuItem(self, wx.NewId(), _("&Copy to clipboard")) + self.Append(self.copy) + self.remove = wx.MenuItem(self, wx.NewId(), _("&Delete")) + self.Append(self.remove) + +class peoplePanelMenu(wx.Menu): + def __init__(self): + super(peoplePanelMenu, self).__init__() + self.reply = wx.MenuItem(self, wx.NewId(), _("Direct &message")) + self.Append(self.reply) + self.lists = wx.MenuItem(self, wx.NewId(), _("&View lists")) + self.Append(self.lists) + self.lists.Enable(False) + self.details = wx.MenuItem(self, wx.NewId(), _("Show user &profile")) + self.Append(self.details) + self.view = wx.MenuItem(self, wx.NewId(), _("&Show user")) + self.Append(self.view) + self.copy = wx.MenuItem(self, wx.NewId(), _("&Copy to clipboard")) + self.Append(self.copy) + self.userActions = wx.MenuItem(self, wx.NewId(), _("&User actions...")) + self.Append(self.userActions) + +class trendsPanelMenu(wx.Menu): + def __init__(self): + super(trendsPanelMenu, self).__init__() + self.search_topic = wx.MenuItem(self, wx.NewId(), _("Search topic")) + self.Append(self.search_topic) + self.tweetThisTrend = wx.MenuItem(self, wx.NewId(), _("&Tweet about this trend")) + self.Append(self.tweetThisTrend) + self.view = wx.MenuItem(self, wx.NewId(), _("&Show item")) + self.Append(self.view) + self.copy = wx.MenuItem(self, wx.NewId(), _("&Copy to clipboard")) + self.Append(self.copy) diff --git a/src/wxUI/sysTrayIcon.py b/src/wxUI/sysTrayIcon.py index d2dd8efc..d9d3960f 100644 --- a/src/wxUI/sysTrayIcon.py +++ b/src/wxUI/sysTrayIcon.py @@ -1,48 +1,48 @@ -# -*- coding: utf-8 -*- -""" A systray for TW Blue """ -############################################################ -# Copyright (c) 2014 José Manuel Delicado Alcolea -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# -############################################################ - -import wx -from wx import adv -import application -import paths -import os - -class SysTrayIcon(adv.TaskBarIcon): - - def __init__(self): - super(SysTrayIcon, self).__init__() - icon=wx.Icon(os.path.join(paths.app_path(), "icon.ico"), wx.BITMAP_TYPE_ICO) - self.SetIcon(icon, application.name) - self.menu=wx.Menu() - self.tweet = self.menu.Append(wx.ID_ANY, _(u"Tweet")) - self.global_settings = self.menu.Append(wx.ID_ANY, _(u"&Global settings")) - self.account_settings = self.menu.Append(wx.ID_ANY, _(u"Account se&ttings")) - self.update_profile = self.menu.Append(wx.ID_ANY, _(u"Update &profile")) - self.show_hide = self.menu.Append(wx.ID_ANY, _(u"&Show / hide")) - self.doc = self.menu.Append(wx.ID_ANY, _(u"&Documentation")) - self.check_for_updates = self.menu.Append(wx.ID_ANY, _(u"Check for &updates")) - self.exit = self.menu.Append(wx.ID_ANY, _(u"&Exit")) - - def show_menu(self): - self.PopupMenu(self.menu) - - def Destroy(self): - self.menu.Destroy() +# -*- coding: utf-8 -*- +""" A systray for TW Blue """ +############################################################ +# Copyright (c) 2014 José Manuel Delicado Alcolea +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +############################################################ + +import wx +from wx import adv +import application +import paths +import os + +class SysTrayIcon(adv.TaskBarIcon): + + def __init__(self): + super(SysTrayIcon, self).__init__() + icon=wx.Icon(os.path.join(paths.app_path(), "icon.ico"), wx.BITMAP_TYPE_ICO) + self.SetIcon(icon, application.name) + self.menu=wx.Menu() + self.tweet = self.menu.Append(wx.ID_ANY, _("Tweet")) + self.global_settings = self.menu.Append(wx.ID_ANY, _("&Global settings")) + self.account_settings = self.menu.Append(wx.ID_ANY, _("Account se&ttings")) + self.update_profile = self.menu.Append(wx.ID_ANY, _("Update &profile")) + self.show_hide = self.menu.Append(wx.ID_ANY, _("&Show / hide")) + self.doc = self.menu.Append(wx.ID_ANY, _("&Documentation")) + self.check_for_updates = self.menu.Append(wx.ID_ANY, _("Check for &updates")) + self.exit = self.menu.Append(wx.ID_ANY, _("&Exit")) + + def show_menu(self): + self.PopupMenu(self.menu) + + def Destroy(self): + self.menu.Destroy() super(SysTrayIcon, self).Destroy() \ No newline at end of file diff --git a/src/wxUI/view.py b/src/wxUI/view.py index 9bc11630..c25bdb9c 100644 --- a/src/wxUI/view.py +++ b/src/wxUI/view.py @@ -13,74 +13,74 @@ class mainFrame(wx.Frame): # Application menu app = wx.Menu() - self.manage_accounts = app.Append(wx.NewId(), _(u"&Manage accounts")) - self.updateProfile = app.Append(wx.NewId(), _(u"&Update profile")) - self.show_hide = app.Append(wx.NewId(), _(u"&Hide window")) - self.menuitem_search = app.Append(wx.NewId(), _(u"&Search")) - self.lists = app.Append(wx.NewId(), _(u"&Lists manager")) - self.keystroke_editor = app.Append(wx.NewId(), _(u"&Edit keystrokes")) - self.account_settings = app.Append(wx.NewId(), _(u"Account se&ttings")) - self.prefs = app.Append(wx.ID_PREFERENCES, _(u"&Global settings")) - self.close = app.Append(wx.ID_EXIT, _(u"E&xit")) + self.manage_accounts = app.Append(wx.NewId(), _("&Manage accounts")) + self.updateProfile = app.Append(wx.NewId(), _("&Update profile")) + self.show_hide = app.Append(wx.NewId(), _("&Hide window")) + self.menuitem_search = app.Append(wx.NewId(), _("&Search")) + self.lists = app.Append(wx.NewId(), _("&Lists manager")) + self.keystroke_editor = app.Append(wx.NewId(), _("&Edit keystrokes")) + self.account_settings = app.Append(wx.NewId(), _("Account se&ttings")) + self.prefs = app.Append(wx.ID_PREFERENCES, _("&Global settings")) + self.close = app.Append(wx.ID_EXIT, _("E&xit")) # Tweet menu tweet = wx.Menu() - self.compose = tweet.Append(wx.NewId(), _(u"&Tweet")) - self.reply = tweet.Append(wx.NewId(), _(u"Re&ply")) - self.retweet = tweet.Append(wx.NewId(), _(u"&Retweet")) - self.fav = tweet.Append(wx.NewId(), _(u"&Like")) - self.unfav = tweet.Append(wx.NewId(), _(u"&Unlike")) - self.view = tweet.Append(wx.NewId(), _(u"&Show tweet")) - self.view_coordinates = tweet.Append(wx.NewId(), _(u"View &address")) - self.view_conversation = tweet.Append(wx.NewId(), _(u"View conversa&tion")) - self.ocr = tweet.Append(wx.NewId(), _(u"Read text in picture")) - self.delete = tweet.Append(wx.NewId(), _(u"&Delete")) + self.compose = tweet.Append(wx.NewId(), _("&Tweet")) + self.reply = tweet.Append(wx.NewId(), _("Re&ply")) + self.retweet = tweet.Append(wx.NewId(), _("&Retweet")) + self.fav = tweet.Append(wx.NewId(), _("&Like")) + self.unfav = tweet.Append(wx.NewId(), _("&Unlike")) + self.view = tweet.Append(wx.NewId(), _("&Show tweet")) + self.view_coordinates = tweet.Append(wx.NewId(), _("View &address")) + self.view_conversation = tweet.Append(wx.NewId(), _("View conversa&tion")) + self.ocr = tweet.Append(wx.NewId(), _("Read text in picture")) + self.delete = tweet.Append(wx.NewId(), _("&Delete")) # User menu user = wx.Menu() - self.follow = user.Append(wx.NewId(), _(u"&Actions...")) - self.timeline = user.Append(wx.NewId(), _(u"&View timeline...")) - self.dm = user.Append(wx.NewId(), _(u"Direct me&ssage")) - self.addToList = user.Append(wx.NewId(), _(u"&Add to list")) - self.removeFromList = user.Append(wx.NewId(), _(u"R&emove from list")) - self.viewLists = user.Append(wx.NewId(), _(u"&View lists")) - self.details = user.Append(wx.NewId(), _(u"Show user &profile")) - self.favs = user.Append(wx.NewId(), _(u"V&iew likes")) + self.follow = user.Append(wx.NewId(), _("&Actions...")) + self.timeline = user.Append(wx.NewId(), _("&View timeline...")) + self.dm = user.Append(wx.NewId(), _("Direct me&ssage")) + self.addToList = user.Append(wx.NewId(), _("&Add to list")) + self.removeFromList = user.Append(wx.NewId(), _("R&emove from list")) + self.viewLists = user.Append(wx.NewId(), _("&View lists")) + self.details = user.Append(wx.NewId(), _("Show user &profile")) + self.favs = user.Append(wx.NewId(), _("V&iew likes")) # buffer menu buffer = wx.Menu() - self.update_buffer = buffer.Append(wx.NewId(), _(u"&Update buffer")) - self.trends = buffer.Append(wx.NewId(), _(u"New &trending topics buffer...")) - self.find = buffer.Append(wx.NewId(), _(u"Find a string in the currently focused buffer...")) - self.load_previous_items = buffer.Append(wx.NewId(), _(u"&Load previous items")) + self.update_buffer = buffer.Append(wx.NewId(), _("&Update buffer")) + self.trends = buffer.Append(wx.NewId(), _("New &trending topics buffer...")) + self.find = buffer.Append(wx.NewId(), _("Find a string in the currently focused buffer...")) + self.load_previous_items = buffer.Append(wx.NewId(), _("&Load previous items")) buffer.AppendSeparator() - self.mute_buffer = buffer.AppendCheckItem(wx.NewId(), _(u"&Mute")) - self.autoread = buffer.AppendCheckItem(wx.NewId(), _(u"&Autoread")) - self.clear = buffer.Append(wx.NewId(), _(u"&Clear buffer")) - self.deleteTl = buffer.Append(wx.NewId(), _(u"&Destroy")) + self.mute_buffer = buffer.AppendCheckItem(wx.NewId(), _("&Mute")) + self.autoread = buffer.AppendCheckItem(wx.NewId(), _("&Autoread")) + self.clear = buffer.Append(wx.NewId(), _("&Clear buffer")) + self.deleteTl = buffer.Append(wx.NewId(), _("&Destroy")) # audio menu audio = wx.Menu() - self.seekLeft = audio.Append(wx.NewId(), _(u"&Seek back 5 seconds")) - self.seekRight = audio.Append(wx.NewId(), _(u"&Seek forward 5 seconds")) + self.seekLeft = audio.Append(wx.NewId(), _("&Seek back 5 seconds")) + self.seekRight = audio.Append(wx.NewId(), _("&Seek forward 5 seconds")) # Help Menu help = wx.Menu() - self.doc = help.Append(-1, _(u"&Documentation")) - self.sounds_tutorial = help.Append(wx.NewId(), _(u"Sounds &tutorial")) - self.changelog = help.Append(wx.NewId(), _(u"&What's new in this version?")) - self.check_for_updates = help.Append(wx.NewId(), _(u"&Check for updates")) - self.reportError = help.Append(wx.NewId(), _(u"&Report an error")) - self.visit_website = help.Append(-1, _(u"{0}'s &website").format(application.name,)) - self.about = help.Append(-1, _(u"About &{0}").format(application.name,)) + self.doc = help.Append(-1, _("&Documentation")) + self.sounds_tutorial = help.Append(wx.NewId(), _("Sounds &tutorial")) + self.changelog = help.Append(wx.NewId(), _("&What's new in this version?")) + self.check_for_updates = help.Append(wx.NewId(), _("&Check for updates")) + self.reportError = help.Append(wx.NewId(), _("&Report an error")) + self.visit_website = help.Append(-1, _("{0}'s &website").format(application.name,)) + self.about = help.Append(-1, _("About &{0}").format(application.name,)) # Add all to the menu Bar - menuBar.Append(app, _(u"&Application")) - menuBar.Append(tweet, _(u"&Tweet")) - menuBar.Append(user, _(u"&User")) - menuBar.Append(buffer, _(u"&Buffer")) - menuBar.Append(audio, _(u"&Audio")) - menuBar.Append(help, _(u"&Help")) + menuBar.Append(app, _("&Application")) + menuBar.Append(tweet, _("&Tweet")) + menuBar.Append(user, _("&User")) + menuBar.Append(buffer, _("&Buffer")) + menuBar.Append(audio, _("&Audio")) + menuBar.Append(help, _("&Help")) self.accel_tbl = wx.AcceleratorTable([ (wx.ACCEL_CTRL, ord('N'), self.compose.GetId()), @@ -166,7 +166,7 @@ class mainFrame(wx.Frame): self.Show() def show_address(self, address): - wx.MessageDialog(self, address, _(u"Address"), wx.OK).ShowModal() + wx.MessageDialog(self, address, _("Address"), wx.OK).ShowModal() def delete_buffer(self, pos): self.nb.DeletePage(pos) @@ -196,4 +196,4 @@ class mainFrame(wx.Frame): return self.nb.GetPageText(page) def no_update_available(): - wx.MessageDialog(None, _(u"Your {0} version is up to date").format(application.name,), _(u"Update"), style=wx.OK).ShowModal() + wx.MessageDialog(None, _("Your {0} version is up to date").format(application.name,), _("Update"), style=wx.OK).ShowModal()