Moved reply and retweet buttons, and added 'in reply to' text

This commit is contained in:
Anna 2010-04-13 13:20:24 -04:00
parent f48d5accaf
commit bbe43d2131

View File

@ -320,6 +320,7 @@ class TweetPane(gtk.ScrolledWindow):
status.user = User() status.user = User()
status.user.screen_name = result.from_user status.user.screen_name = result.from_user
status.user.name = "" status.user.name = ""
status.in_reply_to_screen_name = result.to_user
# The Twitter Search API has different timestamps than the # The Twitter Search API has different timestamps than the
# REST API... balls # REST API... balls
# fixme: # fixme:
@ -382,16 +383,21 @@ class TweetBox(gtk.VBox):
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)
# Build the buttons
button_box = gtk.HBox() button_box = gtk.HBox()
self.pack_start(button_box) self.pack_start(button_box)
reply_button = gtk.Button("Reply") self.reply_to_button = gtk.Label("")
button_box.pack_start(reply_button, expand=False) button_box.pack_start(self.reply_to_button, expand=False)
reply_button.connect("clicked", self.on_reply_clicked)
retweet_button = gtk.Button("Retweet")
button_box.pack_start(retweet_button, expand=False)
retweet_button.connect("clicked", self.on_retweet_clicked)
reply_button = gtk.Button("Reply")
button_box.pack_end(reply_button, expand=False)
reply_button.connect("clicked", self.on_reply_clicked)
retweet_button = gtk.Button("Retweet")
button_box.pack_end(retweet_button, expand=False)
retweet_button.connect("clicked", self.on_retweet_clicked)
def set_status(self, status, read=True): def set_status(self, status, read=True):
self.set_read(read) self.set_read(read)
@ -421,6 +427,11 @@ class TweetBox(gtk.VBox):
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)
self.text.set_markup(new_text) self.text.set_markup(new_text)
# If this is in reply to something, set appropriate label
if status.in_reply_to_screen_name:
self.reply_to_button.set_label('in reply to ' + status.in_reply_to_screen_name)
def clear_status(self): def clear_status(self):
self.header.set_markup('') self.header.set_markup('')