commit-gnue
[Top][All Lists]
Advanced

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

gnue/gnuef ChangeLog src/GFForm.py src/GFObject...


From: James Thompson
Subject: gnue/gnuef ChangeLog src/GFForm.py src/GFObject...
Date: Tue, 20 Feb 2001 11:57:13 -0800

CVSROOT:        /cvs
Module name:    gnue
Changes by:     James Thompson <address@hidden> 01/02/20 11:57:13

Modified files:
        gnuef          : ChangeLog 
        gnuef/src      : GFForm.py GFObjects.py UIwxpython.py 

Log message:
        Cleanup and comments in code
        UI hacks to make it DTRT in several instances where it wasn't
        Updated changelog

CVSWeb URLs:
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/ChangeLog.diff?r1=1.10&r2=1.11
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/src/GFForm.py.diff?r1=1.70&r2=1.71
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/src/GFObjects.py.diff?r1=1.64&r2=1.65
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/src/UIwxpython.py.diff?r1=1.69&r2=1.70

Patches:
Index: gnue/gnuef/ChangeLog
diff -u gnue/gnuef/ChangeLog:1.10 gnue/gnuef/ChangeLog:1.11
--- gnue/gnuef/ChangeLog:1.10   Thu Jan 18 05:26:36 2001
+++ gnue/gnuef/ChangeLog        Tue Feb 20 11:57:12 2001
@@ -1,3 +1,178 @@
+2001-02-19 20:47  jamest
+
+       * TODO, samples/button/forms/form.gfd, samples/zipcode/states.gfd,
+       samples/zipcode/zipcode.gfd, src/GFForm.py, src/GFObjects.py,
+       src/GFParser.py, src/UIbase.py, src/UIwxpython.py: <button> support
+       misc internal changes that I don't recall :( cleaned up TODO a bit
+
+2001-02-19 11:31  jamest
+
+       * src/: GFOptions.py, UIwxpython.py,
+       drivers/postgresql/DBdriver.py: Fixed toolbar on win32 platforms
+       Added quick hack to postgresql to support different encodings
+
+2001-02-16 18:42  jamest
+
+       * src/: GFObjects.py, UIwxpython.py: Fixed gap bugs in entry and
+       labels An empty entry is now considered valid on validated entries
+
+2001-02-15 22:34  jamest
+
+       * INSTALL, TODO, samples/zipcode/states.gfd,
+       samples/zipcode/zipcode.gfd, src/GFForm.py, src/GFObjects.py,
+       src/UIwxpython.py: added gap attrib to entry widgets fixed height
+       bug causing all entry's w/ any height to get set to multiline
+       readonly fields can now be queried slight change to UIwxpython to
+       have it ignore events it can't handle instead of passing to std
+       widget handlers updated INSTALL docs a little
+
+2001-02-12 21:55  jamest
+
+       * src/: GFObjects.py, UIwxpython.py: made toolbar look a little
+       nicer under unix fixed deletion of last charater in entry not
+       working bug
+
+2001-02-09 20:58  dneighbors
+
+       * images/button16.png, images/tb_help.png,
+       images/tb_left_arrow.png, images/tb_new.png,
+       images/tb_preferences.png, images/tb_right_arrow.png,
+       images/tb_save.png, images/tb_search.png, images/tb_trash.png,
+       images/tb_undo.png, src/GFOptions.py, src/UIwxpython.py: tb_*.png  
+       ** Added new buttons from tigert (w/ ok and GPL)
+       
+       button16.png   ** Removed this sample as better icons found
+       
+       GFOptions.py   ** Made status bar messages var's for reuse in
+       buttons/menus   ** Made image vars
+       
+       UIwxpython.py   ** Added all buttons/images   ** Bound buttons to
+       events of menus
+
+2001-02-09 19:00  jamest
+
+       * samples/inventory/forms/sc_inv_cycle_count.gfd, src/GFForm.py,
+       src/GFObjects.py, src/UIwxpython.py: Initial multiline text box
+       support
+
+2001-02-09 16:06  jamest
+
+       * INSTALL, TODO, setup.py, images/gnue-splash.png,
+       images/gnue-splash.xcf, images/gnue.bmp, images/gnue.png,
+       images/gnue.xcf, images/gnuef-splash.bmp,
+       samples/zipcode/zipcode.gfd, src/GFForm.py, src/GFObjects.py,
+       src/GFOptions.py, src/GFParser.py, src/UIbase.py,
+       src/UIwxpython.py: switched all images to png format altered splash
+       screen to use text widgets to display info instead of graphic added
+       <scrollbar> tag support - not implemented yet in code added partial
+       support for keying thru dropdown values (1 char only)
+
+2001-02-09 12:14  dneighbors
+
+       * images/button16.png, src/GFOptions.py, src/UIwxpython.py:
+       GFOptions   ** Added pointer to button image
+       
+       UIwxpython   ** Made image handling platform independent
+       
+       button16.png   ** Generic test button for toolbar added
+
+2001-02-08 22:55  jamest
+
+       * client/gfclient, src/UIwxpython.py,
+       src/drivers/mysql/DBdriver.py, src/drivers/odbc/DBdriver.py: Win32
+       urllib drive letter bug work arround Win32 login dialog under
+       splashscreen bug MySQL/ODBC driver changes Remove function key ref
+       from about dialog
+
+2001-02-08 16:18  treshna
+
+       * samples/zipcode/pg_zip_code.sql: fixed a little typo
+
+2001-02-07 21:11  jamest
+
+       * setup.py, client/gfclient, src/drivers/mysql/DBdriver.py,
+       src/drivers/odbc/DBdriver.py: setup.py only checks during a build
+       Untested changes to fix odbc and mysql drivers error checking
+       Changes gfclient to handle full path symbolic links to forms
+
+2001-02-07 00:46  dneighbors
+
+       * TODO: ** Volunteered for ToolBar support so jamest can pull his
+       hair out    and swear my name when he has to rewrite.
+
+2001-02-07 00:41  dneighbors
+
+       * src/UIwxpython.py: ** Added Hot Key Definitions to Menu Items. 
+       ** Put working tool bar stub in.  Just need to do some clean up   
+       and checking with big kahuna on logistics and toolbar should    be
+       ready to rock.
+
+2001-02-05 19:21  jamest
+
+       * INSTALL, src/GFForm.py, src/GFObjects.py, src/GFOptions.py,
+       src/UIwxpython.py: Cleanups Added Dmitry Sorokin's hack for russian
+       input support Database errors now check for during queries
+
+2001-01-31 13:16  jamest
+
+       * INSTALL, INSTALL.win32, README.windows, TODO,
+       src/drivers/mysql/DBdriver.py, src/drivers/odbc/DBdriver.py:
+       Updates to make mysql and odbc drivers work (Completely
+       Untested!!!!!!) Updates INSTALL instructions
+
+2001-01-30 22:21  jamest
+
+       * TODO, src/UIwxpython.py: More alterations for win32 support
+
+2001-01-29 21:31  jamest
+
+       * src/: GFError.py, GFForm.py, GFObjects.py, UIwxpython.py,
+       drivers/postgresql/DBdriver.py: Started adding support for DBError
+       exceptions Enhanced login support Transactions now supported on
+       commit
+
+2001-01-29 16:50  jamest
+
+       * src/: DBfactory.py, GFForm.py, GFObjects.py, UIwxpython.py,
+       drivers/postgresql/DBdriver.py: More changes needed to get this to
+       run under windows Start of a transaction system
+
+2001-01-29 15:35  jamest
+
+       * INSTALL, setup.py, src/GFForm.py, src/GFOptions.py,
+       src/UIwxpython.py, src/drivers/postgresql/DBdriver.py: Updates to
+       make gnuef play nicer in windows checked in so jade could look at
+       case issue under windows
+
+2001-01-25 16:39  jamest
+
+       * setup.cfg, setup.py: Setup enhancements
+
+2001-01-24 21:13  jamest
+
+       * FAQ, MANIFEST.in, README, README.curses, README.windows,
+       setup.cfg, setup.py, client/gfclient, doc/techref.lyx,
+       doc/techref.ps, images/gnue-splash.xcf, images/gnue.bmp,
+       images/gnuef-splash.bmp, samples/simple/form.gfd,
+       samples/zipcode/zipcode.gfd, setupext/__init__.py,
+       setupext/install_data.py: Updated docs changed -u text to -u pytext
+       and -u newtext to -u text moved images arround a bit setup.py
+       enhancements
+
+2001-01-21 12:50  jamest
+
+       * doc/techref.lyx: New version of the tech ref added here
+       temporarily
+
+2001-01-18 07:26  jamest
+
+       * ChangeLog, NEWS, README, TODO, samples/track/tracking.gfd,
+       samples/zipcode/states.gfd, src/GFForm.py, src/GFObjects.py,
+       src/UIcurses.py: Updated log files to rflect upcomming release Hack
+       to improve master/detail support UIcurses changes: support for
+       hidden fields, reverse video status bars                   cursor
+       positioning code still broke in UIcurses
+
 2001-01-14 22:19  jamest
 
        * src/UIcurses.py: Converted from python 2.0 curses to python 1.5.2
