commit-gnue
[Top][All Lists]
Advanced

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

[gnue] r8368 - trunk/gnue-forms/src/GFObjects


From: johannes
Subject: [gnue] r8368 - trunk/gnue-forms/src/GFObjects
Date: Wed, 5 Apr 2006 04:56:29 -0500 (CDT)

Author: johannes
Date: 2006-04-05 04:56:28 -0500 (Wed, 05 Apr 2006)
New Revision: 8368

Modified:
   trunk/gnue-forms/src/GFObjects/GFBlock.py
   trunk/gnue-forms/src/GFObjects/GFEntry.py
   trunk/gnue-forms/src/GFObjects/GFImage.py
   trunk/gnue-forms/src/GFObjects/GFLabel.py
   trunk/gnue-forms/src/GFObjects/GFLayout.py
   trunk/gnue-forms/src/GFObjects/GFLogic.py
   trunk/gnue-forms/src/GFObjects/GFOption.py
   trunk/gnue-forms/src/GFObjects/GFOptions.py
   trunk/gnue-forms/src/GFObjects/GFPage.py
   trunk/gnue-forms/src/GFObjects/GFParameter.py
   trunk/gnue-forms/src/GFObjects/GFScrollBar.py
   trunk/gnue-forms/src/GFObjects/GFTabStop.py
   trunk/gnue-forms/src/GFObjects/GFValue.py
   trunk/gnue-forms/src/GFObjects/__init__.py
Log:
Pep8-ification


Modified: trunk/gnue-forms/src/GFObjects/GFBlock.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFBlock.py   2006-04-05 09:16:05 UTC (rev 
8367)
+++ trunk/gnue-forms/src/GFObjects/GFBlock.py   2006-04-05 09:56:28 UTC (rev 
8368)
@@ -261,12 +261,12 @@
   # Register a scrollbar widget
   # ---------------------------------------------------------------------------
 
-  def registerScrollbar (self, widget):
+  def register_scrollbar (self, widget):
     """
     Register a given scrollbar widget to the block. This widget will be
     notified on record movement. It has to implement a method
-    'doAdjustScrollbar', taking the current record and the number of records as
-    arguments.
+    'do_adjust_scrollbar', taking the current record and the number of records
+    as arguments.
     """
 
     self._scrollbars.append (widget)
@@ -718,7 +718,7 @@
 
     # Adjusting scrollbars
     for sb in self._scrollbars:
