commit-gnue
[Top][All Lists]
Advanced

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

gnue/forms/src GFInstance.py


From: James Thompson
Subject: gnue/forms/src GFInstance.py
Date: Wed, 03 Apr 2002 01:37:07 -0500

CVSROOT:        /cvsroot/gnue
Module name:    gnue
Changes by:     James Thompson <address@hidden> 02/04/03 01:37:07

Modified files:
        forms/src      : GFInstance.py 

Log message:
        A little more code cleanup

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/GFInstance.py.diff?tr1=1.41&tr2=1.42&r1=text&r2=text

Patches:
Index: gnue/forms/src/GFInstance.py
diff -c gnue/forms/src/GFInstance.py:1.41 gnue/forms/src/GFInstance.py:1.42
*** gnue/forms/src/GFInstance.py:1.41   Wed Apr  3 01:18:05 2002
--- gnue/forms/src/GFInstance.py        Wed Apr  3 01:37:07 2002
***************
*** 123,129 ****
  
                       } )
  
- 
    #
    # Associate a form object with this instance
    #
--- 123,128 ----
***************
*** 175,181 ****
          messageBox = GFMsgBox(self, event.__errortext__)
          messageBox.show()
  
- 
    #
    # nextEntry
    #
--- 174,179 ----
***************
*** 248,253 ****
--- 246,263 ----
      self.updateStatus()
  
    #
+   # _entryUpdated
+   #
+   # Common code snipped called when something has changed with an
+   # entry and it has to update the stat bar.  Used to cut down on
+   # repeated code.
+   #
+   def _entryUpdated(self):
+     
self.dispatchEvent(GFEvent('gotoENTRY',{'object':self._form._currentEntry}))
+     self.updateRecordCounter()
+     self.updateRecordStatus()
+   
+   #
    # previousRecord
    #
    # Called enever an event source has requested that the
***************
*** 261,269 ****
        messageBox = GFMsgBox(self,message)
        messageBox.show()
        return
!     
self.dispatchEvent(GFEvent('gotoENTRY',{'object':self._form._currentEntry}))
!     self.updateRecordCounter()
!     self.updateRecordStatus()
  
    #
    # nextRecord
--- 271,277 ----
        messageBox = GFMsgBox(self,message)
        messageBox.show()
        return
!     self._entryUpdated()
  
    #
    # nextRecord
***************
*** 279,288 ****
        messageBox = GFMsgBox(self,message)
        messageBox.show()
        return
!     
self.dispatchEvent(GFEvent('gotoENTRY',{'object':self._form._currentEntry}))
!     self.updateRecordCounter()
!     self.updateRecordStatus()
! 
  
    #
    # firstRecord
--- 287,293 ----
        messageBox = GFMsgBox(self,message)
        messageBox.show()
        return
!     self._entryUpdated()
  
    #
    # firstRecord
***************
*** 298,307 ****
        messageBox = GFMsgBox(self,message)
        messageBox.show()
        return
!     
self.dispatchEvent(GFEvent('gotoENTRY',{'object':self._form._currentEntry}))
!     self.updateRecordCounter()
!     self.updateRecordStatus()
! 
  
    #
    # lastRecord
--- 303,309 ----
        messageBox = GFMsgBox(self,message)
        messageBox.show()
        return
!     self._entryUpdated()
  
    #
    # lastRecord
***************
*** 317,326 ****
        messageBox = GFMsgBox(self,message)
        messageBox.show()
        return
!     
self.dispatchEvent(GFEvent('gotoENTRY',{'object':self._form._currentEntry}))
!     self.updateRecordCounter()
!     self.updateRecordStatus()
! 
  
    #
    # jumpToRecord
--- 319,325 ----
        messageBox = GFMsgBox(self,message)
        messageBox.show()
        return
!     self._entryUpdated()
  
    #
    # jumpToRecord
***************
*** 343,368 ****
        messageBox.show()
        return
  
!     
self.dispatchEvent(GFEvent('gotoENTRY',{'object':self._form._currentEntry}))
!     self.updateRecordCounter()
!     self.updateRecordStatus()
! 
! 
  
    def jumpRecords(self,event):
      if not self._form.endEditing():
        return
      count = event.data
      for jumps in range(abs(int(count))):
