From 7c06ad8c40691581942d92bf5b001c8aac8b6527 Mon Sep 17 00:00:00 2001 From: Anna Date: Sun, 11 Apr 2010 01:44:44 -0400 Subject: [PATCH] Cleaned up handling of status bar messages --- mytwitter.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mytwitter.py b/mytwitter.py index a78500e..2ca9691 100755 --- a/mytwitter.py +++ b/mytwitter.py @@ -49,6 +49,7 @@ class MyTwitter(): self.update_entry = self.widget_tree.get_widget('update_entry') self.update_count = self.widget_tree.get_widget('update_count') self.status_bar = self.widget_tree.get_widget('status_bar') + self.context_id = self.status_bar.get_context_id('message') # Build us some labels... for i in range(0, self.num_entries): @@ -98,9 +99,12 @@ class MyTwitter(): self.tweets[i].clear_status() self.latest_tweet = statuses[0].id - self.status_bar.pop(self.status_bar.get_context_id('new_tweets')) + self.status_bar.pop(self.context_id) if num_new_tweets > 0: - self.status_bar.push(self.status_bar.get_context_id('new_tweets'), str(num_new_tweets) + ' new tweets') + status_text = str(num_new_tweets) + ' new tweet' + if num_new_tweets > 1: + status_text += 's' + self.status_bar.push(self.context_id, status_text) def update_window_callback(self, widget): @@ -112,8 +116,7 @@ class MyTwitter(): self.update_entry.set_text("") self.api.PostUpdate(text, in_reply_to_status_id=self.reply_id) self.reply_id = None - self.status_bar.push(self.status_bar.get_context_id('update'), - 'Tweet Posted') + self.status_bar.push(self.context_id, 'Tweet Posted') def update_status_callback(self, widget):