Back to index

system-config-printer  1.3.9+20120706
Public Member Functions | Public Attributes
cupshelpers.xmldriverprefs.PrinterType Class Reference

List of all members.

Public Member Functions

def __init__
def add_make_and_model
def add_deviceid_match
def add_drivertype_pattern
def get_drivertype_patterns
def add_avoidtype_pattern
def get_avoidtype_patterns
def add_blacklisted
def get_blacklist
def match

Public Attributes

 make_and_model
 deviceid
 drivertype_patterns
 avoid
 blacklist

Detailed Description

A make-and-model pattern and/or set of IEEE 1284 Device ID
patterns for matching a set of printers, together with an ordered
list of driver type names.

Definition at line 318 of file xmldriverprefs.py.


Constructor & Destructor Documentation

Definition at line 325 of file xmldriverprefs.py.

00325 
00326     def __init__ (self):
00327         self.make_and_model = None
00328         self.deviceid = []
00329         self.drivertype_patterns = []
00330         self.avoid = set()
00331         self.blacklist = set()


Member Function Documentation

Add an avoid driver type pattern.

Definition at line 356 of file xmldriverprefs.py.

00356 
00357     def add_avoidtype_pattern (self, name):
00358         """
00359         Add an avoid driver type pattern.
00360         """
00361         self.avoid.add (name)

Add a blacklisted driver type pattern.

Definition at line 368 of file xmldriverprefs.py.

00368 
00369     def add_blacklisted (self, name):
00370         """
00371         Add a blacklisted driver type pattern.
00372         """
00373         self.blacklist.add (name)

def cupshelpers.xmldriverprefs.PrinterType.add_deviceid_match (   self,
  deviceid_match 
)
Add a Device ID match.

Definition at line 338 of file xmldriverprefs.py.

00338 
00339     def add_deviceid_match (self, deviceid_match):
00340         """
00341         Add a Device ID match.
00342         """
00343         self.deviceid.append (deviceid_match)

Append a driver type pattern.

Definition at line 344 of file xmldriverprefs.py.

00344 
00345     def add_drivertype_pattern (self, name):
00346         """
00347         Append a driver type pattern.
00348         """
00349         self.drivertype_patterns.append (name.strip ())

Set a make-and-model regular expression.  Only one is permitted.

Definition at line 332 of file xmldriverprefs.py.

00332 
00333     def add_make_and_model (self, pattern):
00334         """
00335         Set a make-and-model regular expression.  Only one is permitted.
00336         """
00337         self.make_and_model = re.compile (pattern, re.I)

Return the set of driver type patterns to avoid.

Definition at line 362 of file xmldriverprefs.py.

00362 
00363     def get_avoidtype_patterns (self):
00364         """
00365         Return the set of driver type patterns to avoid.
00366         """
00367         return self.avoid

Return the set of blacklisted driver type patterns.

Definition at line 374 of file xmldriverprefs.py.

00374 
00375     def get_blacklist (self):
00376         """
00377         Return the set of blacklisted driver type patterns.
00378         """
00379         return self.blacklist

Return the list of driver type patterns.

Definition at line 350 of file xmldriverprefs.py.

00350 
00351     def get_drivertype_patterns (self):
00352         """
00353         Return the list of driver type patterns.
00354         """
00355         return self.drivertype_patterns

def cupshelpers.xmldriverprefs.PrinterType.match (   self,
  make_and_model,
  deviceid 
)
Return True if there are no constraints to match against; if
the make-and-model pattern matches; or if all of the IEEE 1284
Device ID patterns match.

The deviceid parameter must be a dict indexed by Device ID
field key, of strings; except for the CMD field which must be
a list of strings.

Return False otherwise.

Definition at line 380 of file xmldriverprefs.py.

00380 
00381     def match (self, make_and_model, deviceid):
00382         """
00383         Return True if there are no constraints to match against; if
00384         the make-and-model pattern matches; or if all of the IEEE 1284
00385         Device ID patterns match.
00386 
00387         The deviceid parameter must be a dict indexed by Device ID
00388         field key, of strings; except for the CMD field which must be
00389         a list of strings.
00390 
00391         Return False otherwise.
00392         """
00393 
00394         matches = (self.make_and_model == None and self.deviceid == [])
00395         if self.make_and_model:
00396             if self.make_and_model.match (make_and_model):
00397                 matches = True
00398 
00399         if not matches:
00400             for match in self.deviceid:
00401                 if match.match (deviceid):
00402                     matches = True
00403                     break
00404 
00405         return matches


Member Data Documentation

Definition at line 329 of file xmldriverprefs.py.

Definition at line 330 of file xmldriverprefs.py.

Definition at line 327 of file xmldriverprefs.py.

Definition at line 328 of file xmldriverprefs.py.

Definition at line 326 of file xmldriverprefs.py.


The documentation for this class was generated from the following file: