mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-23 03:38:08 -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"]:
|
||||
output.speak(" ".join(tweet[:2]))
|
||||
|
||||
def get_tweet(self):
|
||||
""" 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"]
|
||||
else: tweet = self.db.settings[self.name_buffer][self.list.get_selected()]
|
||||
return tweet
|
||||
|
||||
def interact(self, ev):
|
||||
try:
|
||||
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()]
|
||||
tweet = self.get_tweet()
|
||||
urls = twitter.utils.find_urls_in_text(tweet["text"])
|
||||
except:
|
||||
urls = []
|
||||
|
@ -345,7 +345,11 @@ class viewTweet(wx.Dialog):
|
||||
self.SetTitle(_(u"Tweet - %i characters ") % (len(tweet["text"])))
|
||||
panel = wx.Panel(self)
|
||||
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.SetFont(self.text.GetFont())
|
||||
(x, y, z) = dc.GetMultiLineTextExtent("0"*140)
|
||||
|
@ -983,9 +983,10 @@ class mainFrame(wx.Frame):
|
||||
|
||||
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]
|
||||
tweet = self.nb.GetCurrentPage().get_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: 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):
|
||||
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]
|
||||
tweet = self.nb.GetCurrentPage().get_tweet()
|
||||
if tweet["coordinates"] != None:
|
||||
x = tweet["coordinates"]["coordinates"][0]
|
||||
y = tweet["coordinates"]["coordinates"][1]
|
||||
address = geocoder.reverse_geocode(y, x)
|
||||
dialogs.message.viewNonTweet(address[0].__str__().decode("utf-8")).ShowModal()
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user