Changeset 3051 for pykota/trunk/bin
- Timestamp:
- 11/08/06 22:59:55 (18 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/pkprinters
r2829 r3051 31 31 from pykota.tool import Percent, PyKotaTool, PyKotaCommandLineError, crashed, N_ 32 32 from pykota.storage import StoragePrinter 33 34 from pkipplib import pkipplib 33 35 34 36 __doc__ = N_("""pkprinters v%(__version__)s (c) %(__years__)s %(__author__)s … … 145 147 pgroup.addPrinterToGroup(printer) 146 148 149 def getPrinterDeviceURI(self, printername) : 150 """Returns the Device URI attribute for a particular printer.""" 151 cups = pkipplib.CUPS() 152 req = cups.newRequest(pkipplib.IPP_GET_PRINTER_ATTRIBUTES) 153 req.operation["printer-uri"] = ("uri", cups.identifierToURI("printers", printername)) 154 try : 155 return cups.doRequest(req).printer["device-uri"][0][1] 156 except : 157 return "" 158 159 def isPrinterCaptured(self, printername) : 160 """Returns True if the printer is already redirected through PyKota's backend, else False.""" 161 if self.getPrinterDeviceURI(printername).find("cupspykota:") != -1 : 162 return True 163 else : 164 return False 165 147 166 def main(self, names, options) : 148 167 """Manage printers.""" … … 172 191 print " %s" % (_("Passthrough mode : %s") % ((printer.PassThrough and _("ON")) or _("OFF"))) 173 192 print " %s" % (_("Maximum job size : %s") % ((printer.MaxJobSize and (_("%s pages") % printer.MaxJobSize)) or _("Unlimited"))) 193 print " %s" % (_("Routed through PyKota : %s") % ((self.isPrinterCaptured(printer.Name) and _("YES")) or _("NO"))) 174 194 if parents : 175 195 print " %s %s" % (_("in"), parents)