Changed the url-handling code, which can probably be made to work if pygtk can be convinced to give up the current uri
This commit is contained in:
parent
ed500d1dc0
commit
483758a968
18
mytwitter.py
18
mytwitter.py
|
@ -384,6 +384,7 @@ class TweetBox(gtk.VBox):
|
||||||
self.text.set_line_wrap(True)
|
self.text.set_line_wrap(True)
|
||||||
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):
|
||||||
self.text.connect('activate-link', self.on_url_clicked)
|
self.text.connect('activate-link', self.on_url_clicked)
|
||||||
|
self.text.connect('button-press-event', self.on_mouse_clicked)
|
||||||
|
|
||||||
# Build the buttons
|
# Build the buttons
|
||||||
button_box = gtk.HBox()
|
button_box = gtk.HBox()
|
||||||
|
@ -460,12 +461,21 @@ class TweetBox(gtk.VBox):
|
||||||
self.emit('retweet')
|
self.emit('retweet')
|
||||||
|
|
||||||
|
|
||||||
|
def on_mouse_clicked(self, widget, event):
|
||||||
|
self.set_read(True)
|
||||||
|
|
||||||
|
# fixme: only call on_url_clicked if there is an active uri
|
||||||
|
# does pygtk even support this?
|
||||||
|
if event.button == 1:
|
||||||
|
self.on_url_clicked(widget)
|
||||||
|
|
||||||
|
|
||||||
def on_url_clicked(self, widget):
|
def on_url_clicked(self, widget):
|
||||||
# fixme: for now, hard code firefox, since that's what I use
|
# fixme: we're catching this signal just to debug why it doesn't get emitted
|
||||||
# Eventually make this configgable
|
# seems to be related to EventBox?
|
||||||
# fixme: this doesn't work at all right now... figure out how to make this signal happen
|
|
||||||
print 'debug: on_url_clicked()'
|
print 'debug: on_url_clicked()'
|
||||||
# subprocess.Popen('/usr/bin/firefox ' + self.text.get_current_uri(), shell=False).pid
|
return True
|
||||||
|
|
||||||
|
|
||||||
# end class TweetBox
|
# end class TweetBox
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user