commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r7806 - in trunk: gnue-common/src/datasources gnue-forms/src/uidr


From: reinhard
Subject: [gnue] r7806 - in trunk: gnue-common/src/datasources gnue-forms/src/uidrivers/curses gnue-forms/src/uidrivers/gtk2 gnue-forms/src/uidrivers/win32 gnue-forms/src/uidrivers/wx
Date: Tue, 9 Aug 2005 12:21:11 -0500 (CDT)

Author: reinhard
Date: 2005-08-09 12:21:10 -0500 (Tue, 09 Aug 2005)
New Revision: 7806

Modified:
   trunk/gnue-common/src/datasources/GLoginHandler.py
   trunk/gnue-forms/src/uidrivers/curses/UILoginHandler.py
   trunk/gnue-forms/src/uidrivers/gtk2/UILoginHandler.py
   trunk/gnue-forms/src/uidrivers/win32/UILoginHandler.py
   trunk/gnue-forms/src/uidrivers/wx/UILoginHandler.py
Log:
Cleanup, docstrings, minor name change in GLoginHandler.


Modified: trunk/gnue-common/src/datasources/GLoginHandler.py
===================================================================
--- trunk/gnue-common/src/datasources/GLoginHandler.py  2005-08-09 17:04:06 UTC 
(rev 7805)
+++ trunk/gnue-common/src/datasources/GLoginHandler.py  2005-08-09 17:21:10 UTC 
(rev 7806)
@@ -20,6 +20,9 @@
 # - Suite 330, Boston, MA 02111-1307, USA.
 #
 # $Id$
+"""
+Classes for login handlers.
+"""
 
 import getpass
 
@@ -31,6 +34,10 @@
 # =============================================================================
 
 class UserCanceledLogin (errors.UserError):
+  """
+  User cancelled login request (by pressing <Esc>, hitting the <Abort> button
+  etc.).
+  """
   def __init__ (self):
     msg = u_("User canceled the login request.")
     errors.UserError.__init__ (self, msg)
@@ -41,7 +48,14 @@
 # =============================================================================
 
 class LoginHandler:
+  """
+  Abstract base class for all login handlers.
 
+  A login handler is an object that asks the user for login data. Different
+  user interfaces (e.g. gtk2, curses, qt3...) implement different login
+  handlers.
+  """
+
   # ---------------------------------------------------------------------------
   # Get login information (depreciated)
   # ---------------------------------------------------------------------------
@@ -64,6 +78,9 @@
   # ---------------------------------------------------------------------------
 
   def destroyLoginDialog (self):
+    """
+    DEPRECIATED
+    """
     pass
 
 
@@ -106,7 +123,7 @@
       if not added:
         fields.append (errorField)
 
-    result = self._askLogin (title, fields)
+    result = self._askLogin_ (title, fields)
     if result is None:
       raise UserCanceledLogin
 
@@ -117,9 +134,10 @@
   # Do the dirty work for askLogin
   # ---------------------------------------------------------------------------
 
-  def _askLogin (self, title, fields):
+  def _askLogin_ (self, title, fields):
     """
     Descendants override this method to do all the dirty work for askLogin ().
+
     This class converts the given field definition sequence into an old style
     format as required by getLogin () and finally calls getLogin. This process
     will fade out as soon as getLogin is obsolete.
@@ -146,12 +164,13 @@
     try:
       name = len (labels) and labels [0] or ''
       desc = len (labels) > 1 and labels [1] or ''
-      return self.getLogin ([name, desc, data], error)
-
+      result = self.getLogin ([name, desc, data], error)
     finally:
       self.destroyLoginDialog ()
 
+    return result
 
+
 # =============================================================================
 # Class implementing a basic login handler using raw_input and getpass
 # =============================================================================
@@ -169,9 +188,9 @@
   def __init__ (self, useDefaults = False, silent = False):
     """
     @param useDefaults: if True, does not ask for a field if it has a default
-        other than None, but uses that default directly
+      other than None, but uses that default directly
     @param silent: if True, no output occurs and it implicitly sets useDefaults
