Number of new tweets shown in label text
This commit is contained in:
parent
f0193d80a8
commit
2f57d64901
15
mytwitter.py
15
mytwitter.py
|
@ -85,9 +85,15 @@ class MyTwitter():
|
|||
statuses = self.api.GetMentions(count=self.num_entries)
|
||||
else:
|
||||
statuses = self.api.GetListStatuses(list_name, per_page=self.num_entries)
|
||||
|
||||
|
||||
pane.update_window(statuses)
|
||||
|
||||
# Update the label with the number of unread tweets
|
||||
pane_text = list_name
|
||||
if pane.get_num_new_tweets() > 0:
|
||||
pane_text += ' (' + str(pane.get_num_new_tweets()) + ')'
|
||||
self.tweet_notebook.get_tab_label(pane).set_label_text(pane_text)
|
||||
|
||||
|
||||
def update_windows_callback(self, widget):
|
||||
self.update_windows()
|
||||
|
@ -166,6 +172,7 @@ class MyTwitter():
|
|||
tab_label = CloseTabLabel(name)
|
||||
self.tweet_notebook.append_page(widget, tab_label)
|
||||
tab_label.connect('clicked', self.remove_view, name)
|
||||
self.tweet_notebook.set_current_page(-1) # switch to the new pane
|
||||
|
||||
|
||||
### end class MyTwitter
|
||||
|
@ -210,6 +217,9 @@ class TweetPane(gtk.ScrolledWindow):
|
|||
self.tweets[i].connect('retweet', self.mytwitter.on_retweet)
|
||||
|
||||
viewport.add(tweet_box)
|
||||
|
||||
self.connect('focus', self.set_tweets_read)
|
||||
|
||||
self.add(viewport)
|
||||
self.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
|
||||
self.show_all()
|
||||
|
@ -243,6 +253,7 @@ class TweetPane(gtk.ScrolledWindow):
|
|||
def set_tweets_read(self):
|
||||
print 'debug: set_tweets_read()'
|
||||
self.last_tweet_read = self.latest_tweet
|
||||
self.num_new_tweets = 0
|
||||
|
||||
|
||||
def set_tweets_read_callback(self, event):
|
||||
|
@ -356,7 +367,7 @@ class TweetBox(gtk.VBox):
|
|||
gtk.gdk.color_parse("#f2f1f0"))
|
||||
else:
|
||||
self.text_eb.modify_bg(gtk.STATE_NORMAL,
|
||||
gtk.gdk.color_parse("#"))
|
||||
gtk.gdk.color_parse("#dbffdb"))
|
||||
|
||||
|
||||
def on_reply_clicked(self, widget):
|
||||
|
|
Reference in New Issue
Block a user