@@ -218,8 +393,7 @@
 
 2000-12-15 21:32  jamest
 
-       * TODO, images/bmp/gnue-splash.bmp, images/bmp/gnuef-splash.bmp,
-       src/GFController.py, src/GFEvent.py, src/GFForm.py,
+       * TODO, src/GFController.py, src/GFEvent.py, src/GFForm.py,
        src/GFObjects.py, src/GFParser.py, src/GFTrigger.py, src/UIbase.py,
        src/UIpyncurses.py, src/UIwxpython.py,
        src/drivers/mysql/DBdriver.py, src/drivers/postgresql/DBdriver.py:
@@ -229,11 +403,6 @@
 2000-12-15 11:37  jmeskill
 
        * src/: gnue-splash.bmp, gnue.bmp: Moved to gnuef/images
-
-2000-12-15 11:36  jmeskill
-
-       * images/: bmp/gnue-splash.bmp, bmp/gnue.bmp, xcf/gnue-splash.xcf:
-       Moved images to images subdir
 
 2000-12-14 15:02  cspence
 
Index: gnue/gnuef/src/GFForm.py
diff -u gnue/gnuef/src/GFForm.py:1.70 gnue/gnuef/src/GFForm.py:1.71
--- gnue/gnuef/src/GFForm.py:1.70       Mon Feb 19 18:47:24 2001
+++ gnue/gnuef/src/GFForm.py    Tue Feb 20 11:57:13 2001
@@ -283,9 +283,13 @@
   def newRecord(self, event):
     if not hasattr(self,'readonly'):
       self.currentBlock.newRecord()
