commit-gnue
[Top][All Lists]
Advanced

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

gnue/forms doc/Developers-Guide.sxw src/GFObjec...


From: Jason Cater
Subject: gnue/forms doc/Developers-Guide.sxw src/GFObjec...
Date: Thu, 12 Dec 2002 13:03:30 -0500

CVSROOT:        /cvsroot/gnue
Module name:    gnue
Changes by:     Jason Cater <address@hidden>    02/12/12 13:03:30

Modified files:
        forms/doc      : Developers-Guide.sxw 
        forms/src/GFObjects: GFBlock.py GFButton.py GFField.py 
        forms/utils    : gfd04to05.py 

Log message:
        * Removed block-level On-Switch and made the focus triggers behave at a 
trigger level. (The old On-Switch is now equivalent to Post-FocusIn
        * Documented triggers in the Dev Guide

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/doc/Developers-Guide.sxw.diff?tr1=1.23&tr2=1.24&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFObjects/GFBlock.py.diff?tr1=1.69&tr2=1.70&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFObjects/GFButton.py.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFObjects/GFField.py.diff?tr1=1.81&tr2=1.82&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/utils/gfd04to05.py.diff?tr1=1.13&tr2=1.14&r1=text&r2=text

Patches:
Index: gnue/forms/doc/Developers-Guide.sxw
Index: gnue/forms/src/GFObjects/GFBlock.py
diff -c gnue/forms/src/GFObjects/GFBlock.py:1.69 
gnue/forms/src/GFObjects/GFBlock.py:1.70
*** gnue/forms/src/GFObjects/GFBlock.py:1.69    Wed Nov 27 21:24:39 2002
--- gnue/forms/src/GFObjects/GFBlock.py Thu Dec 12 13:03:29 2002
***************
*** 78,84 ****
      # Trigger exposure
      #
      self._validTriggers = {
!                   'ON-SWITCH':      'On-Switch',
                    'ON-NEWRECORD':   'On-NewRecord',
                    'PRE-COMMIT':     'Pre-Commit',
                    'POST-COMMIT':    'Post-Commit',
--- 78,84 ----
      # Trigger exposure
      #
      self._validTriggers = {
! ##                  'ON-SWITCH':      'On-Switch',    ## Deprecated
                    'ON-NEWRECORD':   'On-NewRecord',
                    'PRE-COMMIT':     'Pre-Commit',
                    'POST-COMMIT':    'Post-Commit',
***************
*** 90,96 ****
                    'PRE-FOCUSOUT':   'Pre-FocusOut',
                    'POST-FOCUSOUT':  'Post-FocusOut',
                    'PRE-FOCUSIN':    'Pre-FocusIn',
!                   'POST-FOCUSIN':   'Post-FocusIn',}
  
  
      self._triggerGlobal = 1
--- 90,96 ----
                    'PRE-FOCUSOUT':   'Pre-FocusOut',
                    'POST-FOCUSOUT':  'Post-FocusOut',
                    'PRE-FOCUSIN':    'Pre-FocusIn',
!                   'POST-FOCUSIN':   'Post-FocusIn' }
  
  
      self._triggerGlobal = 1
***************
*** 240,245 ****
--- 240,246 ----
    # Moves the proper record into editing position
    #
    def switchRecord(self, adjustment):
+ 
      self._currentRecord = self._resultSet.getRecordNumber()
      for field in self._fieldList:
        for entry in field._entryList:
***************
*** 247,254 ****
          entry.recalculateVisible( adjustment, self._currentRecord, 
self._recordCount)
        self._form.updateUIEntry(field)
  
!     if adjustment <> 0:
!       self.processTrigger('ON-SWITCH')
  
    #
    # newRecord
--- 248,254 ----
          entry.recalculateVisible( adjustment, self._currentRecord, 
self._recordCount)
        self._form.updateUIEntry(field)
  
! 
  
    #
    # newRecord
***************
*** 256,307 ****
    # Adds a record to the current records in memory
    #
    def newRecord(self):
      if self._resultSet.insertRecord():
        self._recordCount = self._resultSet.getRecordCount()
        self.switchRecord(1)
        self.processTrigger('ON-NEWRECORD')
  
    def nextRecord(self):
!     if self._resultSet.nextRecord():
        self._recordCount = self._resultSet.getRecordCount()
        self.switchRecord(1)
      elif self._autocreate and not self.isEmpty() and not self.restrictInsert:
        self.newRecord()
  
    def lastRecord(self):
!     self._resultSet.lastRecord()
!     self.switchRecord(0)
  
    def firstRecord(self):
!     self._resultSet.firstRecord()
!     self.switchRecord(0)
  
    def prevRecord(self):
!     if self._resultSet.prevRecord():
        self.switchRecord(-1)
  
    def commit(self):
      self._form.changeFocus(self)
      self._form.commit()
!   
  
    def jumpRecord(self, recordNumber):
      # If recordNumber is negative, move relative to last record
      if recordNumber < 0:
        recordNumber += self._resultSet.getRecordCount()
!     if recordNumber < 0: 
        raise "Invalid record number"
!     if not self._resultSet.setRecord(recordNumber):
!       self._resultSet.lastRecord()
!     jump = self._resultSet.getRecordNumber() - self._currentRecord
!     self._currentRecord = self._resultSet.getRecordNumber()
!     self.switchRecord(jump)
  
    #
    # processCommit
    #
    def processCommit(self):
      GDebug.printMesg(1, "processing commit on block %s"%self.name,1)
      self.mode='commit'
  
      self._resultSet.setRecord(self._precommitRecord)
--- 256,370 ----
    # Adds a record to the current records in memory
    #
    def newRecord(self):
+ 
+     # Focus out
+     self.processTrigger('PRE-FOCUSOUT')
+     self.processTrigger('POST-FOCUSOUT')
+ 
      if self._resultSet.insertRecord():
        self._recordCount = self._resultSet.getRecordCount()
        self.switchRecord(1)
+ 
+       # Focus in
+       self.processTrigger('PRE-FOCUSIN')
        self.processTrigger('ON-NEWRECORD')
+       self.processTrigger('POST-FOCUSIN')
  
    def nextRecord(self):
!     if not self._resultSet.isLastRecord():
! 
!       # Do FocusOut triggers
!       self.processTrigger('PRE-FOCUSOUT')
!       # TODO: I'm not 100% sure of the definition of
!       # TODO: Post-FocusOut  In this context!
!       self.processTrigger('POST-FOCUSOUT')
! 
!       self._resultSet.nextRecord()
        self._recordCount = self._resultSet.getRecordCount()
        self.switchRecord(1)
+ 
+       # Focus in
+       self.processTrigger('PRE-FOCUSIN')
+       self.processTrigger('POST-FOCUSIN')
+ 
      elif self._autocreate and not self.isEmpty() and not self.restrictInsert:
        self.newRecord()
  
    def lastRecord(self):
!     if not self._resultSet.isLastRecord():
!       # Do FocusOut triggers
!       self.processTrigger('PRE-FOCUSOUT')
!       self.processTrigger('POST-FOCUSOUT')
! 
!       self._resultSet.lastRecord()
!       self.switchRecord(0)
! 
!       # Focus in
!       self.processTrigger('PRE-FOCUSIN')
!       self.processTrigger('POST-FOCUSIN')
  
    def firstRecord(self):
!     if not self._resultSet.isFirstRecord():
!       # Do FocusOut triggers
!       self.processTrigger('PRE-FOCUSOUT')
!       self.processTrigger('POST-FOCUSOUT')
! 
!       self._resultSet.firstRecord()
!       self.switchRecord(0)
! 
!       # Focus in
!       self.processTrigger('PRE-FOCUSIN')
!       self.processTrigger('POST-FOCUSIN')
  
    def prevRecord(self):
!     if not self._resultSet.isFirstRecord():
! 
!       # Do FocusOut triggers
!       self.processTrigger('PRE-FOCUSOUT')
!       self.processTrigger('POST-FOCUSOUT')
! 
!       self._resultSet.prevRecord()
        self.switchRecord(-1)
  
+       # Focus in
+       self.processTrigger('PRE-FOCUSIN')
+       self.processTrigger('POST-FOCUSIN')
+ 
    def commit(self):
      self._form.changeFocus(self)
      self._form.commit()
! 
  
    def jumpRecord(self, recordNumber):
      # If recordNumber is negative, move relative to last record
      if recordNumber < 0:
        recordNumber += self._resultSet.getRecordCount()
!     if recordNumber < 0:
        raise "Invalid record number"
! 
! 
!     if recurdNumber != self._resultSet.getRecordNumber():
!       # Focus out
!       self.processTrigger('PRE-FOCUSOUT')
!       self.processTrigger('POST-FOCUSOUT')
! 
!       if not self._resultSet.setRecord(recordNumber):
!         self._resultSet.lastRecord()
! 
!       jump = self._resultSet.getRecordNumber() - self._currentRecord
!       self._currentRecord = self._resultSet.getRecordNumber()
!       self.switchRecord(jump)
! 
!       # Focus in
!       self.processTrigger('PRE-FOCUSIN')
!       self.processTrigger('POST-FOCUSIN')
  
    #
    # processCommit
    #
    def processCommit(self):
      GDebug.printMesg(1, "processing commit on block %s"%self.name,1)
+ 
      self.mode='commit'
  
      self._resultSet.setRecord(self._precommitRecord)
***************
*** 384,390 ****
      maxList = [self._dataSourceLink._dataObject]
      while maxList[0]._masterObject:
        maxList = [maxList[0]._masterObject]
!                     
      # Find the longest master/detail chain that
      # contains query values.  This will become
      # the chain that is queried
--- 447,453 ----
      maxList = [self._dataSourceLink._dataObject]
      while maxList[0]._masterObject:
        maxList = [maxList[0]._masterObject]
! 
      # Find the longest master/detail chain that
      # contains query values.  This will become
      # the chain that is queried
***************
*** 409,421 ****
        for entry in block._entryList:
          if hasattr(entry._field,'sloppyQuery') and 
block._queryValues.has_key(entry._field):
            block._queryValues[entry._field] = "%"+ 
string.join(list(block._queryValues[entry._field]),"%")+"%"
!                                                         
      # Build the sql required by the detail blocks
      SQL = ""
      for dataobject in maxList[:-1]:
        for block in self._logic._blockList:
          if dataobject == block._dataSourceLink._dataObject:
            break
        conditions = _generateConditional(block)
        SQL = self._dataSourceLink.getQueryString(conditions,1,SQL)
  
--- 472,490 ----
        for entry in block._entryList:
          if hasattr(entry._field,'sloppyQuery') and 
block._queryValues.has_key(entry._field):
            block._queryValues[entry._field] = "%"+ 
string.join(list(block._queryValues[entry._field]),"%")+"%"
! 
      # Build the sql required by the detail blocks
      SQL = ""
      for dataobject in maxList[:-1]:
+ 
        for block in self._logic._blockList:
          if dataobject == block._dataSourceLink._dataObject:
            break
+ 
+       block.processTrigger('PRE-QUERY')
+       for field in block._fieldList:
+         field.processTrigger('PRE-QUERY')
+ 
        conditions = _generateConditional(block)
        SQL = self._dataSourceLink.getQueryString(conditions,1,SQL)
  
***************
*** 426,437 ****
      rootBlock = block
  
      conditions = _generateConditional(rootBlock)
!     rootBlock._dataSourceLink.createResultSet(conditions, sql=SQL)     
!       
      rootBlock._recordCount = rootBlock._resultSet.getRecordCount()
  
      for block in self._logic._blockList:
        block.processTrigger('POST-QUERY')
  
  
  def _generateConditional(block):
--- 495,508 ----
      rootBlock = block
  
      conditions = _generateConditional(rootBlock)
!     rootBlock._dataSourceLink.createResultSet(conditions, sql=SQL)
! 
      rootBlock._recordCount = rootBlock._resultSet.getRecordCount()
  
      for block in self._logic._blockList:
        block.processTrigger('POST-QUERY')
+       for field in block._fieldList:
+         field.processTrigger('POST-QUERY')
  
  
  def _generateConditional(block):
***************
*** 447,465 ****
              GDebug.printMesg(5,'Adding conditional AND (%s=%s)' % 
(entry.field, block._queryValues[entry]))
              conditionEq[entry.field] = block._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 = {}
  
      return conditions
--- 518,536 ----
              GDebug.printMesg(5,'Adding conditional AND (%s=%s)' % 
(entry.field, block._queryValues[entry]))
              conditionEq[entry.field] = block._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 = {}
  
      return conditions
Index: gnue/forms/src/GFObjects/GFButton.py
diff -c gnue/forms/src/GFObjects/GFButton.py:1.14 
gnue/forms/src/GFObjects/GFButton.py:1.15
*** gnue/forms/src/GFObjects/GFButton.py:1.14   Mon Nov 25 11:44:18 2002
--- gnue/forms/src/GFObjects/GFButton.py        Thu Dec 12 13:03:29 2002
***************
*** 41,48 ****
                             'PRE-FOCUSOUT':   'Pre-FocusOut',
                             'POST-FOCUSOUT':  'Post-FocusOut',
                             'PRE-FOCUSIN':    'Pre-FocusIn',
!                            'POST-FOCUSIN':   'Post-FocusIn',
!                            'ON-SWITCH':      'On-Switch' }
  
  
    def initialize(self):
