commit-gnue
[Top][All Lists]
Advanced

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

gnue common/src/GDataSource.py common/src/GPars...


From: James Thompson
Subject: gnue common/src/GDataSource.py common/src/GPars...
Date: Mon, 04 Nov 2002 09:55:52 -0500

CVSROOT:        /cvsroot/gnue
Module name:    gnue
Changes by:     James Thompson <address@hidden> 02/11/04 09:55:52

Modified files:
        common/src     : GDataSource.py GParser.py GRootObj.py 
                         GTrigger.py 
        designer/src   : Debugger.py 
        designer/src/forms: Instance.py 
        designer/src/reports: Instance.py 
        forms/src      : GFClient.py GFForm.py GFInstance.py 
                         GFLibrary.py GFParser.py 
        navigator/src  : UIwxpython.py 
        reports/src    : GREngine.py GRParser.py GRReport.py 
        reports/src/ignore: test.py 

Log message:
        Migration of import system into common (partially complete)
        Added G*Parser attribute 'Importable' to entities if set to 1 makes then
        that entity becomes importable.
        Adjustments to make reports support importable triggers
        All still pretty rough

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/GDataSource.py.diff?tr1=1.43&tr2=1.44&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/GParser.py.diff?tr1=1.44&tr2=1.45&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/GRootObj.py.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/GTrigger.py.diff?tr1=1.25&tr2=1.26&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/designer/src/Debugger.py.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/designer/src/forms/Instance.py.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/designer/src/reports/Instance.py.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFClient.py.diff?tr1=1.51&tr2=1.52&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFForm.py.diff?tr1=1.195&tr2=1.196&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFInstance.py.diff?tr1=1.61&tr2=1.62&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFLibrary.py.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFParser.py.diff?tr1=1.75&tr2=1.76&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/navigator/src/UIwxpython.py.diff?tr1=1.23&tr2=1.24&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/reports/src/GREngine.py.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/reports/src/GRParser.py.diff?tr1=1.26&tr2=1.27&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/reports/src/GRReport.py.diff?tr1=1.25&tr2=1.26&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/reports/src/ignore/test.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text

