commit-gnue
[Top][All Lists]
Advanced

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

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


From: johannes
Subject: [gnue] r8288 - trunk/gnue-forms/src/GFObjects
Date: Mon, 3 Apr 2006 18:22:20 -0500 (CDT)

Author: johannes
Date: 2006-03-30 02:06:52 -0600 (Thu, 30 Mar 2006)
New Revision: 8288

Modified:
   trunk/gnue-forms/src/GFObjects/GFBlock.py
   trunk/gnue-forms/src/GFObjects/GFComponent.py
   trunk/gnue-forms/src/GFObjects/GFEntry.py
   trunk/gnue-forms/src/GFObjects/GFField.py
   trunk/gnue-forms/src/GFObjects/GFImage.py
   trunk/gnue-forms/src/GFObjects/GFLabel.py
   trunk/gnue-forms/src/GFObjects/GFObj.py
   trunk/gnue-forms/src/GFObjects/GFPage.py
   trunk/gnue-forms/src/GFObjects/GFScrollBar.py
   trunk/gnue-forms/src/GFObjects/GFTabStop.py
   trunk/gnue-forms/src/GFObjects/GFValue.py
Log:
More cleanup


Modified: trunk/gnue-forms/src/GFObjects/GFBlock.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFBlock.py   2006-03-30 02:36:08 UTC (rev 
8287)
+++ trunk/gnue-forms/src/GFObjects/GFBlock.py   2006-03-30 08:06:52 UTC (rev 
8288)
@@ -198,29 +198,29 @@
   # Primary initialization
   #
   def _phase1Init_ (self):
+
     GFContainer._phase1Init_ (self)
 
-    self._form = form = self.findParentOfType('GFForm')
-    self._logic = logic = self.findParentOfType('GFLogic')
+    self._logic = logic = self.findParentOfType ('GFLogic')
 
     self._lastValues = {}
 
-    logic._blockList.append(self)
-    logic._blockMap[self.name] = self
+    logic._blockList.append (self)
+    logic._blockMap [self.name] = self
 
     # Initialize our events system
-    events.EventAware.__init__(self, form._instance.eventController)
+    events.EventAware.__init__ (self, self._form._instance.eventController)
 
     # Create a stub/non-bound datasource if we aren't bound to one
     if not hasattr(self,'datasource') or not self.datasource:
       ds = GFDataSource(self._form)
       ds.type = 'unbound'
       self.datasource = ds.name = "__dts_%s" % id(self)
-      form._datasourceDictionary[ds.name] = ds
+      self._form._datasourceDictionary[ds.name] = ds
       ds._buildObject()
       ds.phaseInit()
 
-    self._dataSourceLink = form._datasourceDictionary.get (self.datasource)
+    self._dataSourceLink = self._form._datasourceDictionary.get 
(self.datasource)
     if self._dataSourceLink is None:
       raise errors.ApplicationError, \
           u_("Datasource '%(datasource)s' in block '%(block)s' not found") \
@@ -249,7 +249,7 @@
     except AttributeError:
       self._maxChildRows = None
 
-    self.walk(self.__setChildRowSettings)
+    self.walk (self.__setChildRowSettings)
 
   def __setChildRowSettings(self, object):
     if hasattr(object,'rows'):

Modified: trunk/gnue-forms/src/GFObjects/GFComponent.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFComponent.py       2006-03-30 02:36:08 UTC 
(rev 8287)
+++ trunk/gnue-forms/src/GFObjects/GFComponent.py       2006-03-30 08:06:52 UTC 
(rev 8288)
@@ -86,8 +86,6 @@
     self._page = self.findParentOfType('GFPage')
     self._page._entryList.append(self)
     
-    self._form = self._block._form
-
     self._displayHandler = displayHandlers.Component(self,
                               self._form._instance.eventController,
                               self.subEventHandler)

Modified: trunk/gnue-forms/src/GFObjects/GFEntry.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFEntry.py   2006-03-30 02:36:08 UTC (rev 
8287)
+++ trunk/gnue-forms/src/GFObjects/GFEntry.py   2006-03-30 08:06:52 UTC (rev 
8288)
@@ -1,4 +1,4 @@
-# Short line describing the purpose of this file
+# GNU Enterprise Forms - GFObjects - Entry objects
 #
 # Copyright 2001-2006 Free Software Foundation
 #

Modified: trunk/gnue-forms/src/GFObjects/GFField.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFField.py   2006-03-30 02:36:08 UTC (rev 
8287)
+++ trunk/gnue-forms/src/GFObjects/GFField.py   2006-03-30 08:06:52 UTC (rev 
8288)
@@ -175,11 +175,6 @@
       self._lowercase = True
 
 
-##    self._formatmask = ""
-##    self._inputmask = hasattr(self,'inputmask') and self.inputmask or ""
-##    self._displaymask = hasattr(self,'displaymask') and self.displaymask or 
""
-
-
     if hasattr(self, 'default') and self.default != None and len(self.default):
       default = self.default
     else:

