Changeset 3245 for pykota/trunk/pykota
- Timestamp:
- 08/31/07 09:27:44 (17 years ago)
- Location:
- pykota/trunk/pykota
- Files:
-
- 5 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/accounter.py
r3184 r3245 40 40 class AccounterBase : 41 41 """A class to account print usage by querying printers.""" 42 def __init__(self, kotafilter, arguments, ispreaccounter=0 ) :42 def __init__(self, kotafilter, arguments, ispreaccounter=0, name="Unknown") : 43 43 """Sets instance vars depending on the current printer.""" 44 self.name = name 44 45 self.filter = kotafilter 45 46 self.arguments = arguments … … 106 107 raise PyKotaAccounterError, _("Unsupported accounter backend %s") % backend 107 108 else : 108 return accounterbackend.Accounter(kotafilter, args, ispreaccounter )109 return accounterbackend.Accounter(kotafilter, args, ispreaccounter, backend.lower()) -
pykota/trunk/pykota/accounters/hardware.py
r3162 r3245 31 31 32 32 class Accounter(AccounterBase) : 33 def __init__(self, kotabackend, arguments, ispreaccounter=0 ) :33 def __init__(self, kotabackend, arguments, ispreaccounter=0, name="hardware") : 34 34 """Initializes querying accounter.""" 35 AccounterBase.__init__(self, kotabackend, arguments )35 AccounterBase.__init__(self, kotabackend, arguments, ispreaccounter, name) 36 36 self.isSoftware = 0 37 37 -
pykota/trunk/pykota/accounters/ink.py
r3133 r3245 87 87 self.inkUsage.append(colordict) 88 88 jobsize = len(pages) 89 if self.filter.InputFile is not None : 90 # when a filename is passed as an argument, the backend 91 # must generate the correct number of copies. 92 jobsize *= self.filter.Copies 93 self.inkUsage *= self.filter.Copies 89 try : 90 if self.filter.InputFile is not None : 91 # when a filename is passed as an argument, the backend 92 # must generate the correct number of copies. 93 jobsize *= self.filter.Copies 94 self.inkUsage *= self.filter.Copies 95 except AttributeError : # When not run from the cupspykota backend 96 pass 94 97 self.filter.logdebug("Ink usage : %s ===> %s" % (cspace, repr(self.inkUsage))) 95 98 return jobsize -
pykota/trunk/pykota/accounters/software.py
r3133 r3245 66 66 self.filter.printInfo(_("Unable to precompute the job's size with the generic PDL analyzer : %s") % msg, "warn") 67 67 else : 68 if self.filter.InputFile is not None : 69 # when a filename is passed as an argument, the backend 70 # must generate the correct number of copies. 71 jobsize *= self.filter.Copies 68 try : 69 if self.filter.InputFile is not None : 70 # when a filename is passed as an argument, the backend 71 # must generate the correct number of copies. 72 jobsize *= self.filter.Copies 73 except AttributeError : # When not run from the cupspykota backend 74 pass 72 75 infile.close() 73 76 return jobsize -
pykota/trunk/pykota/storage.py
r3133 r3245 338 338 totalprice += pageprice 339 339 else : 340 coefficients = self.Printer.Coefficients340 coefficients = upq.Printer.Coefficients 341 341 for (ink, value) in usage.items() : 342 342 coefvalue = coefficients.get(ink, 1.0) 343 343 coefprice = (coefvalue * pageprice) / 100.0 344 344 inkprice = coefprice * value 345 self.parent.tool.logdebug("Applying coefficient %f for color %s (used at %f%% on page %i) to base cost %f gives %f" % (coefvalue, ink, value, pageindex+1, pageprice, inkprice))345 self.parent.tool.logdebug("Applying coefficient %f for color %s (used at %f%% on page %i) to base cost %f on printer %s gives %f" % (coefvalue, ink, value, pageindex+1, pageprice, upq.Printer.Name, inkprice)) 346 346 totalprice += inkprice 347 347 if self.User.OverCharge != 1.0 : # TODO : beware of rounding errors