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="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
|
||||||
<property name="shadow_type">GTK_SHADOW_NONE</property>
|
<property name="shadow_type">GTK_SHADOW_NONE</property>
|
||||||
<property name="window_placement">GTK_CORNER_TOP_LEFT</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>
|
<child>
|
||||||
<widget class="GtkViewport" id="viewport1">
|
<widget class="GtkViewport" id="viewport1">
|
||||||
|
|
14
mytwitter.py
14
mytwitter.py
|
@ -28,6 +28,7 @@ class MyTwitter():
|
||||||
self.tweets = []
|
self.tweets = []
|
||||||
self.list = None
|
self.list = None
|
||||||
self.reply_id = None
|
self.reply_id = None
|
||||||
|
self.last_tweet_read = None
|
||||||
self.latest_tweet = None
|
self.latest_tweet = None
|
||||||
|
|
||||||
# Authenticate with twitter, set up the API object
|
# 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)
|
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 this is our first load of this list, don't treat anything as new!
|
||||||
if self.latest_tweet is None:
|
if self.last_tweet_read is None:
|
||||||
self.latest_tweet = statuses[0].id
|
self.last_tweet_read = statuses[0].id
|
||||||
|
|
||||||
# Keep count of the new tweets for posting a status message
|
# Keep count of the new tweets for posting a status message
|
||||||
num_new_tweets = 0
|
num_new_tweets = 0
|
||||||
|
@ -93,7 +94,7 @@ class MyTwitter():
|
||||||
for i in range(0, self.num_entries):
|
for i in range(0, self.num_entries):
|
||||||
read = True
|
read = True
|
||||||
if i < len(statuses):
|
if i < len(statuses):
|
||||||
if statuses[i].id > self.latest_tweet:
|
if statuses[i].id > self.last_tweet_read:
|
||||||
num_new_tweets += 1
|
num_new_tweets += 1
|
||||||
read = False
|
read = False
|
||||||
self.tweets[i].set_status(statuses[i], read)
|
self.tweets[i].set_status(statuses[i], read)
|
||||||
|
@ -146,7 +147,7 @@ class MyTwitter():
|
||||||
|
|
||||||
def on_list_select_changed(self, widget):
|
def on_list_select_changed(self, widget):
|
||||||
self.list = widget.get_active_text()
|
self.list = widget.get_active_text()
|
||||||
self.latest_tweet = None
|
self.last_tweet_read = None
|
||||||
self.update_window()
|
self.update_window()
|
||||||
|
|
||||||
|
|
||||||
|
@ -159,6 +160,11 @@ class MyTwitter():
|
||||||
def on_retweet(self, widget):
|
def on_retweet(self, widget):
|
||||||
self.api.PostRetweet(widget.id)
|
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
|
### end class MyTwitter
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user