[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue common/src/GTrigger.py designer/src/report...
From: |
James Thompson |
Subject: |
gnue common/src/GTrigger.py designer/src/report... |
Date: |
Fri, 01 Nov 2002 00:02:50 -0500 |
CVSROOT: /cvsroot/gnue
Module name: gnue
Changes by: James Thompson <address@hidden> 02/11/01 00:02:49
Modified files:
common/src : GTrigger.py
designer/src/reports: Instance.py
forms/src : GFForm.py GFParser.py
reports/samples/foobulations: monthly.grd
reports/samples/location: zip-by-state.grd
reports/src : GRLayout.py GRParser.py GRReport.py
Added files:
reports/doc/technotes: 00001.txt
Log message:
More trigger cleanup
Added trigger support to gnue-reports
Added on-startup and on-exit to <report>
Added pre-section and post-section to <section>
Added support for reports trigger editing in designer
foobulations grd is working sample
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/GTrigger.py.diff?tr1=1.24&tr2=1.25&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/designer/src/reports/Instance.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFForm.py.diff?tr1=1.192&tr2=1.193&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFParser.py.diff?tr1=1.74&tr2=1.75&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/reports/doc/technotes/00001.txt?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/reports/samples/foobulations/monthly.grd.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/reports/samples/location/zip-by-state.grd.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.41&tr2=1.42&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/reports/src/GRParser.py.diff?tr1=1.25&tr2=1.26&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/reports/src/GRReport.py.diff?tr1=1.23&tr2=1.24&r1=text&r2=text
Patches:
Index: gnue/common/src/GTrigger.py
diff -c gnue/common/src/GTrigger.py:1.24 gnue/common/src/GTrigger.py:1.25
*** gnue/common/src/GTrigger.py:1.24 Thu Oct 31 21:40:53 2002
--- gnue/common/src/GTrigger.py Fri Nov 1 00:02:48 2002
***************
*** 605,611 ****
--- 605,647 ----
print self._type,": ",_("Invalid trigger "),key
+ #
+ # Return any XML elements associated with
+ # GDataSources. Bases is a dictionary of tags
+ # whose values are update dictionaries.
+ # For example: bases={'datasource': {'BaseClass':myDataSource}}
+ # sets xmlElements['datasource']['BaseClass'] = myDataSource
+ #
+ def getXMLelements(updates={}):
+ xmlElements = {
+ 'trigger': {
+ 'BaseClass': GTrigger,
+ 'Attributes': {
+ 'name': {
+ 'Unique': 1,
+ 'Typecast': GTypecast.name },
+ 'id': {
+ 'Deprecated': 'Use name="..." instead.', # DEPRECATED: Use
name instead
+ 'Typecast': GTypecast.name },
+ 'type': {
+ 'Typecast': GTypecast.uppername },
+ 'src': {
+ 'References': (('trigger','name'),),
+ 'Typecast': GTypecast.name },
+ 'language': {
+ 'Typecast': GTypecast.name,
+ 'ValueSet': {
+ 'python': {} },
+ 'Default': 'python' } },
+ 'MixedContent': 1,
+ 'KeepWhitespace': 1,
+ 'UsableBySiblings': 1,
+ 'ParentTags': None },
+ }
+ for alteration in updates.keys():
+ xmlElements[alteration].update(updates[alteration])
+ return xmlElements
Index: gnue/designer/src/reports/Instance.py
diff -c gnue/designer/src/reports/Instance.py:1.2
gnue/designer/src/reports/Instance.py:1.3
*** gnue/designer/src/reports/Instance.py:1.2 Tue Jul 30 12:55:29 2002
--- gnue/designer/src/reports/Instance.py Fri Nov 1 00:02:48 2002
***************
*** 38,43 ****
--- 38,44 ----
from gnue.designer.PropertyEditor import PropertyEditor
from gnue.designer.DataSourceEditor import DataSourceEditor
from gnue.designer.SchemaViewer import SchemaViewer
+ from gnue.designer.TriggerEditor import TriggerEditor
from gnue.reports import GRReport, GRParser, GRLayout
***************
*** 76,81 ****
--- 77,84 ----
self.addTool(_('propertyEditor'), _('Property Inspector'), PropertyEditor)
## TODO: Causing a segfault with Wizards!!!!
self.addTool(_('treeEditor'), _('Object Navigator'), TreeView)
+ self.addTool('triggerEditor', _('Event Editor'), TriggerEditor)
+
self.addTool(_('schemaViewer'), _('Schema Navigator'), SchemaViewer)
self.loadWizards(wizards)
Index: gnue/forms/src/GFForm.py
diff -c gnue/forms/src/GFForm.py:1.192 gnue/forms/src/GFForm.py:1.193
*** gnue/forms/src/GFForm.py:1.192 Thu Oct 31 21:40:53 2002
--- gnue/forms/src/GFForm.py Fri Nov 1 00:02:48 2002
***************
*** 38,49 ****
from GFObjects import *
from gnue.common.GDataObjects import ConnectionError as DBError
from gnue.common.GRootObj import GRootObj
- #from GFTriggerError import *
from gnue.common.GTrigger import TriggerError
from GFLibrary import *
import GFLibrary
import GFParser
- #import GFTrigger
# Defines which objects are "Tab Stops"
TabStops = ('GFEntry','GFButton')
--- 38,47 ----
Index: gnue/forms/src/GFParser.py
diff -c gnue/forms/src/GFParser.py:1.74 gnue/forms/src/GFParser.py:1.75
*** gnue/forms/src/GFParser.py:1.74 Thu Oct 31 21:40:53 2002
--- gnue/forms/src/GFParser.py Fri Nov 1 00:02:48 2002
***************
*** 398,426 ****
'Typecast': GTypecast.whole } },
'ParentTags': ('page','block','box') },
! 'trigger': {
! 'BaseClass': GTrigger.GTrigger,
! 'Attributes': {
! 'name': {
! 'Unique': 1,
! 'Typecast': GTypecast.name },
! 'id': {
! 'Deprecated': 'Use name="..." instead.', # DEPRECATED: Use
name instead
! 'Typecast': GTypecast.name },
! 'type': {
! 'Typecast': GTypecast.uppername },
! 'src': {
! 'References': (('trigger','name'),),
! 'Typecast': GTypecast.name },
! 'language': {
! 'Typecast': GTypecast.name,
! 'ValueSet': {
! 'python': {} },
! 'Default': 'python' } },
! 'MixedContent': 1,
! 'KeepWhitespace': 1,
! 'UsableBySiblings': 1,
! 'ParentTags': ('form',) },
'options': {
'BaseClass': GFObjects.GFOptions,
--- 398,426 ----
'Typecast': GTypecast.whole } },
'ParentTags': ('page','block','box') },
! # 'trigger': {
! # 'BaseClass': GTrigger.GTrigger,
! # 'Attributes': {
! # 'name': {
! # 'Unique': 1,
! # 'Typecast': GTypecast.name },
! # 'id': {
! # 'Deprecated': 'Use name="..." instead.', # DEPRECATED: Use
name instead
! # 'Typecast': GTypecast.name },
! # 'type': {
! # 'Typecast': GTypecast.uppername },
! # 'src': {
! # 'References': (('trigger','name'),),
! # 'Typecast': GTypecast.name },
! # 'language': {
! # 'Typecast': GTypecast.name,
! # 'ValueSet': {
! # 'python': {} },
! # 'Default': 'python' } },
! # 'MixedContent': 1,
! # 'KeepWhitespace': 1,
! # 'UsableBySiblings': 1,
! # 'ParentTags': ('form',) },
'options': {
'BaseClass': GFObjects.GFOptions,
***************
*** 591,596 ****
--- 591,606 ----
'cparam': {
'BaseClass': GFObjects.GFCParam }
}))
+
+
+ #
+ # Add trigger elements
+ #
+ xmlElements.update(
+ GTrigger.getXMLelements(
+ updates={'trigger':{
+ 'ParentTags': ('form',)},
+ }))
#
# Add menu elements
Index: gnue/reports/samples/foobulations/monthly.grd
diff -c gnue/reports/samples/foobulations/monthly.grd:1.17
gnue/reports/samples/foobulations/monthly.grd:1.18
*** gnue/reports/samples/foobulations/monthly.grd:1.17 Sun Apr 28 21:52:53 2002
--- gnue/reports/samples/foobulations/monthly.grd Fri Nov 1 00:02:49 2002
***************
*** 1,5 ****
--- 1,11 ----
<?xml version="1.0"?>
<report>
+ <trigger name="Trigger_A" type="On-Startup">
+ print "Can you feel that GNUe-Common love?"
+ </trigger>
+ <trigger name="Trigger_B" type="On-Exit">
+ print "Oh yeah.....I can feel it"
+ </trigger>
<parameters>
<parameter name="subtitle" description="Report Subtitle"
***************
*** 29,35 ****
--- 35,53 ----
</out:tablehead>
<section source="dtsFoo" name="nameBreak">
+ <trigger name="foo1" type="pre-section">
+ print "entering nameBreak"
+ </trigger>
+ <trigger name="foo1" type="post-section">
+ print "exiting nameBreak"
+ </trigger>
<section name="details">
+ <trigger name="foo1" type="pre-section">
+ print "entering details"
+ </trigger>
+ <trigger name="foo1" type="post-section">
+ print "exiting details"
+ </trigger>
<out:row>
<firstrow><out:col><field name="name"
section="nameBreak"/></out:col></firstrow>
<notfirstrow><out:col/></notfirstrow>
Index: gnue/reports/samples/location/zip-by-state.grd
diff -c gnue/reports/samples/location/zip-by-state.grd:1.10
gnue/reports/samples/location/zip-by-state.grd:1.11
*** gnue/reports/samples/location/zip-by-state.grd:1.10 Thu May 30 18:26:17 2002
--- gnue/reports/samples/location/zip-by-state.grd Fri Nov 1 00:02:49 2002
***************
*** 24,31 ****
<sfield field="zip"/>
<soption/>
</sorting-->
! <conditions>
! </conditions>
</datasource>
<datasource name="states" database="gnue" table="state"
master="zips" detaillink="state" masterlink="state"/>
--- 24,31 ----
<sfield field="zip"/>
<soption/>
</sorting-->
! <condition>
! </condition>
</datasource>
<datasource name="states" database="gnue" table="state"
master="zips" detaillink="state" masterlink="state"/>
Index: gnue/reports/src/GRLayout.py
diff -c gnue/reports/src/GRLayout.py:1.41 gnue/reports/src/GRLayout.py:1.42
*** gnue/reports/src/GRLayout.py:1.41 Wed Oct 30 17:45:24 2002
--- gnue/reports/src/GRLayout.py Fri Nov 1 00:02:49 2002
***************
*** 30,35 ****
--- 30,37 ----
from gnue.common.GObjects import *
from gnue.common import GDebug, GConditions
+ from gnue.common.GTrigger import GTrigger,GTriggerExtension
+
from GRParameters import GRStubParam
import GRExceptions
import string
***************
*** 148,154 ****
while curr:
if curr._name == sec:
section = curr
- print "setting section to %s" % curr
break
curr = curr._parent.findParentOfType('GRSection')
--- 150,155 ----
***************
*** 208,215 ****
# Any elements contained within a <layout> element
# inherit GRLayoutElement
#
! class GRLayoutElement (GObj):
def __init__(self, parent=None, type='GRLayoutElement'):
GObj.__init__(self, parent, type=type)
self.name = None
self._source = None
--- 209,217 ----
# Any elements contained within a <layout> element
# inherit GRLayoutElement
#
! class GRLayoutElement (GObj,GTriggerExtension):
def __init__(self, parent=None, type='GRLayoutElement'):
+ GTriggerExtension.__init__(self)
GObj.__init__(self, parent, type=type)
self.name = None
self._source = None
***************
*** 272,278 ****
(nextSection._name not in (child._childSections)),
firstSection=firstSection,
nextSection=nextSection)
!
else:
# Handle the layout element.
nextSection = child.process(dest, mapper, first, islast,
--- 274,282 ----
(nextSection._name not in (child._childSections)),
firstSection=firstSection,
nextSection=nextSection)
! # Don't allow the processing to enter trigger objects
! elif isinstance(child, GTrigger):
! pass
else:
# Handle the layout element.
nextSection = child.process(dest, mapper, first, islast,
***************
*** 309,314 ****
--- 313,320 ----
def __init__(self, parent):
ContainerElement.__init__(self, parent, 'GRSection')
self._childSections = []
+ self._validTriggers = {'PRE-SECTION':'Pre-Section',
+ 'POST-SECTION':'Post-Section',}
def _buildObject(self):
if not hasattr(self,'name') or self.name == None:
***************
*** 398,404 ****
# Generic process() method. Process the
# current record and handle any children.
def process(self, dest, mapper, isfirst, islast, firstSection, nextSection):
!
GDebug.printMesg(10,"Repeating Section %s" % self._name)
structuralComment(dest,"<!-- [section:%s] -->" % self._name)
nextSection = self.processChildren(dest, mapper, isfirst, islast,
firstSection, nextSection)
--- 404,410 ----
# Generic process() method. Process the
# current record and handle any children.
def process(self, dest, mapper, isfirst, islast, firstSection, nextSection):
! self.processTrigger('Pre-Section')
GDebug.printMesg(10,"Repeating Section %s" % self._name)
structuralComment(dest,"<!-- [section:%s] -->" % self._name)
nextSection = self.processChildren(dest, mapper, isfirst, islast,
firstSection, nextSection)
***************
*** 412,417 ****
--- 418,424 ----
structuralComment(dest,"<!-- [/section:%s] -->" % self._name)
GDebug.printMesg(10,"Leaving section %s" % self._name)
+ self.processTrigger('Post-Section')
return nextSection
***************
*** 519,527 ****
--- 526,538 ----
class GRFirstRow(ContainerElement):
def __init__(self, parent):
ContainerElement.__init__(self, parent, 'GRFirstRow')
+ # TODO: shouldn't be here
+ # self._validTriggers = { 'ON-NEW-RECORD':'On-New-Record'}
def process(self, dest, mapper, isfirst, islast, firstSection, nextSection):
if isfirst:
+ # TODO: shouldn't be here
+ # self.processTrigger('On-New-Record')
nextSection = self.processChildren(dest, mapper, isfirst, islast,
firstSection, nextSection)
return nextSection
***************
*** 530,538 ****
--- 541,553 ----
class GRNotFirstRow(ContainerElement):
def __init__(self, parent):
ContainerElement.__init__(self, parent, 'GRNotFirstRow')
+ # TODO: shouldn't be here
+ # self._validTriggers = { 'ON-NEW-RECORD':'On-New-Record'}
def process(self, dest, mapper, isfirst, islast, firstSection, nextSection):
if not isfirst:
+ # TODO: shouldn't be here
+ # self.processTrigger('On-New-Record')
nextSection = self.processChildren(dest, mapper, isfirst, islast,
firstSection, nextSection)
return nextSection
Index: gnue/reports/src/GRParser.py
diff -c gnue/reports/src/GRParser.py:1.25 gnue/reports/src/GRParser.py:1.26
*** gnue/reports/src/GRParser.py:1.25 Thu Jun 27 21:14:31 2002
--- gnue/reports/src/GRParser.py Fri Nov 1 00:02:49 2002
***************
*** 30,36 ****
#
import GRReport, GRSources, GRParameters, GRSortOptions, GRLayout
! from gnue.common import GDataSource, GTypecast, GParser
import copy, types
--- 30,36 ----
#
import GRReport, GRSources, GRParameters, GRSortOptions, GRLayout
! from gnue.common import GDataSource, GTypecast, GParser, GTrigger
import copy, types
***************
*** 257,262 ****
--- 257,271 ----
'cparam': {
'BaseClass': GRParameters.GRConditionParam }
}))
+
+ #
+ # Add trigger elements
+ #
+ xmlElements.update(
+ GTrigger.getXMLelements(
+ updates={'trigger':{
+ 'ParentTags': ('report',)},
+ }))
Index: gnue/reports/src/GRReport.py
diff -c gnue/reports/src/GRReport.py:1.23 gnue/reports/src/GRReport.py:1.24
*** gnue/reports/src/GRReport.py:1.23 Sun Oct 20 22:16:02 2002
--- gnue/reports/src/GRReport.py Fri Nov 1 00:02:49 2002
***************
*** 32,37 ****
--- 32,39 ----
from gnue.common.GObjects import *
from gnue.common.GRootObj import GRootObj
from gnue.common import GDebug
+ from gnue.common.GTrigger import GTriggerExtension
+
import sys
import GRParser
import GRParameters
***************
*** 41,48 ****
import GRExceptions
! class GRReport(GObj, GRootObj):
def __init__(self, parent=None):
GObj.__init__(self, parent, type='GRReport')
GRootObj.__init__(self, 'report')
self._connections = None # This will be set by GRParser.loadReport
--- 43,51 ----
import GRExceptions
! class GRReport(GObj, GRootObj,GTriggerExtension):
def __init__(self, parent=None):
+ GTriggerExtension.__init__(self)
GObj.__init__(self, parent, type='GRReport')
GRootObj.__init__(self, 'report')
self._connections = None # This will be set by GRParser.loadReport
***************
*** 50,61 ****
self._datasourceDictionary = {}
self._parameters = None
def initialize(self):
! pass
def postInit(self):
if not self._parameters:
self._parameters = GRParameters.GRParameters(self)
def dumpXML(self, treeDump=1, gap=" "):
--- 53,80 ----
self._datasourceDictionary = {}
self._parameters = None
+ #
+ # New trigger support
+ #
+ self._triggerns={}
+
+ self._validTriggers = { 'ON-STARTUP': 'On-Startup',
+ 'ON-EXIT': 'On-Exit' }
+
+ #self._triggerGlobal = 1
+ self._triggerFunctions = {}
+ #self.
+
+
def initialize(self):
! self.initTriggerSystem()
! self._triggerns.update(self._triggerNamespaceTree._globalNamespace)
def postInit(self):
if not self._parameters:
self._parameters = GRParameters.GRParameters(self)
+ # def startup(self):
+ # self.processTrigger('On-Startup')
def dumpXML(self, treeDump=1, gap=" "):
***************
*** 72,77 ****
--- 91,97 ----
import GRDataMapper
+
# Connect to databases
GDebug.printMesg(3,"Initializing DataSource Connections")
***************
*** 106,111 ****
--- 126,132 ----
mapper = GRDataMapper.GRDataMapper(sources)
layout.prepare(mapper, parameters)
+ self.processTrigger('On-Startup')
# Write common header information
if not omitGNUeXML:
***************
*** 130,135 ****
--- 151,157 ----
if not omitGNUeXML:
dest.write ("\n</gnue:report-output>\n")
+ self.processTrigger('On-Exit')
def getChildOfType(self, type):
rv = None
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnue common/src/GTrigger.py designer/src/report...,
James Thompson <=