+      self.dispatchEvent(GFEvent('uiNEXTRECORD',self.currentEntry))
+      self.currentBlock.nextRecord()
+      self.dispatchEvent(GFEvent('uiPREVRECORD',self.currentEntry))
+      self.currentBlock.prevRecord()
       self.dispatchEvent(GFEvent('gotoENTRY',self.currentEntry));
-      self.updateRecordStatus()
       self.updateRecordCounter()
+      self.updateRecordStatus()
     else:
       self.dispatchEvent(GFEvent('formALERT','Form is readonly'))
 
@@ -321,7 +325,11 @@
       block.processRollback()
       
     self.currentBlock.initQuery()
-      
+    self.dispatchEvent(GFEvent('uiNEXTRECORD',self.currentEntry))
+    self.currentBlock.nextRecord()
+    self.dispatchEvent(GFEvent('uiPREVRECORD',self.currentEntry))
+    self.currentBlock.prevRecord()
+    self.dispatchEvent(GFEvent('gotoENTRY',self.currentEntry));
     self.updateStatus()
     
   def executeQuery(self, event):
@@ -343,6 +351,12 @@
         for block in self.blockList:
           GFDebug.printMesg(1, "Saving %s"%block.name)
           block.processCommit()
+          
+        self.dispatchEvent(GFEvent('uiNEXTRECORD',self.currentEntry))
+        self.currentBlock.nextRecord()
+        self.dispatchEvent(GFEvent('uiPREVRECORD',self.currentEntry))
+        self.currentBlock.prevRecord()
+        self.dispatchEvent(GFEvent('gotoENTRY',self.currentEntry));
         self.updateRecordStatus()
         self.updateRecordCounter()
       else:
@@ -372,6 +386,11 @@
     for block in self.blockList:
       block.processRollback();
     self.dispatchEvent(GFEvent('gotoENTRY',self.currentEntry));
+    self.dispatchEvent(GFEvent('uiNEXTRECORD',self.currentEntry))
+    self.currentBlock.nextRecord()
+    self.dispatchEvent(GFEvent('uiPREVRECORD',self.currentEntry))
+    self.currentBlock.prevRecord()
+    self.dispatchEvent(GFEvent('gotoENTRY',self.currentEntry));                
         
     self.updateRecordStatus()
     self.updateRecordCounter()
     
Index: gnue/gnuef/src/GFObjects.py
diff -u gnue/gnuef/src/GFObjects.py:1.64 gnue/gnuef/src/GFObjects.py:1.65
--- gnue/gnuef/src/GFObjects.py:1.64    Mon Feb 19 18:47:24 2001
+++ gnue/gnuef/src/GFObjects.py Tue Feb 20 11:57:13 2001
@@ -42,24 +42,36 @@
   # This will be the base of the new initialization system for gnuef
   # each childs initialization function must call GFObj.initialize()
   # 
-
   def initialize(self):
     if self.children:
       for child in self.children:
         child.inititialize(function)
-                
+
+  
   def getObjectType(self):
     return self.type
-  
+
+  #
+  # addChild
+  #
+  # Adds an object to an instances list of children
+  #
   def addChild(self, child):
     self.children.append(child)
 
+  
   def walk(self, function):
     function(self)
     if self.children:
       for child in self.children:
         child.walk(function)
 
+  #
+  # findParentOfType
+  #
+  # Moves upward though the parents of an object till
+  # it finds the parent of the specified type
+  #
   def findParentOfType(self,type):
     parentObject = self
     while (parentObject.getObjectType() != type):
@@ -165,8 +177,13 @@
   def buildEntryList(self, object):
     if object.getObjectType() == 'GFEntry':
        self.entryList.append(object)
-
 
+  #
+  # isSaved
+  #
+  # returns a positive value if the datasource the block is associated
+  # with is saved
+  #
   def isSaved(self):
     return self.dataSourceLink.isSaved()
   
@@ -248,9 +265,6 @@
     self.dataSourceLink.clear()
     self.switchRecord(0)
 
-    #self.dispatchEvent(GFEvent('requestPREVRECORD',None))
-    #self.dispatchEvent(GFEvent('requestNEXTRECORD',None))
-
   #
   # initQuery and processQuery
   #
