Back to index

system-config-printer  1.3.9+20120706
Public Member Functions | Public Attributes
options.IPPResolution Class Reference

List of all members.

Public Member Functions

def __new__
def __init__
def __str__

Public Attributes

 xres
 yres
 units

Detailed Description

Definition at line 31 of file options.py.


Constructor & Destructor Documentation

def options.IPPResolution.__init__ (   self,
  values 
)

Definition at line 57 of file options.py.

00057 
00058     def __init__ (self, values):
00059         return tuple.__init__ (self, (self.xres, self.yres, self.units))


Member Function Documentation

def options.IPPResolution.__new__ (   cls,
  values 
)

Definition at line 32 of file options.py.

00032 
00033     def __new__ (cls, values):
00034         cls.UNITS_BY_VAL = { cups.IPP_RES_PER_INCH: "dpi",
00035                              cups.IPP_RES_PER_CM: "dpc" }
00036         cls.UNITS_DEFAULT = cups.IPP_RES_PER_INCH
00037 
00038         cls.UNITS_BY_STR = {}
00039         for v, s in cls.UNITS_BY_VAL.iteritems ():
00040             cls.UNITS_BY_STR[s] = v
00041 
00042         if isinstance (values, str):
00043             matches = re.match ("(\d+)\D+(\d+)(.*)", values).groups ()
00044             xres = int (matches[0])
00045             yres = int (matches[1])
00046             units = cls.UNITS_BY_STR.get (matches[2], cls.UNITS_DEFAULT)
00047         else:
00048             xres = values[0]
00049             yres = values[1]
00050             units = values[2]
00051 
00052         self = tuple.__new__ (cls, (xres, yres, units))
00053         self.xres = xres
00054         self.yres = yres
00055         self.units = units
00056         return self

Definition at line 60 of file options.py.

00060 
00061     def __str__ (self):
00062         return "%sx%s%s" % (self.xres, self.yres,
00063                             self.UNITS_BY_VAL.get (self.units,
00064                                                    self.UNITS_DEFAULT))


Member Data Documentation

Definition at line 54 of file options.py.

Definition at line 52 of file options.py.

Definition at line 53 of file options.py.


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