Back to index

system-config-printer  1.3.9+20120706
Public Member Functions | Public Attributes
userdefault.UserDefaultPrompt Class Reference

List of all members.

Public Member Functions

def __init__
def on_toggled
def on_response

Public Attributes

 set_default_fn
 refresh_fn
 name
 userdef
 systemwide
 clearpersonal
 personal

Detailed Description

Definition at line 88 of file userdefault.py.


Constructor & Destructor Documentation

def userdefault.UserDefaultPrompt.__init__ (   self,
  set_default_fn,
  refresh_fn,
  name,
  title,
  parent,
  primarylabel,
  systemwidelabel,
  clearpersonallabel,
  personallabel 
)

Definition at line 98 of file userdefault.py.

00098 
00099                   personallabel):
00100         self.set_default_fn = set_default_fn
00101         self.refresh_fn = refresh_fn
00102         self.name = name
00103         dialog = gtk.Dialog (title,
00104                              parent,
00105                              gtk.DIALOG_MODAL |
00106                              gtk.DIALOG_DESTROY_WITH_PARENT |
00107                              gtk.DIALOG_NO_SEPARATOR,
00108                              (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
00109                               gtk.STOCK_OK, gtk.RESPONSE_OK))
00110         dialog.set_default_response (gtk.RESPONSE_OK)
00111         dialog.set_border_width (6)
00112         dialog.set_resizable (False)
00113         hbox = gtk.HBox (False, 12)
00114         hbox.set_border_width (6)
00115         image = gtk.Image ()
00116         image.set_from_stock (gtk.STOCK_DIALOG_QUESTION, gtk.ICON_SIZE_DIALOG)
00117         image.set_alignment (0.0, 0.0)
00118         hbox.pack_start (image, False, False, 0)
00119         vboxouter = gtk.VBox (False, 6)
00120         primary = gtk.Label ()
00121         primary.set_markup ('<span weight="bold" size="larger">' +
00122                             primarylabel + '</span>')
00123         primary.set_line_wrap (True)
00124         primary.set_alignment (0.0, 0.0)
00125         vboxouter.pack_start (primary, False, False, 0)
00126         vboxradio = gtk.VBox (False, 0)
00127         systemwide = gtk.RadioButton (label=systemwidelabel)
00128         vboxradio.pack_start (systemwide, False, False, 0)
00129         clearpersonal = gtk.CheckButton (clearpersonallabel)
00130         alignment = gtk.Alignment (0, 0, 0, 0)
00131         alignment.set_padding (0, 0, 12, 0)
00132         alignment.add (clearpersonal)
00133         vboxradio.pack_start (alignment)
00134         vboxouter.pack_start (vboxradio, False, False, 0)
00135         personal = gtk.RadioButton (group=systemwide,
00136                                     label=personallabel)
00137         vboxouter.pack_start (personal, False, False, 0)
00138         hbox.pack_start (vboxouter, False, False, 0)
00139         dialog.vbox.pack_start (hbox, False, False, 0)
00140         systemwide.set_active (True)
00141         clearpersonal.set_active (True)
00142         self.userdef = UserDefaultPrinter ()
00143         clearpersonal.set_sensitive (self.userdef.get () != None)
00144 
00145         self.systemwide = systemwide
00146         self.clearpersonal = clearpersonal
00147         self.personal = personal
00148         systemwide.connect ("toggled", self.on_toggled)
00149         dialog.connect ("response", self.on_response)
00150         dialog.show_all ()


Member Function Documentation

def userdefault.UserDefaultPrompt.on_response (   self,
  dialog,
  response_id 
)

Definition at line 155 of file userdefault.py.

00155 
00156     def on_response (self, dialog, response_id):
00157         if response_id != gtk.RESPONSE_OK:
00158             dialog.destroy ()
00159             return
00160 
00161         if self.systemwide.get_active ():
00162             if self.clearpersonal.get_active ():
00163                 self.userdef.clear ()
00164             self.set_default_fn (self.name)
00165         else:
00166             try:
00167                 self.userdef.set (self.name)
00168             except Exception, e:
00169                 print "Error setting default: %s" % repr (e)
00170 
00171             self.refresh_fn ()
00172 
00173         dialog.destroy ()
def userdefault.UserDefaultPrompt.on_toggled (   self,
  button 
)

Definition at line 151 of file userdefault.py.

00151 
00152     def on_toggled (self, button):
00153         self.clearpersonal.set_sensitive (self.userdef.get () != None and
00154                                           self.systemwide.get_active ())


Member Data Documentation

Definition at line 145 of file userdefault.py.

Definition at line 101 of file userdefault.py.

Definition at line 146 of file userdefault.py.

Definition at line 100 of file userdefault.py.

Definition at line 99 of file userdefault.py.

Definition at line 144 of file userdefault.py.

Definition at line 141 of file userdefault.py.


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