From 589879686ff255db128046e39f69e5b51ba8c6fb Mon Sep 17 00:00:00 2001 From: Anna Date: Sun, 11 Apr 2010 21:14:24 -0400 Subject: [PATCH] Changed latest tweet system so that tweets must be explicitly set read... last_read_tweet doesn't automatically update in update_window --- default.glade | 1 + mytwitter.py | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/default.glade b/default.glade index aeb22d8..9be404f 100644 --- a/default.glade +++ b/default.glade @@ -93,6 +93,7 @@ GTK_POLICY_ALWAYS GTK_SHADOW_NONE GTK_CORNER_TOP_LEFT + diff --git a/mytwitter.py b/mytwitter.py index e635924..acc3282 100755 --- a/mytwitter.py +++ b/mytwitter.py @@ -28,6 +28,7 @@ class MyTwitter(): self.tweets = [] self.list = None self.reply_id = None + self.last_tweet_read = None self.latest_tweet = None # Authenticate with twitter, set up the API object @@ -84,8 +85,8 @@ class MyTwitter(): statuses = self.api.GetListStatuses(self.list, per_page=self.num_entries) # If this is our first load of this list, don't treat anything as new! - if self.latest_tweet is None: - self.latest_tweet = statuses[0].id + if self.last_tweet_read is None: + self.last_tweet_read = statuses[0].id # Keep count of the new tweets for posting a status message num_new_tweets = 0 @@ -93,7 +94,7 @@ class MyTwitter(): for i in range(0, self.num_entries): read = True if i < len(statuses): - if statuses[i].id > self.latest_tweet: + if statuses[i].id > self.last_tweet_read: num_new_tweets += 1 read = False self.tweets[i].set_status(statuses[i], read) @@ -146,7 +147,7 @@ class MyTwitter(): def on_list_select_changed(self, widget): self.list = widget.get_active_text() - self.latest_tweet = None + self.last_tweet_read = None self.update_window() @@ -159,6 +160,11 @@ class MyTwitter(): def on_retweet(self, widget): self.api.PostRetweet(widget.id) + + def set_tweets_read(self): + print 'debug: set_tweets_read()' + self.last_tweet_read = self.latest_tweet + ### end class MyTwitter