@@ -437,6 +451,11 @@
     if hasattr(self,'prequery'):
       self.query()
 
+  #
+  # new
+  #
+  # create a new, empty record
+  #
   def new(self):
     newentry = {}
     for key in self.emptyRecord.keys():
@@ -444,6 +463,12 @@
     self.resultSet.append(newentry)
     self.resultSetStatus.append('saved')
 
+  #
+  # clear
+  #
+  # remove all records from memory except for an initial
+  # empty record
+  #
   def clear(self):
     self.resultSet = []
     self.resultSetStatus = []
@@ -459,6 +484,11 @@
   def getLastRecordNumber(self):
     return len(self.resultSet)-1
 
+  #
+  # isSaved
+  #
+  # returns a positive value if all records in the datasource are saved
+  #
   def isSaved(self):
     value = 1
     for count in range(len(self.resultSetStatus)):
@@ -466,7 +496,13 @@
         value = 0
         break
     return value
-  
+
+  #
+  # query
+  #
+  # Takes the first record in the datasource and uses it as a query mask
+  # against the database backend
+  #
   def query(self):
     GFDebug.printMesg(2, "Query with this in resultSet\n%s"%self.resultSet[0])
     if hasattr(self,'database'):
@@ -501,13 +537,13 @@
               self.resultSet[count][key] = str(self.resultSet[count][key])
       else:
         self.clear()
-        
-##  def beginTransaction(self):
-##    self.dataConnection.beginTransaction()
 
-##  def rollback(self):  
-##    self.dataConnection.rollback()
-      
+  #
+  # commit
+  #
+  # goes thru all records in the datasource and if they are new, have been 
alters, or marked
+  # for delete then it calls the appropriate GFDatabase methods to accomplish 
inserts,updates,or deletes
+  #
   def commit(self):
     if hasattr(self,'database'):
       for count in range(len(self.resultSet)):
@@ -563,6 +599,13 @@
           if self.resultSet[count][key] != None:
             self.resultSet[count][key] = str(self.resultSet[count][key])
 
+  #
+  # markForRemoval
+  #
+  # Flips a specifics record number's unique key value from back and forth
+  # from positive to negative.  A negative unique key means that the record
+  # is marked for deletion on next commit
+  #
   def markForRemoval(self,recordNumber):
     if not self.resultSet[recordNumber].has_key(self.dataConnection.uniqueKey):
       self.resultSet[recordNumber][self.dataConnection.uniqueKey] = 'delete'
@@ -605,8 +648,15 @@
         self.resultSet[recordNumber][fieldName] = value
         if not internalCall: 
           self.resultSetStatus[recordNumber] = 'modified'
-        #lock that record in the datasource
-
+        #
+        # Eventually we need to lock that record in the datasource here
+        #
+        
+  #
+  # addField
+  #
+  # Adds a named field to a datasource
+  # 
   def addField(self,fieldName):
     if not fieldName in self.fieldList:
       for count in range(len(self.resultSet)):
@@ -617,7 +667,8 @@
 ############################################################
 # GFDatabase
 #
-# The connection to a specific chunk of data
+# A wrapper for the various database drivers.  Presents
+# a consistant API to all database drivers
 #
 class GFDatabase(GFObj):
   def __init__(self, parent=None):
Index: gnue/gnuef/src/UIwxpython.py
diff -u gnue/gnuef/src/UIwxpython.py:1.69 gnue/gnuef/src/UIwxpython.py:1.70
--- gnue/gnuef/src/UIwxpython.py:1.69   Mon Feb 19 18:47:24 2001
+++ gnue/gnuef/src/UIwxpython.py        Tue Feb 20 11:57:13 2001
@@ -34,21 +34,21 @@
     self.incommingEvent.update({'msgBoxUI' : self.msgBox,
                                 'getLogin' : self.getLogin
                                 })
-#
-#Note: new api. onInit is called during the main event loop of
-#      the UI (i.e. wxPython.mainLoop in this case)
-#
+  #
+  #Note: new api. onInit is called during the main event loop of
+  #      the UI (i.e. wxPython.mainLoop in this case)
+  #
   def onInit(self):
