Don't show retweet in DM pane, DM pane 'Reply' button should send DM to target user, and position cursor / dehilight text when replying

This commit is contained in:
Anna
2010-06-30 16:13:30 -04:00
parent 3aadbebd64
commit 1b4d2ccbfb
2 changed files with 34 additions and 9 deletions

View File

@ -18,7 +18,7 @@ class TweetPane(gtk.ScrolledWindow):
It also gets some data from its parent, including num_entries
'''
def __init__(self, list_name, username, num_entries=20, single_tweet=None, is_user=False, conversation=False):
def __init__(self, list_name, username, num_entries=20, single_tweet=None, is_user=False, conversation=False, is_dm=False):
gtk.ScrolledWindow.__init__(self)
# If the username is encoded in the tweet pane's name, we really want
@ -37,6 +37,7 @@ class TweetPane(gtk.ScrolledWindow):
self.is_user = is_user
self.following = False
self.verified = False
self.is_dm = is_dm
self.tab_label = CloseTabLabel(self.list_name)
@ -66,7 +67,7 @@ class TweetPane(gtk.ScrolledWindow):
# Build us some labels...
for i in range(0, self.num_entries):
self.tweets.append(TweetBox(self.conversation, self.is_user))
self.tweets.append(TweetBox(self.conversation, self.is_user, self.is_dm))
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)
@ -193,7 +194,10 @@ class TweetPane(gtk.ScrolledWindow):
def on_tweet_reply(self, widget):
self.emit('tweet-reply', {'screen_name': widget.screen_name, 'id': widget.id})
if self.is_dm:
self.emit('tweet-reply-dm', widget.screen_name)
else:
self.emit('tweet-reply', {'screen_name': widget.screen_name, 'id': widget.id})
def on_retweet(self, widget):
@ -233,6 +237,9 @@ class TweetPane(gtk.ScrolledWindow):
gobject.signal_new("tweet-reply", TweetPane,
gobject.SIGNAL_RUN_LAST,
gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT,))
gobject.signal_new("tweet-reply-dm", TweetPane,
gobject.SIGNAL_RUN_LAST,
gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT,))
gobject.signal_new("tweet-retweet", TweetPane,
gobject.SIGNAL_RUN_LAST,
gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT,))
@ -265,7 +272,7 @@ class TweetBox(gtk.HBox):
Also stores the data necessary for replying or retweeting (id, screen name)
'''
def __init__(self, conversation=False, is_user=False):
def __init__(self, conversation=False, is_user=False, is_dm=False):
gtk.HBox.__init__(self)
self.screen_name = None
@ -278,6 +285,7 @@ class TweetBox(gtk.HBox):
self.conversation = conversation
self.is_user = is_user
self.is_dm = is_dm
self.init_widgets()
@ -386,10 +394,11 @@ class TweetBox(gtk.HBox):
button_box.pack_end(reply_button, expand=False)
reply_button.connect("clicked", self.on_reply_clicked)
retweet_button = gtk.Button("Retweet")
retweet_button.set_relief(gtk.RELIEF_HALF)
button_box.pack_end(retweet_button, expand=False)
retweet_button.connect("clicked", self.on_retweet_clicked)
if not self.is_dm:
retweet_button = gtk.Button("Retweet")
retweet_button.set_relief(gtk.RELIEF_HALF)
button_box.pack_end(retweet_button, expand=False)
retweet_button.connect("clicked", self.on_retweet_clicked)
def set_status(self, status, read=True):