First steps toward moving the follow, at, and verified info into a box at the top of the pane

This commit is contained in:
Anna 2010-05-20 00:04:44 -04:00
parent eccfe997d9
commit 22067b4ad2
3 changed files with 164 additions and 94 deletions

View file

@ -343,8 +343,10 @@ class MyTwitter():
new_pane = TweetPane(name, num_entries=entries, single_tweet=single_tweet, is_user=is_user, conversation=conversation)
if is_user:
new_pane.connect('at-clicked', self.on_at_button_clicked)
new_pane.connect('follow-clicked', self.on_follow_button_clicked)
apithreads.GetFollowing(api=self.api, pane=new_pane, user=name).start()
apithreads.GetVerified(api=self.api, pane=new_pane, user=name).start()
apithreads.GetUserInfo(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)
@ -354,8 +356,6 @@ class MyTwitter():
new_pane.connect('tweet-in-reply-to', self.on_reply_to)
new_pane.connect('tweet-conversation', self.on_conversation)
new_pane.connect('show-user', self.show_user_callback)
new_pane.connect('following-set', self.update_follow_button)
new_pane.connect('verified-set', self.update_verified_label)
# Special logic for single tweet pane
if single_tweet is not None:
@ -381,13 +381,6 @@ class MyTwitter():
# Now get the new page, and set everything up
pane = self.tweet_notebook.get_nth_page(page_num)
pane.set_tweets_read()
self.update_follow_button(pane)
if pane.get_is_user():
self.at_button.show()
else:
self.at_button.hide()
self.update_verified_label(pane)
def on_tabs_reordered(self, widget, child, page_num):
@ -415,19 +408,6 @@ class MyTwitter():
self.status_bar.push(self.context_id, text)
def on_following_button_clicked(self, event):
current_pane = self.get_current_pane()
user_name = re.sub('^user: ', '', current_pane.get_list_name())
if current_pane.get_following():
follow = False # destroy the friendship
else:
follow = True
thread = apithreads.ChangeFriendship(self.api, current_pane, user_name, follow)
thread.sig_proxy.connect('friendship-changed', self.on_friendship_changed)
thread.start()
def on_friendship_changed(self, widget, data):
if data['success']:
if data['follow']:
@ -441,26 +421,6 @@ class MyTwitter():
self.update_status_bar('Failed to unfollow ' + data['user_name'])
# pane should be the currently active pane
def update_follow_button(self, pane):
if not pane.get_is_user():
self.following_button.set_label('')
self.following_button.hide()
elif pane.get_following():
self.following_button.set_label('Unfollow')
self.following_button.show()
else:
self.following_button.set_label('Follow')
self.following_button.show()
def update_verified_label(self, pane):
if pane.get_verified():
self.verified_label.show()
else:
self.verified_label.hide()
def show_user(self, name):
self.add_to_notebook('user: ' + name)
@ -469,9 +429,7 @@ class MyTwitter():
self.show_user(data)
def on_at_button_clicked(self, widget):
current_pane = self.get_current_pane()
user_name = re.sub('^user: ', '', current_pane.get_list_name())
def on_at_button_clicked(self, widget, user_name):
self.add_to_notebook('@' + user_name)