Changeset 3429
- Timestamp:
- 10/05/08 11:21:53 (16 years ago)
- Location:
- pykota/trunk
- Files:
-
- 5 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/pkinvoice
r3413 r3429 264 264 if outfname != "-" : 265 265 nbusers = len(peruser) 266 print_("Invoiced %(nbusers)i users for %(nbjobs)i jobs, %(nbpages)i pages and %(nbcredits).3f credits") \267 % locals() 266 self.display("%s\n" % (_("Invoiced %(nbusers)i users for %(nbjobs)i jobs, %(nbpages)i pages and %(nbcredits).3f credits") \ 267 % locals())) 268 268 269 269 if __name__ == "__main__" : -
pykota/trunk/bin/pkrefund
r3413 r3429 257 257 percent.oneMore() 258 258 else : 259 print _("Date : %s") % str(job.JobDate)[:19]260 print _("Printer : %s") % job.PrinterName261 print _("User : %s") % job.UserName262 print _("JobId : %s") % job.JobId263 print _("Title : %s") % job.JobTitle259 self.display("%s\n" % (_("Date : %s") % str(job.JobDate)[:19])) 260 self.display("%s\n" % (_("Printer : %s") % job.PrinterName)) 261 self.display("%s\n" % (_("User : %s") % job.UserName)) 262 self.display("%s\n" % (_("JobId : %s") % job.JobId)) 263 self.display("%s\n" % (_("Title : %s") % job.JobTitle)) 264 264 if job.JobBillingCode : 265 print _("Billing code : %s") % job.JobBillingCode266 print _("Pages : %i") % job.JobSize267 print _("Credits : %.3f") % job.JobPrice265 self.display("%s\n" % (_("Billing code : %s") % job.JobBillingCode)) 266 self.display("%s\n" % (_("Pages : %i") % job.JobSize)) 267 self.display("%s\n" % (_("Credits : %.3f") % job.JobPrice)) 268 268 269 269 while True : … … 292 292 if outfname != "-" : 293 293 nbusers = len(peruser) 294 print_("Refunded %(nbusers)i users for %(nbjobs)i jobs, %(nbpages)i pages and %(nbcredits).3f credits") \295 % locals() 294 self.display("%s\n" % (_("Refunded %(nbusers)i users for %(nbjobs)i jobs, %(nbpages)i pages and %(nbcredits).3f credits") \ 295 % locals())) 296 296 297 297 if __name__ == "__main__" : -
pykota/trunk/bin/pkturnkey
r3424 r3429 331 331 return 332 332 sys.stderr.flush() # ensure outputs don't mix 333 print 334 print "--- CUT ---" 335 print "# Here are some lines that we suggest you add at the end" 336 print "# of the pykota.conf file. These lines gives possible" 337 print "# values for the way print jobs' size will be computed." 338 print "# NB : it is possible that a manual configuration gives" 339 print "# better results for you. As always, your mileage may vary." 340 print "#" 333 self.display("\n--- CUT ---\n") 334 self.display("# Here are some lines that we suggest you add at the end\n") 335 self.display("# of the pykota.conf file. These lines gives possible\n") 336 self.display("# values for the way print jobs' size will be computed.\n") 337 self.display("# NB : it is possible that a manual configuration gives\n") 338 self.display("# better results for you. As always, your mileage may vary.\n") 339 self.display("#\n") 341 340 for (name, uri) in printers : 342 print "[%s]" % name341 self.display("[%s]\n" % name) 343 342 accounter = "software()" 344 343 try : … … 380 379 accounter = "hardware(pjl:%s)" % port 381 380 382 print "preaccounter : software()"383 print "accounter : %s" % accounter384 print385 print "--- CUT ---"381 self.display("preaccounter : software()\n") 382 self.display("accounter : %s\n" % accounter) 383 self.display("\n") 384 self.display("--- CUT ---\n") 386 385 387 386 def main(self, names, options) : -
pykota/trunk/bin/repykota
r3413 r3429 81 81 82 82 self.reportingtool = reporter.openReporter(self, "text", printers, ugnames, options.groups) 83 print self.reportingtool.generateReport()83 self.display(self.reportingtool.generateReport()) 84 84 85 85 if __name__ == "__main__" : -
pykota/trunk/pykota/tool.py
r3413 r3429 47 47 def __init__(self, app, size=None) : 48 48 """Initializes the engine.""" 49 self.isatty = sys.stdout.isatty() 49 50 self.app = app 50 51 self.size = None … … 63 64 def display(self, msg) : 64 65 """Displays the value.""" 65 self.app.display(msg) 66 if self.isatty : 67 self.app.display(msg) 68 sys.stdout.flush() 66 69 67 70 def oneMore(self) : … … 151 154 152 155 def display(self, message) : 153 """Display a message but only if stdout is a tty.""" 154 if sys.stdout.isatty() : 155 sys.stdout.write(message.encode(self.charset, \ 156 """Display a message after ensuring the correct charset is used.""" 157 sys.stdout.write(message.encode(self.charset, 156 158 "replace")) 157 sys.stdout.flush()158 159 159 160 def logdebug(self, message) :