Exemple #1
0
class Download(object):
    def __init__(self, url, destination):
        self.url = url
        self.destination = destination
        self.pb = None

    def feedback(self, numblocks, blocksize, totalsize):
        if not self.pb:
            self.pb = Progress(totalsize)

        self.pb.progress(numblocks * blocksize)

    def download(self):
        cb = None
        if sys.stdout.isatty():
            cb = self.feedback

        urllib.urlretrieve(self.url, self.destination, cb)
        if self.pb:
            self.pb.finish()
Exemple #2
0
class Download(object):

    def __init__(self, url, destination):
        self.url = url
        self.destination = destination
        self.pb = None

    def feedback(self, numblocks, blocksize, totalsize):
        if not self.pb:
            self.pb = Progress(totalsize)

        self.pb.progress(numblocks * blocksize)

    def download(self):
        cb = None
        if sys.stdout.isatty():
            cb = self.feedback

        urllib.urlretrieve(self.url, self.destination, cb)
        if self.pb:
            self.pb.finish()
Exemple #3
0
    def feedback(self, numblocks, blocksize, totalsize):
        if not self.pb:
            self.pb = Progress(totalsize)

        self.pb.progress(numblocks * blocksize)
Exemple #4
0
    def feedback(self, numblocks, blocksize, totalsize):
        if not self.pb:
            self.pb = Progress(totalsize)

        self.pb.progress(numblocks * blocksize)
Exemple #5
0
 def __init__(self, globl, progress_object):
     BaseProgress.__init__(self, 100)
     self.globl = globl
     self.progress_object = progress_object
Exemple #6
0
 def __init__(self, globl, progress_object):
     BaseProgress.__init__(self, 100)
     self.globl = globl
     self.progress_object = progress_object