commit-gnue
[Top][All Lists]
Advanced

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

gnue/gnue-reports/src GRLayout.py GRReport.py G...


From: Jason Cater
Subject: gnue/gnue-reports/src GRLayout.py GRReport.py G...
Date: Tue, 05 Jun 2001 22:25:00 -0700

CVSROOT:        /home/cvs
Module name:    gnue
Changes by:     Jason Cater <address@hidden>    01/06/05 22:25:00

Modified files:
        gnue-reports/src: GRLayout.py GRReport.py GRSources.py 

Log message:
        Added parameter support to layout section and started support in 
Sources section

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-reports/src/GRLayout.py.diff?cvsroot=OldCVS&tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-reports/src/GRReport.py.diff?cvsroot=OldCVS&tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-reports/src/GRSources.py.diff?cvsroot=OldCVS&tr1=1.3&tr2=1.4&r1=text&r2=text

Patches:
Index: gnue/gnue-reports/src/GRLayout.py
diff -u gnue/gnue-reports/src/GRLayout.py:1.4 
gnue/gnue-reports/src/GRLayout.py:1.5
--- gnue/gnue-reports/src/GRLayout.py:1.4       Tue May 29 19:19:49 2001
+++ gnue/gnue-reports/src/GRLayout.py   Tue Jun  5 22:25:00 2001
@@ -31,7 +31,7 @@
 
 
 from gnue.common.GObjects import *
-from gnue.common import GDebug
+from gnue.common import GDebug, GConditions
 import GRExceptions
 import string
 
@@ -73,9 +73,10 @@
   #
   # Prepare for running
   # 
-  def prepare(self, mapper):
+  def prepare(self, mapper, parameters):
 
     self._mapper = mapper
+    self._parameters = parameters
     self.walk(self.__prepare)
 
   # Used by prepare()
@@ -102,6 +103,7 @@
              "Summary %s in section %s does not connect to a source" \
                  % (object.name, object.getParentOfType('GRSection').name)
 
+
     
 
       # This all looks confusing, but basically it simply figures out
@@ -156,6 +158,12 @@
                  object.function)
 
 
+    # 
+    # Pull value for paramters
+    #
+    if object.getObjectType == 'GRParam': 
+      object._value = self._parameters.getParameter(object.name) 
+
   #
   # Process layout and dump output.
   # self.prepare *must* have been called.
@@ -256,6 +264,27 @@
     dest.write (self._mymapper.getField(self.name, self.format))
     structuralComment(dest,"<!--[/field:%s]-->" % self.name)
 
+
+############################################################
+#
+# <param> tag 
+#
+# Note that this can be present in conditions or in 
+# layout.  Since layout requires extra care, the 
+# class is actually defined here instead of GRSources.
+#
+class GRParam(GRLayoutElement, GConditions.GCParam): 
+  def __init__(self, parent): 
+    GRLayoutElement.__init__(self, parent, 'GRParam') 
+    self.name = "" 
+    self._value = ""
+
+  def proces(self, dest, mapper): 
+    structuralComment(dest,"<!--[param:%s]-->" % self.name)
+    if self._value != None: 
+      dest.write ("%s" % self._value)
+    structuralComment(dest,"<!--[/param:%s]-->" % self.name)
+  
 
 ############################################################
 #
Index: gnue/gnue-reports/src/GRReport.py
diff -u gnue/gnue-reports/src/GRReport.py:1.8 
gnue/gnue-reports/src/GRReport.py:1.9
--- gnue/gnue-reports/src/GRReport.py:1.8       Tue May 29 19:19:49 2001
+++ gnue/gnue-reports/src/GRReport.py   Tue Jun  5 22:25:00 2001
@@ -97,11 +97,11 @@
     sortoptions.setSortOption(userSortOption)
 
     # Prepare data sources for active duty
-    sources.prepare()
+    sources.prepare(parameters, sortoptions)
 
     # .. and the layout sections
     mapper = GRDataMapper.GRDataMapper(sources)
-    layout.prepare(mapper)
+    layout.prepare(mapper, parameters)
 
     # Write common header information
     dest.write ('<?xml version="1.0"?>\n')
Index: gnue/gnue-reports/src/GRSources.py
diff -u gnue/gnue-reports/src/GRSources.py:1.3 
gnue/gnue-reports/src/GRSources.py:1.4
--- gnue/gnue-reports/src/GRSources.py:1.3      Tue May 29 19:19:49 2001
+++ gnue/gnue-reports/src/GRSources.py  Tue Jun  5 22:25:00 2001
@@ -32,6 +32,7 @@
 
 from gnue.common.GObjects import *
 from gnue.common.GDataSource import GDataSource
+from gnue.common.GConditions import GCondition
 from gnue.common import GDebug
 import GRExceptions
 
@@ -43,12 +44,16 @@
   #
   # Prepare for running
   # 
-  def prepare(self): 
+  def prepare(self, parameters, sortoptions): 
 
+    self._parameters = parameters
+    self._sortoptions = sortoptions 
+
     # Connect to databases    
     self._datasourceDictionary = {}
     self.walk(self.__initConnections)
     self.walk(self.__connectMasterDetail)
+    self.walk(self.__setUserOptions) 
 
 
   # Used internally by self.prepare()
@@ -73,6 +78,14 @@
            "Detail source '%s' references non-existant master '%s'" \
                          % (object.name, object.master)
 
+  def __setUserOptions(self, object): 
+    if object.getObjectType() == 'GRParam': 
+      object._value = self._parameters.getParameter(object.name) 
+
+#    if object.getObjectType() == 'GRSortOption': 
+#      pass
+
+
   def getDataSource(self, source): 
     return self._datasourceDictionary[source]
 
@@ -89,5 +102,9 @@
   #  created yet.  [Yes, it's fugly]
   def masterResultSetChanged(self, masterResultSet, detailResultSet): 
     pass
+
+class GRConditions(GCondition): 
+  def __init__(self, parent): 
+    GCondition.__init__(self, parent, 'GRCondition') 
 
 



reply via email to

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