Back to index

system-config-printer  1.3.9+20120706
Public Member Functions | Public Attributes | Static Public Attributes
authconn.AuthDialog Class Reference

List of all members.

Public Member Functions

def __init__
def set_prompt
def set_auth_info
def get_auth_info
def get_remember_password
def field_grab_focus

Public Attributes

 auth_info_required
 prompt_label
 field_entry
 remember_checkbox

Static Public Attributes

dictionary AUTH_FIELD

Detailed Description

Definition at line 32 of file authconn.py.


Constructor & Destructor Documentation

def authconn.AuthDialog.__init__ (   self,
  title = None,
  parent = None,
  flags = gtk.DIALOG_MODAL | gtk.DIALOG_NO_SEPARATOR,
  buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
  gtk,
  STOCK_OK,
  gtk,
  RESPONSE_OK,
  auth_info_required = ['username',
  password,
  allow_remember = False 
)

Definition at line 42 of file authconn.py.

00042 
00043                   allow_remember=False):
00044         if title == None:
00045             title = _("Authentication")
00046         gtk.Dialog.__init__ (self, title, parent, flags, buttons)
00047         self.auth_info_required = auth_info_required
00048         self.set_default_response (gtk.RESPONSE_OK)
00049         self.set_border_width (6)
00050         self.set_resizable (False)
00051         hbox = gtk.HBox (False, 12)
00052         hbox.set_border_width (6)
00053         image = gtk.Image ()
00054         image.set_from_stock (gtk.STOCK_DIALOG_AUTHENTICATION,
00055                               gtk.ICON_SIZE_DIALOG)
00056         image.set_alignment (0.0, 0.0)
00057         hbox.pack_start (image, False, False, 0)
00058         vbox = gtk.VBox (False, 12)
00059         self.prompt_label = gtk.Label ()
00060         vbox.pack_start (self.prompt_label, False, False, 0)
00061 
00062         num_fields = len (auth_info_required)
00063         table = gtk.Table (num_fields, 2)
00064         table.set_row_spacings (6)
00065         table.set_col_spacings (6)
00066 
00067         self.field_entry = []
00068         for i in range (num_fields):
00069             field = auth_info_required[i]
00070             label = gtk.Label (_(self.AUTH_FIELD.get (field, field)))
00071             label.set_alignment (0, 0.5)
00072             table.attach (label, 0, 1, i, i + 1)
00073             entry = gtk.Entry ()
00074             entry.set_visibility (field != 'password')
00075             table.attach (entry, 1, 2, i, i + 1, 0, 0)
00076             self.field_entry.append (entry)
00077 
00078         self.field_entry[num_fields - 1].set_activates_default (True)
00079         vbox.pack_start (table, False, False, 0)
00080         hbox.pack_start (vbox, False, False, 0)
00081         self.vbox.pack_start (hbox)
00082 
00083         if allow_remember:
00084             cb = gtk.CheckButton (_("Remember password"))
00085             cb.set_active (False)
00086             vbox.pack_start (cb)
00087             self.remember_checkbox = cb
00088 
00089         self.vbox.show_all ()


Member Function Documentation

def authconn.AuthDialog.field_grab_focus (   self,
  field 
)

Definition at line 110 of file authconn.py.

00110 
00111     def field_grab_focus (self, field):
00112         i = self.auth_info_required.index (field)
00113         self.field_entry[i].grab_focus ()

Definition at line 101 of file authconn.py.

00101 
00102     def get_auth_info (self):
00103         return map (lambda x: x.get_text (), self.field_entry)

Definition at line 104 of file authconn.py.

00104 
00105     def get_remember_password (self):
00106         try:
00107             return self.remember_checkbox.get_active ()
00108         except AttributeError:
00109             return False

def authconn.AuthDialog.set_auth_info (   self,
  auth_info 
)

Definition at line 97 of file authconn.py.

00097 
00098     def set_auth_info (self, auth_info):
00099         for i in range (len (self.field_entry)):
00100             self.field_entry[i].set_text (auth_info[i])

def authconn.AuthDialog.set_prompt (   self,
  prompt 
)

Definition at line 90 of file authconn.py.

00090 
00091     def set_prompt (self, prompt):
00092         self.prompt_label.set_markup ('<span weight="bold" size="larger">' +
00093                                       prompt + '</span>')
00094         self.prompt_label.set_use_markup (True)
00095         self.prompt_label.set_alignment (0, 0)
00096         self.prompt_label.set_line_wrap (True)


Member Data Documentation

dictionary authconn.AuthDialog.AUTH_FIELD [static]
Initial value:
{'username': N_("Username:"),
                'password': N_("Password:"),
                'domain': N_("Domain:")}

Definition at line 33 of file authconn.py.

Definition at line 46 of file authconn.py.

Definition at line 66 of file authconn.py.

Definition at line 58 of file authconn.py.

Definition at line 86 of file authconn.py.


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