Cleaned up handling of status bar messages
This commit is contained in:
parent
a06d47cfcc
commit
7c06ad8c40
11
mytwitter.py
11
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):
|
||||
|
|
Reference in New Issue
Block a user