mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2025-01-31 05:10:45 -06:00
Move interact to main controler.
This commit is contained in:
parent
b03d832376
commit
6c690d7a3d
@ -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()
|
||||
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user