Changeset 2790

Show
Ignore:
Timestamp:
03/06/06 08:50:32 (19 years ago)
Author:
jerome
Message:

Now uses the Percent class like other tools do.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/pkinvoice

    r2689 r2790  
    4747    hasPIL = 1 
    4848 
    49 from pykota.tool import PyKotaToolError, PyKotaCommandLineError, crashed, N_ 
     49from pykota.tool import Percent, PyKotaToolError, PyKotaCommandLineError, crashed, N_ 
    5050from pykota.dumper import DumPyKota 
    51 from pykota.config import PyKotaConfigError 
    52 from pykota.storage import PyKotaStorageError 
    5351 
    5452__doc__ = N_("""pkinvoice v%(__version__)s (c) %(__years__)s %(__author__)s 
     
    282280            names = [ "*" ] 
    283281             
     282        percent = Percent(self) 
    284283        outfname = options["output"]     
    285284        if outfname != "-" : 
    286             self.display("%s...\n" % _("Processing")) 
    287              
     285            percent.display("%s..." % _("Extracting datas")) 
    288286        entries = self.storage.getMatchingUsers(",".join(names)) 
     287        percent.setSize(len(entries)) 
    289288        if entries : 
     289            percent.display("\n%s\n" % _("Generating invoices")) 
    290290            self.initPDF(options["logo"].strip()) 
    291             nbtotal = len(entries) 
    292             for i in range(nbtotal) : 
    293                 entry = entries[i] 
     291            for entry in entries : 
    294292                number += self.pagePDF(number, entry, vat, options["start"], options["end"], options["unit"]) 
    295293                if outfname != "-" : 
    296                     percent = 100.0 * float(i) / float(nbtotal) 
    297                     self.display("\r%.02f%%" % percent) 
     294                    percent.oneMore() 
    298295                     
    299296            if number > firstnumber : 
     
    301298             
    302299        if outfname != "-" : 
    303             self.display("\r100.00%%\r        ") 
    304             self.display("\r%s\n" % _("Done.")) 
     300            percent.done() 
    305301                      
    306302if __name__ == "__main__" :