コード例 #1
0
ファイル: window.py プロジェクト: dvrasp/Vodstok
 def __init__(self, callback=None):
     self.m = DownUpManager.getInstance()
     self.m.registerListener(self)
     self.task = None
     self.kind = ''
     self.start = time()
     self.callback = callback
コード例 #2
0
ファイル: window.py プロジェクト: dvrasp/Vodstok
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
コード例 #3
0
ファイル: window.py プロジェクト: dvrasp/Vodstok
 def __init__(self):
     self.m = DownUpManager()
     self.m.registerListener(self)
     self.task = None
     self.kind = ''
     self.start = time()