#33: generalize url.

This commit is contained in:
Bill Dengler 2015-05-12 11:20:50 -04:00
parent 0ddc20ea7c
commit d19baf411a

View File

@ -434,24 +434,26 @@ class baseBufferController(bufferController):
tweet = self.get_tweet() tweet = self.get_tweet()
urls = utils.find_urls(tweet) urls = utils.find_urls(tweet)
#handle audio-only (no weblinks) tweets. #handle audio-only (no weblinks) tweets.
if len(urls) == 1 and utils.is_audio(tweet) and self.session.settings["general"]["autohandle_audio"]: if len(urls) == 1 and utils.is_audio(tweet):
return self.audio() return self.audio()
else: else:
return self.url() return self.url()
def url(self): def url(self,url=''):
if url == '':
tweet = self.get_tweet() tweet = self.get_tweet()
urls = utils.find_urls(tweet) urls = utils.find_urls(tweet)
if len(urls) == 1: if len(urls) == 1:
output.speak(_(u"Opening URL..."), True) url=urls[0]
webbrowser.open_new_tab(urls[0])
elif len(urls) > 1: elif len(urls) > 1:
urls_list = dialogs.urlList.urlList() urls_list = dialogs.urlList.urlList()
urls_list.populate_list(urls) urls_list.populate_list(urls)
if urls_list.get_response() == widgetUtils.OK: if urls_list.get_response() == widgetUtils.OK:
output.speak(_(u"Opening URL..."), True) url=urls_list.get_string()
webbrowser.open_new_tab(urls_list.get_string())
if hasattr(urls_list, "destroy"): urls_list.destroy() if hasattr(urls_list, "destroy"): urls_list.destroy()
if url != '':
output.speak(_(u"Opening URL..."), True)
webbrowser.open_new_tab(url)
def clear_list(self): def clear_list(self):
dlg = commonMessageDialogs.clear_list() dlg = commonMessageDialogs.clear_list()