summaryrefslogtreecommitdiff
path: root/apt/progress.py
blob: 7fbfc09aba834b34a96493a764a5bf8d3b0a3e94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import sys

class OpProgress:
    """ Abstract class to implement reporting on cache opening """
    def __init__(self):
        pass
    def Update(self, percent):
        pass
    def Done(self):
        pass

class OpTextProgress(OpProgress):
    """ A simple text based cache open reporting class """
    def __init__(self):
        OpProgress.__init__(self)
    def Update(self, percent):
        sys.stdout.write("\r%s: %.2i  " % (self.Op,percent))
        sys.stdout.flush()
    def Done(self):
        sys.stdout.write("\r%s: Done\n" % self.Op)



class FetchProgress:
    def __init__(self):
        pass
    
    def Start(self):
        pass
    
    def Stop(self):
        pass
    
    def UpdateStatus(self, uri, descr, shortDescr, status):
        pass

    def Pulse(self):
        pass

    def MediaChange(self, medium, drive):
        pass

class InstallProgress:
    def __init__(self):
        pass
    def StartUpdate(self):
        pass
    def FinishUpdate(self):
        pass
    def UpdateInterface(self):
        pass


class CdromProgress:
    def __init__(self):
        pass
    def Update(self, text, step):
        """ update is called regularly so that the gui can be redrawn """
        pass
    def AskCdromName(self):
        pass
    def ChangeCdrom(self):
        pass

# module test code
if __name__ == "__main__":
    import apt_pkg
    apt_pkg.init()
    progress = OpTextProgress()
    cache = apt_pkg.GetCache(progress)
    depcache = apt_pkg.GetDepCache(cache)
    depcache.Init(progress)