Patches:
Index: gnue/common/src/GDataSource.py
diff -c gnue/common/src/GDataSource.py:1.43 gnue/common/src/GDataSource.py:1.44
*** gnue/common/src/GDataSource.py:1.43 Thu Oct 31 18:12:26 2002
--- gnue/common/src/GDataSource.py      Mon Nov  4 09:55:51 2002
***************
*** 370,375 ****
--- 370,376 ----
    xmlElements = {
        'datasource': {
           'BaseClass': GDataSource,
+          'Importable': 1,
           'Attributes': {
              'name':        {
                 'Required': 1,
Index: gnue/common/src/GParser.py
diff -c gnue/common/src/GParser.py:1.44 gnue/common/src/GParser.py:1.45
*** gnue/common/src/GParser.py:1.44     Wed Aug  7 19:29:18 2002
--- gnue/common/src/GParser.py  Mon Nov  4 09:55:51 2002
***************
*** 27,33 ****
  # NOTES:
  #
  
! import sys
  
  try:
    from xml.sax import saxutils
--- 27,36 ----
  # NOTES:
  #
  
! import sys, copy, types
! from gnue.common.GObjects import GObj
! from gnue.common.GTrigger import GTrigger
! from gnue.common.FileUtils import openResource
  
  try:
    from xml.sax import saxutils
***************
*** 118,154 ****
    return object
  
  
- 
- #######################################################
- #
- # char
- #
- # This is for typecasting strings
- #
- # NOTE: This is a redefinition of GTypecast.text.
- #   This redefinition will be removed as soon as all
- #   references to it are changes.  You should be using
- #   GTypecast from now on.
- #
- #######################################################
- char  = GTypecast.text
- 
- 
- #######################################################
- #
- # bool
- #
- # This is for typecasting booleans
- #
- # NOTE: This is a redefinition of GTypecast.boolean.
- #   This redefinition will be removed as soon as all
- #   references to it are changes.  You should be using
- #   GTypecast from now on.
- #
- #######################################################
- bool = GTypecast.boolean
- 
- 
  #######################################################
  #
  # normalise_whitespace
--- 121,126 ----
***************
*** 225,231 ****
  
          # Typecasting, anyone?  If attribute should be int, make it an int
          try:
!           attrs[attr] = 
baseAttrs[attr].get('Typecast',char)(saxattrs[qattr].encode(encoding)) # 
default(baseAttrs[attr],'Typecast',char)(saxattrs[qattr])
            loadedxmlattrs[attr] = attrs[attr]
          except KeyError:
            raise MarkupError, _('Error processing <%s> tag [I do not recognize 
the "%s" attribute') % (name, attr)
--- 197,203 ----
  
          # Typecasting, anyone?  If attribute should be int, make it an int
          try:
!           attrs[attr] = 
baseAttrs[attr].get('Typecast',GTypecast.text)(saxattrs[qattr].encode(encoding))
 # default(baseAttrs[attr],'Typecast',GTypecast.text)(saxattrs[qattr])
            loadedxmlattrs[attr] = attrs[attr]
          except KeyError:
            raise MarkupError, _('Error processing <%s> tag [I do not recognize 
the "%s" attribute') % (name, attr)
***************
*** 242,248 ****
  
            # Pull default values for missing attributes
            if baseAttrs[attr].has_key ('Default'):
!             attrs[attr] = baseAttrs[attr].get('Typecast', char) 
(baseAttrs[attr]['Default'])# default(baseAttrs[attr],'Typecast', char) 
(baseAttrs[attr]['Default'])
  
            # Check for missing required attributes
            elif baseAttrs[attr].get('Required', 0): #default(baseAttrs[attr], 
'Required', 0):
--- 214,220 ----
  
            # Pull default values for missing attributes
            if baseAttrs[attr].has_key ('Default'):
!             attrs[attr] = baseAttrs[attr].get('Typecast', GTypecast.text) 
(baseAttrs[attr]['Default'])# default(baseAttrs[attr],'Typecast', 
GTypecast.text) (baseAttrs[attr]['Default'])
  
            # Check for missing required attributes
            elif baseAttrs[attr].get('Required', 0): #default(baseAttrs[attr], 
'Required', 0):
***************
*** 337,339 ****
--- 309,404 ----
      GDebug.printMesg(50, "</%s>" % name)
  
  
+ class GImportItem(GObj):
+   def __init__(self, parent=None, type="GCImport-Item"):
+     GObj.__init__(self, parent, type=type)
+     self._loadedxmlattrs = {} # Set by parser
+     self._inits = [self.primaryInit]
+     self._xmlParser = self.findParentOfType(None)._xmlParser
+ 
+   def _buildObject(self):
+     if hasattr(self,'_xmltag'):
+       self._type = 'GC%s' % self._xmltag
+       print self._type
+     if not hasattr(self,'_importclass'):
+       print "Adding import class dude"
+       self._importclass = self._xmlParser\
+          .getXMLelements()[string.lower(self._type[9:])]['BaseClass']
+     return GObj._buildObject(self)
+ 
+   def primaryInit(self):
+      #
+      # Open the library and convert it into objects
+      #
+      handle = openResource(self.library)
+      form = self._xmlParser.loadFile(handle, 
self.findParentOfType(None)._app, initialize=0)
+      handle.close()
+      id = 'id'
+      if hasattr(self,'name'):
+          id = 'name'
+      #
+      # Configure the imported object, assign as a child of self
+      #
+      rv = self.__findImportItem(self, form, id)
+      if rv != None:
+        rv._parent = self
+        rv._IMPORTED = 1
+        self._children.append(rv)
+        #
+        # transfer attributes reassigned during the import
+        #
+        for key in self._loadedxmlattrs.keys():
+          if key[0] != '_':
+            rv.__dict__[key] = self._loadedxmlattrs[key]
+            GDebug.printMesg (5, ">>> Moving %s" % key)
+        rv._buildObject()
+ 
+   #
+   # __findImportItem
+   #
+   # finds the item in the object tree with the
+   # same name and instance type
+   #
+   def __findImportItem(self, find, object, id):
+      if isinstance(object, find._importclass) and \
+         hasattr(object, id) and \
+         object.__dict__[id] == find.__dict__[id]:
+        return object
+      elif hasattr(object,'_children'):
+        rv = None
+        for child in object._children:
+          rv = self.__findImportItem(find, child, id)
+          if rv:
+            break
+        return rv
+      else:
+        return None
+                                                    
+ 
+ 
+ def buildImportableTags(elements):
+     #
+     # Scans xml elements and looks for Importable = 1
+     # Items with this set can be imported
+     # If an object needs to be importable,
+     # simply add its tag name to the tuple below
+     # and make sure it has a "name" attribute
+     # (otherwise we don't know how to reference
+     # it in the imported file).
+     #
+     for key in elements.keys():
+      if elements[key].has_key('Importable') and elements[key]['Importable']:
+        name = "import-%s" % key
+        copy._deepcopy_dispatch[types.FunctionType] = copy._deepcopy_atomic
+        copy._deepcopy_dispatch[types.ClassType] = copy._deepcopy_atomic
+        copy._deepcopy_dispatch[type(int)] = copy._deepcopy_atomic
+ 
+        p = copy.deepcopy(elements[key])
+        p['BaseClass'] = GImportItem
+        p['Attributes']['library'] = {
+           'Required': 1,
+           'Typecast': GTypecast.name }
+        p['MixedContent'] = 0
+        p['Required'] = 0
+        elements[name] = p
+     return elements
Index: gnue/common/src/GRootObj.py
diff -c gnue/common/src/GRootObj.py:1.5 gnue/common/src/GRootObj.py:1.6
*** gnue/common/src/GRootObj.py:1.5     Sat Nov  2 01:02:01 2002
--- gnue/common/src/GRootObj.py Mon Nov  4 09:55:51 2002
***************
*** 37,46 ****
  #
  #
  class GRootObj(GObj):
!   def __init__(self, rootName, xmlElementCallback):
      self._triggerNamespaceTree = None
      self._rname = rootName
      self.__xmlElementCallback = xmlElementCallback
  
      # This will store any "global myVar" that the triggers execute.
      self._globalRuntimeNamespace = {}
--- 37,47 ----
  #
  #
  class GRootObj(GObj):
!   def __init__(self, rootName, xmlElementCallback, xmlParser):
      self._triggerNamespaceTree = None
      self._rname = rootName
      self.__xmlElementCallback = xmlElementCallback
+     self._xmlParser = xmlParser
  
      # This will store any "global myVar" that the triggers execute.
      self._globalRuntimeNamespace = {}
Index: gnue/common/src/GTrigger.py
diff -c gnue/common/src/GTrigger.py:1.25 gnue/common/src/GTrigger.py:1.26
*** gnue/common/src/GTrigger.py:1.25    Fri Nov  1 00:02:48 2002
--- gnue/common/src/GTrigger.py Mon Nov  4 09:55:51 2002
***************
*** 36,42 ****
  
  from gnue.common import GTypecast
  from xml.sax import saxutils
! from gnue.common.GParser import GContent
  
  class TriggerError:
    def __init__(self, msg):
--- 36,42 ----
  
  from gnue.common import GTypecast
  from xml.sax import saxutils
! from gnue.common.GParserHelpers import GContent
  
  class TriggerError:
    def __init__(self, msg):
***************
*** 617,622 ****
--- 617,623 ----
    xmlElements = {
        'trigger': {
           'BaseClass': GTrigger,
+          'Importable': 1,
           'Attributes': {
              'name': {
                 'Unique': 1,
Index: gnue/designer/src/Debugger.py
diff -c gnue/designer/src/Debugger.py:1.7 gnue/designer/src/Debugger.py:1.8
*** gnue/designer/src/Debugger.py:1.7   Tue Jul  2 10:08:21 2002
--- gnue/designer/src/Debugger.py       Mon Nov  4 09:55:51 2002
***************
*** 50,56 ****
        self._saveexit = sys.exit
        sys.exit = self.debugClosing
        debugInstance = DebugInstance(caller._app)
!       
debugInstance.setForm(GFParser.loadForm(StringIO(caller.rootObject.dumpXML(treeDump=1)),
 debugInstance))
        debugInstance.activate()
        debugInstance._ui._debuginstance = self
      except: 
--- 50,56 ----
        self._saveexit = sys.exit
        sys.exit = self.debugClosing
        debugInstance = DebugInstance(caller._app)
!       
debugInstance.setForm(GFParser.loadFile(StringIO(caller.rootObject.dumpXML(treeDump=1)),
 debugInstance))
        debugInstance.activate()
        debugInstance._ui._debuginstance = self
      except: 
Index: gnue/designer/src/forms/Instance.py
diff -c gnue/designer/src/forms/Instance.py:1.14 
gnue/designer/src/forms/Instance.py:1.15
*** gnue/designer/src/forms/Instance.py:1.14    Thu Oct 31 21:40:53 2002
--- gnue/designer/src/forms/Instance.py Mon Nov  4 09:55:51 2002
***************
*** 71,77 ****
  
  
    def loadBuffer(self, buffer):
!     form = GFParser.loadForm (buffer, self, initialize=0)
      form.name = 'form'
      return form
  
--- 71,77 ----
  
  
    def loadBuffer(self, buffer):
!     form = GFParser.loadFile (buffer, self, initialize=0)
      form.name = 'form'
      return form
  
Index: gnue/designer/src/reports/Instance.py
diff -c gnue/designer/src/reports/Instance.py:1.3 
gnue/designer/src/reports/Instance.py:1.4
*** gnue/designer/src/reports/Instance.py:1.3   Fri Nov  1 00:02:48 2002
--- gnue/designer/src/reports/Instance.py       Mon Nov  4 09:55:51 2002
***************
*** 54,60 ****
  
  
    def loadBuffer(self, buffer):
!     report = GRParser.loadReport (buffer, self, initialize=0)
      report.name = 'report'
      return report
  
--- 54,60 ----
  
  
    def loadBuffer(self, buffer):
!     report = GRParser.loadFile (buffer, self, initialize=0)
      report.name = 'report'
      return report
  
Index: gnue/forms/src/GFClient.py
diff -c gnue/forms/src/GFClient.py:1.51 gnue/forms/src/GFClient.py:1.52
*** gnue/forms/src/GFClient.py:1.51     Mon Oct 28 06:19:48 2002
--- gnue/forms/src/GFClient.py  Mon Nov  4 09:55:51 2002
***************
*** 39,45 ****
  from gnue.common.GClientApp import *
  from gnue.forms.GFInstance import *
  from gnue.forms.GFForm import *
! from gnue.forms.GFParser import loadForm
  from gnue.forms import GFKeyMapper
  from gnue.common import GDebug
  from gnue.common import GConfig, GDataObjects, GConnections
--- 39,45 ----
  from gnue.common.GClientApp import *
  from gnue.forms.GFInstance import *
  from gnue.forms.GFForm import *
! from gnue.forms.GFParser import loadFile
  from gnue.forms import GFKeyMapper
  from gnue.common import GDebug
  from gnue.common import GConfig, GDataObjects, GConnections
***************
*** 182,188 ****
        #
        fileHandle=openResource(formFile)
  
!       form = loadForm (fileHandle, instance)
        fileHandle.close()
  
        #
--- 182,188 ----
        #
        fileHandle=openResource(formFile)
  
!       form = loadFile (fileHandle, instance)
        fileHandle.close()
  
        #
Index: gnue/forms/src/GFForm.py
diff -c gnue/forms/src/GFForm.py:1.195 gnue/forms/src/GFForm.py:1.196
*** gnue/forms/src/GFForm.py:1.195      Sun Nov  3 23:50:26 2002
--- gnue/forms/src/GFForm.py    Mon Nov  4 09:55:51 2002
***************
*** 39,44 ****
--- 39,45 ----
  from gnue.common.GDataObjects import ConnectionError as DBError
  from gnue.common.GRootObj import GRootObj
  from gnue.common.GTrigger import TriggerError
+ from gnue.common.GParser import GImportItem
  from GFLibrary import *
  import GFLibrary
  import GFParser
***************
*** 48,54 ****
  
  class GFForm(GRootObj, GFObj, events.EventAware):
    def __init__(self, parent=None, app=None):
!     GRootObj.__init__(self, 'form', GFParser.getXMLelements)
      GFObj.__init__(self, parent)
      self._type = "GFForm"
      self._currentObject = [self]
--- 49,56 ----
  
  class GFForm(GRootObj, GFObj, events.EventAware):
    def __init__(self, parent=None, app=None):
!   # TODO: with a little tweaking we can now stop passing  
GFParser.getXMLelements 
!     GRootObj.__init__(self, 'form', GFParser.getXMLelements, GFParser)
      GFObj.__init__(self, parent)
      self._type = "GFForm"
      self._currentObject = [self]
***************
*** 333,339 ****
        importTriggers = string.split(string.replace(object.triggers,' 
',''),',')
  
        handle = openResource(object.library)
!       form = GFParser.loadForm(handle, self._app, initialize=0)
        handle.close()
  
        if importAllDataSources or len(importDataSources):
--- 335,341 ----
        importTriggers = string.split(string.replace(object.triggers,' 
',''),',')
  
        handle = openResource(object.library)
!       form = GFParser.loadFile(handle, self._app, initialize=0)
        handle.close()
  
        if importAllDataSources or len(importDataSources):
***************
*** 364,403 ****
              child._buildObject()
  
  
!     elif isinstance(object, GFLibrary.GFImportItem):
! 
!       handle = openResource(object.library)
!       form = GFParser.loadForm(handle, self._app, initialize=0)
!       handle.close()
!       id = 'id'
!       if hasattr(object,'name'):
!         id = 'name'
! 
!       rv = self.__findImportItem(object, form, id)
!       if rv != None:
!         rv._parent = object
!         rv._IMPORTED = 1
!         object._children.append(rv)
!         for key in object._loadedxmlattrs.keys():
!           if key[0] != '_':
!             rv.__dict__[key] = object._loadedxmlattrs[key]
!             GDebug.printMesg (5, ">>> Moving %s" % key)
!         rv._buildObject()
! 
!   def __findImportItem(self, find, object, id):
!     if isinstance(object, find._importclass) and \
!        hasattr(object, id) and \
!        object.__dict__[id] == find.__dict__[id]:
!       return object
!     elif hasattr(object,'_children'):
!       rv = None
!       for child in object._children:
!         rv = self.__findImportItem(find, child, id)
!         if rv:
!           break
!       return rv
!     else:
!       return None
  
    #
    # end of routines made for walking
--- 366,405 ----
              child._buildObject()
  
  
!     elif isinstance(object, GImportItem):
!       pass
! ##       handle = openResource(object.library)
! ##       form = GFParser.loadFile(handle, self._app, initialize=0)
! ##       handle.close()
! ##       id = 'id'
! ##       if hasattr(object,'name'):
! ##         id = 'name'
! 
! ##       rv = self.__findImportItem(object, form, id)
! ##       if rv != None:
! ##         rv._parent = object
! ##         rv._IMPORTED = 1
! ##         object._children.append(rv)
! ##         for key in object._loadedxmlattrs.keys():
! ##           if key[0] != '_':
! ##             rv.__dict__[key] = object._loadedxmlattrs[key]
! ##             GDebug.printMesg (5, ">>> Moving %s" % key)
! ##         rv._buildObject()
! 
! ##   def __findImportItem(self, find, object, id):
! ##     if isinstance(object, find._importclass) and \
! ##        hasattr(object, id) and \
! ##        object.__dict__[id] == find.__dict__[id]:
! ##       return object
! ##     elif hasattr(object,'_children'):
! ##       rv = None
! ##       for child in object._children:
! ##         rv = self.__findImportItem(find, child, id)
! ##         if rv:
! ##           break
! ##       return rv
! ##     else:
! ##       return None
  
    #
    # end of routines made for walking
Index: gnue/forms/src/GFInstance.py
diff -c gnue/forms/src/GFInstance.py:1.61 gnue/forms/src/GFInstance.py:1.62
*** gnue/forms/src/GFInstance.py:1.61   Fri Oct 25 18:08:33 2002
--- gnue/forms/src/GFInstance.py        Mon Nov  4 09:55:51 2002
***************
*** 34,40 ****
  import os
  import sys
  from gnue.forms.GFForm import *
! from gnue.forms.GFParser import loadForm
  from gnue.forms import VERSION
  from gnue.common import GDebug, GDataObjects
  from gnue.common import events
--- 34,40 ----
  import os
  import sys
  from gnue.forms.GFForm import *
! from gnue.forms.GFParser import loadFile
  from gnue.forms import VERSION
  from gnue.common import GDebug, GDataObjects
  from gnue.common import events
Index: gnue/forms/src/GFLibrary.py
diff -c gnue/forms/src/GFLibrary.py:1.4 gnue/forms/src/GFLibrary.py:1.5
*** gnue/forms/src/GFLibrary.py:1.4     Mon Oct  8 08:38:13 2001
--- gnue/forms/src/GFLibrary.py Mon Nov  4 09:55:51 2002
***************
*** 49,54 ****
        self._type = 'GF%s' % self._xmltag
      if not hasattr(self,'_importclass'):
        self._importclass = GFParser\
!          .getXMLelements()[string.lower(self._type[9:])][0]
      return GObj._buildObject(self)
  
--- 49,56 ----
        self._type = 'GF%s' % self._xmltag
      if not hasattr(self,'_importclass'):
        self._importclass = GFParser\
!          .getXMLelements()[string.lower(self._type[9:])]['BaseClass']
!    
!     print self._type, self._importclass
      return GObj._buildObject(self)
  
Index: gnue/forms/src/GFParser.py
diff -c gnue/forms/src/GFParser.py:1.75 gnue/forms/src/GFParser.py:1.76
*** gnue/forms/src/GFParser.py:1.75     Fri Nov  1 00:02:48 2002
--- gnue/forms/src/GFParser.py  Mon Nov  4 09:55:51 2002
***************
*** 56,62 ****
  #  not want the loaded form to connect to databases, etc)
  #######################################################
  
! def loadForm(buffer, app, initialize=1):
    return GParser.loadXMLObject (buffer, xmlFormsHandler, 'GFForm', 'form',
             initialize, attributes={"_app": app,
                                 "_connections": app.connections })
--- 56,62 ----
  #  not want the loaded form to connect to databases, etc)
  #######################################################
  
! def loadFile(buffer, app, initialize=1):
    return GParser.loadXMLObject (buffer, xmlFormsHandler, 'GFForm', 'form',
             initialize, attributes={"_app": app,
                                 "_connections": app.connections })
***************
*** 144,149 ****
--- 144,150 ----
        'page': {
           'BaseClass': GFObjects.GFPage,
           'Required': 1,
+          'Importable':1,
           'Attributes': {
              'name': {
                 'Unique': 1,
***************
*** 154,159 ****
--- 155,161 ----
  
        'block': {
           'BaseClass': GFObjects.GFBlock,
+          'Importable':1,
           'Attributes': {
              'name': {
                 'Required': 1,
***************
*** 211,216 ****
--- 213,219 ----
        # structure after this list
        'entry': { 
           'BaseClass': GFObjects.GFEntry,
+          'Importable':1,
           'Attributes': { 
              'name': {
                 'Required': 1,
***************
*** 374,379 ****
--- 377,383 ----
  
        'button': {
           'BaseClass': GFObjects.GFButton,
+          'Importable':1,
           'Attributes': {
              'name': {
                 'Unique': 1,
***************
*** 398,427 ****
                 '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,
           'SingleInstance': 1,
--- 402,407 ----
***************
*** 620,642 ****
      # (otherwise we don't know how to reference
      # it in the imported file).
      #
!     for key in ('datasource','page','block','trigger','button','entry'):
!       name = "import-%s" % key
!       copy._deepcopy_dispatch[types.FunctionType] = copy._deepcopy_atomic
!       copy._deepcopy_dispatch[types.ClassType] = copy._deepcopy_atomic
!       copy._deepcopy_dispatch[type(int)] = copy._deepcopy_atomic
! 
!       p = copy.deepcopy(xmlElements[key])
!       p['BaseClass'] = GFLibrary.GFImportItem
!       p['Attributes']['library'] = {
!          'Required': 1,
!          'Typecast': GTypecast.name }
!       p['MixedContent'] = 0
!       p['Required'] = 0
! 
!       xmlElements[name] = p
! 
!   return xmlElements
  
  #
  # Different Types of Entries
--- 600,624 ----
      # (otherwise we don't know how to reference
      # it in the imported file).
      #
! #    if 0:
! #     for key in ('datasource','page','block','trigger','button','entry'):
! #      name = "import-%s" % key
! #      copy._deepcopy_dispatch[types.FunctionType] = copy._deepcopy_atomic
! #      copy._deepcopy_dispatch[types.ClassType] = copy._deepcopy_atomic
! #      copy._deepcopy_dispatch[type(int)] = copy._deepcopy_atomic
! #
! #      p = copy.deepcopy(xmlElements[key])
! #      p['BaseClass'] = GFLibrary.GFImportItem
! #      p['Attributes']['library'] = {
! #         'Required': 1,
! #         'Typecast': GTypecast.name }
! #      p['MixedContent'] = 0
! #      p['Required'] = 0
! #
! #      xmlElements[name] = p
! #      #print xmlElements.keys()
! #  # print GParser.buildImportableTags(xmlElements).keys()
!   return GParser.buildImportableTags(xmlElements)
  
  #
  # Different Types of Entries
Index: gnue/navigator/src/UIwxpython.py
diff -c gnue/navigator/src/UIwxpython.py:1.23 
gnue/navigator/src/UIwxpython.py:1.24
*** gnue/navigator/src/UIwxpython.py:1.23       Tue Sep 24 00:41:10 2002
--- gnue/navigator/src/UIwxpython.py    Mon Nov  4 09:55:51 2002
***************
*** 252,258 ****
        # Build the form tree
        #
        fileHandle = openResource(formfile)
!       form = GFParser.loadForm (fileHandle, instance)
        fileHandle.close()
  
        #
--- 252,258 ----
        # Build the form tree
        #
        fileHandle = openResource(formfile)
!       form = GFParser.loadFile (fileHandle, instance)
        fileHandle.close()
  
        #
Index: gnue/reports/src/GREngine.py
diff -c gnue/reports/src/GREngine.py:1.17 gnue/reports/src/GREngine.py:1.18
*** gnue/reports/src/GREngine.py:1.17   Tue Oct  8 17:50:42 2002
--- gnue/reports/src/GREngine.py        Mon Nov  4 09:55:51 2002
***************
*** 60,66 ****
      try:
        fileHandle = openResource(reportFile)
  
!       report = GRParser.loadReport(fileHandle, self._connectionManager)
  
      except IOError, msg:
        raise GRExceptions.ReportUnreadable, \
--- 60,66 ----
      try:
        fileHandle = openResource(reportFile)
  
!       report = GRParser.loadFile(fileHandle, self._connectionManager)
  
      except IOError, msg:
        raise GRExceptions.ReportUnreadable, \
Index: gnue/reports/src/GRParser.py
diff -c gnue/reports/src/GRParser.py:1.26 gnue/reports/src/GRParser.py:1.27
*** gnue/reports/src/GRParser.py:1.26   Fri Nov  1 00:02:49 2002
--- gnue/reports/src/GRParser.py        Mon Nov  4 09:55:51 2002
***************
*** 54,60 ****
  # the report is initialized and ready to go.
  #######################################################
  
! def loadReport(buffer, connections, initialize=1):
    return GParser.loadXMLObject (buffer, xmlReportHandler, 'GRReport', 
'report',
             initialize, attributes={"_connections": connections})
  
--- 54,60 ----
  # the report is initialized and ready to go.
  #######################################################
  
! def loadFile(buffer, connections, initialize=1):
    return GParser.loadXMLObject (buffer, xmlReportHandler, 'GRReport', 
'report',
             initialize, attributes={"_connections": connections})
  
***************
*** 269,275 ****
  
  
  
!   return xmlElements
  
  
  #######################################################
--- 269,275 ----
  
  
  
!   return GParser.buildImportableTags(xmlElements)
  
  
  #######################################################
Index: gnue/reports/src/GRReport.py
diff -c gnue/reports/src/GRReport.py:1.25 gnue/reports/src/GRReport.py:1.26
*** gnue/reports/src/GRReport.py:1.25   Sat Nov  2 01:02:01 2002
--- gnue/reports/src/GRReport.py        Mon Nov  4 09:55:51 2002
***************
*** 46,54 ****
  class GRReport(GRootObj, GObj, GTriggerExtension):
    def __init__(self, parent=None):
      GTriggerExtension.__init__(self)
!     GRootObj.__init__(self, 'report', GRParser.getXMLelements)
      GObj.__init__(self, parent, type='GRReport')
!     self._connections = None  # This will be set by GRParser.loadReport
      self._inits = (self.initialize,self.postInit)
      self._datasourceDictionary = {}
      self._parameters = None
--- 46,54 ----
  class GRReport(GRootObj, GObj, GTriggerExtension):
    def __init__(self, parent=None):
      GTriggerExtension.__init__(self)
!     GRootObj.__init__(self, 'report', GRParser.getXMLelements, GRParser)
      GObj.__init__(self, parent, type='GRReport')
!     self._connections = None  # This will be set by GRParser.loadFile
      self._inits = (self.initialize,self.postInit)
      self._datasourceDictionary = {}
      self._parameters = None
***************
*** 56,61 ****
--- 56,62 ----
      #
      # New trigger support
      #
+     self._triggerDictionary = {}
      self._triggerns={}
  
      self._validTriggers = { 'ON-STARTUP':     'On-Startup',
***************
*** 63,69 ****
  
      #self._triggerGlobal = 1
      self._triggerFunctions = {}
!     #self.
  
  
    def initialize(self):
--- 64,70 ----
  
      #self._triggerGlobal = 1
      self._triggerFunctions = {}
!     self._app = None
  
  
    def initialize(self):
***************
*** 73,81 ****
    def postInit(self):
      if not self._parameters:
        self._parameters = GRParameters.GRParameters(self)
- #  def startup(self):
- #    self.processTrigger('On-Startup')
- 
  
    #
    # Process the report and generate output per the report definition.
--- 74,79 ----
Index: gnue/reports/src/ignore/test.py
diff -c gnue/reports/src/ignore/test.py:1.1 gnue/reports/src/ignore/test.py:1.2
*** gnue/reports/src/ignore/test.py:1.1 Fri Oct 19 22:41:21 2001
--- gnue/reports/src/ignore/test.py     Mon Nov  4 09:55:51 2002
***************
*** 56,62 ****
    print "The file %s doesn't seem to exist.\n%s\n%s" % (reportfile, 
sys.exc_info()[0], sys.exc_info()[1])
    sys.exit()
  
! report = loadReport (fileHandle)
  
  print 
"\n\n####################################################################\n"
  
--- 56,62 ----
    print "The file %s doesn't seem to exist.\n%s\n%s" % (reportfile, 
sys.exc_info()[0], sys.exc_info()[1])
    sys.exit()
  
! report = loadFile (fileHandle)
  
  print 
"\n\n####################################################################\n"
  




reply via email to

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