Selecting lists in View menu now works
This commit is contained in:
parent
6cc19e1087
commit
f7eb9993dc
45
mytwitter.py
45
mytwitter.py
|
@ -25,9 +25,6 @@ class MyTwitter():
|
||||||
if self.refresh_time < 10:
|
if self.refresh_time < 10:
|
||||||
self.refresh_time = 10
|
self.refresh_time = 10
|
||||||
|
|
||||||
self.tweet_panes = []
|
|
||||||
self.tweets = []
|
|
||||||
self.list = None
|
|
||||||
self.reply_id = None
|
self.reply_id = None
|
||||||
|
|
||||||
# Authenticate with twitter, set up the API object
|
# Authenticate with twitter, set up the API object
|
||||||
|
@ -55,9 +52,9 @@ class MyTwitter():
|
||||||
self.tweet_notebook.remove_page(0) # kill the page that glade makes us have
|
self.tweet_notebook.remove_page(0) # kill the page that glade makes us have
|
||||||
|
|
||||||
# Add the Home tab to the notebook
|
# Add the Home tab to the notebook
|
||||||
self.tweet_panes.append(TweetPane('Home', self))
|
home_pane = TweetPane('Home', self)
|
||||||
self.tweet_notebook.append_page(self.tweet_panes[0])
|
self.tweet_notebook.append_page(home_pane)
|
||||||
self.tweet_notebook.set_tab_label_text(self.tweet_panes[0], 'Home')
|
self.tweet_notebook.set_tab_label_text(home_pane, 'Home')
|
||||||
|
|
||||||
# Put Home, @user, and lists in the View menu...
|
# Put Home, @user, and lists in the View menu...
|
||||||
lists = self.api.GetUserLists()
|
lists = self.api.GetUserLists()
|
||||||
|
@ -79,7 +76,8 @@ class MyTwitter():
|
||||||
|
|
||||||
|
|
||||||
def update_windows(self):
|
def update_windows(self):
|
||||||
for pane in self.tweet_panes:
|
for i in range(0, self.tweet_notebook.get_n_pages()):
|
||||||
|
pane = self.tweet_notebook.get_nth_page(i)
|
||||||
list_name = pane.get_list_name()
|
list_name = pane.get_list_name()
|
||||||
|
|
||||||
if list_name is None or list_name == 'Home':
|
if list_name is None or list_name == 'Home':
|
||||||
|
@ -137,17 +135,21 @@ class MyTwitter():
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
def set_tweets_read_callback(self, event):
|
|
||||||
self.set_tweets_read()
|
|
||||||
|
|
||||||
|
|
||||||
def on_view_selected(self, event, name):
|
def on_view_selected(self, event, name):
|
||||||
print 'debug: on_view_selected(): ' + name
|
# If it already exists, don't add it, just switch to it
|
||||||
|
for i in range(self.tweet_notebook.get_n_pages()):
|
||||||
|
pane = self.tweet_notebook.get_nth_page(i)
|
||||||
|
if pane.get_list_name() == name:
|
||||||
|
self.tweet_notebook.set_current_page(i)
|
||||||
|
return
|
||||||
|
|
||||||
|
# Now, add a new tab with this list
|
||||||
|
new_pane = TweetPane(name, self)
|
||||||
|
self.tweet_notebook.append_page(new_pane)
|
||||||
|
self.tweet_notebook.set_tab_label_text(new_pane, name)
|
||||||
|
|
||||||
|
# And, to propagate it:
|
||||||
|
self.update_windows()
|
||||||
|
|
||||||
### end class MyTwitter
|
### end class MyTwitter
|
||||||
|
|
||||||
|
@ -222,6 +224,15 @@ class TweetPane(gtk.ScrolledWindow):
|
||||||
def get_list_name(self):
|
def get_list_name(self):
|
||||||
return self.list_name
|
return self.list_name
|
||||||
|
|
||||||
|
|
||||||
|
def set_tweets_read(self):
|
||||||
|
print 'debug: set_tweets_read()'
|
||||||
|
self.last_tweet_read = self.latest_tweet
|
||||||
|
|
||||||
|
|
||||||
|
def set_tweets_read_callback(self, event):
|
||||||
|
self.set_tweets_read()
|
||||||
|
|
||||||
### end class TweetPane
|
### end class TweetPane
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user