Made conversations work correctly
This commit is contained in:
@ -16,7 +16,7 @@ class TweetPane(gtk.ScrolledWindow):
|
||||
It also gets some data from its parent, including num_entries
|
||||
'''
|
||||
|
||||
def __init__(self, list_name, num_entries=20, single_tweet=None, is_user=False):
|
||||
def __init__(self, list_name, num_entries=20, single_tweet=None, is_user=False, conversation=False):
|
||||
gtk.ScrolledWindow.__init__(self)
|
||||
|
||||
self.data_lock = RLock()
|
||||
@ -25,11 +25,10 @@ class TweetPane(gtk.ScrolledWindow):
|
||||
|
||||
self.list_name = list_name
|
||||
self.single_tweet = single_tweet
|
||||
self.conversation = conversation
|
||||
|
||||
self.num_entries = num_entries
|
||||
if self.single_tweet is not None:
|
||||
self.num_entries = 1
|
||||
|
||||
|
||||
self.is_user = is_user
|
||||
self.following = False
|
||||
self.verified = False
|
||||
@ -58,7 +57,7 @@ class TweetPane(gtk.ScrolledWindow):
|
||||
tweet_box.pack_start(self.message)
|
||||
|
||||
for i in range(0, self.num_entries):
|
||||
self.tweets.append(TweetBox())
|
||||
self.tweets.append(TweetBox(self.conversation))
|
||||
tweet_box.pack_start(self.tweets[i], expand=False)
|
||||
self.tweets[i].connect('reply', self.on_tweet_reply)
|
||||
self.tweets[i].connect('retweet', self.on_retweet)
|
||||
@ -98,7 +97,10 @@ class TweetPane(gtk.ScrolledWindow):
|
||||
# If this is our first load of this list, don't treat anything as new!
|
||||
if self.last_tweet_read is None:
|
||||
try:
|
||||
self.last_tweet_read = statuses[0].id
|
||||
ids = [status.id for status in statuses]
|
||||
ids.sort()
|
||||
ids.reverse()
|
||||
self.last_tweet_read = ids[0]
|
||||
except IndexError:
|
||||
self.last_tweet_read = 0
|
||||
|
||||
@ -158,6 +160,10 @@ class TweetPane(gtk.ScrolledWindow):
|
||||
return self.single_tweet
|
||||
|
||||
|
||||
def get_conversation(self):
|
||||
return self.conversation
|
||||
|
||||
|
||||
def updated_once(self):
|
||||
return self.updated_once
|
||||
|
||||
@ -243,7 +249,7 @@ class TweetBox(gtk.HBox):
|
||||
Also stores the data necessary for replying or retweeting (id, screen name)
|
||||
'''
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self, conversation=False):
|
||||
gtk.HBox.__init__(self)
|
||||
|
||||
self.screen_name = None
|
||||
@ -251,6 +257,9 @@ class TweetBox(gtk.HBox):
|
||||
self.in_reply_to_id = None
|
||||
self.in_reply_to_screen_name = None
|
||||
|
||||
# Lets the tweetbox know if it is part of a conversation or not
|
||||
self.conversation = conversation
|
||||
|
||||
self.init_widgets()
|
||||
|
||||
|
||||
@ -308,7 +317,7 @@ class TweetBox(gtk.HBox):
|
||||
button_box.pack_start(self.reply_to_button, expand=False)
|
||||
self.reply_to_button.connect("clicked", self.on_in_reply_to_clicked)
|
||||
|
||||
self.conversation_button = gtk.Button("Conversation")
|
||||
self.conversation_button = gtk.Button("(conversation)")
|
||||
self.conversation_button.set_relief(gtk.RELIEF_NONE)
|
||||
button_box.pack_start(self.conversation_button, expand=False)
|
||||
self.conversation_button.connect("clicked", self.on_conversation_clicked)
|
||||
@ -366,7 +375,7 @@ class TweetBox(gtk.HBox):
|
||||
self.text.set_markup(new_text)
|
||||
|
||||
# If this is in reply to something, set appropriate label
|
||||
if self.in_reply_to_screen_name and self.in_reply_to_id:
|
||||
if not self.conversation and self.in_reply_to_screen_name and self.in_reply_to_id:
|
||||
self.reply_to_button.set_label('in reply to ' + self.in_reply_to_screen_name)
|
||||
self.conversation_button.show()
|
||||
|
||||
@ -404,7 +413,7 @@ class TweetBox(gtk.HBox):
|
||||
|
||||
|
||||
def on_conversation_clicked(self, widget):
|
||||
self.emit('in-reply-to', {'id': self.in_reply_to_id, 'name': self.in_reply_to_screen_name})
|
||||
self.emit('conversation', {'id': self.id, 'name': self.in_reply_to_screen_name})
|
||||
|
||||
|
||||
def on_user_clicked(self, widget):
|
||||
|
Reference in New Issue
Block a user