Added Verified Account label to verified accounts

This commit is contained in:
Anna 2010-04-16 17:32:17 -04:00
parent d47b12124f
commit 6bde20333f
4 changed files with 75 additions and 3 deletions

View File

@ -261,6 +261,32 @@
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="verified_label">
<property name="visible">True</property>
<property name="label" translatable="yes">Verified Account</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>

View File

@ -50,6 +50,7 @@ class MyTwitter():
self.search_entry = self.widget_tree.get_widget('search_entry')
self.following_button = self.widget_tree.get_widget('following_button')
self.at_button = self.widget_tree.get_widget('at_button')
self.verified_label = self.widget_tree.get_widget('verified_label')
self.context_id = self.status_bar.get_context_id('message')
@ -196,10 +197,12 @@ class MyTwitter():
is_user = False
following = False
verified = False
if re.match('user:', name):
is_user = True
following = self.check_following(name)
new_pane = TweetPane(name, num_entries=self.num_entries, single_tweet=single_tweet, is_user=is_user, following=following)
verified = self.check_verified(name)
new_pane = TweetPane(name, num_entries=self.num_entries, single_tweet=single_tweet, is_user=is_user, following=following, verified=verified)
self.tweet_notebook.append_page_menu(new_pane, new_pane.get_tab_label(), gtk.Label(name))
new_pane.get_tab_label().connect('close-clicked', self.remove_view_callback, name)
new_pane.connect('tweet-reply', self.on_reply)
@ -230,6 +233,10 @@ class MyTwitter():
self.at_button.show()
else:
self.at_button.hide()
if pane.get_verified():
self.verified_label.show()
else:
self.verified_label.hide()
def on_search(self, event):
@ -263,6 +270,13 @@ class MyTwitter():
return relationship.source.following
# Name is the name of a pane, with the 'user: ' in place
def check_verified(self, name):
screen_name = re.sub('user: ', '', name)
user = self.api.GetUser(screen_name)
return user.verified
def update_follow_button(self, pane):
if not pane.get_is_user():
self.following_button.set_label('')
@ -358,7 +372,6 @@ class User():
self.name = None
# main
parser = optparse.OptionParser()
parser.add_option('-c' ,'--config', dest="filename", default="~/.mytwitter")

View File

@ -0,0 +1,28 @@
diff -r 51ac454d5d89 twitter.py
--- a/twitter.py Thu Dec 31 15:06:42 2009 -0500
+++ b/twitter.py Fri Apr 16 17:30:32 2010 -0400
@@ -221,6 +221,7 @@
_CopyProperty(data, user, 'profile_link_color', 'profile.link_color')
_CopyProperty(data, user, 'profile_text_color', 'profile.text_color')
_CopyProperty(data, user, 'protected')
+ _CopyProperty(data, user, 'verified')
_CopyProperty(data, user, 'utc_offset')
_CopyProperty(data, user, 'time_zone')
_CopyProperty(data, user, 'url')
diff -r 51ac454d5d89 twitter_pb2.py
--- a/twitter_pb2.py Thu Dec 31 15:06:42 2009 -0500
+++ b/twitter_pb2.py Fri Apr 16 17:30:32 2010 -0400
@@ -253,6 +253,13 @@
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
+ descriptor.FieldDescriptor(
+ name='verified', full_name='twitter.User.verified', index=18,
+ number=19, type=8, cpp_type=7, label=1,
+ default_value=False,
+ message_type=None, enum_type=None, containing_type=None,
+ is_extension=False, extension_scope=None,
+ options=None),
],
extensions=[
],

View File

@ -13,7 +13,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, following=False):
def __init__(self, list_name, num_entries=20, single_tweet=None, is_user=False, following=False, verified=False):
gtk.ScrolledWindow.__init__(self)
self.updated_once = False
@ -27,6 +27,7 @@ class TweetPane(gtk.ScrolledWindow):
self.is_user = is_user
self.following = following
self.verified = verified
self.tab_label = CloseTabLabel(self.list_name)
@ -148,6 +149,10 @@ class TweetPane(gtk.ScrolledWindow):
return self.following
def get_verified(self):
return self.verified
def set_following(self, following):
self.following = following