-      sb.doAdjustScrollbar (self.__visibleStart,
+      sb.do_adjust_scrollbar (self.__visibleStart,
           max (self._recordCount, self.__visibleStart + self._rows))
 
   # ---------------------------------------------------------------------------
@@ -976,7 +976,7 @@
 
     # Adjusting scrollbars
     for sb in self._scrollbars:
-      sb.doAdjustScrollbar (self._currentRecord, self._recordCount)
+      sb.do_adjust_scrollbar (self._currentRecord, self._recordCount)
 
 
   # ---------------------------------------------------------------------------

Modified: trunk/gnue-forms/src/GFObjects/GFEntry.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFEntry.py   2006-04-05 09:16:05 UTC (rev 
8367)
+++ trunk/gnue-forms/src/GFObjects/GFEntry.py   2006-04-05 09:56:28 UTC (rev 
8368)
@@ -26,145 +26,140 @@
 """
 
 from gnue.forms.input import displayHandlers
-from GFTabStop import GFTabStop
+from gnue.forms.GFObjects.GFTabStop import GFTabStop
 
 # =============================================================================
 # Class for data entry widgets
 # =============================================================================
 
-class GFEntry (GFTabStop):
+class GFEntry(GFTabStop):
 
-  # ---------------------------------------------------------------------------
-  # Constructor
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Constructor
+    # -------------------------------------------------------------------------
 
-  def __init__ (self, parent = None, value = None):
+    def __init__(self, parent=None, value=None):
 
-    GFTabStop.__init__ (self, parent, 'GFEntry')
+        GFTabStop.__init__(self, parent, 'GFEntry')
 
-    # Default attributes (these may be replaced by parser)
-    self.Char__height = int (gConfigForms ('widgetHeight'))
-    self.Char__width  = int (gConfigForms ('widgetWidth'))
-    self.style = "default"
-    self.label = ""
+        # Default attributes (these may be replaced by parser)
+        self.Char__height = int(gConfigForms('widgetHeight'))
+        self.Char__width  = int(gConfigForms('widgetWidth'))
+        self.style = "default"
+        self.label = ""
 
-    # Trigger exposure
-    self._validTriggers = {'PRE-FOCUSOUT'     : 'Pre-FocusOut',
-                           'POST-FOCUSOUT'    : 'Post-FocusOut',
-                           'PRE-FOCUSIN'      : 'Pre-FocusIn',
-                           'POST-FOCUSIN'     : 'Post-FocusIn',
-                           'ON-NEXT-ENTRY'    : 'On-Next-Entry',
-                           'ON-PREVIOUS-ENTRY': 'On-Previous-Entry'}
+        # Trigger exposure
+        self._validTriggers = {
+            'PRE-FOCUSOUT'     : 'Pre-FocusOut',
+            'POST-FOCUSOUT'    : 'Post-FocusOut',
+            'PRE-FOCUSIN'      : 'Pre-FocusIn',
+            'POST-FOCUSIN'     : 'Post-FocusIn',
+            'ON-NEXT-ENTRY'    : 'On-Next-Entry',
+            'ON-PREVIOUS-ENTRY': 'On-Previous-Entry'}
 
-    self._triggerFunctions = {'set': {'function': self.triggerSetValue},
-                              'get': {'function': self.getValue}}
-    self._triggerSet = self.triggerSetValue
-    self._triggerGet = self.getValue
+        self._triggerFunctions = {'set': {'function': self.triggerSetValue},
+                                  'get': {'function': self.getValue}}
+        self._triggerSet = self.triggerSetValue
+        self._triggerGet = self.getValue
 
-    self._triggerProperties = {
-          'rows':     {'get': self.triggerGetRows},
-          'value':    {'set': self.triggerSetValue,
-                       'get': self.getValue },
-          'hidden':   {'set': self.triggerSetHidden,
-                       'get': self.triggerGetHidden },
-          'navigable':{'set': self.triggerSetNavigable,
-                       'get': self.triggerGetNavigable },
-    }
+        self._triggerProperties = {
+              'rows':     {'get': self.triggerGetRows},
+              'value':    {'set': self.triggerSetValue,
+                           'get': self.getValue},
+              'hidden':   {'set': self.triggerSetHidden,
+                           'get': self.triggerGetHidden},
+              'navigable':{'set': self.triggerSetNavigable,
+                           'get': self.triggerGetNavigable},
+        }
 
 
-  # ---------------------------------------------------------------------------
-  # Phase I init
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Phase I init
+    # -------------------------------------------------------------------------
 
-  def _phase_1_init_ (self):
-    """
-    On Phase 1 initialization add the entry to the owning blocks' entry list as
-    well as to the pages' field list.
-    """
+    def _phase_1_init_(self):
+        """
+        On Phase 1 initialization add the entry to the owning blocks' entry
+        list as well as to the pages' field list.
+        """
 
-    GFTabStop._phase_1_init_ (self)
+        GFTabStop._phase_1_init_(self)
 
-    self._block = self.get_block ()
-    self._block._entryList.append (self)
+        self._block = self.get_block()
+        self._block._entryList.append(self)
 
-    self._field = self.get_field ()
-    self._field._entryList.append (self)
+        self._field = self.get_field()
+        self._field._entryList.append(self)
 
-    # Have a look wether the entry will be navigable or not
-    if self.style == 'label':
-      self.navigable = False
+        # Have a look wether the entry will be navigable or not
+        if self.style == 'label':
+            self.navigable = False
 
-    self._formatmask  = ""
-    self._inputmask   = getattr (self, 'inputmask', '')
-    self._displaymask = getattr (self, 'displaymask', '')
+        self._formatmask  = ""
+        self._inputmask   = getattr(self, 'inputmask', '')
+        self._displaymask = getattr(self, 'displaymask', '')
 
-    # Associate a display handler with this instance
-    self._displayHandler = displayHandlers.factory (self,
+        # Associate a display handler with this instance
+        self._displayHandler = displayHandlers.factory(self,
                              self._form._instance.eventController,
                              self.subEventHandler,
                              self._displaymask,
                              self._inputmask)
 
-    # Row settings
-    self._rows = getattr (self, 'rows', self._field._rows)
-    self._gap  = getattr (self, 'rowSpacer', self._field._gap)
+        # Row settings
+        self._rows = getattr(self, 'rows', self._field._rows)
+        self._gap  = getattr(self, 'rowSpacer', self._field._gap)
 
 
-  # ---------------------------------------------------------------------------
-  # Implementation of virtual methods
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Implementation of virtual methods
+    # -------------------------------------------------------------------------
 
-  def _is_navigable_ (self, mode):
+    def _is_navigable_(self, mode):
 
-    return self.navigable and self._block.navigable and not self.hidden
+        return self.navigable and self._block.navigable and not self.hidden
 
 
-  # ===========================================================================
-  # Trigger functions
-  # ===========================================================================
+    # =========================================================================
+    # Trigger functions
+    # =========================================================================
 
-  def getValue (self, *args, **parms):
+    def getValue(self, *args, **parms):
 
-    return self._field.getValue (*args, **parms)
+        return self._field.getValue(*args, **parms)
 
+    # -------------------------------------------------------------------------
 
-  # ---------------------------------------------------------------------------
+    def triggerSetValue(self, *args, **parms):
 
-  def triggerSetValue (self, *args, **parms):
+        return self._field.triggerSetValue(*args, **parms)
 
-    return self._field.triggerSetValue (*args, **parms)
+    # -------------------------------------------------------------------------
 
+    def triggerGetRows(self):
 
-  # ---------------------------------------------------------------------------
+        return self._rows
 
-  def triggerGetRows (self):
+    # -------------------------------------------------------------------------
 
-    return self._rows
+    def triggerSetHidden(self, value):
 
+        self.hidden = bool(value)
 
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
 
-  def triggerSetHidden (self, value):
+    def triggerGetHidden(self):
 
-    self.hidden = bool (value)
+        return self.hidden
 
+    # -------------------------------------------------------------------------
 
-  # ---------------------------------------------------------------------------
+    def triggerSetNavigable(self, value):
 
-  def triggerGetHidden (self):
+        self.navigable = bool(value)
 
-    return self.hidden
+    # -------------------------------------------------------------------------
 
+    def triggerGetNavigable(self):
 
-  # ---------------------------------------------------------------------------
-
-  def triggerSetNavigable (self, value):
-
-    self.navigable = bool (value)
-
-
-  # ---------------------------------------------------------------------------
-
-  def triggerGetNavigable (self):
-
-    return self.navigable
+        return self.navigable

Modified: trunk/gnue-forms/src/GFObjects/GFImage.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFImage.py   2006-04-05 09:16:05 UTC (rev 
8367)
+++ trunk/gnue-forms/src/GFObjects/GFImage.py   2006-04-05 09:56:28 UTC (rev 
8368)
@@ -24,58 +24,58 @@
 Wrapper class for image objects
 """
 
-from GFTabStop import GFTabStop
 from gnue.forms.input import displayHandlers
+from gnue.forms.GFObjects.GFTabStop import GFTabStop
 
 
 # =============================================================================
 # Image objects
 # =============================================================================
 
-class GFImage (GFTabStop):
+class GFImage(GFTabStop):
 
-  # ---------------------------------------------------------------------------
-  # Constructor
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Constructor
+    # -------------------------------------------------------------------------
 
-  def __init__ (self, parent = None, value = None):
+    def __init__(self, parent=None, value=None):
 
-    GFTabStop.__init__ (self, parent, 'GFImage')
+        GFTabStop.__init__(self, parent, 'GFImage')
 
-    # Default attributes (these may be replaced by parser)
-    self.type = "URL"
-    self.Char__height = int (gConfigForms ('widgetHeight'))
+        # Default attributes (these may be replaced by parser)
+        self.type = "URL"
+        self.Char__height = int(gConfigForms('widgetHeight'))
 
 
-  # ---------------------------------------------------------------------------
-  # Get the current value
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Get the current value
+    # -------------------------------------------------------------------------
 
-  def getValue (self, *args, **kwargs):
+    def getValue(self, *args, **kwargs):
 
-    return self._field.getValue (*args, **kwargs)
+        return self._field.getValue(*args, **kwargs)
 
 
-  # ---------------------------------------------------------------------------
-  # Implementation of virtual methods
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Implementation of virtual methods
+    # -------------------------------------------------------------------------
 
-  def _phase_1_init_ (self):
+    def _phase_1_init_(self):
 
-    GFTabStop._phase_1_init_ (self)
+        GFTabStop._phase_1_init_(self)
 
-    self._block = self.get_block ()
-    self._block._entryList.append (self)
+        self._block = self.get_block()
+        self._block._entryList.append(self)
 
-    self._field = self.get_field ()
-    self._field._entryList.append (self)
+        self._field = self.get_field()
+        self._field._entryList.append(self)
 
-    self._displayHandler = displayHandlers.factory (self,
+        self._displayHandler = displayHandlers.factory(self,
                               self._form._instance.eventController,
                               self.subEventHandler, None, None)
 
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
 
-  def _is_navigable_ (self, mode):
+    def _is_navigable_(self, mode):
 
-    return False
+        return False

Modified: trunk/gnue-forms/src/GFObjects/GFLabel.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFLabel.py   2006-04-05 09:16:05 UTC (rev 
8367)
+++ trunk/gnue-forms/src/GFObjects/GFLabel.py   2006-04-05 09:56:28 UTC (rev 
8368)
@@ -24,39 +24,39 @@
 A class wrapping static text objects
 """
 
-from GFObj import GFObj
+from gnue.forms.GFObjects.GFObj import GFObj
 
 # =============================================================================
 # A generic text class
 # =============================================================================
 
-class GFLabel (GFObj):
+class GFLabel(GFObj):
 
-  # ---------------------------------------------------------------------------
-  # Constructor
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Constructor
+    # -------------------------------------------------------------------------
 
-  def __init__ (self, parent = None):
+    def __init__(self, parent=None):
 
-    GFObj.__init__ (self, parent, 'GFLabel')
+        GFObj.__init__(self, parent, 'GFLabel')
 
-    # Default attributes (these may be replaced by parser)
-    self.alignment    = "left"
-    self.Char__height = int (gConfigForms ('widgetHeight'))
+        # Default attributes (these may be replaced by parser)
+        self.alignment = "left"
+        self.Char__height = int(gConfigForms('widgetHeight'))
 
 
-  # ---------------------------------------------------------------------------
-  # Implementation of virtual methods
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Implementation of virtual methods
+    # -------------------------------------------------------------------------
 
-  def _phase_1_init_ (self):
-    """
-    On phase 1 initialization make sure to get the current value of the rows-
-    and rowSpacer-attribute. Since a GFLabel has no block it won't be set
-    otherwise.
-    """
+    def _phase_1_init_ (self):
+        """
+        On phase 1 initialization make sure to get the current value of the
+        rows- and rowSpacer-attribute. Since a GFLabel has no block it won't be
+        set otherwise.
+        """
 
-    GFObj._phase_1_init_ (self)
+        GFObj._phase_1_init_(self)
 
-    self._rows = getattr (self, 'rows', self._rows)
-    self._gap  = getattr (self, 'rowSpacer', self._gap)
+        self._rows = getattr(self, 'rows', self._rows)
+        self._gap  = getattr(self, 'rowSpacer', self._gap)

Modified: trunk/gnue-forms/src/GFObjects/GFLayout.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFLayout.py  2006-04-05 09:16:05 UTC (rev 
8367)
+++ trunk/gnue-forms/src/GFObjects/GFLayout.py  2006-04-05 09:56:28 UTC (rev 
8368)
@@ -24,80 +24,79 @@
 Handles the <layout> tag.
 """
 
-from gnue.common.apps import GDebug
-from GFObj import GFObj
+from gnue.forms.GFObjects.GFObj import GFObj
 
 
 # =============================================================================
 # Class implementing the layout tag
 # =============================================================================
 
-class GFLayout (GFObj):
+class GFLayout(GFObj):
 
-  # ---------------------------------------------------------------------------
-  # Constructor
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Constructor
+    # -------------------------------------------------------------------------
 
-  def __init__ (self, parent = None):
+    def __init__(self, parent=None):
 
-    GFObj.__init__ (self, parent, "GFLayout")
+        GFObj.__init__(self, parent, "GFLayout")
 
-    self._pageList      = []
-    self.tabbed         = 'none'
-    self._triggerGlobal = 1
+        self._pageList = []
+        self.tabbed = 'none'
+        self._triggerGlobal = 1
 
 
-  # ---------------------------------------------------------------------------
-  # Object creation
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Object creation
+    # -------------------------------------------------------------------------
 
-  def _buildObject (self):
+    def _buildObject(self):
 
-    # TODO: This is temporary until layout management support works
-    self.walk (self.__addxy)
+        # TODO: This is temporary until layout management support works
+        self.walk(self.__addxy)
 
-    return GFObj._buildObject (self)
+        return GFObj._buildObject(self)
 
 
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
 
-  def __addxy (self, object):
+    def __addxy(self, object):
 
-    for attr in ('x','y','height','width'):
-      try:
-        v = int (object.__dict__ ['Char__%s' % attr])
-        object.__dict__ ['Char__%s' % attr] = v
-        object.__dict__ ['_Layout__%s' % attr] = v
+        for attr in ('x','y','height','width'):
+            try:
+                v = int(object.__dict__['Char__%s' % attr])
+                object.__dict__['Char__%s' % attr] = v
+                object.__dict__['_Layout__%s' % attr] = v
 
-      except KeyError:
-        pass
+            except KeyError:
+                pass
 
 
-  # ---------------------------------------------------------------------------
-  # Implementation of virtual methods
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Implementation of virtual methods
+    # -------------------------------------------------------------------------
 
-  def _phase_1_init_ (self):
+    def _phase_1_init_(self):
 
-    GFObj._phase_1_init_ (self)
-    self._xmlchildnamespaces = self.__findNamespaces (self)
+        GFObj._phase_1_init_(self)
+        self._xmlchildnamespaces = self.__findNamespaces(self)
 
 
-  # ---------------------------------------------------------------------------
-  # Find the XML namespace in use by any child objects
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Find the XML namespace in use by any child objects
+    # -------------------------------------------------------------------------
 
-  def __findNamespaces (self, object):
+    def __findNamespaces(self, object):
 
-    ns = {}
-    for child in object._children:
-      try:
-        if child._xmlnamespaces:
-          ns.update (list (child._xmlnamespaces))
-        else:
-          ns.update (self._findNamespace (child))
+        ns = {}
+        for child in object._children:
+            try:
+                if child._xmlnamespaces:
+                    ns.update(list(child._xmlnamespaces))
+                else:
+                    ns.update(self._findNamespace(child))
 
-      except AttributeError:
-        pass
+            except AttributeError:
+                pass
 
-    return ns
+        return ns

Modified: trunk/gnue-forms/src/GFObjects/GFLogic.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFLogic.py   2006-04-05 09:16:05 UTC (rev 
8367)
+++ trunk/gnue-forms/src/GFObjects/GFLogic.py   2006-04-05 09:56:28 UTC (rev 
8368)
@@ -1,6 +1,9 @@
+# GNU Enterprise Forms - GFObjects - Logic tag
 #
-# This file is part of GNU Enterprise.
+# Copyright 2001-2006 Free Software Foundation
 #
+# This file is part of GNU Enterprise
+#
 # GNU Enterprise is free software; you can redistribute it
 # and/or modify it under the terms of the GNU General Public
 # License as published by the Free Software Foundation; either
@@ -16,30 +19,30 @@
 # write to the Free Software Foundation, Inc., 59 Temple Place
 # - Suite 330, Boston, MA 02111-1307, USA.
 #
-# Copyright 2000-2006 Free Software Foundation
-#
-#
-# FILE:
-# GFLogic.py
-#
-# DESCRIPTION:
+# $Id$
 """
 Handles the <logic> tag.
 """
-# NOTES:
-#
-# HISTORY:
-#
 
-import string
-from GFObj import GFObj
+from gnue.forms.GFObjects.GFObj import GFObj
 
+# =============================================================================
+# Wrapper for the logic tag
+# =============================================================================
 
 class GFLogic(GFObj):
-  def __init__(self, parent=None):
-    GFObj.__init__(self, parent, "GFLogic")
-    self._blockMap = {}
-    self._blockList = []
+    """
+    The logic tag is a container for all business logic elements like, blocks,
+    fields, block-level and field-level triggers.
+    """
 
-  def _buildObject(self):
-    return GFObj._buildObject(self)
+    # -------------------------------------------------------------------------
+    # Constructor
+    # -------------------------------------------------------------------------
+
+    def __init__(self, parent=None):
+
+        GFObj.__init__(self, parent, "GFLogic")
+
+        self._blockMap = {}
+        self._blockList = []

Modified: trunk/gnue-forms/src/GFObjects/GFOption.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFOption.py  2006-04-05 09:16:05 UTC (rev 
8367)
+++ trunk/gnue-forms/src/GFObjects/GFOption.py  2006-04-05 09:56:28 UTC (rev 
8368)
@@ -1,53 +1,57 @@
+# GNU Enterprise Forms - GFObjects - Option elements
 #
-# This file is part of GNU Enterprise.
+# Copyright 2001-2006 Free Software Foundation
 #
-# GNU Enterprise is free software; you can redistribute it 
+# This file is part of GNU Enterprise
+#
+# GNU Enterprise is free software; you can redistribute it
 # and/or modify it under the terms of the GNU General Public
-# License as published by the Free Software Foundation; either 
+# License as published by the Free Software Foundation; either
 # version 2, or (at your option) any later version.
 #
-# GNU Enterprise is distributed in the hope that it will be 
-# useful, but WITHOUT ANY WARRANTY; without even the implied 
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 # PURPOSE. See the GNU General Public License for more details.
 #
-# You should have received a copy of the GNU General Public 
-# License along with program; see the file COPYING. If not, 
-# write to the Free Software Foundation, Inc., 59 Temple Place 
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
 # - Suite 330, Boston, MA 02111-1307, USA.
 #
-# Copyright 2000-2006 Free Software Foundation
-#
-# FILE:
-# GFObjects.py
-#
-# DESCRIPTION:
+# $Id$
 """
 Option support
 """
-# NOTES:
-#
 
-from gnue.common.definitions.GObjects import * 
+from gnue.forms.GFObjects.GFObj import GFObj
 
-# GFOption
-#
-class GFOption(GObj):
-  def __init__(self, parent=None, name="", value=None):
-    GObj.__init__(self, parent)
-    self._type = "GFOption"
-    self.name = name
-    self.value = value
+# =============================================================================
+# Wrapper for an options element
+# =============================================================================
 
-  def _buildObject(self):
-    if self.value == None:
-      self.value = self.getChildrenAsContent()
-      self._children = []
-    return GObj._buildObject(self)
+class GFOption(GFObj):
 
+    # -------------------------------------------------------------------------
+    # Constructor
+    # -------------------------------------------------------------------------
 
+    def __init__(self, parent=None, name="", value=None):
 
+        GFObj.__init__(self, parent, 'GFOption')
 
+        self.name = name
+        self.value = value
 
 
+    # -------------------------------------------------------------------------
+    # Object initialization
+    # -------------------------------------------------------------------------
 
+    def _buildObject(self):
+
+        if self.value == None:
+            self.value = self.getChildrenAsContent()
+            self._children = []
+
+        return GFObj._buildObject(self)

Modified: trunk/gnue-forms/src/GFObjects/GFOptions.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFOptions.py 2006-04-05 09:16:05 UTC (rev 
8367)
+++ trunk/gnue-forms/src/GFObjects/GFOptions.py 2006-04-05 09:56:28 UTC (rev 
8368)
@@ -1,47 +1,41 @@
+# GNU Enterprise Forms - GFObjects - Options container
 #
-# This file is part of GNU Enterprise.
+# Copyright 2001-2006 Free Software Foundation
 #
-# GNU Enterprise is free software; you can redistribute it 
-# and/or modify it under the terms of the GNU General Public 
-# License as published by the Free Software Foundation; either 
+# This file is part of GNU Enterprise
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
 # version 2, or (at your option) any later version.
 #
-# GNU Enterprise is distributed in the hope that it will be 
-# useful, but WITHOUT ANY WARRANTY; without even the implied 
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 # PURPOSE. See the GNU General Public License for more details.
 #
-# You should have received a copy of the GNU General Public 
-# License along with program; see the file COPYING. If not, 
-# write to the Free Software Foundation, Inc., 59 Temple Place 
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
 # - Suite 330, Boston, MA 02111-1307, USA.
 #
-# Copyright 2000-2006 Free Software Foundation
-#
-# FILE:
-# GFObjects.py
-#
-# DESCRIPTION:
+# $Id$
 """
 Options container support
 """
-# NOTES:
-#
 
-from gnue.common.definitions.GObjects import * 
+from gnue.forms.GFObjects.GFObj import GFObj
 
-#
-# GFOptions
-#
-class GFOptions(GObj):
-  def __init__(self, parent=None):
-    GObj.__init__(self, parent)
-    self._type = "GFOptions"
+# =============================================================================
+# Collection of options
+# =============================================================================
 
+class GFOptions(GFObj):
 
+    # -------------------------------------------------------------------------
+    # Constructor
+    # -------------------------------------------------------------------------
 
+    def __init__(self, parent=None):
 
-
-
-
-
+        GFObj.__init__(self, parent, 'GFOptions')

Modified: trunk/gnue-forms/src/GFObjects/GFPage.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFPage.py    2006-04-05 09:16:05 UTC (rev 
8367)
+++ trunk/gnue-forms/src/GFObjects/GFPage.py    2006-04-05 09:56:28 UTC (rev 
8368)
@@ -24,7 +24,7 @@
 Logical page support
 """
 
-from GFContainer import GFContainer
+from gnue.forms.GFObjects.GFContainer import GFContainer
 
 # =============================================================================
 # Implementation of a logical page object
@@ -32,35 +32,35 @@
 
 class GFPage(GFContainer):
 
-  # ---------------------------------------------------------------------------
-  # Constructor
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Constructor
+    # -------------------------------------------------------------------------
 
-  def __init__ (self, parent = None):
+    def __init__(self, parent=None):
 
-    GFContainer.__init__ (self, parent, "GFPage")
+        GFContainer.__init__(self, parent, "GFPage")
 
-    self._validTriggers = {
-      'PRE-FOCUSOUT' : 'Pre-FocusOut',
-      'POST-FOCUSOUT': 'Post-FocusOut',
-      'PRE-FOCUSIN'  : 'Pre-FocusIn',
-      'POST-FOCUSIN' : 'Post-FocusIn',
-    }
+        self._validTriggers = {
+            'PRE-FOCUSOUT' : 'Pre-FocusOut',
+            'POST-FOCUSOUT': 'Post-FocusOut',
+            'PRE-FOCUSIN'  : 'Pre-FocusIn',
+            'POST-FOCUSIN' : 'Post-FocusIn',
+        }
 
-    self._entryList = []
+        self._entryList = []
 
 
-  # ---------------------------------------------------------------------------
-  # Implementation of virtual methods
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Implementation of virtual methods
+    # -------------------------------------------------------------------------
 
-  def _phase_1_init_ (self):
-    """
-    On phase 1 initialization a logical page registers itself at the logic
-    object.
-    """
+    def _phase_1_init_(self):
+        """
+        On phase 1 initialization a logical page registers itself at the logic
+        object.
+        """
 
-    GFContainer._phase_1_init_ (self)
+        GFContainer._phase_1_init_(self)
 
-    layout = self.findParentOfType ('GFLayout')
-    layout._pageList.append (self)
+        layout = self.findParentOfType('GFLayout')
+        layout._pageList.append(self)

Modified: trunk/gnue-forms/src/GFObjects/GFParameter.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFParameter.py       2006-04-05 09:16:05 UTC 
(rev 8367)
+++ trunk/gnue-forms/src/GFObjects/GFParameter.py       2006-04-05 09:56:28 UTC 
(rev 8368)
@@ -1,76 +1,125 @@
+# GNU Enterprise Forms - GFObjects - Paramters
 #
-# This file is part of GNU Enterprise.
+# Copyright 2001-2006 Free Software Foundation
 #
-# GNU Enterprise is free software; you can redistribute it 
-# and/or modify it under the terms of the GNU General Public 
-# License as published by the Free Software Foundation; either 
+# This file is part of GNU Enterprise
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
 # version 2, or (at your option) any later version.
 #
-# GNU Enterprise is distributed in the hope that it will be 
-# useful, but WITHOUT ANY WARRANTY; without even the implied 
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
 # PURPOSE. See the GNU General Public License for more details.
 #
-# You should have received a copy of the GNU General Public 
+# You should have received a copy of the GNU General Public
 # License along with program; see the file COPYING. If not,
 # write to the Free Software Foundation, Inc., 59 Temple Place
 # - Suite 330, Boston, MA 02111-1307, USA.
 #
-# Copyright 2000-2006 Free Software Foundation
-#
-#
-# FILE:
-# GFParameters.py
-#
-# DESCRIPTION:
+# $Id$
 """
 Parameter support
 """
-# NOTES:
-#
 
-from GFObj import GFObj
 from gnue.common.datasources import GConditions
-import string
+from gnue.forms.GFObjects.GFObj import GFObj
+from gnue.common.definitions import GParser
 
-#
-#
-#
+# =============================================================================
+# Exceptions
+# =============================================================================
+
+class ParameterNotFoundError(GParser.MarkupError):
+    def __init__(self, name, cp):
+        msg = u_("Parameter '%(name)s' not defined in the form") \
+              % {'name': name}
+        GParser.MarkupError.__init__(self, msg, cp._url, cp._lineNumber)
+
+# =============================================================================
+# Wrapper for a single forms parameter
+# =============================================================================
+
 class GFParameter(GFObj):
-  def __init__(self, parent=None):
-    GFObj.__init__(self, parent, 'GFParameter')
+    """
+    This object defines the available parameters of a form.
+    """
 
+    # -------------------------------------------------------------------------
+    # Constructor
+    # -------------------------------------------------------------------------
 
-  def _buildObject(self):
-    self._name = string.lower(self.name)
-    return GFObj._buildObject(self)
+    def __init__(self, parent=None):
 
-#
-#
-#
+        GFObj.__init__(self, parent, 'GFParameter')
+
+
+    # -------------------------------------------------------------------------
+    # Object initialization
+    # -------------------------------------------------------------------------
+
+    def _buildObject(self):
+
+      self._name = self.name.lower()
+      return GFObj._buildObject(self)
+
+
+# =============================================================================
+# A parameter for datasource conditions
+# =============================================================================
+
 class GFCParam(GConditions.GCParam):
+    """
+    Parameter used in conditions. The referenced parameter must be defined in
+    the form using a GFParameter tag.
+    """
 
-  def __init__(self, parent=None):
-    GConditions.GCParam.__init__(self, parent)
-    self._inits.append(self.initialize)
-    self._type = "GFCParam"
+    # -------------------------------------------------------------------------
+    # Constructor
+    # -------------------------------------------------------------------------
 
+    def __init__(self, parent=None):
 
-  def initialize(self):
-    self._name = string.lower(self.name)
-    self._form = self.findParentOfType('GFForm')
-    for param in self._form._children:
-      if isinstance(param, GFParameter) and param._name == self._name:
-        self._parameter = param
-        break
+        GConditions.GCParam.__init__(self, parent)
+        self._type = "GFCParam"
+        self._inits.append(self.__phase_1_init)
 
 
-  def getValue(self):
-      val = self._form.getParameter(self._name)
-      if val is None:
-        return ""
-      elif self._parameter.type == 'number':
-        return float(val)
-      else:
-        return "%s" % val
+    # -------------------------------------------------------------------------
+    # Phase 1 initialization
+    # -------------------------------------------------------------------------
 
+    def __phase_1_init(self):
+
+        self._name = self.name.lower()
+        self._form = self.findParentOfType('GFForm')
+        self._parameter = None
+
+        for param in self._form._children:
+            if isinstance(param, GFParameter) and param._name == self._name:
+                self._parameter = param
+                break
+
+        if not self._parameter:
+            raise ParameterNotFoundError (self.name,self)
+
+
+    # -------------------------------------------------------------------------
+    # Get the current value of a parameter
+    # -------------------------------------------------------------------------
+
+    def getValue(self):
+        """
+        Return the value of the parameter. If the parameters' type is 'number'
+        the value will be a float, otherwise a string
+        """
+
+        val = self._form.getParameter(self._name)
+        if val is None:
+            return ""
+        elif self._parameter.type == 'number':
+            return float(val)
+        else:
+            return "%s" % val

Modified: trunk/gnue-forms/src/GFObjects/GFScrollBar.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFScrollBar.py       2006-04-05 09:16:05 UTC 
(rev 8367)
+++ trunk/gnue-forms/src/GFObjects/GFScrollBar.py       2006-04-05 09:56:28 UTC 
(rev 8368)
@@ -27,96 +27,96 @@
 from gnue.common.apps import errors
 from gnue.forms.GFObjects.GFObj import GFObj
 
+
 # =============================================================================
 # GFScrollBar
 # =============================================================================
 
-class GFScrollBar (GFObj):
+class GFScrollBar(GFObj):
   
-  # ---------------------------------------------------------------------------
-  # Constructor
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Constructor
+    # -------------------------------------------------------------------------
 
-  def __init__ (self, parent = None):
+    def __init__(self, parent=None):
 
-    GFObj.__init__ (self, parent)
+        GFObj.__init__ (self, parent, 'GFScrollBar')
 
-    self._type = "GFScrollBar"
-    self.label = ""
-    self._scrollrows  = 1
+        self.label = ""
+        self._scrollrows  = 1
 
 
-  # ---------------------------------------------------------------------------
-  # Phase I init: find the parent GFForm and the bound GFBlock
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Phase I init: find the parent GFForm and the bound GFBlock
+    # -------------------------------------------------------------------------
 
-  def _phase_1_init_(self):
+    def _phase_1_init_(self):
 
-    GFObj._phase_1_init_(self)
+        GFObj._phase_1_init_(self)
 
-    self._block = self.get_block()
-    self._block.registerScrollbar (self)
+        self._block = self.get_block()
+        self._block.register_scrollbar(self)
 
-    self._scrollrows = getattr (self, 'scrollrows', self._block._rows)
+        self._scrollrows = getattr(self, 'scrollrows', self._block._rows)
 
 
-  # ---------------------------------------------------------------------------
-  # Get the number of records and rows of the wrapped block
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Get the number of records and rows of the wrapped block
+    # -------------------------------------------------------------------------
 
-  def getRecordAndPageCount (self):
-    """
-    Get the current record, the number of records and the number of rows of the
-    underlying block. The number of rows is usable as a page size.
+    def get_record_and_page_count(self):
+        """
+        Get the current record, the number of records and the number of rows of
+        the underlying block. The number of rows is usable as a page size.
 
-    @return: tuple (current-record, record-count, rows)
-    """
+        @return: tuple (current-record, record-count, rows)
+        """
 
-    try:
-      return (self._block._currentRecord, self._block._recordCount,
-        self._scrollrows)
-    except AttributeError:
-      # let designer start
-      return (0, 0, 1)
+        try:
+            return (self._block._currentRecord, self._block._recordCount,
+                    self._scrollrows)
+        except AttributeError:
+            # let designer start
+            return (0, 0, 1)
 
 
-  # ---------------------------------------------------------------------------
-  # Call the UI widget to adjust the scrollbar to a given position
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Call the UI widget to adjust the scrollbar to a given position
+    # -------------------------------------------------------------------------
 
-  def doAdjustScrollbar (self, current, count):
-    """
-    Update the UI scrollbar to reflect a new position or record-count.
+    def do_adjust_scrollbar(self, current, count):
+        """
+        Update the UI scrollbar to reflect a new position or record-count.
 
-    @param current: current first visible record number in the block
-    @param count: number of records in the block
-    """
+        @param current: current first visible record number in the block
+        @param count: number of records in the block
+        """
 
-    if self.uiWidget is not None:
-      self.uiWidget.doAdjustScrollbar (current, count)
+        if self.uiWidget is not None:
+            self.uiWidget.do_adjust_scrollbar(current, count)
 
 
-  # ---------------------------------------------------------------------------
-  # Jump to a record relative to the current record
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Jump to a record relative to the current record
+    # -------------------------------------------------------------------------
 
-  def _event_scrollDelta (self, delta):
-    """
-    Move the record pointer of the block relative to the current record.
-    @param delta: number of records to be moved (can be negative)
-    """
+    def _event_scrollDelta(self, delta):
+        """
+        Move the record pointer of the block relative to the current record.
+        @param delta: number of records to be moved (can be negative)
+        """
 
-    self._block._event_scroll_delta (delta)
+        self._block._event_scroll_delta(delta)
 
 
-  # ---------------------------------------------------------------------------
-  # Jump to a given record number
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Jump to a given record number
+    # -------------------------------------------------------------------------
 
-  def _event_scrollToRecord (self, recordNumber):
-    """
-    Move the record pointer of the block to an absolute position.
-    @param recordNumber: number of record to jump to.
-    """
+    def _event_scrollToRecord(self, recordNumber):
+        """
+        Move the record pointer of the block to an absolute position.
+        @param recordNumber: number of record to jump to.
+        """
 
-    self._block._event_scroll_to_record (recordNumber)
+        self._block._event_scroll_to_record(recordNumber)

Modified: trunk/gnue-forms/src/GFObjects/GFTabStop.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFTabStop.py 2006-04-05 09:16:05 UTC (rev 
8367)
+++ trunk/gnue-forms/src/GFObjects/GFTabStop.py 2006-04-05 09:56:28 UTC (rev 
8368)
@@ -26,67 +26,66 @@
 """
 
 from gnue.common import events
-from GFObj import GFObj
+from gnue.forms.GFObjects.GFObj import GFObj
 
 # =============================================================================
 # Base class for navigable controls
 # =============================================================================
 
 class GFTabStop (GFObj):
-  """
-  A base class for all GFObjects that can receive focus on the UI.
+    """
+    A base class for all GFObjects that can receive focus on the UI.
 
-  @cvar _navigableInQuery_: If True the object can recieve the keyboard focus
-    in query mode, otherwise not
-  """
+    @cvar _navigableInQuery_: If True the object can recieve the keyboard focus
+      in query mode, otherwise not
+    """
   
-  _navigableInQuery_ = True
+    _navigableInQuery_ = True
 
-  # ---------------------------------------------------------------------------
-  # Constructor
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Constructor
+    # -------------------------------------------------------------------------
 
-  def __init__ (self, parent, type):
+    def __init__(self, parent, type):
 
-    GFObj.__init__(self, parent, type)
+        GFObj.__init__(self, parent, type)
 
-    # The sub-event handler handles the events that are passed from the
-    # GFInstance. This is the event handler that display handlers 
-    self.subEventHandler = events.EventController ()
+        # The sub-event handler handles the events that are passed from the
+        # GFInstance. This is the event handler that display handlers 
+        self.subEventHandler = events.EventController()
 
 
-  # ---------------------------------------------------------------------------
-  # Implementation of virtual methods
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Implementation of virtual methods
+    # -------------------------------------------------------------------------
 
-  def _phase_1_init_ (self):
-    """
-    On phase 1 initialization find the owning GFPage-instance.
-    This instance is then available through self._page.
-    """
+    def _phase_1_init_(self):
+        """
+        On phase 1 initialization find the owning GFPage-instance.
+        This instance is then available through self._page.
+        """
 
-    GFObj._phase_1_init_ (self)
+        GFObj._phase_1_init_(self)
 
-    self._page = self.findParentOfType ('GFPage')
-    self._page._entryList.append (self)
+        self._page = self.findParentOfType('GFPage')
+        self._page._entryList.append(self)
 
 
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
 
-  def _is_navigable_ (self, mode):
-    """
-    In general an object is navigable if it is not hidden and it's navigable
-    xml-attribute is set. If mode is 'query' it additionally depends wether an
-    object is 'queryable' or not. If mode is 'edit' or 'new' only objects are
-    navigable which are not 'readonly'.
-    """
+    def _is_navigable_ (self, mode):
+        """
+        In general an object is navigable if it is not hidden and it's
+        navigable xml-attribute is set. If mode is 'query' it additionally
+        depends wether an object is 'queryable' or not. If mode is 'edit' or
+        'new' only objects are navigable which are not 'readonly'.
+        """
 
-    if self.hidden:
-      return False
+        if self.hidden:
+            return False
 
-    else:
-      if mode == 'query':
-        return self.navigable and self._navigableInQuery_
-      else:
-        return self.navigable and (not self.readonly)
-
+        else:
+            if mode == 'query':
+                return self.navigable and self._navigableInQuery_
+            else:
+                return self.navigable and (not self.readonly)

Modified: trunk/gnue-forms/src/GFObjects/GFValue.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFValue.py   2006-04-05 09:16:05 UTC (rev 
8367)
+++ trunk/gnue-forms/src/GFObjects/GFValue.py   2006-04-05 09:56:28 UTC (rev 
8368)
@@ -24,43 +24,44 @@
 Base class for objects containing a value
 """
 
-from GFObj import GFObj
+from gnue.forms.GFObjects.GFObj import GFObj
 
 # =============================================================================
 # Base class for objects containing a value
 # =============================================================================
 
-class GFValue (GFObj):
+class GFValue(GFObj):
 
-  # ---------------------------------------------------------------------------
-  # Constructor
-  # ---------------------------------------------------------------------------
+    # -------------------------------------------------------------------------
+    # Constructor
+    # -------------------------------------------------------------------------
 
-  def __init__ (self, parent = None, value = None, type = 'GFValue'):
+    def __init__(self, parent=None, value=None, type='GFValue'):
 
-    GFObj.__init__ (self, parent, type)
-    self._value = value
+        GFObj.__init__(self, parent, type)
+        self._value = value
 
-  # ---------------------------------------------------------------------------
-  # Set the value
-  # ---------------------------------------------------------------------------
 
-  def setValue (self, value):
-    """
-    Set the objects' value
-    """
+    # -------------------------------------------------------------------------
+    # Set the value
+    # -------------------------------------------------------------------------
 
-    self._value = value
+    def setValue(self, value):
+        """
+        Set the objects' value
+        """
 
+        self._value = value
 
-  # ---------------------------------------------------------------------------
-  # Retrieve the value
-  # ---------------------------------------------------------------------------
 
-  def getValue (self):
-    """
-    Return the objects' value
-    """
+    # -------------------------------------------------------------------------
+    # Retrieve the value
+    # -------------------------------------------------------------------------
 
-    assert gDebug (6, "Value = %s" % self._value)
-    return self._value
+    def getValue(self):
+        """
+        Return the objects' value
+        """
+
+        assert gDebug(6, "Value = %s" % self._value)
+        return self._value

Modified: trunk/gnue-forms/src/GFObjects/__init__.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/__init__.py  2006-04-05 09:16:05 UTC (rev 
8367)
+++ trunk/gnue-forms/src/GFObjects/__init__.py  2006-04-05 09:56:28 UTC (rev 
8368)
@@ -43,6 +43,6 @@
        ]
 
 for module in __all__:
-  exec "from gnue.forms.GFObjects.%s import %s" % (module,module)
+    exec "from gnue.forms.GFObjects.%s import %s" % (module,module)
 
 from GFParameter import GFCParam





reply via email to

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