--- 41,47 ----
                             'PRE-FOCUSOUT':   'Pre-FocusOut',
                             'POST-FOCUSOUT':  'Post-FocusOut',
                             'PRE-FOCUSIN':    'Pre-FocusIn',
!                            'POST-FOCUSIN':   'Post-FocusIn'}
  
  
    def initialize(self):
Index: gnue/forms/src/GFObjects/GFField.py
diff -c gnue/forms/src/GFObjects/GFField.py:1.81 
gnue/forms/src/GFObjects/GFField.py:1.82
*** gnue/forms/src/GFObjects/GFField.py:1.81    Sat Dec  7 03:31:20 2002
--- gnue/forms/src/GFObjects/GFField.py Thu Dec 12 13:03:29 2002
***************
*** 73,81 ****
                             'POST-FOCUSOUT':  'Post-FocusOut',
                             'PRE-FOCUSIN':    'Pre-FocusIn',
                             'POST-FOCUSIN':   'Post-FocusIn',
-                            'ON-SWITCH':      'On-Switch',
                             'PRE-COMMIT':     'Pre-Commit',
                             'POST-COMMIT':    'Post-Commit',
                             'POST-QUERY':     'Post-Query',
  ##                           'PRE-MODIFY':     'Pre-Modify', #This must be a 
