Back to index

system-config-printer  1.3.9+20120706
Functions | Variables
check-device-ids Namespace Reference

Functions

def got_device
def driver_uri_to_filename
def driver_uri_to_pkg

Variables

tuple c = cups.Connection()
 devices = None
 SPECIFIC_URI = None
tuple id_dict = cupshelpers.parseDeviceID(sys.argv[2])
tuple attrs = c.getPrinterAttributes(sys.argv[1])
tuple scheme = str(SPECIFIC_URI.split (":", 1)[0])
int n = 0
list device_ids = []
tuple make_and_model = attrs.get('device-make-and-model')
tuple device_id = attrs.get('device-id')
 hostname = None
tuple colon = hostname.find(":")
list devs = []
tuple pf = probe_printer.PrinterFinder()
tuple id_fields = cupshelpers.parseDeviceID(device_id)
string this_id = "MFG:%s;MDL:%s;"
tuple bus = dbus.SessionBus()
tuple obj
tuple proxy = dbus.Interface(obj, "org.freedesktop.PackageKit.Modify")
int timeout = 3600
tuple ppds = PPDs(c.getPPDs ())
tuple makes = ppds.getMakes()
int i = 1
tuple item = unichr(0x251c)
tuple last = unichr(0x2514)
 line = item
list cmd = id_fields['CMD']
list drivers = ppds.ids[id_fields['MFG'].lower ()]
tuple more = unichr(0x2502)
tuple n_drivers = len(drivers)
int j = 1
tuple matches = set(ppds.getInfoFromModel (mfr, mdl))
tuple mfrl = mfr.lower()
 mdls = None
tuple missing = set(matches)
tuple ppd_device_id = ppds.getInfoFromPPDName(each)
tuple ppd_id_fields = cupshelpers.parseDeviceID(ppd_device_id)
list value = id_fields[field]
list ppd_value = ppd_id_fields[field]

Function Documentation

def check-device-ids.driver_uri_to_filename (   uri)

Definition at line 196 of file check-device-ids.py.

00196 
00197 def driver_uri_to_filename (uri):
00198     schemeparts = uri.split (':', 2)
00199     if len (schemeparts) < 2:
00200         if uri.startswith ("lsb/usr/"):
00201             return "/usr/share/ppd/" + uri[8:]
00202         elif uri.startswith ("lsb/opt/"):
00203             return "/opt/share/ppd/" + uri[8:]
00204         elif uri.startswith ("lsb/local/"):
00205             return "/usr/local/share/ppd/" + uri[10:]
00206 
00207         return "/usr/share/cups/model/" + uri
00208 
00209     scheme = schemeparts[0]
00210     if scheme != "drv":
00211         return "/usr/lib/cups/driver/" + scheme
00212 
00213     rest = schemeparts[1]
00214     rest = rest.lstrip ('/')
00215     parts = rest.split ('/')
00216     if len (parts) > 1:
00217         parts = parts[:len (parts) - 1]
00218 
00219     return "/usr/share/cups/drv/" + reduce (lambda x, y: x + "/" + y, parts)

def check-device-ids.driver_uri_to_pkg (   uri)

Definition at line 220 of file check-device-ids.py.

00220 
00221 def driver_uri_to_pkg (uri):
00222     filename = driver_uri_to_filename (uri)
00223 
00224     try:
00225         import packagekit.client, packagekit.enums
00226         client = packagekit.client.PackageKitClient ()
00227         packages = client.search_file ([filename],
00228                                        packagekit.enums.FILTER_INSTALLED)
00229         return packages[0].name
00230     except:
00231         return filename

def check-device-ids.got_device (   dev)

Definition at line 121 of file check-device-ids.py.

00121 
00122                 def got_device (dev):
00123                     if dev != None:
00124                         devs.append (dev)


Variable Documentation

tuple check-device-ids.attrs = c.getPrinterAttributes(sys.argv[1])

Definition at line 54 of file check-device-ids.py.

tuple check-device-ids.bus = dbus.SessionBus()

Definition at line 160 of file check-device-ids.py.

tuple check-device-ids.c = cups.Connection()

