commit-gnue
[Top][All Lists]
Advanced

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

gnue/reports samples/foobulations/monthly.grd s...


From: Jason Cater
Subject: gnue/reports samples/foobulations/monthly.grd s...
Date: Mon, 08 Apr 2002 12:03:24 -0400

CVSROOT:        /cvsroot/gnue
Module name:    gnue
Changes by:     Jason Cater <address@hidden>    02/04/08 12:03:20

Modified files:
        reports/samples/foobulations: monthly.grd 
        reports/src    : GRDataMapper.py GRLayout.py 

Log message:
        saving changes before a gutting session

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/reports/samples/foobulations/monthly.grd.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/reports/src/GRDataMapper.py.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/reports/src/GRLayout.py.diff?tr1=1.20&tr2=1.21&r1=text&r2=text

Patches:
Index: gnue/reports/samples/foobulations/monthly.grd
diff -c gnue/reports/samples/foobulations/monthly.grd:1.5 
gnue/reports/samples/foobulations/monthly.grd:1.6
*** gnue/reports/samples/foobulations/monthly.grd:1.5   Mon Apr  8 01:51:28 2002
--- gnue/reports/samples/foobulations/monthly.grd       Mon Apr  8 12:03:19 2002
***************
*** 35,41 ****
                  <out:col><field name="foodate"/></out:col>
                  <out:col><field name="foobs"/></out:col>
              </out:row>
!             </section>
            <default>
              <out:row>
                <out:col>(No results to display)</out:col>
--- 35,42 ----
                  <out:col><field name="foodate"/></out:col>
                  <out:col><field name="foobs"/></out:col>
              </out:row>
!           </section>
!           <out:subtotal/>
            <default>
              <out:row>
                <out:col>(No results to display)</out:col>
Index: gnue/reports/src/GRDataMapper.py
diff -c gnue/reports/src/GRDataMapper.py:1.10 
gnue/reports/src/GRDataMapper.py:1.11
*** gnue/reports/src/GRDataMapper.py:1.10       Mon Apr  8 01:51:29 2002
--- gnue/reports/src/GRDataMapper.py    Mon Apr  8 12:03:20 2002
***************
*** 130,142 ****
      GDebug.printMesg(10, "After _loadFields, changed=%s" % self.changed)
      self.initial = 0
  
  
!   #  Used in GRSources.__connectMasterDetail to link detail datasource to 
    #  master source.  Called by GDataObjects.ResultSet when master changed
    #  This will actually be over-written by GRDataMapper but at the time
!   #  the master-detail must be linked, the GRDataMapper will not have been 
    #  created yet.  [Yes, it's fugly]
!   def _masterChanged(self, masterResultSet, detailResultSet): 
      GDebug.printMesg (5, 'GRDataMapper._masterChanged')
      self.resultset = detailResultSet
  
--- 130,159 ----
      GDebug.printMesg(10, "After _loadFields, changed=%s" % self.changed)
      self.initial = 0
  