!       if count > 0:
!         self._form.nextRecord()
!       if count < 0:
!         self._form.prevRecord()
! 
!     
self.dispatchEvent(GFEvent('gotoENTRY',{'object':self._form._currentEntry}))
!     self.updateRecordCounter()
!     self.updateRecordStatus()
! 
  
    def executeExit(self, event):
      if not self._form.isSaved():
--- 342,364 ----
        messageBox.show()
        return
  
!     self._entryUpdated()
  
    def jumpRecords(self,event):
      if not self._form.endEditing():
        return
+     
      count = event.data
+     # Doing this to reduce comparisons in the loop
+     if count > 0:
+       method = self._form.nextRecord
+     else:
+       method = self._form.prevRecord
+       
      for jumps in range(abs(int(count))):
!       method()
!       
!     self._entryUpdated()
  
    def executeExit(self, event):
      if not self._form.isSaved():
***************
*** 388,394 ****
        self._form.deleteRecord()
        self.updateRecordStatus()
  
- 
    #
    # newRecord
    #
--- 384,389 ----
***************
*** 403,412 ****
        self.dispatchEvent(GFEvent('formALERT','Block does not allow insert'));
      else:
        self._form.newRecord()
!       
self.dispatchEvent(GFEvent('gotoENTRY',{'object':self._form._currentEntry}))
!       self.updateRecordCounter()
!       self.updateRecordStatus()
! 
  
    #
    # executeAbout
--- 398,404 ----
        self.dispatchEvent(GFEvent('formALERT','Block does not allow insert'));
      else:
        self._form.newRecord()
!       self._entryUpdated()
  
    #
    # executeAbout
***************
*** 451,460 ****
    #
    def executeRollback(self,event):
      self._form.rollback()
!     
self.dispatchEvent(GFEvent('gotoENTRY',{'object':self._form._currentEntry}))
!     self.updateRecordStatus()
!     self.updateRecordCounter()
! 
  
    #
    # Routines to update parts of the UI's status bar
--- 443,449 ----
    #
    def executeRollback(self,event):
      self._form.rollback()
!     self._entryUpdated()
  
    #
    # Routines to update parts of the UI's status bar
***************
*** 467,476 ****
  
    def updatePageCounter(self):
      maxPages = len(self._form._pageList)
!     for count in range(len(self._form._pageList)):
!       if self._form._pageList[count] == self._form._currentPage:
!         break
! 
      
self.dispatchEvent(GFEvent('uiUPDATESTATUS',[None,None,None,None,None,count+1,maxPages]))
  
    def updateTip(self):
--- 456,462 ----
  
    def updatePageCounter(self):
      maxPages = len(self._form._pageList)
!     count = self._form._pageList.index(self._form._currentPage)
      
self.dispatchEvent(GFEvent('uiUPDATESTATUS',[None,None,None,None,None,count+1,maxPages]))
  
    def updateTip(self):
***************
*** 526,532 ****
      self.updateRecordStatus()
      self.updateTip()
  
- 
    def requestQuery(self, event):
      if not self._form.endEditing():
        return
--- 512,517 ----
***************
*** 553,561 ****
        messageBox.show()
        return
      self._form.refreshDisplay(self._form._currentBlock)
!     
self.dispatchEvent(GFEvent('gotoENTRY',{'object':self._form._currentEntry}))
!     self.updateRecordStatus()
!     self.updateRecordCounter()
  
    def executeQuery(self, event):
      if not self._form.endEditing():
--- 538,544 ----
        messageBox.show()
        return
      self._form.refreshDisplay(self._form._currentBlock)
!     self._entryUpdated()
  
    def executeQuery(self, event):
      if not self._form.endEditing():
***************
*** 565,573 ****
        messageBox = GFMsgBox(self,message)
        messageBox.show()
      self._form.refreshDisplay(self._form._currentBlock)
!     
self.dispatchEvent(GFEvent('gotoENTRY',{'object':self._form._currentEntry}))
!     self.updateRecordStatus()
!     self.updateRecordCounter()
  
  
      
--- 548,554 ----
        messageBox = GFMsgBox(self,message)
        messageBox.show()
      self._form.refreshDisplay(self._form._currentBlock)
!     self._entryUpdated()
  
  
      
***************
*** 626,629 ****
  
      # pass control to UI
      ui.mainLoop()
- 
--- 607,609 ----



reply via email to

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