Since activate-link breaks when a label contains an empty link, we crafted a workaround to avoid creating empty links.
This commit is contained in:
parent
9f239e8c37
commit
6fa0c8d7f7
3
TODO
3
TODO
|
@ -10,11 +10,10 @@ features:
|
||||||
* Support creating new lists and adding users to it (as well as removing users and deleting lists)
|
* Support creating new lists and adding users to it (as well as removing users and deleting lists)
|
||||||
|
|
||||||
* Changing the active user needs to do more 'work'
|
* Changing the active user needs to do more 'work'
|
||||||
** Refresh relavant pages
|
** Refresh relevant pages
|
||||||
|
|
||||||
|
|
||||||
bugs:
|
bugs:
|
||||||
|
|
||||||
* "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
|
* Links must be right-clicked on to activate - can't left-click on the link directly. This seems to be a pygtk issue
|
||||||
* If an @ appears anywhere in a status update, links after it try to resolve to user: links... need to work on my regexes
|
|
||||||
|
|
|
@ -443,8 +443,8 @@ class TweetBox(gtk.HBox):
|
||||||
new_text = re.sub(r'&([^;]*?)( |$)', r'&\1\2', new_text)
|
new_text = re.sub(r'&([^;]*?)( |$)', r'&\1\2', new_text)
|
||||||
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://.*?)([^0-9a-zA-Z.~/]|$)", r'<a href="\1">\1</a>\2', new_text)
|
||||||
new_text = re.sub(r'@(.*?)( |$)', r'@<a href="@\1">\1</a>\2', new_text)
|
new_text = re.sub(r'@(.*?)([^0-9a-zA-Z_]|$)', self._make_user_link, 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
|
||||||
|
@ -523,10 +523,19 @@ class TweetBox(gtk.HBox):
|
||||||
def on_url_clicked(self, widget, uri):
|
def on_url_clicked(self, widget, uri):
|
||||||
self.set_read()
|
self.set_read()
|
||||||
self.emit('tweet-read')
|
self.emit('tweet-read')
|
||||||
|
|
||||||
if re.match(r'@', uri):
|
if re.match(r'@', uri):
|
||||||
self.emit('show-user', re.sub(r'@', '', uri))
|
self.emit('show-user', re.sub(r'@', '', uri))
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def _make_user_link(self, matchobj):
|
||||||
|
name = matchobj.group(1)
|
||||||
|
if name == '':
|
||||||
|
return '@' + matchobj.group(2)
|
||||||
|
else:
|
||||||
|
return '@<a href="@' + name + '">' + name + '</a>' + matchobj.group(2)
|
||||||
|
|
||||||
# end class TweetBox
|
# end class TweetBox
|
||||||
|
|
||||||
# signals for TweetBox
|
# signals for TweetBox
|
||||||
|
@ -755,6 +764,7 @@ class CloseTabLabel(gtk.EventBox):
|
||||||
def on_button_press(self, event, direction):
|
def on_button_press(self, event, direction):
|
||||||
self.emit('label-clicked')
|
self.emit('label-clicked')
|
||||||
|
|
||||||
|
|
||||||
### end class CloseTabLabel
|
### end class CloseTabLabel
|
||||||
|
|
||||||
# signals for CloseTabLabel
|
# signals for CloseTabLabel
|
||||||
|
|
Reference in New Issue
Block a user