Back to index

system-config-printer  1.3.9+20120706
Classes | Functions
optionwidgets Namespace Reference

Classes

class  Option
class  OptionBool
class  OptionPickOne
class  OptionPickMany

Functions

def OptionWidget

Function Documentation

def optionwidgets.OptionWidget (   option,
  ppd,
  gui,
  tab_label = None 
)
Factory function

Definition at line 26 of file optionwidgets.py.

00026 
00027 def OptionWidget(option, ppd, gui, tab_label=None):
00028     """Factory function"""
00029     ui = option.ui
00030     if (ui == cups.PPD_UI_BOOLEAN and
00031         len (option.choices) != 2):
00032         # This option is advertised as a Boolean but in fact has more
00033         # than two choices.
00034         print "Treating Boolean option %s as PickOne" % option.keyword
00035         ui = cups.PPD_UI_PICKONE
00036 
00037     if ui == cups.PPD_UI_BOOLEAN:
00038         return OptionBool(option, ppd, gui, tab_label=tab_label)
00039     elif ui == cups.PPD_UI_PICKONE:
00040         return OptionPickOne(option, ppd, gui, tab_label=tab_label)
00041     elif ui == cups.PPD_UI_PICKMANY:
00042         return OptionPickMany(option, ppd, gui, tab_label=tab_label)
00043 
00044 # ---------------------------------------------------------------------------