commit-gnue
[Top][All Lists]
Advanced

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

gnue common/scripts/gnuedtd common/src/GDataObj...


From: James Thompson
Subject: gnue common/scripts/gnuedtd common/src/GDataObj...
Date: Tue, 05 Nov 2002 21:03:43 -0500

CVSROOT:        /cvsroot/gnue
Module name:    gnue
Changes by:     James Thompson <address@hidden> 02/11/05 21:03:43

Modified files:
        common/scripts : gnuedtd 
        common/src     : GDataObjects.py GDataSource.py 
        common/src/dbdrivers/_dbsig: DBdriver.py 
        common/src/dbdrivers/psycopg: DBdriver.py 
        common/utils   : doc-xml-attrs-openoffice.py 
        forms/src      : GFInstance.py 
        forms/src/GFObjects: GFBlock.py 
        forms/src/uidrivers/wx: UIdriver.py 

Log message:
        temp fix for dcl ticket #60 - query on detail is blocked again
        partial implementation of query by detail logic which should all be 
turned off
        at the moment.  (syncing machines)
        misc fixes for changes in the GRootObj

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/scripts/gnuedtd.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/GDataObjects.py.diff?tr1=1.55&tr2=1.56&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/GDataSource.py.diff?tr1=1.44&tr2=1.45&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/dbdrivers/_dbsig/DBdriver.py.diff?tr1=1.58&tr2=1.59&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/dbdrivers/psycopg/DBdriver.py.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/utils/doc-xml-attrs-openoffice.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFInstance.py.diff?tr1=1.62&tr2=1.63&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFObjects/GFBlock.py.diff?tr1=1.59&tr2=1.60&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/uidrivers/wx/UIdriver.py.diff?tr1=1.206&tr2=1.207&r1=text&r2=text

Patches:
Index: gnue/common/scripts/gnuedtd
diff -c gnue/common/scripts/gnuedtd:1.10 gnue/common/scripts/gnuedtd:1.11
*** gnue/common/scripts/gnuedtd:1.10    Sun Oct 27 21:10:26 2002
--- gnue/common/scripts/gnuedtd Tue Nov  5 21:03:42 2002
***************
*** 368,374 ****
  
          datatype = self.default(
               self.xmlElements[element]['Attributes'][att],
!              'Typecast',GParser.char)
  
          if datatype == int:
            tokentype = "%number;"
--- 368,374 ----
  
          datatype = self.default(
               self.xmlElements[element]['Attributes'][att],
!              'Typecast',GTypecast.text)
  
          if datatype == int:
            tokentype = "%number;"
Index: gnue/common/src/GDataObjects.py
diff -c gnue/common/src/GDataObjects.py:1.55 
gnue/common/src/GDataObjects.py:1.56
*** gnue/common/src/GDataObjects.py:1.55        Thu Oct  3 10:35:47 2002
--- gnue/common/src/GDataObjects.py     Tue Nov  5 21:03:42 2002
***************
*** 125,136 ****
      return self._createResultSet(
         GConditions.combineConditions(conditions, self._staticCondition),
         readOnly=readOnly, masterRecordSet=masterRecordSet)
! 
    # Designed to be replaced by vendor-specific code
    def _createResultSet(self, conditions={}, readOnly=0, masterRecordSet=None):
      pass
  
    # Do not over-ride by vendor code
    def createEmptyResultSet(self, readOnly=0, masterRecordSet=None):
      return self._createEmptyResultSet(readOnly, masterRecordSet)
  
--- 125,139 ----
      return self._createResultSet(
         GConditions.combineConditions(conditions, self._staticCondition),
         readOnly=readOnly, masterRecordSet=masterRecordSet)
!   
    # Designed to be replaced by vendor-specific code
    def _createResultSet(self, conditions={}, readOnly=0, masterRecordSet=None):
      pass
  
    # Do not over-ride by vendor code
+   def getQueryString(self,conditions={},forDetailSQL=None,additionalSQL=""):
+     return self._buildQuery(conditions,forDetailSQL,additionalSQL)
+   
    def createEmptyResultSet(self, readOnly=0, masterRecordSet=None):
      return self._createEmptyResultSet(readOnly, masterRecordSet)
  
