Initial commit of 'conversation' button... needs a lot of work still

This commit is contained in:
Anna
2010-05-18 12:26:31 -04:00
parent 0ead5932a5
commit 3357249d28
3 changed files with 82 additions and 4 deletions

View File

@ -145,6 +145,53 @@ class GetSingleTweet(ApiThread):
class GetConversation(ApiThread):
def __init__(self, api, pane, root_tweet_id):
ApiThread.__init__(self, api)
self.pane = pane
self.root_tweet_id = root_tweet_id
def run(self):
statuses = []
last_tweet = None
# Get the root tweet
try:
with self.api.lock:
last_tweet = self.api.GetStatus(self.single_tweet)
statuses.append(last_tweet)
except (HTTPError, URLError):
statuses = None
last_tweet = None
# get tweets in a loop, until there is no in_reply_to_status_id
if last_tweet is not None:
while last_tweet.in_reply_to_status_id is not None:
try:
with self.api.lock:
last_tweet = self.api.GetStatus(self.single_tweet)
statuses.append(last_tweet)
except (HTTPError, URLError):
last_tweet = None
# In case we've never seen some of these users, grab their profile images and cache them
for status in statuses:
avcache.add_to_cache(status.user)
statuses.reverse()
gtk.gdk.threads_enter()
try:
self.pane.update_window(statuses)
finally:
gtk.gdk.threads_leave()
### End class GetConversation
class GetFollowing(ApiThread):
def __init__(self, api, pane, user):
ApiThread.__init__(self, api)