Changed latest tweet system so that tweets must be explicitly set read... last_read_tweet doesn't automatically update in update_window
This commit is contained in:
parent
1167e3e910
commit
589879686f
|
@ -93,6 +93,7 @@
|
|||
<property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
|
||||
<property name="shadow_type">GTK_SHADOW_NONE</property>
|
||||
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
||||
<signal name="grab_focus" handler="set_tweets_read" last_modification_time="Mon, 12 Apr 2010 01:09:46 GMT"/>
|
||||
|
||||
<child>
|
||||
<widget class="GtkViewport" id="viewport1">
|
||||
|
|
14
mytwitter.py
14
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
|
||||
|
||||
|
||||
|
|
Reference in New Issue
Block a user