Changeset 1582 for pykota/trunk/bin
- Timestamp:
- 07/01/04 19:45:49 (20 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/pkprinters
r1546 r1582 24 24 # 25 25 # $Log$ 26 # Revision 1.12 2004/07/01 17:45:47 jalet 27 # Added code to handle the description field for printers 28 # 26 29 # Revision 1.11 2004/06/18 13:34:48 jalet 27 30 # Now all tracebacks include PyKota's version number … … 87 90 88 91 -d | --delete Deletes printers from the quota storage. 92 93 -D | --description Adds a textual description to printers. 89 94 90 95 -c | --charge p[,j] Sets the price per page and per job to charge. … … 122 127 examples : 123 128 124 $ pkprinters --add - -charge 0.05,0.1 hp2100 hp2200 hp8000129 $ pkprinters --add -D "HP Printer" --charge 0.05,0.1 hp2100 hp2200 hp8000 125 130 126 131 Will create three printers named hp2100, hp2200 and hp8000. … … 128 133 per job will be set at 0.1 unit. Units are in your own currency, 129 134 or whatever you want them to mean. 130 If any of these printers already exists, it is not modified at 131 all. 135 All of their descriptions will be set to the string "HP Printer". 136 If any of these printers already exists, it will also be modified 137 unless the -s|--skipexisting command line option is also used. 132 138 133 139 $ pkprinters --delete "*" … … 191 197 if printer.Exists : 192 198 if options["skipexisting"] : 193 self. logger.log_message(_("Printer %s already exists, skipping.") % printer.Name, "warn")199 self.printError(_("Printer %s already exists, skipping.") % printer.Name) 194 200 else : 195 self. logger.log_message(_("Printer %s already exists, will be modified.") % printer.Name, "warn")201 self.printError(_("Printer %s already exists, will be modified.") % printer.Name) 196 202 printers.append(printer) 197 203 else : … … 216 222 if parents : 217 223 parents = "%s %s" % (_("in"), parents) 218 print "%s (%s + #*%s) %s" % \219 (printer.Name, printer. PricePerJob, \224 print "%s [%s] (%s + #*%s) %s" % \ 225 (printer.Name, printer.Description, printer.PricePerJob, \ 220 226 printer.PricePerPage, parents) 221 227 else : 222 228 if options["charge"] : 223 229 printer.setPrices(perpage, perjob) 230 if options["description"] is not None : 231 printer.setDescription(options["description"].strip()) 224 232 if options["groups"] : 225 233 for pgroup in printersgroups : … … 232 240 retcode = 0 233 241 try : 234 short_options = "hvac: dg:lrs"235 long_options = ["help", "version", "add", "charge=", "de lete", "groups=", "list", "remove", "skipexisting"]242 short_options = "hvac:D:dg:lrs" 243 long_options = ["help", "version", "add", "charge=", "description=", "delete", "groups=", "list", "remove", "skipexisting"] 236 244 237 245 # Initializes the command line tool … … 246 254 options["add"] = options["a"] or options["add"] 247 255 options["charge"] = options["c"] or options["charge"] 256 options["description"] = options["D"] or options["description"] 248 257 options["delete"] = options["d"] or options["delete"] 249 258 options["groups"] = options["g"] or options["groups"] … … 256 265 elif options["version"] : 257 266 manager.display_version_and_quit() 258 elif (options["delete"] and (options["add"] or options["groups"] or options["charge"] or options["remove"] )) \267 elif (options["delete"] and (options["add"] or options["groups"] or options["charge"] or options["remove"] or options["description"])) \ 259 268 or (options["skipexisting"] and not options["add"]) \ 260 or (options["list"] and (options["add"] or options["delete"] or options["groups"] or options["charge"] or options["remove"] )) :269 or (options["list"] and (options["add"] or options["delete"] or options["groups"] or options["charge"] or options["remove"] or options["description"])) : 261 270 raise PyKotaToolError, _("incompatible options, see help.") 262 271 elif options["remove"] and not options["groups"] :