mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-23 11:48:07 -06:00
Fixing some issues with tweets and retweets
This commit is contained in:
parent
79124810b0
commit
ada6f1fb0d
@ -283,10 +283,15 @@ class basePanel(wx.Panel):
|
|||||||
if self.name_buffer in config.main["other_buffers"]["autoread_buffers"]:
|
if self.name_buffer in config.main["other_buffers"]["autoread_buffers"]:
|
||||||
output.speak(" ".join(tweet[:2]))
|
output.speak(" ".join(tweet[:2]))
|
||||||
|
|
||||||
def interact(self, ev):
|
def get_tweet(self):
|
||||||
try:
|
""" Gets a tweet or retweet."""
|
||||||
if self.db.settings[self.name_buffer][self.list.get_selected()].has_key("retweeted_status"): tweet = self.db.settings[self.name_buffer][self.list.get_selected()]["retweeted_status"]
|
if self.db.settings[self.name_buffer][self.list.get_selected()].has_key("retweeted_status"): tweet = self.db.settings[self.name_buffer][self.list.get_selected()]["retweeted_status"]
|
||||||
else: tweet = self.db.settings[self.name_buffer][self.list.get_selected()]
|
else: tweet = self.db.settings[self.name_buffer][self.list.get_selected()]
|
||||||
|
return tweet
|
||||||
|
|
||||||
|
def interact(self, ev):
|
||||||
|
try:
|
||||||
|
tweet = self.get_tweet()
|
||||||
urls = twitter.utils.find_urls_in_text(tweet["text"])
|
urls = twitter.utils.find_urls_in_text(tweet["text"])
|
||||||
except:
|
except:
|
||||||
urls = []
|
urls = []
|
||||||
|
@ -345,7 +345,11 @@ class viewTweet(wx.Dialog):
|
|||||||
self.SetTitle(_(u"Tweet - %i characters ") % (len(tweet["text"])))
|
self.SetTitle(_(u"Tweet - %i characters ") % (len(tweet["text"])))
|
||||||
panel = wx.Panel(self)
|
panel = wx.Panel(self)
|
||||||
label = wx.StaticText(panel, -1, _(u"Tweet"))
|
label = wx.StaticText(panel, -1, _(u"Tweet"))
|
||||||
self.text = wx.TextCtrl(panel, -1, tweet["text"], style=wx.TE_READONLY|wx.TE_MULTILINE, size=(250, 180))
|
if tweet.has_key("retweeted_status"):
|
||||||
|
text = "rt @%s: %s" % (tweet["retweeted_status"]["user"]["screen_name"], tweet["retweeted_status"]["text"])
|
||||||
|
else:
|
||||||
|
text = tweet["text"]
|
||||||
|
self.text = wx.TextCtrl(panel, -1, text, style=wx.TE_READONLY|wx.TE_MULTILINE, size=(250, 180))
|
||||||
dc = wx.WindowDC(self.text)
|
dc = wx.WindowDC(self.text)
|
||||||
dc.SetFont(self.text.GetFont())
|
dc.SetFont(self.text.GetFont())
|
||||||
(x, y, z) = dc.GetMultiLineTextExtent("0"*140)
|
(x, y, z) = dc.GetMultiLineTextExtent("0"*140)
|
||||||
|
@ -983,9 +983,10 @@ class mainFrame(wx.Frame):
|
|||||||
|
|
||||||
def reverse_geocode(self, event=None):
|
def reverse_geocode(self, event=None):
|
||||||
try:
|
try:
|
||||||
if self.db.settings[self.nb.GetCurrentPage().name_buffer][self.nb.GetCurrentPage().list.get_selected()]["coordinates"] != None:
|
tweet = self.nb.GetCurrentPage().get_tweet()
|
||||||
x = self.db.settings[self.nb.GetCurrentPage().name_buffer][self.nb.GetCurrentPage().list.get_selected()]["coordinates"]["coordinates"][0]
|
if tweet["coordinates"] != None:
|
||||||
y = self.db.settings[self.nb.GetCurrentPage().name_buffer][self.nb.GetCurrentPage().list.get_selected()]["coordinates"]["coordinates"][1]
|
x = tweet["coordinates"]["coordinates"][0]
|
||||||
|
y = tweet["coordinates"]["coordinates"][1]
|
||||||
address = geocoder.reverse_geocode(y, x)
|
address = geocoder.reverse_geocode(y, x)
|
||||||
if event == None: output.speak(address[0].__str__().decode("utf-8"))
|
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: wx.MessageDialog(self, address[0].__str__().decode("utf-8"), _(u"Address"), wx.OK).ShowModal()
|
||||||
@ -1000,9 +1001,10 @@ class mainFrame(wx.Frame):
|
|||||||
|
|
||||||
def view_reverse_geocode(self, event=None):
|
def view_reverse_geocode(self, event=None):
|
||||||
try:
|
try:
|
||||||
if self.db.settings[self.nb.GetCurrentPage().name_buffer][self.nb.GetCurrentPage().list.get_selected()]["coordinates"] != None:
|
tweet = self.nb.GetCurrentPage().get_tweet()
|
||||||
x = self.db.settings[self.nb.GetCurrentPage().name_buffer][self.nb.GetCurrentPage().list.get_selected()]["coordinates"]["coordinates"][0]
|
if tweet["coordinates"] != None:
|
||||||
y = self.db.settings[self.nb.GetCurrentPage().name_buffer][self.nb.GetCurrentPage().list.get_selected()]["coordinates"]["coordinates"][1]
|
x = tweet["coordinates"]["coordinates"][0]
|
||||||
|
y = tweet["coordinates"]["coordinates"][1]
|
||||||
address = geocoder.reverse_geocode(y, x)
|
address = geocoder.reverse_geocode(y, x)
|
||||||
dialogs.message.viewNonTweet(address[0].__str__().decode("utf-8")).ShowModal()
|
dialogs.message.viewNonTweet(address[0].__str__().decode("utf-8")).ShowModal()
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user