Made @names into clickable links that load the user tab
This commit is contained in:
parent
dad6c68159
commit
8764cc77c3
1
TODO
1
TODO
|
@ -15,3 +15,4 @@ bugs:
|
||||||
* Direct Messages have no names, only screen names (may not be fixable without
|
* Direct Messages have no names, only screen names (may not be fixable without
|
||||||
considerable tweaks to python-twitter)
|
considerable tweaks to python-twitter)
|
||||||
* "ValueError: list.remove(x): x not in list" when trying to close a tab (error recurred after adding conversation support). Tabs can be reordered, then closed, as a workaround.
|
* "ValueError: list.remove(x): x not in list" when trying to close a tab (error recurred after adding conversation support). Tabs can be reordered, then closed, as a workaround.
|
||||||
|
* Links must be right-clicked on to activate - can't left-click on the link directly. This seems to be a pygtk issue
|
||||||
|
|
|
@ -206,7 +206,7 @@ class GetFollowing(ApiThread):
|
||||||
relationship = self.api.ShowFriendships(target_screen_name=screen_name)
|
relationship = self.api.ShowFriendships(target_screen_name=screen_name)
|
||||||
following = relationship.source.following
|
following = relationship.source.following
|
||||||
except (HTTPError, URLError):
|
except (HTTPError, URLError):
|
||||||
following = false
|
following = False
|
||||||
|
|
||||||
self.pane.set_following(following)
|
self.pane.set_following(following)
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ class GetVerified(ApiThread):
|
||||||
user = self.api.GetUser(screen_name)
|
user = self.api.GetUser(screen_name)
|
||||||
verified = user.verified
|
verified = user.verified
|
||||||
except (HTTPError, URLError):
|
except (HTTPError, URLError):
|
||||||
verified = false
|
verified = False
|
||||||
|
|
||||||
self.pane.set_verified(verified)
|
self.pane.set_verified(verified)
|
||||||
|
|
||||||
|
|
|
@ -374,6 +374,7 @@ class TweetBox(gtk.HBox):
|
||||||
new_text = re.sub(r'&([^;]*?)( |$)', r'&\1\2', new_text)
|
new_text = re.sub(r'&([^;]*?)( |$)', r'&\1\2', new_text)
|
||||||
if gtk.gtk_version[0] > 2 or (gtk.gtk_version[0] == 2 and gtk.gtk_version[1] >= 18):
|
if gtk.gtk_version[0] > 2 or (gtk.gtk_version[0] == 2 and gtk.gtk_version[1] >= 18):
|
||||||
new_text = re.sub(r"(http://.*?)( |$)", r'<a href="\1">\1</a>\2', new_text)
|
new_text = re.sub(r"(http://.*?)( |$)", r'<a href="\1">\1</a>\2', new_text)
|
||||||
|
new_text = re.sub(r'@(.*?)( |$)', r'@<a href="@\1">\1</a>\2', new_text)
|
||||||
self.text.set_markup(new_text)
|
self.text.set_markup(new_text)
|
||||||
|
|
||||||
# If this is in reply to something, set appropriate label
|
# If this is in reply to something, set appropriate label
|
||||||
|
@ -431,16 +432,13 @@ class TweetBox(gtk.HBox):
|
||||||
def on_mouse_clicked(self, widget, event):
|
def on_mouse_clicked(self, widget, event):
|
||||||
if event.button == 1:
|
if event.button == 1:
|
||||||
self.set_read(True)
|
self.set_read(True)
|
||||||
# fixme: call on_url_clicked if there is an active uri
|
|
||||||
# Apparently, this must wait until pygtk 2.18
|
|
||||||
|
|
||||||
|
|
||||||
def on_url_clicked(self, widget, event):
|
def on_url_clicked(self, widget, uri):
|
||||||
self.set_read()
|
self.set_read()
|
||||||
# fixme: we're catching this signal just to debug why it doesn't get emitted
|
if re.match(r'@', uri):
|
||||||
# seems to be related to EventBox?
|
self.emit('show-user', re.sub(r'@', '', uri))
|
||||||
print 'debug: on_url_clicked()'
|
return True
|
||||||
|
|
||||||
|
|
||||||
# end class TweetBox
|
# end class TweetBox
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user