Made handlers for following and verified setting work correctly
This commit is contained in:
parent
44e1a39afe
commit
b43bc3ccea
|
@ -82,7 +82,7 @@ class GetTweets(ApiThread):
|
||||||
|
|
||||||
|
|
||||||
class GetSingleTweet(ApiThread):
|
class GetSingleTweet(ApiThread):
|
||||||
def __init__(self, pane, single_tweet):
|
def __init__(self, api, pane, single_tweet):
|
||||||
ApiThread.__init__(self, api)
|
ApiThread.__init__(self, api)
|
||||||
self.pane = pane
|
self.pane = pane
|
||||||
self.single_tweet = single_tweet
|
self.single_tweet = single_tweet
|
||||||
|
|
19
mytwitter.py
19
mytwitter.py
|
@ -68,9 +68,6 @@ class MyTwitter():
|
||||||
|
|
||||||
self.reply_id = None
|
self.reply_id = None
|
||||||
|
|
||||||
self.following_handler = -1
|
|
||||||
self.verified_handler = -1
|
|
||||||
|
|
||||||
# Load up all the GUI stuff
|
# Load up all the GUI stuff
|
||||||
self.init_user_interface('./default.glade')
|
self.init_user_interface('./default.glade')
|
||||||
self.init_widgets()
|
self.init_widgets()
|
||||||
|
@ -303,8 +300,6 @@ class MyTwitter():
|
||||||
self.db['open_tabs'] = ot
|
self.db['open_tabs'] = ot
|
||||||
|
|
||||||
is_user = False
|
is_user = False
|
||||||
following = False
|
|
||||||
verified = False
|
|
||||||
if re.match('user:', name):
|
if re.match('user:', name):
|
||||||
is_user = True
|
is_user = True
|
||||||
new_pane = TweetPane(name, num_entries=self.num_entries, single_tweet=single_tweet, is_user=is_user)
|
new_pane = TweetPane(name, num_entries=self.num_entries, single_tweet=single_tweet, is_user=is_user)
|
||||||
|
@ -320,6 +315,8 @@ class MyTwitter():
|
||||||
new_pane.connect('tweet-retweet', self.on_retweet)
|
new_pane.connect('tweet-retweet', self.on_retweet)
|
||||||
new_pane.connect('tweet-in-reply-to', self.on_reply_to)
|
new_pane.connect('tweet-in-reply-to', self.on_reply_to)
|
||||||
new_pane.connect('show-user', self.show_user_callback)
|
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
|
# Special logic for single tweet pane
|
||||||
if single_tweet is not None:
|
if single_tweet is not None:
|
||||||
|
@ -336,14 +333,6 @@ class MyTwitter():
|
||||||
last_page = self.db['active_page']
|
last_page = self.db['active_page']
|
||||||
self.db['active_page'] = page_num
|
self.db['active_page'] = page_num
|
||||||
|
|
||||||
# Disconnect the old signals
|
|
||||||
if last_page != page_num:
|
|
||||||
pane = self.tweet_notebook.get_nth_page(last_page)
|
|
||||||
if self.following_handler != -1:
|
|
||||||
pane.disconnect(self.following_handler)
|
|
||||||
if self.verified_handler != -1:
|
|
||||||
pane.disconnect(self.verified_handler)
|
|
||||||
|
|
||||||
# Now get the new page, and set everything up
|
# Now get the new page, and set everything up
|
||||||
pane = self.tweet_notebook.get_nth_page(page_num)
|
pane = self.tweet_notebook.get_nth_page(page_num)
|
||||||
pane.set_tweets_read()
|
pane.set_tweets_read()
|
||||||
|
@ -355,10 +344,6 @@ class MyTwitter():
|
||||||
|
|
||||||
self.update_verified_label(pane)
|
self.update_verified_label(pane)
|
||||||
|
|
||||||
# Follow button and verified label can be returned later if this is a new pane, so set up signals
|
|
||||||
self.following_handler = pane.connect('following-set', self.update_follow_button)
|
|
||||||
self.verified_handler = pane.connect('verified-set', self.update_verified_label)
|
|
||||||
|
|
||||||
|
|
||||||
def on_tabs_reordered(self, widget, child, page_num):
|
def on_tabs_reordered(self, widget, child, page_num):
|
||||||
self.db['active_page'] = page_num
|
self.db['active_page'] = page_num
|
||||||
|
|
Reference in New Issue
Block a user