From bbe43d21314c2130147e723f942ed5cfc55713a4 Mon Sep 17 00:00:00 2001 From: Anna Date: Tue, 13 Apr 2010 13:20:24 -0400 Subject: [PATCH] Moved reply and retweet buttons, and added 'in reply to' text --- mytwitter.py | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/mytwitter.py b/mytwitter.py index 58febe7..f0ded6b 100755 --- a/mytwitter.py +++ b/mytwitter.py @@ -320,6 +320,7 @@ class TweetPane(gtk.ScrolledWindow): status.user = User() status.user.screen_name = result.from_user status.user.name = "" + status.in_reply_to_screen_name = result.to_user # The Twitter Search API has different timestamps than the # REST API... balls # 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): self.text.connect('activate-link', self.on_url_clicked) + # Build the buttons button_box = gtk.HBox() self.pack_start(button_box) - reply_button = gtk.Button("Reply") - button_box.pack_start(reply_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) + self.reply_to_button = gtk.Label("") + button_box.pack_start(self.reply_to_button, expand=False) + 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): self.set_read(read) @@ -421,6 +427,11 @@ class TweetBox(gtk.VBox): new_text = re.sub(r"(http://.*?)( |$)", r'\1\2', 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): self.header.set_markup('')