Modified: trunk/gnue-forms/src/GFObjects/GFImage.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFImage.py   2006-03-30 02:36:08 UTC (rev 
8287)
+++ trunk/gnue-forms/src/GFObjects/GFImage.py   2006-03-30 08:06:52 UTC (rev 
8288)
@@ -1,6 +1,9 @@
+# GNU Enterprise Forms - GFObjects - Image objects
 #
-# 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,27 +19,17 @@
 # write to the Free Software Foundation, Inc., 59 Temple Place
 # - Suite 330, Boston, MA 02111-1307, USA.
 #
-# Copyright 2000-2006 Free Software Foundation
-#
-#
-# FILE:
-# GFImage.py
-#
-# DESCRIPTION:
+# $Id$
 """
-Logical image support
+Wrapper class for image objects
 """
-# NOTES:
-#
-# HISTORY:
-# Copyright (c) 2000 Free Software Foundation
-#
 
 from gnue.common.apps import errors
 from GFTabStop import GFTabStop
 from gnue.forms.input import displayHandlers
 from gnue.common.definitions import GParser
 
+
 # =============================================================================
 # Exceptions
 # =============================================================================
@@ -54,29 +47,37 @@
     GParser.MarkupError.__init__ (self, msg, image._url, image._lineNumber)
 
 
-#
-#GFLabel
-#
-class GFImage(GFTabStop):
-  def __init__(self, parent=None, value=None):
-    GFTabStop.__init__(self, parent, 'GFImage')
+# =============================================================================
+# Image objects
+# =============================================================================
 
+class GFImage (GFTabStop):
+
+  # ---------------------------------------------------------------------------
+  # Constructor
+  # ---------------------------------------------------------------------------
+
+  def __init__ (self, parent = None, value = None):
+
+    GFTabStop.__init__ (self, parent, 'GFImage')
+
     # Default attributes (these may be replaced by parser)
     self.type = "URL"
-    self.Char__height = int(gConfigForms('widgetHeight'))
+    self.Char__height = int (gConfigForms ('widgetHeight'))
 
 
-  def _buildObject(self):
-    if not hasattr(self, 'rows') and hasattr(self,'visibleCount'):
-      self.rows = self.visibleCount
-      del self.visibleCount
-    return GFTabStop._buildObject(self)
+  # ---------------------------------------------------------------------------
+  # Get the current value
+  # ---------------------------------------------------------------------------
 
-  def setValue(self, value):
-    if not self._value:
-      GFTabStop.setValue(self,value)
+  def getValue (self, *args, **kwargs):
 
+    return self._field.getValue (*args, **kwargs)
+
+
   # ---------------------------------------------------------------------------
+  # Implementation of virtual methods
+  # ---------------------------------------------------------------------------
 
   def _phase1Init_ (self):
 
@@ -102,13 +103,8 @@
                               self._form._instance.eventController,
                               self.subEventHandler, None, None)
 
+  # ---------------------------------------------------------------------------
 
-  # TODO: Conversion:  Does this belong here or not?
-  def getValue(self, *args, **parms):
-    return self._field.getValue(*args, **parms)
-
-
-
   def _isNavigable_ (self, mode):
-    return False
 
+    return False

Modified: trunk/gnue-forms/src/GFObjects/GFLabel.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFLabel.py   2006-03-30 02:36:08 UTC (rev 
8287)
+++ trunk/gnue-forms/src/GFObjects/GFLabel.py   2006-03-30 08:06:52 UTC (rev 
8288)
@@ -1,13 +1,16 @@
+# GNU Enterprise Forms - GFObjects - Generic text objects
 #
-# 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 
+# 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.
 #
@@ -16,52 +19,27 @@
 # 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$
 """
-Logical label support
+A class wrapping static text objects
 """
-# NOTES:
-#
 
-from GFValue import GFValue
+from GFObj import GFObj
 
-#
-#GFLabel
-#
-class GFLabel(GFValue):
-  def __init__(self, parent=None, value=None):
-    GFValue.__init__(self, parent, value, 'GFLabel')
+# =============================================================================
+# A generic text class
+# =============================================================================
 
-    # Default attributes (these may be replaced by parser)
-    self.alignment = "left"
-    self.Char__height = int(gConfigForms('widgetHeight'))
+class GFLabel (GFObj):
 
-  def _buildObject(self):
-    if not hasattr(self, 'rows') and hasattr(self,'visibleCount'):
-      self.rows = self.visibleCount
-      del self.visibleCount
-    return GFValue._buildObject(self)
+  # ---------------------------------------------------------------------------
+  # Constructor
+  # ---------------------------------------------------------------------------
 
-  def setValue(self, value):
-    if not self._value:
-      GFValue.setValue(self,value)
+  def __init__ (self, parent = None):
 