+   #
+   # Will the next recordset cause
+   #
+   def _precheckNextFields(self, recordset):
+     if not recordset:
+       return 0
+     changed = 0
+     for field in self.fields.keys():
+       val = recordset.getField(field)
+       GDebug.printMesg(10, 'self=%s,%s'%(self,self.name))
+       if ( not self.grouping or \
+            self.fields[field] != val ):
+         changed = 1
+         GDebug.printMesg(10, "Field %s changed after nextRecord 
(%s,%s,%s,%s)" % (field, self.initial, self.grouping, self.fields[field], val))
+     GDebug.printMesg(10, "After _precheckNextFields, changed=%s" % changed)
+     return changed
+ 
  
!   #  Used in GRSources.__connectMasterDetail to link detail datasource to
    #  master source.  Called by GDataObjects.ResultSet when master changed
    #  This will actually be over-written by GRDataMapper but at the time
!   #  the master-detail must be linked, the GRDataMapper will not have been
    #  created yet.  [Yes, it's fugly]
!   def _masterChanged(self, masterResultSet, detailResultSet):
      GDebug.printMesg (5, 'GRDataMapper._masterChanged')
      self.resultset = detailResultSet
  
***************
*** 216,221 ****
--- 233,242 ----
        GDebug.printMesg (4, 'Creating ResultSet for source %s' % source)
        controlSection.resultset = self.sources.getDataSource(source)\
               .getDataObject().createResultSet(readOnly=1)
+       if controlSection.resultset.nextRecord():
+         controlSection.__nextRecord = controlSection.resultset.current
+       else:
+         controlSection.__nextRecord = None
      else:
        GDebug.printMesg(4, 'Getting pre-created ResultSet for source "%s"; 
parent=%s' \
               % (source, controlSection.parent))
***************
*** 230,250 ****
      GDebug.printMesg (6, 'Getting next record for source %s' % source)
      if  source == None:
        GDebug.printMesg (6, 'No next record to return for source %s' % source)
!       return None
  
      controlSection = self.sourceMap[source][0]
  
!     if not controlSection.resultset.nextRecord():
!       return None
      else:
!       recordset = controlSection.resultset.current
        firstSection = None
        for s in self.sourceMap[source]:
          s._loadFields(recordset)
          if firstSection == None and s.changed:
            GDebug.printMesg(10, "After next record, first changed section is 
%s" % s.name)
            firstSection = s.name
!       return firstSection
  
  
  
--- 251,288 ----
      GDebug.printMesg (6, 'Getting next record for source %s' % source)
      if  source == None:
        GDebug.printMesg (6, 'No next record to return for source %s' % source)
!       return (None, None)
  
      controlSection = self.sourceMap[source][0]
  
!     if not controlSection.__nextRecord:
!       return (None, None)
      else:
!     
!       recordset = controlSection.__nextRecord
!       if controlSection.resultset.nextRecord():
!         controlSection.__nextRecord = controlSection.resultset.current
!       else:
!         controlSection.__nextRecord = None
! 
        firstSection = None
+       nextSection = None
+ 
        for s in self.sourceMap[source]:
          s._loadFields(recordset)
+ 
+         # What is the current section?
          if firstSection == None and s.changed:
            GDebug.printMesg(10, "After next record, first changed section is 
%s" % s.name)
            firstSection = s.name
! 
!         # What will the next section be?
!         if (nextSection is None and \
!             controlSection.__nextRecord and \
!             s._precheckNextFields(controlSection.__nextRecord)):
!           nextSection = s.name
! 
!       return (firstSection, nextSection)
  
  
  
Index: gnue/reports/src/GRLayout.py
diff -c gnue/reports/src/GRLayout.py:1.20 gnue/reports/src/GRLayout.py:1.21
*** gnue/reports/src/GRLayout.py:1.20   Mon Apr  8 01:51:29 2002
--- gnue/reports/src/GRLayout.py        Mon Apr  8 12:03:20 2002
***************
*** 168,179 ****
                   object.function)
  
  
-     #
-     # Pull value for parameters
-     #
-     if object.getObjectType() == 'GRParam':
-       object._value = self._parameters.getParameter(object.name)
- 
    #
    # Process layout and dump output.
    # self.prepare *must* be called prior to processing
--- 168,173 ----
***************
*** 206,212 ****
      self._inits = [self.primaryInit]
  
    # Called if section contains data
!   def process(self, dest, mapper, isfirst=0):
      pass
  
    def primaryInit(self):
--- 200,206 ----
      self._inits = [self.primaryInit]
  
    # Called if section contains data
!   def process(self, dest, mapper, isfirst=0, nextSection=None):
      pass
  
    def primaryInit(self):
***************
*** 229,244 ****
      GRLayoutElement.__init__(self, parent, type=type)
  
  
!   def processChildren(self, dest, mapper, isfirst=0):
      for child in self._children:
        if child.getObjectType() == "_content_":
          dest.write(child.getContent())
        else:
!         if isinstance(child, GRSection) and child._mymapper.toplevel:
!           GDebug.printMesg(10, "Calling new controlling section")
!           child.processAsController(dest, mapper)
          else:
!           child.process(dest, mapper, isfirst or isinstance(child, GRSection))
  
    #
    #  getAncestorWithSource()
--- 223,244 ----
      GRLayoutElement.__init__(self, parent, type=type)
  
  
!   def processChildren(self, dest, mapper, isfirst=0, nextSection=None):
      for child in self._children:
        if child.getObjectType() == "_content_":
          dest.write(child.getContent())
        else:
!         if isinstance(child, GRSection):
!           if child._mymapper.toplevel:
!             GDebug.printMesg(10, "Calling new controlling section")
!             child.processAsController(dest, mapper)
!           else:
!             child.process(dest, mapper, 1, nextSection)
! #            print nextSection, child._name
! #            if nextSection == child._name:
! #              break
          else:
!           child.process(dest, mapper, isfirst, nextSection)
  
    #
    #  getAncestorWithSource()
***************
*** 292,332 ****
        # This is a dataless section...
        # simply process it's children
  
!       self.process(dest, mapper, 1)
  
!     elif mapper.getFirstRecord(self._source):
!       # This is a data-bound section and there
!       # was data returned, so process section
  
-       oldSection = None
-       section = self
  
!       while section:
  
  
!         # Process the current data row starting at correct section
!         section.process(dest, mapper,
!              isfirst=(oldSection in section._childSections))
  
!         # Determine the next section to process our data.
!         # (i.e., handle section grouping)
!         goto = mapper.getNextRecord(self._source)
!         GDebug.printMesg (10, "Goto is '%s'" % goto)
  
-         if goto == None:
-           section = None
-         else:
            oldSection = section._name
-           section = mapper.sectionMap[goto]._object
  
!     else:
!       # This is a data-bound section and there
!       # was no data returned, so generate default
!       # text (if any)
! 
!       for c2 in self._children:
!         if isinstance (c2, GRDefault):
!           c2.processDefault(dest, mapper)
  
    #
    #  getAncestorWithSource()
--- 292,337 ----
        # This is a dataless section...
        # simply process it's children
  
!       self.process(dest, mapper, 1, None)
  
!     else:
!       if mapper.getFirstRecord(self._source):
!         # This is a data-bound section and there
!         # was data returned, so process section
  
  
!         # Determine the next section to process our data.
!         # (i.e., handle section grouping)
!         (goto, gotoNext) = mapper.getFirstRecord(self._source)
  
+         oldSection = None
  
!         while goto:
  
!           section = mapper.sectionMap[goto]._object
!           if gotoNext:
!             nextSection = mapper.sectionMap[gotoNext]._object._name
!           else:
!              gotoNext = None
! 
!           # Process the current data row starting at correct section
!           section.process(dest, mapper, (oldSection in 
section._childSections),
!                         nextSection)
! 
!           (goto, gotoNext) = mapper.getNextRecord(self._source)
!           GDebug.printMesg (10, "Goto is '%s'; next is '%s'" % (goto, 
gotoNext))
  
            oldSection = section._name
  
!       else:
!         # This is a data-bound section and there
!         # was no data returned, so generate default
!         # text (if any)
! 
!         for c2 in self._children:
!           if isinstance (c2, GRDefault):
!             c2.processDefault(dest, mapper)
! 
  
    #
    #  getAncestorWithSource()
***************
*** 342,352 ****
  
    # Generic process() method.  Process the
    # current record and handle any children.
!   def process(self, dest, mapper, isfirst=0):
  
      GDebug.printMesg(10,"Repeating Section %s" % self._name)
      structuralComment(dest,"<!--[section:%s]-->" % self._name)
!     self.processChildren(dest, mapper, isfirst)
      structuralComment(dest,"<!--[/section:%s]-->" % self._name)
      GDebug.printMesg(10,"Leaving section %s" % self._name)
  
--- 347,357 ----
  
    # Generic process() method.  Process the
    # current record and handle any children.
!   def process(self, dest, mapper, isfirst=0, nextSection=None):
  
      GDebug.printMesg(10,"Repeating Section %s" % self._name)
      structuralComment(dest,"<!--[section:%s]-->" % self._name)
!     self.processChildren(dest, mapper, isfirst, nextSection)
      structuralComment(dest,"<!--[/section:%s]-->" % self._name)
      GDebug.printMesg(10,"Leaving section %s" % self._name)
  
***************
*** 372,381 ****
          dest.write(child.getContent())
      structuralComment(dest,"<!--[/default]-->")
  
!   def process(self, dest, mapper, isfirst=0):
      pass
  
  
  ############################################################
  #
  # <field> tag
--- 377,387 ----
          dest.write(child.getContent())
      structuralComment(dest,"<!--[/default]-->")
  
!   def process(self, dest, mapper, isfirst=0, nextSection=None):
      pass
  
  
+ 
  ############################################################
  #
  # <field> tag
***************
*** 386,417 ****
      self._section = None
      self.format = None
  
!   def process(self, dest, mapper, isfirst=0):
      structuralComment(dest,"<!--[field:%s]-->" % self.name)
      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 process(self, dest, mapper, isfirst=0):
-     structuralComment(dest,"<!--[param:%s]-->" % self.name)
-     if self._value != None:
-       dest.write ("%s" % self._value)
-     structuralComment(dest,"<!--[/param:%s]-->" % self.name)
- 
  
  ############################################################
  #
--- 392,403 ----
      self._section = None
      self.format = None
  
!   def process(self, dest, mapper, isfirst=0, nextSection=None):
      structuralComment(dest,"<!--[field:%s]-->" % self.name)
      dest.write (self._mymapper.getField(self.name, self.format))
      structuralComment(dest,"<!--[/field:%s]-->" % self.name)
  
  
  
  ############################################################
  #
***************
*** 424,430 ****
      self.function = "count"
      self.format = None
  
!   def process(self, dest, mapper, isfirst=0):
      structuralComment(dest,"<!--[summ:%s]-->" % self.name)
      dest.write (self._mymapper.getSummary(self.name, self.function, 
self.format))
      structuralComment(dest,"<!--[/summ:%s]-->" % self.name)
--- 410,416 ----
      self.function = "count"
      self.format = None
  
!   def process(self, dest, mapper, isfirst=0, nextSection=None):
      structuralComment(dest,"<!--[summ:%s]-->" % self.name)
      dest.write (self._mymapper.getSummary(self.name, self.function, 
self.format))
      structuralComment(dest,"<!--[/summ:%s]-->" % self.name)
***************
*** 442,448 ****
      GRLayoutElement.__init__(self, parent)
      GRStubParam.__init__(self, parent)
  
!   def process(self, dest, mapper, isfirst=0):
      structuralComment(dest,"<!--[param:%s]-->" % self.name)
      dest.write (self.getFormattedValue())
      structuralComment(dest,"<!--[/summ:%s]-->" % self.name)
--- 428,434 ----
      GRLayoutElement.__init__(self, parent)
      GRStubParam.__init__(self, parent)
  
!   def process(self, dest, mapper, isfirst=0, nextSection=None):
      structuralComment(dest,"<!--[param:%s]-->" % self.name)
      dest.write (self.getFormattedValue())
      structuralComment(dest,"<!--[/summ:%s]-->" % self.name)
***************
*** 459,485 ****
    def __init__(self, parent):
      ContainerElement.__init__(self, parent, 'GRFirstRow')
  
!   def process(self, dest, mapper, isfirst=0):
      if isfirst:
!       self.processChildren(dest, mapper, isfirst)
  
  
  class GRNotFirstRow(ContainerElement):
    def __init__(self, parent):
      ContainerElement.__init__(self, parent, 'GRNotFirstRow')
  
!   def process(self, dest, mapper, isfirst=0):
      if not isfirst:
!       self.processChildren(dest, mapper, isfirst)
  
- #
- #class GRLastRow(LogicStub):
- #  _typestub = 'GRLastRow'
- #
- #
- #class GRLastRow(LogicStub):
- #  _typestub = 'GRNotLastRow'
- #
  
  
  ############################################################
--- 445,483 ----
    def __init__(self, parent):
      ContainerElement.__init__(self, parent, 'GRFirstRow')
  
!   def process(self, dest, mapper, isfirst=0, nextSection=None):
      if isfirst:
!       self.processChildren(dest, mapper, isfirst, nextSection)
  
  
  class GRNotFirstRow(ContainerElement):
    def __init__(self, parent):
      ContainerElement.__init__(self, parent, 'GRNotFirstRow')
  
!   def process(self, dest, mapper, isfirst=0, nextSection=None):
      if not isfirst:
!       self.processChildren(dest, mapper, isfirst, nextSection)
! 
! 
! class GRLastRow(ContainerElement):
!   def __init__(self, parent):
!     ContainerElement.__init__(self, parent, 'GRLastRow')
! 
!   def process(self, dest, mapper, isfirst=0, nextSection=None):
!     # TODO
!     if not nextSection:
!       self.processChildren(dest, mapper, isfirst, nextSection)
! 
! 
! class GRNotLastRow(ContainerElement):
!   def __init__(self, parent):
!     ContainerElement.__init__(self, parent, 'GRNotLastRow')
! 
!   def process(self, dest, mapper, isfirst=0, nextSection=None):
!     # TODO
!     if nextSection:
!       self.processChildren(dest, mapper, isfirst, nextSection)
  
  
  
  ############################################################
***************
*** 491,506 ****
    def __init__(self, parent):
      ContainerElement.__init__(self, parent, 'GRPassThru')
  
!   def process(self, dest, mapper, isfirst=0):
      dest.write('<%s' % self._xmltag)
      for attr in self._loadedxmlattrs.keys():
        dest.write(' %s="%s"' % (attr, 
saxutils.escape(str(self._loadedxmlattrs[attr]))))
  
      if len(self._children):
        dest.write('>')
!       self.processChildren(dest, mapper, isfirst)
        dest.write('</%s>' % self._xmltag)
      else:
        dest.write('/>')
- 
  
--- 489,503 ----
    def __init__(self, parent):
      ContainerElement.__init__(self, parent, 'GRPassThru')
  
!   def process(self, dest, mapper, isfirst=0, nextSection=None):
      dest.write('<%s' % self._xmltag)
      for attr in self._loadedxmlattrs.keys():
        dest.write(' %s="%s"' % (attr, 
saxutils.escape(str(self._loadedxmlattrs[attr]))))
  
      if len(self._children):
        dest.write('>')
!       self.processChildren(dest, mapper, isfirst, nextSection)
        dest.write('</%s>' % self._xmltag)
      else:
        dest.write('/>')
  



reply via email to

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