mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2025-07-17 13:46:07 -04:00
Geo support has been implemented
This commit is contained in:
@@ -276,6 +276,8 @@ class baseBufferController(bufferController):
|
||||
self.buffer.list.list.SetStringItem(self.buffer.list.get_selected(), 2, ts)
|
||||
if utils.is_audio(tweet):
|
||||
self.session.sound.play("audio.ogg")
|
||||
if utils.is_geocoded(tweet):
|
||||
self.session.sound.play("geo.ogg")
|
||||
|
||||
def audio(self):
|
||||
tweet = self.get_tweet()
|
||||
|
@@ -111,6 +111,7 @@ class Controller(object):
|
||||
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.add_to_favourites, self.view.fav)
|
||||
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.remove_from_favourites, self.view.unfav)
|
||||
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.view_item, self.view.view)
|
||||
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.reverse_geocode, menuitem=self.view.view_coordinates)
|
||||
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.delete, self.view.delete)
|
||||
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.follow, menuitem=self.view.follow)
|
||||
widgetUtils.connect_event(self.view, widgetUtils.MENU, self.send_dm, self.view.dm)
|
||||
@@ -501,6 +502,45 @@ class Controller(object):
|
||||
timer.start()
|
||||
buffer.session.settings["other_buffers"]["trending_topic_buffers"].append(woeid)
|
||||
|
||||
def reverse_geocode(self, event=None):
|
||||
try:
|
||||
tweet = self.get_current_buffer().get_right_tweet()
|
||||
if tweet["coordinates"] != None:
|
||||
x = tweet["coordinates"]["coordinates"][0]
|
||||
y = tweet["coordinates"]["coordinates"][1]
|
||||
address = geocoder.reverse_geocode(y, x)
|
||||
if event == None: output.speak(address[0].__str__().decode("utf-8"))
|
||||
else: self.view.show_address(address[0].__str__().decode("utf-8"))
|
||||
else:
|
||||
output.speak(_(u"There are no coordinates in this tweet"))
|
||||
except GeocoderError:
|
||||
output.speak(_(u"There are no results for the coordinates in this tweet"))
|
||||
except ValueError:
|
||||
output.speak(_(u"Error decoding coordinates. Try again later."))
|
||||
except KeyError:
|
||||
pass
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
def view_reverse_geocode(self, event=None):
|
||||
try:
|
||||
tweet = self.get_current_buffer().get_right_tweet()
|
||||
if tweet["coordinates"] != None:
|
||||
x = tweet["coordinates"]["coordinates"][0]
|
||||
y = tweet["coordinates"]["coordinates"][1]
|
||||
address = geocoder.reverse_geocode(y, x)
|
||||
dlg = messages.viewTweet(address[0].__str__(), False)
|
||||
else:
|
||||
output.speak(_(u"There are no coordinates in this tweet"))
|
||||
except GeocoderError:
|
||||
output.speak(_(u"There are no results for the coordinates in this tweet"))
|
||||
except ValueError:
|
||||
output.speak(_(u"Error decoding coordinates. Try again later."))
|
||||
except KeyError:
|
||||
pass
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
def skip_buffer(self, forward=True):
|
||||
buff = self.get_current_buffer()
|
||||
if buff.invisible == False:
|
||||
|
Reference in New Issue
Block a user