Author: btami
Date: 2005-07-24 13:38:31 -0500 (Sun, 24 Jul 2005)
New Revision: 7750
Modified:
trunk/gnue-reports/samples/foobulations/monthly.grd
trunk/gnue-reports/src/base/GRDataMapper.py
trunk/gnue-reports/src/base/layout/GRLayout.py
trunk/gnue-reports/src/base/layout/GRSection.py
Log:
support formulas in unbound sections
Modified: trunk/gnue-reports/samples/foobulations/monthly.grd
===================================================================
--- trunk/gnue-reports/samples/foobulations/monthly.grd 2005-07-22 17:43:57 UTC
(rev 7749)
+++ trunk/gnue-reports/samples/foobulations/monthly.grd 2005-07-24 18:38:31 UTC
(rev 7750)
@@ -6,7 +6,15 @@
<trigger name="Trigger_B" type="On-Exit">
print "Oh yeah.....I can feel it"
</trigger>
+ <trigger name="myFoobs" type="NAMED"><![CDATA[
+return int(details.foobs.get())+2
+]]></trigger>
+ <trigger name="timestamp" type="NAMED"><![CDATA[
+from datetime import datetime
+return datetime.now()
+]]></trigger>
+
<parameters>
<parameter name="subtitle" description="Report Subtitle"
default="Subtitle Not Provided"/>
@@ -24,13 +32,10 @@
<out:report>
<out:reportTitle>Monthly Accounting Foobulation Report</out:reportTitle>
-
- <trigger name="myFoobs" type="NAMED"><![CDATA[
-return int(details.foobs.get())+2
-]]></trigger>
-
<out:section break="page">
- <out:sectionTitle><param name="subtitle"/></out:sectionTitle>
+ <out:sectionTitle><param name="subtitle"/>
+<section name="unbound"><formula name="stamp"><trigger type="On-Process"
src="timestamp"/></formula>
+</section></out:sectionTitle>
<out:table width="100%">
<out:tablehead>
<out:colhead width="30">Name</out:colhead>
@@ -62,7 +67,7 @@
<notfirstrow><out:col/></notfirstrow>
<out:col align="center"><field name="foodate"
format="%m/%d/%Y"/></out:col>
<out:col align="right"><field name="foobs"/></out:col>
- <out:col align="right"><formula name="adate"><trigger
type="On-Process" src="myFoobs"/></formula></out:col>
+ <out:col align="right"><formula name="plus2"><trigger
type="On-Process" src="myFoobs"/></formula></out:col>
</out:row>
</section>
<out:row type="subtotal" level="2">
Modified: trunk/gnue-reports/src/base/GRDataMapper.py
===================================================================
--- trunk/gnue-reports/src/base/GRDataMapper.py 2005-07-22 17:43:57 UTC (rev
7749)
+++ trunk/gnue-reports/src/base/GRDataMapper.py 2005-07-24 18:38:31 UTC (rev
7750)
@@ -264,8 +264,6 @@
self.sourceMap = {}
def addSection(self, section, source, parentSection):
- if source == None:
- return
if self.sectionMap.has_key (section):
raise GRExceptions.SectionHasDuplicateName, \
'Section "%s" is defined multiple times' % section
@@ -275,7 +273,7 @@
else:
parentMapper = self.sectionMap[parentSection]
- if self.sourceMap.has_key(source) and \
+ if self.sourceMap.has_key(source) and source != None and\
not self.sourceMap[source][0].isAncestorOf(parentMapper):
raise GRExceptions.SourceMappedToSiblingSections, \
"Section '%s' attempts to use source '%s', but does not descend from
'%s'" % \
@@ -289,8 +287,9 @@
GDebug.printMesg(5,"Setting section %s as source controller" % self.name)
self.sourceMap[source] = [mapper]
mapper.toplevel = 1
- mapper.datasource = self.sources.getDataSource(source)
- mapper.datasource.registerEventListeners ({
+ if source != None:
+ mapper.datasource = self.sources.getDataSource(source)
+ mapper.datasource.registerEventListeners ({
'dsResultSetActivated': mapper._dsResultSetActivated})
else:
self.sourceMap[source][-1].grouping = 1
@@ -311,8 +310,6 @@
def addFormulaToSection(self, section, name, object):
self.sectionMap[section].addFormula(name, object)
-# self.sources.getDataSource(self.sectionMap[section].source) \
-# .referenceField(field)
#
Modified: trunk/gnue-reports/src/base/layout/GRLayout.py
===================================================================
--- trunk/gnue-reports/src/base/layout/GRLayout.py 2005-07-22 17:43:57 UTC
(rev 7749)
+++ trunk/gnue-reports/src/base/layout/GRLayout.py 2005-07-24 18:38:31 UTC
(rev 7750)
@@ -121,7 +121,7 @@
parentSection = object.findParentOfType('GRSection',includeSelf=0)
- if isinstance(object, GRSection) and object._source != None:
+ if isinstance(object, GRSection):
if parentSection is None:
self._mapper.addSection(object._name, object._source, None)
else:
Modified: trunk/gnue-reports/src/base/layout/GRSection.py
===================================================================
--- trunk/gnue-reports/src/base/layout/GRSection.py 2005-07-22 17:43:57 UTC
(rev 7749)
+++ trunk/gnue-reports/src/base/layout/GRSection.py 2005-07-24 18:38:31 UTC
(rev 7750)
@@ -78,6 +78,11 @@
"Controlling section %s's processAsController() called" % self._name)
if self._source == None:
+ for s in mapper.sourceMap[None]:
+ # and run formula triggers
+ for formula in s.formulas.keys():
+ s.formulas[formula] =
s.formulaObjects[formula].processTrigger('On-Process')
+
# This is a dataless section...
# simply process it's children
_______________________________________________
Commit-gnue mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/commit-gnue