-        to True.
+      to True.
     """
 
     self.__silent      = silent
@@ -182,7 +201,7 @@
   # Ask for all fields requestd
   # ---------------------------------------------------------------------------
 
-  def _askLogin (self, title, fields):
+  def _askLogin_ (self, title, fields):
     
     result = {}
 
@@ -250,7 +269,7 @@
   # Ask for the given fields
   # ---------------------------------------------------------------------------
 
-  def _askLogin (self, title, fields):
+  def _askLogin_ (self, title, fields):
 
     result = {}
     for (label, name, ftype, default, master, elements) in fields:

Modified: trunk/gnue-forms/src/uidrivers/curses/UILoginHandler.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/curses/UILoginHandler.py     2005-08-09 
17:04:06 UTC (rev 7805)
+++ trunk/gnue-forms/src/uidrivers/curses/UILoginHandler.py     2005-08-09 
17:21:10 UTC (rev 7806)
@@ -36,11 +36,9 @@
   # Get input for all fields listed in loginData
   # ---------------------------------------------------------------------------
 
-  def _askLogin (self, title, fields):
+  def _askLogin_ (self, title, fields):
 
     dlg = dialogs.InputDialog (title, fields, self.uiDriver.attr)
 
     dlg.run ()
     return dlg.inputData
-
-

Modified: trunk/gnue-forms/src/uidrivers/gtk2/UILoginHandler.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/gtk2/UILoginHandler.py       2005-08-09 
17:04:06 UTC (rev 7805)
+++ trunk/gnue-forms/src/uidrivers/gtk2/UILoginHandler.py       2005-08-09 
17:21:10 UTC (rev 7806)
@@ -37,7 +37,7 @@
   # Create an instance of an InputDialog and return it's result
   # ---------------------------------------------------------------------------
 
-  def _askLogin (self, title, fields):
+  def _askLogin_ (self, title, fields):
 
     lfields = fields [:]
     if lfields [0][2] != 'image':
@@ -54,7 +54,8 @@
 
     try:
       dlg.run ()
-      return dlg.inputData
-
+      result = dlg.inputData
     finally:
       dlg.destroy ()
+
+    return result

Modified: trunk/gnue-forms/src/uidrivers/win32/UILoginHandler.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/win32/UILoginHandler.py      2005-08-09 
17:04:06 UTC (rev 7805)
+++ trunk/gnue-forms/src/uidrivers/win32/UILoginHandler.py      2005-08-09 
17:21:10 UTC (rev 7806)
@@ -33,13 +33,13 @@
 
 
 class UILoginHandler(GLoginHandler.LoginHandler):
-
+
   # ---------------------------------------------------------------------------
   # Create an instance of an InputDialog and return it's result
   # ---------------------------------------------------------------------------
 
-  def _askLogin (self, title, fields):
-
+  def _askLogin_ (self, title, fields):
+
     lfields = fields [:]
     if lfields [0][2] != 'image':
       imageFile = gConfigForms('loginBMP')
@@ -55,7 +55,8 @@
 
     try:
       dlg.DoModal ()
-      return dlg.inputData
-
+      result = dlg.inputData
     finally:
       dlg.Destroy ()
+
+    return result

Modified: trunk/gnue-forms/src/uidrivers/wx/UILoginHandler.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx/UILoginHandler.py 2005-08-09 17:04:06 UTC 
(rev 7805)
+++ trunk/gnue-forms/src/uidrivers/wx/UILoginHandler.py 2005-08-09 17:21:10 UTC 
(rev 7806)
@@ -36,21 +36,10 @@
 class UILoginHandler (GLoginHandler.LoginHandler):
 
   # ---------------------------------------------------------------------------
-  # Constructor
-  # ---------------------------------------------------------------------------
-
-  def __init__ (self):
-
-    self._wxapp = getWxApp ()
-
-
-  # ---------------------------------------------------------------------------
   # Prompt for all fields
   # ---------------------------------------------------------------------------
 
-  def _askLogin (self, title, fields):
-    """
-    """
+  def _askLogin_ (self, title, fields):
 
     lfields = fields [:]
     if lfields [0][2] != 'image':
@@ -67,7 +56,8 @@
     
     try:
       dialog.ShowModal ()
-      return dialog.inputData
-
+      result = dialog.inputData
     finally:
       dialog.Destroy ()
+
+    return result





reply via email to

[Prev in Thread] Current Thread [Next in Thread]