From a3e7effb83a934e5f10c0e49f288f1864013b571 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Cort=C3=A9z?= Date: Thu, 12 Feb 2015 13:10:42 -0600 Subject: [PATCH] Improvements in the tweet and dm dialogue --- src/controller/messages.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/controller/messages.py b/src/controller/messages.py index 26f40abe..9b264cde 100644 --- a/src/controller/messages.py +++ b/src/controller/messages.py @@ -35,6 +35,7 @@ class basicTweet(object): t.to_lang = dest msg = t.translate(text_to_translate) self.message.set_text(msg) + self.message.text_focus() output.speak(_(u"Translated")) else: return @@ -43,29 +44,35 @@ class basicTweet(object): urls = utils.find_urls_in_text(self.message.get_text()) if len(urls) == 0: output.speak(_(u"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")) + self.message.text_focus() elif len(urls) > 1: list_urls = urlList.urlList() 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")) + 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 sexpanded")) + 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")) + self.message.text_focus() elif len(urls) > 1: list_urls = urlList.urlList() 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")) + self.message.text_focus() def text_processor(self, *args, **kwargs): self.message.set_title(_(u"%s - %s of 140 characters") % (self.title, len(self.message.get_text()))) @@ -121,7 +128,7 @@ class reply(tweet): def __init__(self, session, title, caption, text, users=None): super(reply, self).__init__(session, title, caption, text, messageType="reply") self.users = users - if self.users != None: + if self.users != None and len(self.users) > 1: widgetUtils.connect_event(self.message.mentionAll, widgetUtils.BUTTON_PRESSED, self.mention_all) self.message.enable_button("mentionAll") self.message.set_cursor_at_end() @@ -129,6 +136,7 @@ class reply(tweet): def mention_all(self, *args, **kwargs): self.message.set_text(self.message.get_text()+self.users) self.message.set_cursor_at_end() + self.message.text_focus() class dm(basicTweet): def __init__(self, session, title, caption, text):