From bb27c08424b47652dc0e64c1fdb9acf34481a322 Mon Sep 17 00:00:00 2001 From: Bill Dengler Date: Sat, 16 May 2015 19:08:13 -0400 Subject: [PATCH 1/5] #43: Fix keymap conflict. --- src/keymaps/Qwitter.keymap | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/keymaps/Qwitter.keymap b/src/keymaps/Qwitter.keymap index 46bb0ea2..c95b6936 100644 --- a/src/keymaps/Qwitter.keymap +++ b/src/keymaps/Qwitter.keymap @@ -10,6 +10,7 @@ left = control+win+left right = control+win+right next_account = control+win+shift+right previous_account = control+win+shift+left +show_hide=control+win+w post_tweet = control+win+n post_reply = control+win+r post_retweet = control+win+shift+r @@ -43,4 +44,4 @@ edit_keystrokes = control+win+k view_user_lists = win+alt+shift+l reverse_geocode = control+win+g view_reverse_geocode = control+win+shift+g -get_trending_topics = control+win+shift+t \ No newline at end of file +get_trending_topics = control+win+shift+t From 66686c786d7f5c47e984119a51001af8bfc37bbe Mon Sep 17 00:00:00 2001 From: Bill Dengler Date: Sat, 16 May 2015 19:09:11 -0400 Subject: [PATCH 2/5] String cleanup. --- src/controller/mainController.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controller/mainController.py b/src/controller/mainController.py index 060004ee..df7a4cad 100644 --- a/src/controller/mainController.py +++ b/src/controller/mainController.py @@ -1263,7 +1263,7 @@ class Controller(object): output.speak(_(u"Session mute on"), True) elif buffer.session.settings["sound"]["session_mute"] == True: buffer.session.settings["sound"]["session_mute"] = False - output.speak(_(u"Global mute off"), True) + output.speak(_(u"Session mute off"), True) def toggle_buffer_mute(self, *args, **kwargs): buffer = self.get_current_buffer() From d52114656271fc9972e6382c46302a152a73f391 Mon Sep 17 00:00:00 2001 From: Bill Dengler Date: Sat, 16 May 2015 19:25:02 -0400 Subject: [PATCH 3/5] Fixed #44. --- src/wxUI/dialogs/message.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/wxUI/dialogs/message.py b/src/wxUI/dialogs/message.py index 1b12d92c..7f27fadf 100644 --- a/src/wxUI/dialogs/message.py +++ b/src/wxUI/dialogs/message.py @@ -5,7 +5,7 @@ import widgetUtils class textLimited(widgetUtils.BaseDialog): def __init__(self, *args, **kwargs): super(textLimited, self).__init__(parent=None, *args, **kwargs) - + self.shift=False def createTextArea(self, message="", text=""): self.panel = wx.Panel(self) self.label = wx.StaticText(self.panel, -1, message) @@ -16,6 +16,8 @@ class textLimited(widgetUtils.BaseDialog): # dc.SetFont(font) # x, y = dc.GetTextExtent("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") # self.text.SetSize((x, y)) + self.Bind(wx.EVT_TEXT_ENTER, self.on_enter) + self.Bind(wx.EVT_CHAR_HOOK, self.handle_keys) self.text.SetFocus() self.textBox = wx.BoxSizer(wx.HORIZONTAL) self.textBox.Add(self.label, 0, wx.ALL, 5) @@ -44,6 +46,16 @@ class textLimited(widgetUtils.BaseDialog): def onSelect(self, ev): self.text.SelectAll() + def on_enter(self,event): + if self.shift==False and hasattr(self,'okButton'): + return wx.PostEvent(self.okButton.GetEventHandler(),wx.PyCommandEvent(wx.EVT_BUTTON.typeId,wx.ID_OK)) + else: + return self.text.WriteText('\n') + + def handle_keys(self,event): + self.shift=event.ShiftDown() + event.Skip() + def set_cursor_at_end(self): self.text.SetInsertionPoint(len(self.text.GetValue())) @@ -90,8 +102,6 @@ class tweet(textLimited): self.mainBox.Add(self.ok_cancelSizer) selectId = wx.NewId() self.Bind(wx.EVT_MENU, self.onSelect, id=selectId) - self.Bind(wx.EVT_TEXT_ENTER, self.on_enter) - self.Bind(wx.EVT_CHAR_HOOK, self.handle_keys) self.accel_tbl = wx.AcceleratorTable([ (wx.ACCEL_CTRL, ord('A'), selectId), ]) @@ -110,16 +120,8 @@ class tweet(textLimited): if openFileDialog.ShowModal() == wx.ID_CANCEL: return None return open(openFileDialog.GetPath(), "rb") - def handle_keys(self,event): - self.shift=event.ShiftDown() - event.Skip() - def on_enter(self,event): - if self.shift==False: - return wx.PostEvent(self.okButton.GetEventHandler(),wx.PyCommandEvent(wx.EVT_BUTTON.typeId,wx.ID_OK)) - else: - return text.WriteText('\n') - + class retweet(tweet): def createControls(self, title, message, text): self.mainBox = wx.BoxSizer(wx.VERTICAL) From b03d832376247eedeb3d3de62138ff659a6fd922 Mon Sep 17 00:00:00 2001 From: Bill Dengler Date: Sun, 17 May 2015 00:15:10 -0400 Subject: [PATCH 4/5] String cleanup. --- src/twitter/compose.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/twitter/compose.py b/src/twitter/compose.py index fae41fe9..351ca1c5 100644 --- a/src/twitter/compose.py +++ b/src/twitter/compose.py @@ -78,7 +78,7 @@ def compose_followers_list(tweet, db, relative_times=True): ts2 = _("Unavailable") else: ts2 = _("Unavailable") - return [_(u"%s (@%s). %s followers, %s friends, %s tweets. Last tweet on %s. Joined Twitter on %s") % (tweet["name"], tweet["screen_name"], tweet["followers_count"], tweet["friends_count"], tweet["statuses_count"], ts2, ts)] + 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)] def compose_event(data, username): if data["event"] == "block": From 6c690d7a3d294a346bf3f4b0ca21634d96472724 Mon Sep 17 00:00:00 2001 From: Bill Dengler Date: Sun, 17 May 2015 13:22:11 -0400 Subject: [PATCH 5/5] Move interact to main controler. --- src/controller/buffersController.py | 25 ------------------------- src/controller/mainController.py | 26 ++++++++++++++++++++++++-- 2 files changed, 24 insertions(+), 27 deletions(-) diff --git a/src/controller/buffersController.py b/src/controller/buffersController.py index 8f4e570a..fce66a97 100644 --- a/src/controller/buffersController.py +++ b/src/controller/buffersController.py @@ -435,31 +435,6 @@ class baseBufferController(bufferController): except: log("Exception while executing audio method.") @_tweets_exist - def interact(self): - "Select the best action for the currently focused tweet (audio, geocode, URL, etc)." - if hasattr(sound.URLPlayer,'stream'): - return sound.URLPlayer.stop_audio(delete=True) - tweet = self.get_tweet() - url=None - urls = utils.find_urls(tweet) - if len(urls) == 1: - url=urls[0] - elif len(urls) > 1: - urls_list = dialogs.urlList.urlList() - urls_list.populate_list(urls) - if urls_list.get_response() == widgetUtils.OK: - url=urls_list.get_string() - if hasattr(urls_list, "destroy"): urls_list.destroy() - if url != None: - output.speak("Opening media...",True) - if sound.URLPlayer.is_playable(url=url,play=True,volume=self.session.settings["sound"]["volume"]) == False: - return webbrowser.open_new_tab(url) - elif utils.is_geocoded(tweet): - return output.speak("Not implemented",True) - else: - output.speak("Not actionable.",True) - self.session.sound.play("error.ogg") - def url(self,url='',announce=True): if url == '': tweet = self.get_tweet() diff --git a/src/controller/mainController.py b/src/controller/mainController.py index df7a4cad..52792494 100644 --- a/src/controller/mainController.py +++ b/src/controller/mainController.py @@ -1010,9 +1010,31 @@ class Controller(object): except: pass - def interact(self, *args, **kwargs): + def interact(self): + "Select the best action for the currently focused tweet (audio, geocode, URL, etc)." buffer = self.get_current_buffer() - return buffer.interact() + if hasattr(sound.URLPlayer,'stream'): + return sound.URLPlayer.stop_audio(delete=True) + tweet = buffer.get_tweet() + url=None + urls = utils.find_urls(tweet) + if len(urls) == 1: + url=urls[0] + elif len(urls) > 1: + urls_list = dialogs.urlList.urlList() + urls_list.populate_list(urls) + if urls_list.get_response() == widgetUtils.OK: + url=urls_list.get_string() + if hasattr(urls_list, "destroy"): urls_list.destroy() + if url != None: + output.speak("Opening media...",True) + if sound.URLPlayer.is_playable(url=url,play=True,volume=buffer.session.settings["sound"]["volume"]) == False: + return webbrowser.open_new_tab(url) + elif utils.is_geocoded(tweet): + return output.speak("Not implemented",True) + else: + output.speak("Not actionable.",True) + buffer.session.sound.play("error.ogg") def url(self, *args, **kwargs): buffer = self.get_current_buffer()