204 | | percent.display("\n%s...\n" % _("Rerouting printers to CUPS")) |
205 | | for printer in printers : |
206 | | uri = self.getPrinterDeviceURI(printer.Name) |
207 | | if self.isPrinterCaptured(deviceuri=uri) : |
208 | | newuri = uri.replace("cupspykota:", "") |
209 | | if newuri.startswith("//") : |
210 | | newuri = newuri[2:] |
211 | | self.regainPriv() # to avoid having to enter password. |
212 | | os.system('lpadmin -p "%s" -v "%s"' % (printer.Name, newuri)) |
213 | | self.logdebug("Printer %s rerouted to %s" % (printer.Name, newuri)) |
214 | | self.dropPriv() |
215 | | percent.oneMore() |
| 208 | if docups : |
| 209 | percent.display("\n%s...\n" % _("Rerouting printers to CUPS")) |
| 210 | for printer in printers : |
| 211 | uri = self.getPrinterDeviceURI(printer.Name) |
| 212 | if self.isPrinterCaptured(deviceuri=uri) : |
| 213 | newuri = uri.replace("cupspykota:", "") |
| 214 | if newuri.startswith("//") : |
| 215 | newuri = newuri[2:] |
| 216 | self.regainPriv() # to avoid having to enter password. |
| 217 | os.system('lpadmin -p "%s" -v "%s"' % (printer.Name, newuri)) |
| 218 | self.logdebug("Printer %s rerouted to %s" % (printer.Name, newuri)) |
| 219 | self.dropPriv() |
| 220 | percent.oneMore() |
270 | | uri = self.getPrinterDeviceURI(printer.Name) |
271 | | if not self.isPrinterCaptured(deviceuri=uri) : |
272 | | newuri = "cupspykota://%s" % uri |
273 | | self.regainPriv() # to avoid having to enter password. |
274 | | os.system('lpadmin -p "%s" -v "%s"' % (printer.Name, newuri)) |
275 | | self.logdebug("Printer %s rerouted to %s" % (printer.Name, newuri)) |
276 | | self.dropPriv() |
| 275 | if docups : |
| 276 | uri = self.getPrinterDeviceURI(printer.Name) |
| 277 | if not self.isPrinterCaptured(deviceuri=uri) : |
| 278 | newuri = "cupspykota://%s" % uri |
| 279 | self.regainPriv() # to avoid having to enter password. |
| 280 | os.system('lpadmin -p "%s" -v "%s"' % (printer.Name, newuri)) |
| 281 | self.logdebug("Printer %s rerouted to %s" % (printer.Name, newuri)) |
| 282 | self.dropPriv() |
317 | | short_options = "hvac:D:dg:lrsnpm:" |
318 | | long_options = ["help", "version", "add", "charge=", "description=", \ |
| 323 | short_options = "hvaCc:D:dg:lrsnpm:" |
| 324 | long_options = ["help", "version", "add", "cups", "charge=", "description=", \ |