Broken commit, see new bug in TODO for details. Summary: new segfault at launch

This commit is contained in:
Anna 2010-04-27 16:21:21 -04:00
parent 5ab60f1278
commit 7cce83c0f3
4 changed files with 104 additions and 40 deletions

View file

@ -288,9 +288,12 @@ class MyTwitter():
verified = False
if re.match('user:', name):
is_user = True
following = self.check_following(name)
verified = self.check_verified(name)
new_pane = TweetPane(name, num_entries=self.num_entries, single_tweet=single_tweet, is_user=is_user, following=following, verified=verified)
new_pane = TweetPane(name, num_entries=self.num_entries, single_tweet=single_tweet, is_user=is_user)
if is_user:
apithreads.GetFollowing(api=self.api, pane=new_pane, user=name).start()
apithreads.GetVerified(api=self.api, pane=new_pane, user=name).start()
self.tweet_notebook.append_page_menu(new_pane, new_pane.get_tab_label(), gtk.Label(name))
self.tweet_notebook.set_tab_reorderable(new_pane, True)
new_pane.get_tab_label().connect('close-clicked', self.remove_view_callback, name, single_tweet)
@ -301,14 +304,9 @@ class MyTwitter():
# Special logic for single tweet pane
if single_tweet is not None:
try:
statuses = []
statuses.append(self.api.GetStatus(single_tweet))
new_pane.update_window(statuses)
except HTTPError:
self.tweet_notebook.remove_page(-1)
self.update_status_bar('Error retrieving tweet id: ' + str(single_tweet))
return
apithreads.GetSingleTweet(api=self.api,
pane=new_pane,
single_tweet=single_tweet).start()
self.update_windows()
self.tweet_notebook.set_current_page(-1) # switch to the new pane
@ -359,34 +357,15 @@ class MyTwitter():
user_name = re.sub('^user: ', '', current_pane.get_list_name())
if current_pane.get_following():
self.api.DestroyFriendship(user_name)
current_pane.set_following(self.check_following(user_name))
current_pane.set_following(False)
else:
self.api.CreateFriendship(user_name)
current_pane.set_following(self.check_following(user_name))
current_pane.set_following(True)
self.update_follow_button(current_pane)
# Name is the name of a pane, with the 'user: ' in place
def check_following(self, name):
screen_name = re.sub('user: ', '', name)
try:
relationship = self.api.ShowFriendships(target_screen_name=screen_name)
except HTTPError:
return False
return relationship.source.following
# Name is the name of a pane, with the 'user: ' in place
def check_verified(self, name):
screen_name = re.sub('user: ', '', name)
try:
user = self.api.GetUser(screen_name)
except HTTPError:
return False
return user.verified
# pane should be the currently active pane
def update_follow_button(self, pane):
if not pane.get_is_user():
self.following_button.set_label('')