Example #1
0
 def set_state_callback(self,usercallback,getpeerlist=True):
     """ 
     Set a callback for retrieving the state of the download. This callback
     will be called immediately with a DownloadState object as first parameter.
     The callback method must return a tuple (when,getpeerlist) where "when" 
     indicates whether the callback should be called again and represents a
     number of seconds from now. If "when" <= 0.0 the callback will not be
     called again. "getpeerlist" is a boolean that indicates whether the 
     DownloadState passed to the callback on the next invocation should
     contain info about the set of current peers.
     
     The callback will be called by a popup thread which can be used
     indefinitely (within reason) by the higher level code.
             
     @param usercallback Function that accepts DownloadState as parameter and 
     returns a (float,boolean) tuple.
     """
     DownloadImpl.set_state_callback(self,usercallback,getpeerlist=getpeerlist)
Example #2
0
 def set_state_callback(self, usercallback, getpeerlist=False, delay=0.0):
     """ 
     Set a callback for retrieving the state of the download. This callback
     will be called immediately with a DownloadState object as first parameter.
     The callback method must return a tuple (when,getpeerlist) where "when" 
     indicates whether the callback should be called again and represents a
     number of seconds from now. If "when" <= 0.0 the callback will not be
     called again. "getpeerlist" is a boolean that indicates whether the 
     DownloadState passed to the callback on the next invocation should
     contain info about the set of current peers.
     
     The callback will be called by a popup thread which can be used
     indefinitely (within reason) by the higher level code.
             
     @param usercallback Function that accepts DownloadState as parameter and 
     returns a (float,boolean) tuple.
     """
     DownloadImpl.set_state_callback(self,
                                     usercallback,
                                     getpeerlist=getpeerlist,
                                     delay=delay)