Reworked how adding lists is handled (so the child thread does the actual work and we can employ a Condition object to allow the add_to_notebook function to have the list information available) and put in code that should list the lists a user is in. Currently seems to not function as expected, however.

This commit is contained in:
Anna 2010-06-02 17:00:11 -04:00
parent 48cce6a353
commit 8fac5ad7c2
3 changed files with 74 additions and 23 deletions

View file

@ -22,21 +22,14 @@ class CustomApi(OAuthApi):
instantiated
'''
def __init__(self, access_token):
def __init__(self, access_token, hrafn_obj):
OAuthApi.__init__(self, CONSUMER_KEY, CONSUMER_SECRET, access_token)
self.lock = RLock()
self.sig_proxy = SigProxy()
self.username = self.GetUserInfo().screen_name
self._username = self.username
thread = GetUserLists(api=self)
thread.sig_proxy.connect('lists-ready', self.on_lists_ready)
thread.start()
def on_lists_ready(self, widget, lists, ignored):
self.sig_proxy.emit('lists-ready', self.username, lists)
thread = GetUserLists(self, hrafn_obj).start()
# End class CustomApi
@ -250,9 +243,9 @@ class GetUserInfo(ApiThread):
class GetUserLists(ApiThread):
def __init__(self, api):
def __init__(self, api, hrafn_obj):
ApiThread.__init__(self, api)
self.sig_proxy = SigProxy()
self.hrafn_obj = hrafn_obj
def run(self):
@ -272,7 +265,11 @@ class GetUserLists(ApiThread):
sleep(30)
done = False
self.sig_proxy.emit('lists-ready', lists, None)
gtk.gdk.threads_enter()
try:
self.hrafn_obj.add_lists(self.api.username, lists)
finally:
gtk.gdk.threads_leave()
### End class GetUserLists
@ -374,10 +371,6 @@ class SigProxy(gtk.Alignment):
# End class SigProxy
gobject.signal_new("lists-ready", SigProxy,
gobject.SIGNAL_RUN_LAST,
gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT,gobject.TYPE_PYOBJECT))
gobject.signal_new("update-posted", SigProxy,
gobject.SIGNAL_RUN_LAST,
gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT,))