Fixed printing lists for users

This commit is contained in:
Anna 2010-06-02 17:07:12 -04:00
parent 8fac5ad7c2
commit 9af8d9a496
3 changed files with 6 additions and 9 deletions

View File

@ -259,7 +259,7 @@ class GetUserLists(ApiThread):
twitter_lists = self.api.GetUserLists() twitter_lists = self.api.GetUserLists()
for name in [l.name for l in twitter_lists['lists']]: for name in [l.name for l in twitter_lists['lists']]:
list_members = self.api.GetListMembers(name) list_members = self.api.GetListMembers(name)
lists[name] = [u.name for u in list_members['users']] lists[name] = [u.screen_name for u in list_members['users']]
except (HTTPError, URLError) as exception: except (HTTPError, URLError) as exception:
print 'debug: GetUserLists had error: ' + str(exception.code) print 'debug: GetUserLists had error: ' + str(exception.code)
sleep(30) sleep(30)

View File

@ -341,23 +341,19 @@ class Hrafn():
found_lists = [] found_lists = []
username = re.sub('user: ', '', name) username = re.sub('user: ', '', name)
# We're not going to change the data, just access it.
# This condition only exists to let us know when the lists are
# ready
# Ergo, we can release it right after we get out of the conditional
self.lists_cond.acquire() self.lists_cond.acquire()
while not self.lists.has_key(self.username): while not self.lists.has_key(self.username):
self.lists_cond.wait() self.lists_cond.wait()
self.lists_cond.release()
for list_name in self.lists[self.username].keys(): for list_name in self.lists[self.username].keys():
try: try:
i = self.lists[self.username][list_name].index(username) i = self.lists[self.username][list_name].index(username)
found_lists.append(list_name) found_lists.append(list_name)
except: except ValueError:
pass pass
new_pane.set_lists(found_lists) new_pane.set_lists(found_lists)
self.lists_cond.release()
new_pane.connect('at-clicked', self.on_at_button_clicked) new_pane.connect('at-clicked', self.on_at_button_clicked)
new_pane.connect('follow-clicked', self.on_follow_button_clicked) new_pane.connect('follow-clicked', self.on_follow_button_clicked)

View File

@ -753,13 +753,14 @@ class UserBox(gtk.VBox):
self.verified_label.hide() self.verified_label.hide()
self.name_label.hide() self.name_label.hide()
self.avatar.hide() self.avatar.hide()
self.list_label.hide()
def set_lists(self, lists): def set_lists(self, lists):
if not lists: if not lists:
return return
list_label_text = 'In lists: ' list_label_text = 'Lists: '
for l in lists: for l in lists:
list_label_text += l + ' ' list_label_text += l + ' '