-    self.incommingEvent.update({'gotoENTRY'    : self.switchFocus,
-                           'updateENTRY'  : self.updateEntry,
-                           'gotoPAGE'     : self.gotoPage,
-                           'formALERT'    : self.formAlert,
-                           'requireLOGIN' : self.getLogin,
-                           'uiNEXTRECORD' : self.adjustMultiView,
-                           'uiPREVRECORD' : self.adjustMultiView,
-                           'uiUPDATESTATUS': self.updateStatus,
-                           'uiABOUT': self.aboutBox,
-                           'exitApplication': self.exitApplication
+    self.incommingEvent.update({'gotoENTRY'       : self.switchFocus,
+                                'updateENTRY'     : self.updateEntry,
+                                'gotoPAGE'        : self.gotoPage,
+                                'formALERT'       : self.formAlert,
+                                'requireLOGIN'    : self.getLogin,
+                                'uiNEXTRECORD'    : self.adjustMultiView,
+                                'uiPREVRECORD'    : self.adjustMultiView,
+                                'uiUPDATESTATUS'  : self.updateStatusBar,
+                                'uiABOUT'         : self.aboutBox,
+                                'exitApplication' : self.exitApplication
                           })
     
 
@@ -100,9 +100,8 @@
     self.visiblePage = self.pageList[0]
 
     self.frame.Show(TRUE)
-
-
     self.splash.Destroy()
+    
   #
   # Misc functions
   #
@@ -110,11 +109,11 @@
     self.MainLoop() # simply call the wxApp's MainLoop method
     
   def OnInit(self):
-    #SplashScreen Stuff
-    #Note splash screen is used to bootstrap
-    #In future need to implement callback in platform
-    #independent way.
-    #object tree building
+    # SplashScreen Stuff
+    # Note splash screen is used to bootstrap
+    # In future need to implement callback in platform
+    # independent way.
+    # object tree building
     wxInitAllImageHandlers()
     self.splash = SplashScreen(None,bitmapfile=GFOptions.splashScreenPNG,
                                duration=1000, callback=self.onMain,
@@ -154,10 +153,69 @@
     self.splash.CenterOnScreen()
     return true
     
+  #############################################################################
+  #
+  # Incomming Event Processors
+  #
+  # Processes the incomming events from other objects
+  #
+  def updateEntry(self,event):
+    index = self.formToUI[event.data][1]
+    
+    block = event.data.block
+    currentRecord = block.currentRecord
+
+    if hasattr(event.data, 'style'):
+      style = event.data.style
+    else:
+      style = 'text'
+
+    # Fill the prior spots 
+    for count in range(index):
+      value = 
block.dataSourceLink.getField(currentRecord-(index-count),event.data.field)
+      if style == 'dropdown':
+        value = event.data.allowedValues()[value]
+
+      self.formToUI[event.data][0][count].SetEvtHandlerEnabled(FALSE)
+      self.formToUI[event.data][0][count].SetValue(value)
+      self.formToUI[event.data][0][count].SetEvtHandlerEnabled(TRUE)
+
+    # fill currently indexed spot
+    if style == 'dropdown':
+      value = event.data.allowedValues()[event.data.getValue()]
+    else:
+      value = event.data.getValue()
+    
+    self.formToUI[event.data][0][index].SetEvtHandlerEnabled(FALSE)
+    self.formToUI[event.data][0][index].SetValue(value)
+    self.formToUI[event.data][0][index].SetEvtHandlerEnabled(TRUE)
+
+    
self.formToUI[event.data][0][index].SetInsertionPoint(event.data.cursorPosition)
+
+    # Fill trailing spots
+    #
+    # You must skip the matching index but
+    # you do not want to just add 1 to count
+    # as the formulas would then be off
+    count = index
+    while count < int(event.data.visibleCount):
+      if count != index:
+        if currentRecord+(count-index) > block.recordCount:
+          value = ""
+        else:
+          value = 
block.dataSourceLink.getField(currentRecord+(count-index),event.data.field)
+          if style == 'dropdown':
+            value = event.data.allowedValues()[value]
+        self.formToUI[event.data][0][count].SetEvtHandlerEnabled(FALSE)
+        self.formToUI[event.data][0][count].SetValue(value)
+        self.formToUI[event.data][0][count].SetEvtHandlerEnabled(TRUE)
+      count = count +1   
+
   #
-  # Event handlers
+  # adjustMultiView
   #
-  # Methods called to deal with incomming events
+  # when a form object has more than one record visible on the screen
+  # this will adjust the entries to ensure the proper one is visible
   #
   def adjustMultiView(self, event):
     block = event.data.block.form.currentBlock
@@ -209,16 +267,102 @@
 
         self.formToUI[entry][1] = index
 
+  #
+  # switchFocus
+  #
+  # Moves the focus to a specific UI widget
+  #
   def switchFocus(self, event):
     index = self.formToUI[event.data][1]
     self.formToUI[event.data][0][index].SetFocus()
-    #sys.stderr.write("fields %d, %s 
\n"%(self.formToUI[event.data][1],self.formToUI[event.data][0]))
     
-  def updateStatus(self,event):
+  #
+  # gotoPage
+  #
+  # makes the requested page visible on the screen
+  #
+  def gotoPage(self, event):
+    index = self.formToUI[event.data][1]
+    self.visiblePage.Show(FALSE)
+    self.formToUI[event.data][0][index].Show(TRUE)
+    self.visiblePage = self.formToUI[event.data][0][index]
+    self.visiblePage.Show(TRUE)
+
+  #
+  # formAlert
+  #
+  # Rings a bell and alters the statusbar to display
+  # a line of text
+  #
+  def formAlert(self, event):
+    wxBell()
+    self.statusBar.SetStatusText(event.data,0)
+
+
+  #
+  # aboutBox
+  #
+  # Displays a modal about box on the screen.
+  #
+  def aboutBox(self, event):
+    programVersion = event.data[0]
+    formName = event.data[1]
+    formVersion = event.data[2]
+    author = event.data[3]
+    description = event.data[4]
+
+    dlg = wxMessageDialog(self.frame,
+                          "GNUE Forms\n"
+                          "  Version : %s\n"
+                          "  Driver  : UIwxpython\n"
+                          "-= Form Info =-\n"
+                          "  Name   : %s\n"
+                          "  Version: %s\n"
+                          "  Author : %s\n"
+                          "  Description: %s\n" 
+                          % (programVersion, formName 
,formVersion,author,description),
+                          "About", wxOK | wxICON_INFORMATION)
+    dlg.ShowModal()
+    dlg.Destroy()
+
+  #
+  # msgBox
+  #
+  # Displays a modal message box on the screen
+  #
+  def msgBox(self, event):
+    if hasattr(self,'frame'):
+      parent = wxPyTypeCast( self.frame, 'wxWindow' )
+    else:
+      parent = NULL
+      
+    message = event.data.message
+    caption = event.data.caption
+    dialog = wxMessageDialog(parent, message, caption, 
style=wxOK|wxICON_EXCLAMATION )
+    dialog.ShowModal()
+    dialog.Destroy()
+
+
+  #
+  # exitApplication
+  #
+  # Forces closure of the form by passing a non-vetoable close
+  # to the application's frame.  closeTrap will then exit w/o
+  # asking the form for permission again.
+  #
+  def exitApplication(self,event):
+    self.frame.Close(true)
+
+  #
+  # updateStatusBar
+  #
+  # Updates the information displayed on the form's status bar
+  #
+  def updateStatusBar(self,event):
     statusValues = {'saved':'OK',
                     'modified':'MOD',
                     'deleted':'DEL'}
-                    
+    
     tip, recordStatus, insertMode, currentRecord, maxRecord, currentPage, 
maxPage =event.data
 
     if tip != None:
@@ -240,68 +384,43 @@
       self.statusBar.SetStatusText(string.strip("%s/%s" % 
(currentPage,maxPage)),4)
 
 
-  def updateEntry(self,event):
-    index = self.formToUI[event.data][1]
-    
-    block = event.data.block # .form.currentBlock
-    currentRecord = block.currentRecord
-
-    if hasattr(event.data, 'style'):
-      style = event.data.style
-    else:
-      style = 'text'
-
-    # Fill the prior spots 
-    for count in range(index):
-      value = 
block.dataSourceLink.getField(currentRecord-(index-count),event.data.field)
-      if style == 'dropdown':
-        value = event.data.allowedValues()[value]
+  #############################################################################
+  #
+  # Internal Event Processors
+  #
+  # Processes the events from the widget set
+  #
 
-      self.formToUI[event.data][0][count].SetEvtHandlerEnabled(FALSE)
-      self.formToUI[event.data][0][count].SetValue(value)
-      self.formToUI[event.data][0][count].SetEvtHandlerEnabled(TRUE)
+  #
+  # menuExitEvent
+  #
+  # Catches the Exit event from the menu and make sure it closes in such a way 
to 
+  # trigger the closeTrap method
+  #
+  def menuExitEvent(self, event):
+    self.frame.Close()
 
-    # fill currently indexed spot
-    if style == 'dropdown':
-      value = event.data.allowedValues()[event.data.getValue()]
+  #
+  # closeTrap
+  #
+  # intercepts the applications closure and generates an event to the form 
requesting
+  # closure.  Allows the form to control closure.  If the form approves it'll 
send
+  # back an event closing the application
+  #
+  def closeTrap(self,event):
+    # hack for swig shortcomming
+    eo = event.GetEventObject()
+    object = wxPyTypeCast(eo, 'wxFrame')
+    if event.CanVeto():
+      self.dispatchEvent(GFEvent('requestEXIT'))
     else:
-      value = event.data.getValue()
-    
-    self.formToUI[event.data][0][index].SetEvtHandlerEnabled(FALSE)
-    self.formToUI[event.data][0][index].SetValue(value)
-    self.formToUI[event.data][0][index].SetEvtHandlerEnabled(TRUE)
-
-    
self.formToUI[event.data][0][index].SetInsertionPoint(event.data.cursorPosition)
-
-    # Fill trailing spots
-    #
-    # You must skip the matching index but
-    # you do not want to just add 1 to count
-    # as the formulas would then be off
-    count = index
-    while count < int(event.data.visibleCount):
-      if count != index:
-        if currentRecord+(count-index) > block.recordCount:
-          value = ""
-        else:
-          value = 
block.dataSourceLink.getField(currentRecord+(count-index),event.data.field)
-          if style == 'dropdown':
-            value = event.data.allowedValues()[value]
-        self.formToUI[event.data][0][count].SetEvtHandlerEnabled(FALSE)
-        self.formToUI[event.data][0][count].SetValue(value)
-        self.formToUI[event.data][0][count].SetEvtHandlerEnabled(TRUE)
-      count = count +1   
-        
-  def gotoPage(self, event):
-    index = self.formToUI[event.data][1]
-    self.visiblePage.Show(FALSE)
-    self.formToUI[event.data][0][index].Show(TRUE)
-    self.visiblePage = self.formToUI[event.data][0][index]
-    self.visiblePage.Show(TRUE)
-    
+      object.Destroy()
+      
   #
-  # uiEventTrap traps wxPython events and converts
-  # them to GFForms UI requests
+  # uiEventTrap 
+  # 
+  # traps most data entry related wxPython events and converts them to GFForms 
UI requests
+  # really need to be recoded to something more friendly - maybe multiple 
event handlers
   #
   def uiEventTrap(self, event):
     action = None
@@ -324,8 +443,7 @@
           elif (1728 <= event.KeyCode() <= 1791):
             offset = 1536
             action = GFEvent('requestKEYPRESS',chr(event.KeyCode()-offset))
-                                    
-
+            
     #
     # Mouse Events
     #
@@ -421,23 +539,38 @@
     else:
       # Need to probably log this somewhere in debug mode
       pass
-      #event.Skip()
       
     if action != None:
       self.dispatchEvent(action)
+ 
+
+  #############################################################################
+  #
+  # UI Objects
+  #
+  # A set of standard UI objects that allow us to move more code into UIbase
+  # These map generic functionality to the specific UI widget set in use by
+  # this driver
+  #
+
+  # Needs to be implemented
+
 
+  #############################################################################
   #
-  # Handlers used by buildUI to add widgets to the UI
+  # Object Handlers
   #
+  # handlers "handle" the creation of UI widgets used to represent objects
+  # on a form.
+  #
+
   def stdHandler(self):
-    object    = self.currentObject[0]
+    object = self.currentObject[0]
     container = self.currentWidget[0]
     widget = []
 
     if not hasattr(object,'hidden'):
       if not hasattr(object,'visibleCount'):
-      #  count = int(object.visibleCount)
-      #else:
         object.visibleCount = 1
       
       count = int(object.visibleCount)
@@ -584,8 +717,8 @@
     EVT_MENU(self, 102, lambda event, l=self: 
l.dispatchEvent(GFEvent('requestROLLBACK')))
     fileMenu.AppendSeparator()
     fileMenu.Append( 101, "E&xit",GFOptions.msg_exit)
-    EVT_MENU(self, 101,  self.TimeToQuit)
-
+    EVT_MENU(self, 101,  self.menuExitEvent)
+     
     dataMenu = wxMenu()
     dataMenu.Append( 201, "Next Record             (Up)",GFOptions.msg_next)
     EVT_MENU(self, 201, lambda event, l=self: 
l.dispatchEvent(GFEvent('requestNEXTRECORD')))
@@ -615,18 +748,14 @@
     menuBar.Append( fileMenu, "&File" )
     menuBar.Append( dataMenu, "&Data" )
     menuBar.Append( helpMenu, "&Help" )
-
-    self.frame.SetMenuBar( menuBar );
 
-    
+    self.frame.SetMenuBar( menuBar );    
 #
 #  There has got to be better way to call events to ride off the EVT_MENU
 #  Ok if i give buttons same id as menu's they share events
-#  I dont know if this is horribly wrong or design so im leaving duplicate 
events
-#  for toolbar below if one needs to revert back
-#
+#  I dont know if this is horribly wrong or design
+
 
-#    mainToolBar = 
self.frame.CreateToolBar(wxTB_HORIZONTAL|wxNO_BORDER|wxTB_FLAT)
     if sys.platform == 'win32':
       mainToolBar = self.frame.CreateToolBar()
     else:
@@ -645,18 +774,6 @@
     mainToolBar.AddSimpleTool(208, wxImage(GFOptions.tb_query, 
wxBITMAP_TYPE_PNG).ConvertToBitmap(), "Execute Query", GFOptions.msg_query)
     mainToolBar.AddSeparator()
     mainToolBar.AddSimpleTool(300, wxImage(GFOptions.tb_help, 
wxBITMAP_TYPE_PNG).ConvertToBitmap(), "Help", GFOptions.msg_help)
-
-
-
-#    EVT_TOOL(self, 10, lambda event, l=self: 
l.dispatchEvent(GFEvent('requestCOMMIT')))
-#    EVT_TOOL(self, 15, lambda event, l=self: 
l.dispatchEvent(GFEvent('requestNEWRECORD')))
-#    EVT_TOOL(self, 20, lambda event, l=self: 
l.dispatchEvent(GFEvent('requestROLLBACK')))
-#    EVT_TOOL(self, 25, lambda event, l=self: 
l.dispatchEvent(GFEvent('requestMARKFORDELETE')))
-#    EVT_TOOL(self, 30, lambda event, l=self: 
l.dispatchEvent(GFEvent('requestPREVRECORD')))
-#    EVT_TOOL(self, 35, lambda event, l=self: 
l.dispatchEvent(GFEvent('requestNEXTRECORD')))
-#    EVT_TOOL(self, 40, lambda event, l=self: 
l.dispatchEvent(GFEvent('requestQUERY')))
-#    EVT_TOOL(self, 45, lambda event, l=self: 
l.dispatchEvent(GFEvent('executeQUERY')))
-#    EVT_TOOL(self, 50, lambda event, l=self: 
l.dispatchEvent(GFEvent('requestABOUT')))
     mainToolBar.Realize()
 
 