Index: gnue/common/src/GDataSource.py
diff -c gnue/common/src/GDataSource.py:1.44 gnue/common/src/GDataSource.py:1.45
*** gnue/common/src/GDataSource.py:1.44 Mon Nov  4 09:55:51 2002
--- gnue/common/src/GDataSource.py      Tue Nov  5 21:03:42 2002
***************
*** 250,255 ****
--- 250,258 ----
        self.__setResultSet( resultSet )
        return resultSet
  
+   def getQueryString(self,conditions={},forDetailSQL=None,additionalSQL=""):
+     return self._dataObject.getQueryString(conditions, 
forDetailSQL,additionalSQL)
+ 
    #
    # Master/detail stuff
    #
Index: gnue/common/src/dbdrivers/_dbsig/DBdriver.py
diff -c gnue/common/src/dbdrivers/_dbsig/DBdriver.py:1.58 
gnue/common/src/dbdrivers/_dbsig/DBdriver.py:1.59
*** gnue/common/src/dbdrivers/_dbsig/DBdriver.py:1.58   Thu Oct 31 18:12:26 2002
--- gnue/common/src/dbdrivers/_dbsig/DBdriver.py        Tue Nov  5 21:03:42 2002
***************
*** 514,520 ****
     GDebug.printMesg(0,
       "Database driver needs updated to not initialize 
DBSIG_DataObject_Object")
  
!   def _buildQuery(self, conditions={}):
      GDebug.printMesg(7,'Implicit Fields: %s' % self._fieldReferences)
      if self.distinct:
        distinct = "distinct "
--- 514,520 ----
     GDebug.printMesg(0,
       "Database driver needs updated to not initialize 
DBSIG_DataObject_Object")
  
!   def _buildQuery(self, conditions={}, forDetail=None, additionalSQL=""):
      GDebug.printMesg(7,'Implicit Fields: %s' % self._fieldReferences)
      if self.distinct:
        distinct = "distinct "
***************
*** 525,538 ****
        pis = "%s," % self._primaryIdSelect
      else:
        pis = ""
!     if len(self._fieldReferences):
        q = "SELECT %s%s%s FROM %s%s" % \
             (distinct, pis, string.join(self._fieldReferences.keys(),","), 
self.table,
!             self._conditionToSQL(conditions))
      else:
        self._primaryIdSelect = None
        q = "SELECT %s* FROM %s%s" % (self.distinct, self.table,
!                         self._conditionToSQL(conditions))
  
      if hasattr(self,'order_by'):
       q = "%s ORDER BY %s " % (q, self.order_by)
--- 525,551 ----
        pis = "%s," % self._primaryIdSelect
      else:
        pis = ""
! 
!     whereClause = self._conditionToSQL(conditions)
!     if additionalSQL:
!       if len(whereClause):
!         whereClause += ' and %s' % (additionalSQL)
!       else:
!         whereClause = 'WHERE %s' % (additionalSQL)
!       
!     if forDetail:
!       q = "%s in (SELECT %s FROM %s%s)" % \
!                      (string.join(self._masterfields,","),
!                       string.join(self._detailfields,","),
!                       self.table, whereClause)
!     elif len(self._fieldReferences):
        q = "SELECT %s%s%s FROM %s%s" % \
             (distinct, pis, string.join(self._fieldReferences.keys(),","), 
self.table,
!             whereClause)
      else:
        self._primaryIdSelect = None
        q = "SELECT %s* FROM %s%s" % (self.distinct, self.table,
!                         whereClause)
  
      if hasattr(self,'order_by'):
       q = "%s ORDER BY %s " % (q, self.order_by)
Index: gnue/common/src/dbdrivers/psycopg/DBdriver.py
diff -c gnue/common/src/dbdrivers/psycopg/DBdriver.py:1.10 
gnue/common/src/dbdrivers/psycopg/DBdriver.py:1.11
*** gnue/common/src/dbdrivers/psycopg/DBdriver.py:1.10  Fri Jan  4 17:56:59 2002
--- gnue/common/src/dbdrivers/psycopg/DBdriver.py       Tue Nov  5 21:03:42 2002
***************
*** 54,61 ****
    def __init__(self): 
      PG_DataObject.__init__(self)
  
!   def _buildQuery(self, conditions={}): 
!     return PGSQL_DataObject_Object._buildQuery(self, conditions)
  
  class PG_DataObject_SQL(PG_DataObject, \
        PGSQL_DataObject_SQL): 
--- 54,61 ----
    def __init__(self): 
      PG_DataObject.__init__(self)
  
!   def _buildQuery(self, conditions={},forDetail=None, additionalSQL=""): 
!     return PGSQL_DataObject_Object._buildQuery(self, 
conditions,forDetail,additionalSQL)
  
  class PG_DataObject_SQL(PG_DataObject, \
        PGSQL_DataObject_SQL): 
Index: gnue/common/utils/doc-xml-attrs-openoffice.py
diff -c gnue/common/utils/doc-xml-attrs-openoffice.py:1.1 
gnue/common/utils/doc-xml-attrs-openoffice.py:1.2
*** gnue/common/utils/doc-xml-attrs-openoffice.py:1.1   Sun Oct 27 21:10:26 2002
--- gnue/common/utils/doc-xml-attrs-openoffice.py       Tue Nov  5 21:03:43 2002
***************
*** 292,298 ****
              adescr = '<text:span text:style-name="Placeholder" >No 
description provided</text:span>'
  
            datatype = self.xmlElements[element]['Attributes'][att].get(
!                'Typecast',GParser.char)
  
            if datatype in (GTypecast.number, GTypecast.integer, 
GTypecast.whole):
              atype = '<text:span text:style-name="Emphasis" 
>numeric</text:span>'
--- 292,298 ----
              adescr = '<text:span text:style-name="Placeholder" >No 
description provided</text:span>'
  
            datatype = self.xmlElements[element]['Attributes'][att].get(
!             'Typecast',GTypecast.text)
  
            if datatype in (GTypecast.number, GTypecast.integer, 
GTypecast.whole):
              atype = '<text:span text:style-name="Emphasis" 
>numeric</text:span>'
Index: gnue/forms/src/GFInstance.py
diff -c gnue/forms/src/GFInstance.py:1.62 gnue/forms/src/GFInstance.py:1.63
*** gnue/forms/src/GFInstance.py:1.62   Mon Nov  4 09:55:51 2002
--- gnue/forms/src/GFInstance.py        Tue Nov  5 21:03:43 2002
***************
*** 520,530 ****
    def requestQuery(self, event):
      if not self._form.endEditing():
        return
!     if hasattr(self._form._currentBlock,"master"):
        messageBox = GFMsgBox(self, _("Query from detail blocks currently not 
supported"))
        messageBox.show()
        return
      message = self._form.prepQuery()
      if message:
        messageBox = GFMsgBox(self,message)
        messageBox.show()
--- 520,533 ----
    def requestQuery(self, event):
      if not self._form.endEditing():
        return
!     
!     if hasattr(self._form._currentBlock._dataSourceLink,"master"):
        messageBox = GFMsgBox(self, _("Query from detail blocks currently not 
supported"))
        messageBox.show()
        return
+ 
      message = self._form.prepQuery()
+ 
      if message:
        messageBox = GFMsgBox(self,message)
        messageBox.show()
Index: gnue/forms/src/GFObjects/GFBlock.py
diff -c gnue/forms/src/GFObjects/GFBlock.py:1.59 
gnue/forms/src/GFObjects/GFBlock.py:1.60
*** gnue/forms/src/GFObjects/GFBlock.py:1.59    Sun Nov  3 23:59:08 2002
--- gnue/forms/src/GFObjects/GFBlock.py Tue Nov  5 21:03:43 2002
***************
*** 54,60 ****
  
      self._inits = [self.initialize]
  
!     self._datasource = None
      self._resultSet = None
      self._dataSourceLink = None
      self._entryList = []
--- 54,60 ----
  
      self._inits = [self.initialize]
  
!     #self._datasource = None
      self._resultSet = None
      self._dataSourceLink = None
      self._entryList = []
***************
*** 332,406 ****
      # If Enter-Query is hit thrice, cancel the query and go into normal mode.
  
      if self.mode != 'query':
!       self.mode = 'query'
!       self._query2 = int(gConfig("RememberLastQuery"))
!       self._queryValues = {}
!       self._queryValues.update(self._queryDefaults)
!       self.switchRecord(0)
      elif self._query2:
!       self._query2 = 0
!       self._queryValues = {}
!       self._queryValues.update(self._lastQueryValues)
!       self.switchRecord(0)
      else:
!       self.mode = 'normal'
!       self.switchRecord(0)
! 
!     # Removed to allow the GFForm object to deside when to clear the block
!     # self.processRollback()
  
    def processQuery(self):
!     # Implement sloppyQuery system
!     if self.mode == 'query':
!       for entry in self._entryList:
!         if hasattr(entry,'sloppyQuery'):
!           newValue = '%'
!           value = entry._value
!           for letter in value:
!             if letter != "%":
!               newValue += letter+"%"
!           entry.setValue(newValue)
! 
!       self.mode = 'normal'
! 
!       self._lastQueryValues = {}
!       self._lastQueryValues.update(self._queryValues)
! 
!       conditionLike = {}
!       conditionEq = {}
! 
!       # Get all the user-supplied parameters from the entry widgets
!       for entry in self._queryValues.keys():
!         if entry._bound and entry.isQueryable() and 
len(str(self._queryValues[entry])):
            if entry.typecast == 'text':
!             GDebug.printMesg(5,'Adding conditional LIKE (%s like %s)' % 
(entry.field, self._queryValues[entry]))
!             conditionLike[entry.field] = self._queryValues[entry]
            else:
!             GDebug.printMesg(5,'Adding conditional AND (%s=%s)' % 
(entry.field, self._queryValues[entry]))
!             conditionEq[entry.field] = self._queryValues[entry]
  
!       if len(conditionLike.keys()) and len(conditionEq.keys()): 
          GDebug.printMesg(5,'Combining like w/and (%s, %s)' % (conditionLike, 
conditionEq))
          conditions = GConditions.combineConditions( \
              GConditions.buildConditionFromDict(conditionLike, 
GConditions.GClike), \
              GConditions.buildConditionFromDict(conditionEq, GConditions.GCeq) 
)
  
!       elif len(conditionLike.keys()): 
          conditions = GConditions.buildConditionFromDict(conditionLike, 
GConditions.GClike)
  
!       elif len(conditionEq.keys()):
          conditions = GConditions.buildConditionFromDict(conditionEq, 
GConditions.GCeq)
  
!       else: 
          conditions = {}
  
!       self._dataSourceLink.createResultSet(conditions)
!       self._recordCount = self._resultSet.getRecordCount()
! 
!       self.processTrigger('POST-QUERY')
! 
! 
! 
  
  
  
--- 332,442 ----
      # If Enter-Query is hit thrice, cancel the query and go into normal mode.
  
      if self.mode != 'query':
!       for block in self._form._blockList:
!         block.mode = 'query'
!         block._query2 = int(gConfig("RememberLastQuery"))
!         block._queryValues = {}
!         block._queryValues.update(self._queryDefaults)
!         block.switchRecord(0)
      elif self._query2:
!       for block in self._form._blockList:
!         block._query2 = 0
!         block._queryValues = {}
!         block._queryValues.update(self._lastQueryValues)
!         block.switchRecord(0)
      else:
!       for block in self._form._blockList:
!         block.mode = 'normal'
!         block.switchRecord(0)
  
+                 
    def processQuery(self):
! ##     for block in self._form._blockList:
! ##       if block._queryValues.keys():
! ##         print "Need to query", block.name
! ##         if block._dataSourceLink._dataObject._masterObject:
! ##           block._lastQueryValues = {}
! ##           block._lastQueryValues.update(block._queryValues)
! ##           conditions = _generateConditional(block)
! ##           block._dataSourceLink.createResultSet(conditions)
! ##           print self._dataSourceLink.getQueryString(conditions,1)
! ##         else:
! ##           print "master object"
! 
!     if 0: # TODO: disable for tonite (05-NOV-2002: jst)
!      maxList = []
!  
!      for block in self._form._blockList:
!        if block._queryValues.keys():
!          list = [block._dataSourceLink._dataObject._masterObject]
!          while list[0]._masterObject:
!            list.append(list[0]._masterObject)
!          if len(maxList) < len(list): maxList = list
! 
! 
!      SQL = ""
!      for dataobject in maxList:
!        for block in self._form._blockList:
!          if dataobject == block._dataSourceLink._dataObject:
!            break
!        conditions = _generateConditional(block)
!        SQL = self._dataSourceLink.getQueryString(conditions,1,SQL)
!        print "working ", SQL
!      print SQL
! 
! ##     # Implement sloppyQuery system
! ##     if self.mode == 'query':
! ##       for entry in self._entryList:
! ##         if hasattr(entry,'sloppyQuery'):
! ##           newValue = '%'
! ##           value = entry._value
! ##           for letter in value:
! ##             if letter != "%":
! ##               newValue += letter+"%"
! ##           entry.setValue(newValue)
! 
!     self.mode = 'normal'
! 
!     self._lastQueryValues = {}
!     self._lastQueryValues.update(self._queryValues)
!     conditions = _generateConditional(self)
!     self._dataSourceLink.createResultSet(conditions)     
!       
!     self._recordCount = self._resultSet.getRecordCount()
!     self.processTrigger('POST-QUERY')
! 
! 
! def _generateConditional(block):
!     conditionLike = {}
!     conditionEq = {}
!     # Get all the user-supplied parameters from the entry widgets
!     for entry in block._queryValues.keys():
!         if entry._bound and entry.isQueryable() and 
len(str(block._queryValues[entry])):
            if entry.typecast == 'text':
!             GDebug.printMesg(5,'Adding conditional LIKE (%s like %s)' % 
(entry.field, block._queryValues[entry]))
!             conditionLike[entry.field] = block._queryValues[entry]
            else:
!             GDebug.printMesg(5,'Adding conditional AND (%s=%s)' % 
(entry.field, block._queryValues[entry]))
!             conditionEq[entry.field] = block._queryValues[entry]
  
!     print "Like",conditionLike
!     print "EQ",conditionEq
!     if len(conditionLike.keys()) and len(conditionEq.keys()): 
          GDebug.printMesg(5,'Combining like w/and (%s, %s)' % (conditionLike, 
conditionEq))
          conditions = GConditions.combineConditions( \
              GConditions.buildConditionFromDict(conditionLike, 
GConditions.GClike), \
              GConditions.buildConditionFromDict(conditionEq, GConditions.GCeq) 
)
  
!     elif len(conditionLike.keys()): 
          conditions = GConditions.buildConditionFromDict(conditionLike, 
GConditions.GClike)
  
!     elif len(conditionEq.keys()):
          conditions = GConditions.buildConditionFromDict(conditionEq, 
GConditions.GCeq)
  
!     else: 
          conditions = {}
  
!     return conditions
  
  
  
Index: gnue/forms/src/uidrivers/wx/UIdriver.py
diff -c gnue/forms/src/uidrivers/wx/UIdriver.py:1.206 
gnue/forms/src/uidrivers/wx/UIdriver.py:1.207
*** gnue/forms/src/uidrivers/wx/UIdriver.py:1.206       Mon Nov  4 19:38:47 2002
--- gnue/forms/src/uidrivers/wx/UIdriver.py     Tue Nov  5 21:03:43 2002
***************
*** 900,906 ****
          value = ""
  
        newWidget = wxTextCtrl(event.container, -1, value, defaultPoint, 
defaultSize, styles)
- 
      self._eventHandler = event.eventHandler
      _setDefaultEventHandlers(newWidget, event.eventHandler, event.initialize)
      return newWidget
--- 900,905 ----
***************
*** 1088,1093 ****
--- 1087,1094 ----
      global _charWidth,_charHeight
      object = _eventObjTowxWindow(event)
  
+     print object
+     
      id = object.GetId()
      gfObject     = _IdToGFObj[id]
      screenWidget = _IdToWxObj[id]




reply via email to

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