typo
                             'PRE-INSERT':     'Pre-Insert',
--- 73,81 ----
                             'POST-FOCUSOUT':  'Post-FocusOut',
                             'PRE-FOCUSIN':    'Pre-FocusIn',
                             'POST-FOCUSIN':   'Post-FocusIn',
                             'PRE-COMMIT':     'Pre-Commit',
                             'POST-COMMIT':    'Post-Commit',
+                            'PRE-QUERY':      'Pre-Query',
                             'POST-QUERY':     'Post-Query',
  ##                           'PRE-MODIFY':     'Pre-Modify', #This must be a 
typo
                             'PRE-INSERT':     'Pre-Insert',
Index: gnue/forms/utils/gfd04to05.py
diff -c gnue/forms/utils/gfd04to05.py:1.13 gnue/forms/utils/gfd04to05.py:1.14
*** gnue/forms/utils/gfd04to05.py:1.13  Tue Nov 26 21:34:32 2002
--- gnue/forms/utils/gfd04to05.py       Thu Dec 12 13:03:29 2002
***************
*** 280,285 ****
--- 280,289 ----
    # should be reparented to a page
    elif object._parent._tag == 'block':
      object.reparent(object._parent._origparent)
+     
+     # Block On-Switch triggers are now Post-FocusIn
+     if object._tag == 'trigger' and object.type.upper() == 'ON-SWITCH':
+       object.type = 'Post-FocusIn'
  
  
  def fixTriggers(object):



reply via email to

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