@@ -671,62 +788,6 @@
     
     return self.frame
 
-  def closeTrap(self,event):
-    # hack for swig shortcomming
-    eo = event.GetEventObject()
-    object = wxPyTypeCast(eo, 'wxFrame')
-    if event.CanVeto():
-      self.dispatchEvent(GFEvent('requestEXIT'))
-    else:
-      object.Destroy()
-      
-  def aboutBox(self, event):
-    programVersion = event.data[0]
-    formName = event.data[1]
-    formVersion = event.data[2]
-    author = event.data[3]
-    description = event.data[4]
-
-    dlg = wxMessageDialog(self.frame,
-                          "GNUE Forms\n"
-                          "  Version : %s\n"
-                          "  Driver  : UIwxpython\n"
-                          "-= Form Info =-\n"
-                          "  Name   : %s\n"
-                          "  Version: %s\n"
-                          "  Author : %s\n"
-                          "  Description: %s\n" 
-#                          "-= Quick Reference =-\n"
-#                          "  F5 : Mark record for delete at next commit\n"
-#                          "  F6 : Commit Changes\n"
-#                          "  F8 : Enter query mode|Abort query mode\n"
-#                          "  F9 : Execute query with current mask\n"
-#                          "  F12: Add new record\n"
-                          % (programVersion, formName 
,formVersion,author,description),
-                          "About", wxOK | wxICON_INFORMATION)
-    dlg.ShowModal()
-    dlg.Destroy()
-
-  def menuHandler(self, event):
-    # hack for swig shortcomming
-    eo = event.GetEventObject()
-    object = wxPyTypeCast(eo, 'wxMenu')
-    print object.GetTitle()
-    print object.GetMenuItems()
-
-  def formAlert(self, event):
-    wxBell()
-    self.statusBar.SetStatusText(event.data,0)
-
-                                      
-
-  def TimeToQuit(self, event):
-    self.frame.Close()
-
-  def exitApplication(self,event):
-    self.frame.Close(true)
-
-
   def entryHandler(self):
     object    = self.currentObject[0]
     container = self.currentWidget[0]