-  #
-  # Routines called during a phaseInit
-  #
-  def _phase1Init_ (self):
-    GFValue._phase1Init_ (self)
-    self._block = self.findParentOfType('GFBlock')
+    GFObj.__init__ (self, parent, 'GFLabel')
 
-
-
-
-
-
-
+    # Default attributes (these may be replaced by parser)
+    self.alignment    = "left"
+    self.Char__height = int (gConfigForms ('widgetHeight'))

Modified: trunk/gnue-forms/src/GFObjects/GFObj.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFObj.py     2006-03-30 02:36:08 UTC (rev 
8287)
+++ trunk/gnue-forms/src/GFObjects/GFObj.py     2006-03-30 08:06:52 UTC (rev 
8288)
@@ -178,4 +178,4 @@
     construction of the objects.
     """
 
-    pass
+    self._form = self.findParentOfType ('GFForm')

Modified: trunk/gnue-forms/src/GFObjects/GFPage.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFPage.py    2006-03-30 02:36:08 UTC (rev 
8287)
+++ trunk/gnue-forms/src/GFObjects/GFPage.py    2006-03-30 08:06:52 UTC (rev 
8288)
@@ -50,7 +50,6 @@
 
   def _phase1Init_ (self):
     GFContainer._phase1Init_ (self)
-    self._form = self.findParentOfType('GFForm')
 
     layout = self.findParentOfType('GFLayout')
     layout._pageList.append(self)

Modified: trunk/gnue-forms/src/GFObjects/GFScrollBar.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFScrollBar.py       2006-03-30 02:36:08 UTC 
(rev 8287)
+++ trunk/gnue-forms/src/GFObjects/GFScrollBar.py       2006-03-30 08:06:52 UTC 
(rev 8288)
@@ -66,8 +66,6 @@
 
     GFObj._phase1Init_ (self)
 
-    self._form = self.findParentOfType ('GFForm')
-
     # ...Block
     if not self.block in self._form._logic._blockMap:
       raise BlockNotFoundError, (self.block, self)

Modified: trunk/gnue-forms/src/GFObjects/GFTabStop.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFTabStop.py 2006-03-30 02:36:08 UTC (rev 
8287)
+++ trunk/gnue-forms/src/GFObjects/GFTabStop.py 2006-03-30 08:06:52 UTC (rev 
8288)
@@ -61,14 +61,13 @@
 
   def _phase1Init_ (self):
     """
-    On phase 1 initialization find the owning GFPage- and GFForm-instance.
-    These instances are then available through self._form and self._page.
+    On phase 1 initialization find the owning GFPage-instance.
+    This instance is then available through self._page.
     """
 
     GFObj._phase1Init_ (self)
 
     self._page = self.findParentOfType ('GFPage')
-    self._form = self._page.findParentOfType ('GFForm')
 
 
   # ---------------------------------------------------------------------------

Modified: trunk/gnue-forms/src/GFObjects/GFValue.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFValue.py   2006-03-30 02:36:08 UTC (rev 
8287)
+++ trunk/gnue-forms/src/GFObjects/GFValue.py   2006-03-30 08:06:52 UTC (rev 
8288)
@@ -1,63 +1,66 @@
+# GNU Enterprise Forms - GFObjects - Objects having values
 #
-# 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:
-# GFObjects.py
-#
-# DESCRIPTION:
+# $Id$
 """
-Module for the majority of the objects that make up a form
+Base class for objects containing a value
 """
-#
-# NOTES:
-#
 
 from GFObj import GFObj
 
-from gnue.common.apps import GDebug
+# =============================================================================
+# Base class for objects containing a value
+# =============================================================================
 
-#
-# GFValue
-#
-# An object that can store and retrieve a value
-#
-class GFValue(GFObj):
-  # Add value attrib support
-  def __init__(self, parent=None, value=None, type='GFValue'):
-    GFObj.__init__(self, parent, type)
-    self._value = value
+class GFValue (GFObj):
 
-  def setValue(self, value):
-    self._value = value
+  # ---------------------------------------------------------------------------
+  # Constructor
+  # ---------------------------------------------------------------------------
 
-  def getValue(self):
-    assert gDebug(6, "Value = %s"% self._value)
-    return self._value
+  def __init__ (self, parent = None, value = None, type = 'GFValue'):
 
+    GFObj.__init__ (self, parent, type)
+    self._value = value
 
+  # ---------------------------------------------------------------------------
+  # Set the value
+  # ---------------------------------------------------------------------------
 
+  def setValue (self, value):
+    """
+    Set the objects' value
+    """
 
+    self._value = value
 
 
+  # ---------------------------------------------------------------------------
+  # Retrieve the value
+  # ---------------------------------------------------------------------------
 
+  def getValue (self):
+    """
+    Return the objects' value
+    """
 
-
-
-
+    assert gDebug (6, "Value = %s" % self._value)
+    return self._value





reply via email to

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