Definition at line 30 of file check-device-ids.py.

string check-device-ids.cmd = id_fields['CMD']

Definition at line 255 of file check-device-ids.py.

tuple check-device-ids.colon = hostname.find(":")

Definition at line 114 of file check-device-ids.py.

tuple check-device-ids.device_id = attrs.get('device-id')

Definition at line 104 of file check-device-ids.py.

list check-device-ids.device_ids = []

Definition at line 95 of file check-device-ids.py.

dictionary check-device-ids.devices = None

Definition at line 32 of file check-device-ids.py.

list check-device-ids.devs = []

Definition at line 119 of file check-device-ids.py.

tuple check-device-ids.drivers = ppds.ids[id_fields['MFG'].lower ()]

Definition at line 269 of file check-device-ids.py.

list check-device-ids.hostname = None

Definition at line 107 of file check-device-ids.py.

int check-device-ids.i = 1

Definition at line 232 of file check-device-ids.py.

tuple check-device-ids.id_dict = cupshelpers.parseDeviceID(sys.argv[2])

Definition at line 42 of file check-device-ids.py.

tuple check-device-ids.id_fields = cupshelpers.parseDeviceID(device_id)

Definition at line 150 of file check-device-ids.py.

string check-device-ids.item = unichr(0x251c)

Definition at line 234 of file check-device-ids.py.

int check-device-ids.j = 1

Definition at line 281 of file check-device-ids.py.

string check-device-ids.last = unichr(0x2514)

Definition at line 235 of file check-device-ids.py.

check-device-ids.line = item

Definition at line 251 of file check-device-ids.py.

tuple check-device-ids.make_and_model = attrs.get('device-make-and-model')

Definition at line 103 of file check-device-ids.py.

tuple check-device-ids.makes = ppds.getMakes()

Definition at line 194 of file check-device-ids.py.

tuple check-device-ids.matches = set(ppds.getInfoFromModel (mfr, mdl))

Definition at line 295 of file check-device-ids.py.

list check-device-ids.mdls = None

Definition at line 297 of file check-device-ids.py.

tuple check-device-ids.mfrl = mfr.lower()

Definition at line 296 of file check-device-ids.py.

tuple check-device-ids.missing = set(matches)

Definition at line 307 of file check-device-ids.py.

string check-device-ids.more = unichr(0x2502)

Definition at line 274 of file check-device-ids.py.

int check-device-ids.n = 0

Definition at line 94 of file check-device-ids.py.

tuple check-device-ids.n_drivers = len(drivers)

Definition at line 280 of file check-device-ids.py.

tuple check-device-ids.obj
Initial value:
00001 bus.get_object("org.freedesktop.PackageKit",
00002                               "/org/freedesktop/PackageKit")

Definition at line 164 of file check-device-ids.py.

tuple check-device-ids.pf = probe_printer.PrinterFinder()

Definition at line 126 of file check-device-ids.py.

check-device-ids.ppd_device_id = ppds.getInfoFromPPDName(each)

Definition at line 310 of file check-device-ids.py.

tuple check-device-ids.ppd_id_fields = cupshelpers.parseDeviceID(ppd_device_id)

Definition at line 318 of file check-device-ids.py.

list check-device-ids.ppd_value = ppd_id_fields[field]

Definition at line 321 of file check-device-ids.py.

tuple check-device-ids.ppds = PPDs(c.getPPDs ())

Definition at line 192 of file check-device-ids.py.

tuple check-device-ids.proxy = dbus.Interface(obj, "org.freedesktop.PackageKit.Modify")

Definition at line 166 of file check-device-ids.py.

tuple check-device-ids.scheme = str(SPECIFIC_URI.split (":", 1)[0])

Definition at line 72 of file check-device-ids.py.

list check-device-ids.SPECIFIC_URI = None

Definition at line 40 of file check-device-ids.py.

string check-device-ids.this_id = "MFG:%s;MDL:%s;"

Definition at line 151 of file check-device-ids.py.

int check-device-ids.timeout = 3600

Definition at line 184 of file check-device-ids.py.

list check-device-ids.value = id_fields[field]

Definition at line 320 of file check-device-ids.py.