Please help me with following problem. I need to implement progress bar for huge sync operation in my app.
And I cannot figure out how P4.Progress is working.
Here is my small test code.
import P4 P4PORT = 'port:1666' P4USER = 'user' P4CLIENT = 'client' p4 = None class MyProgress(P4.Progress): TYPES = ["Unknown", "Submit", "Sync", "Clone"] UNITS = ["Unknown", "Percent", "Files", "KBytes", "MBytes"] def __init__(self): P4.Progress.__init__(self) def init(self, typ): P4.Progress.init(self, typ) print "Progress.init with '%s'" % self.TYPES[typ] def setDescription(self, description, units): P4.Progress.setDescription(self, description, units) print "Progress.setDescription with '%s' and units '%s'" % (description, self.UNITS[units]) def setTotal(self, total): P4.Progress.setTotal(self, total) print "Progress.setTotal with '%s' " % total def update(self, position): P4.Progress.update(self, position) print "Progress.update with '%s'" % position def done(self, fail): P4.Progress.done(self, fail) print "Progress.done with '%s"'' % fail def init(p4Port, p4User, p4Client): global p4 p4 = P4.P4() p4.port = p4Port p4.user = p4User p4.client = p4Client p4.charset = 'utf8' p4.exception_level = 1 p4.progress = createProgress() p4.connect() def createProgress(): progress = MyProgress() progress.init(progress.TYPE_RECEIVEFILE) progress.setDescription('My Description', progress.UNIT_KBYTES) return progress def run(): init(P4PORT, P4USER, P4CLIENT) p4.run_sync('//depot/...#head') if __name__ == '__main__': run()
How the progress work? it should call update method with each of progress step?
In my code update is never called.
What am I doing wrong?