def __init__(self, callback=None): self.m = DownUpManager.getInstance() self.m.registerListener(self) self.task = None self.kind = '' self.start = time() self.callback = callback
class MainManager: """ Vodstok UI stream manager This class implements our UI upload/download operations. This is a proxy to DownUpManager, with some UI interactions added. """ def __init__(self): self.m = DownUpManager() self.m.registerListener(self) self.task = None self.kind = '' self.start = time() def __getattr__(self, attr): """ Proxy implementation Every attribute not defined in this class but defined in the DownUpManager will be forwarded to its single instance. """ if hasattr(self.m, attr): return getattr(self.m, attr) else: raise AttributeError() def onTaskDone(self, task): """ Task completed callback """ pass def onTaskProgress(self, task, progress): """ Task progress callback """ pass def onTaskCancel(self,task): """ Task canceled callback (implemented but never called since we do not allow task cancelation) """ return def onTaskError(self, task): """ Task error callback. Stop everything if an error occured. """ pass def onTaskCreated(self, task): return def onTaskStarted(self, task): return
def __init__(self): self.m = DownUpManager() self.m.registerListener(self) self.task = None self.kind = '' self.start = time()