@@ -788,10 +849,19 @@
 
     return widget
 
-    
+
+  #############################################################################
   #
   # Login support
   #
+  # All methods below this point are only used to present the initial login box
+  #
+
+  #
+  # getLogin
+  #
+  # creates the login dialog and displays it modal
+  #
   def getLogin(self, event):
     self.logindata = event.data
     self.dlg = wxDialog(NULL, -1, "Login Required for %s" % 
str(event.data[2].dbname),wxPoint(-1,-1),wxSize(250,150))
@@ -809,22 +879,29 @@
   
 
     EVT_CHAR(self.usernameEntry, self.usernameEventTrap)
-    EVT_TEXT_ENTER(self.passwordEntry, 10, self.passwordEnterTrap)
     EVT_CHAR(self.passwordEntry, self.passwordEventTrap)
 
     self.dlg.Raise()
-    #self.dlg.Refresh()
     self.dlg.CenterOnScreen()
     self.dlg.ShowModal()
     self.dlg.Destroy()
-    
     
+  #
+  # usernameEventTrap
+  #
+  # enables the user to press return and have it jump to the password box
+  #
   def usernameEventTrap(self, event):
     if event.KeyCode() == WXK_RETURN:
       self.passwordEntry.SetFocus()
     else:
       event.Skip()
-        
+
+  #
+  # passwordEventTrap
+  #
+  # catches the return key on the password box
+  # 
   def passwordEventTrap(self, event):
     if event.KeyCode() == WXK_RETURN:
       self.logindata[0] = self.usernameEntry.GetValue()
@@ -833,22 +910,10 @@
     else:
       event.Skip()
 
-  def passwordEnterTrap(self, event):
-    print "Processing enter"
-    self.logindata[0] = self.usernameEntry.GetValue()
-    self.logindata[1] = self.passwordEntry.GetValue()
-    self.dlg.EndModal(1)
 
 
-  def msgBox(self, event):
-    if hasattr(self,'frame'):
-      parent = wxPyTypeCast( self.frame, 'wxWindow' )
-    else:
-      parent = NULL
-      
-    message = event.data.message
-    caption = event.data.caption
-    dialog = wxMessageDialog(parent, message, caption, 
style=wxOK|wxICON_EXCLAMATION )
-    dialog.ShowModal()
-    dialog.Destroy()
-    
+
+
+
+
+



reply via email to

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