mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-23 03:38:08 -06:00
Reverse geocode is now in TWBlue. Ctrl+win+g and CTRL+Shift+Win+G and in the tweet menu on the menu bar
This commit is contained in:
parent
fee7254d55
commit
79124810b0
@ -40,6 +40,7 @@ Dependencies list:
|
|||||||
* [Requests](http://www.python-requests.org/en/latest/) 2.2.1: [Recommended download site](https://pypi.python.org/pypi/requests/2.2.1)
|
* [Requests](http://www.python-requests.org/en/latest/) 2.2.1: [Recommended download site](https://pypi.python.org/pypi/requests/2.2.1)
|
||||||
* [Requests-oauthlib](https://github.com/requests/requests-oauthlib) 0.4.0
|
* [Requests-oauthlib](https://github.com/requests/requests-oauthlib) 0.4.0
|
||||||
* [Suds](https://fedorahosted.org/suds) 0.4: [Recommended download site](https://pypi.python.org/pypi/suds/0.4)
|
* [Suds](https://fedorahosted.org/suds) 0.4: [Recommended download site](https://pypi.python.org/pypi/suds/0.4)
|
||||||
|
* [Pygeocoder: ](http://code.xster.net/pygeocoder/wiki/Home) You can install this dependency by using pip or easy_install.
|
||||||
* Bootstrap 1.2.1: included in dependencies directory.
|
* Bootstrap 1.2.1: included in dependencies directory.
|
||||||
Copy the bootstrap.exe file corresponding to the desired platform in the windows folder, inside this repository.
|
Copy the bootstrap.exe file corresponding to the desired platform in the windows folder, inside this repository.
|
||||||
This dependency has been built using pure basic 4.61. Its source can be found at http://hg.q-continuum.net/updater
|
This dependency has been built using pure basic 4.61. Its source can be found at http://hg.q-continuum.net/updater
|
||||||
|
@ -88,3 +88,5 @@ search = string(default="control+win+-")
|
|||||||
edit_keystrokes = string(default="control+win+k")
|
edit_keystrokes = string(default="control+win+k")
|
||||||
view_user_lists = string(default="control+win+l")
|
view_user_lists = string(default="control+win+l")
|
||||||
get_more_items = string(default="alt+win+pageup")
|
get_more_items = string(default="alt+win+pageup")
|
||||||
|
reverse_geocode = string(default="control+win+g")
|
||||||
|
view_reverse_geocode = string(default="control+win+shift+g")
|
@ -158,6 +158,8 @@ class basePanel(wx.Panel):
|
|||||||
self.list.list.SetString(self.list.get_selected(), " ".join(self.compose_function(self.db.settings[self.name_buffer][self.list.get_selected()], self.db)))
|
self.list.list.SetString(self.list.get_selected(), " ".join(self.compose_function(self.db.settings[self.name_buffer][self.list.get_selected()], self.db)))
|
||||||
if twitter.utils.is_audio(tweet):
|
if twitter.utils.is_audio(tweet):
|
||||||
sound.player.play("audio.ogg", False)
|
sound.player.play("audio.ogg", False)
|
||||||
|
if twitter.utils.is_geocoded(tweet):
|
||||||
|
sound.player.play("geo.mp3", False)
|
||||||
|
|
||||||
def start_streams(self):
|
def start_streams(self):
|
||||||
if self.name_buffer == "sent":
|
if self.name_buffer == "sent":
|
||||||
|
@ -34,6 +34,8 @@ import urllib2
|
|||||||
import sysTrayIcon
|
import sysTrayIcon
|
||||||
import switchModule
|
import switchModule
|
||||||
import languageHandler
|
import languageHandler
|
||||||
|
import pygeocoder
|
||||||
|
from pygeolib import GeocoderError
|
||||||
from sessionmanager import manager
|
from sessionmanager import manager
|
||||||
from mysc import event
|
from mysc import event
|
||||||
from mysc.thread_utils import call_threaded
|
from mysc.thread_utils import call_threaded
|
||||||
@ -47,6 +49,7 @@ from extra import SoundsTutorial
|
|||||||
from keystrokeEditor import gui as keystrokeEditorGUI
|
from keystrokeEditor import gui as keystrokeEditorGUI
|
||||||
log = original_logger.getLogger("gui.main")
|
log = original_logger.getLogger("gui.main")
|
||||||
|
|
||||||
|
geocoder = pygeocoder.Geocoder()
|
||||||
class mainFrame(wx.Frame):
|
class mainFrame(wx.Frame):
|
||||||
""" Main class of the Frame. This is the Main Window."""
|
""" Main class of the Frame. This is the Main Window."""
|
||||||
|
|
||||||
@ -90,6 +93,8 @@ class mainFrame(wx.Frame):
|
|||||||
self.Bind(wx.EVT_MENU, self.unfav, unfav)
|
self.Bind(wx.EVT_MENU, self.unfav, unfav)
|
||||||
view = tweet.Append(wx.NewId(), _(u"&Show tweet"))
|
view = tweet.Append(wx.NewId(), _(u"&Show tweet"))
|
||||||
self.Bind(wx.EVT_MENU, self.view, view)
|
self.Bind(wx.EVT_MENU, self.view, view)
|
||||||
|
view_coordinates = tweet.Append(wx.NewId(), _(u"View &address"))
|
||||||
|
self.Bind(wx.EVT_MENU, self.reverse_geocode, view_coordinates)
|
||||||
delete = tweet.Append(wx.NewId(), _(u"&Delete"))
|
delete = tweet.Append(wx.NewId(), _(u"&Delete"))
|
||||||
self.Bind(wx.EVT_MENU, self.delete, delete)
|
self.Bind(wx.EVT_MENU, self.delete, delete)
|
||||||
|
|
||||||
@ -976,6 +981,39 @@ class mainFrame(wx.Frame):
|
|||||||
def switch_account(self, ev):
|
def switch_account(self, ev):
|
||||||
switchModule.switcher(self)
|
switchModule.switcher(self)
|
||||||
|
|
||||||
|
def reverse_geocode(self, event=None):
|
||||||
|
try:
|
||||||
|
if self.db.settings[self.nb.GetCurrentPage().name_buffer][self.nb.GetCurrentPage().list.get_selected()]["coordinates"] != None:
|
||||||
|
x = self.db.settings[self.nb.GetCurrentPage().name_buffer][self.nb.GetCurrentPage().list.get_selected()]["coordinates"]["coordinates"][0]
|
||||||
|
y = self.db.settings[self.nb.GetCurrentPage().name_buffer][self.nb.GetCurrentPage().list.get_selected()]["coordinates"]["coordinates"][1]
|
||||||
|
address = geocoder.reverse_geocode(y, x)
|
||||||
|
if event == None: output.speak(address[0].__str__().decode("utf-8"))
|
||||||
|
else: wx.MessageDialog(self, address[0].__str__().decode("utf-8"), _(u"Address"), wx.OK).ShowModal()
|
||||||
|
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
|
||||||
|
|
||||||
|
def view_reverse_geocode(self, event=None):
|
||||||
|
try:
|
||||||
|
if self.db.settings[self.nb.GetCurrentPage().name_buffer][self.nb.GetCurrentPage().list.get_selected()]["coordinates"] != None:
|
||||||
|
x = self.db.settings[self.nb.GetCurrentPage().name_buffer][self.nb.GetCurrentPage().list.get_selected()]["coordinates"]["coordinates"][0]
|
||||||
|
y = self.db.settings[self.nb.GetCurrentPage().name_buffer][self.nb.GetCurrentPage().list.get_selected()]["coordinates"]["coordinates"][1]
|
||||||
|
address = geocoder.reverse_geocode(y, x)
|
||||||
|
dialogs.message.viewNonTweet(address[0].__str__().decode("utf-8")).ShowModal()
|
||||||
|
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
|
||||||
|
|
||||||
### Close App
|
### Close App
|
||||||
def Destroy(self):
|
def Destroy(self):
|
||||||
self.sysTray.Destroy()
|
self.sysTray.Destroy()
|
||||||
|
BIN
src/sounds/default/geo.mp3
Normal file
BIN
src/sounds/default/geo.mp3
Normal file
Binary file not shown.
@ -58,6 +58,10 @@ def is_audio(tweet):
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def is_geocoded(tweet):
|
||||||
|
if tweet.has_key("coordinates") and tweet["coordinates"] != None:
|
||||||
|
return True
|
||||||
|
|
||||||
def get_all_mentioned(tweet, config):
|
def get_all_mentioned(tweet, config):
|
||||||
""" Gets all users that has been mentioned."""
|
""" Gets all users that has been mentioned."""
|
||||||
if tweet.has_key("retweeted_status"): tweet = tweet["retweeted_status"]
|
if tweet.has_key("retweeted_status"): tweet = tweet["retweeted_status"]
|
||||||
|
Loading…
Reference in New Issue
Block a user