Handle some special cases for the app_button

This commit is contained in:
Anna 2010-05-22 22:50:18 -04:00
parent 90d8ed7fe5
commit c2fd23b335

View File

@ -402,14 +402,14 @@ class TweetBox(gtk.HBox):
timestring = timestamp.astimezone(timezone).strftime(time_format)
# Set the header
self.app_url = re.sub(r'.*<a href="(.*?)".*', r'\1', status.source)
self.app_url = re.sub(r'.*<a href=\"(.*?)\".*', r'\1', status.source)
app_name = re.sub(r'.*<a.*?>(.*)</a>.*', r'\1', status.source)
self.app_button.set_label(app_name)
if self.app_url:
self.app_button.set_sensitive(True)
else:
self.app_button.set_sensitive(False)
if re.match('/', self.app_url):
self.app_url = 'http://twitter.com' + self.app_url
elif re.match('web', self.app_url):
self.app_url = None
self.time_label.set_label(timestring)
@ -418,7 +418,6 @@ class TweetBox(gtk.HBox):
else:
self.user_button.set_label(user.name + " (" + user.screen_name + ") ")
# and the text
new_text = status.text
new_text = re.sub(r'&([^;]*?)( |$)', r'&amp;\1\2', new_text)
@ -491,9 +490,8 @@ class TweetBox(gtk.HBox):
def on_app_button_clicked(self, widget):
self.set_read()
print 'debug: on_app_button_clicked(): ' + self.app_url
# if self.app_url:
# webbrowser.open(self.app_url)
if self.app_url:
webbrowser.open(self.app_url)
def on_mouse_clicked(self, widget, event):