commit-gnue
[Top][All Lists]
Advanced

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

gnue/gnuef client/gfclient src/GFForm.py src/UI...


From: James Thompson
Subject: gnue/gnuef client/gfclient src/GFForm.py src/UI...
Date: Wed, 21 Feb 2001 13:42:17 -0800

CVSROOT:        /cvs
Module name:    gnue
Changes by:     James Thompson <address@hidden> 01/02/21 13:42:17

Modified files:
        gnuef/client   : gfclient 
        gnuef/src      : GFForm.py UIbase.py UIwxpython.py 

Log message:
        Start of rewrite of UI system
        Lots of misc cleanups

CVSWeb URLs:
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/client/gfclient.diff?r1=1.18&r2=1.19
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/src/GFForm.py.diff?r1=1.71&r2=1.72
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/src/UIbase.py.diff?r1=1.18&r2=1.19
http://subversions.gnu.org/cgi-bin/cvsweb/gnue/gnuef/src/UIwxpython.py.diff?r1=1.70&r2=1.71

Patches:
Index: gnue/gnuef/client/gfclient
diff -u gnue/gnuef/client/gfclient:1.18 gnue/gnuef/client/gfclient:1.19
--- gnue/gnuef/client/gfclient:1.18     Thu Feb  8 20:55:14 2001
+++ gnue/gnuef/client/gfclient  Wed Feb 21 13:42:17 2001
@@ -22,6 +22,8 @@
 from gnue.forms.GFForm import *
 from gnue.forms.GFController import *
 from gnue.forms.GFDebug import *
+from gnue.forms.GFForm import *
+
 __version__ = "0.0.2"
 
 _usage = """
@@ -73,38 +75,49 @@
           print "No Forms Definition File Specified.  Use GFClient -h for more 
information."
           sys.exit()
 
-    # get the form file handler
-    # we have to deal with win32 urllib thinking the the c: in c:/foo/bar is a 
protocol 
-    drive = os.path.splitdrive(self.formfile) 
-    try:
-      if len(drive[0]):
-        fp = open(self.formfile,'r')
-      else:
-        fp = urllib.urlopen(self.formfile)
-        
-    except:
-      print "The file %s doesn't seem to exist.\n%s\n%s" % (self.formfile, 
sys.exc_info()[0], sys.exc_info()[1])
-      
-      sys.exit()
-
     # Initialize user interface (defaults to gui)
     #  If the DISPLAY var isn't set then switch to text 
     if self.ui_type == 'gui'  :
       if os.environ.has_key('DISPLAY') or os.name != 'posix':
         from gnue.forms import UIwxpython
-        ui=UIwxpython.GFUserInterface(fp)
+        ui=UIwxpython.GFUserInterface()
       else:
         SetOptions.ui_type='text'
 
     if self.ui_type == 'pytext':
       from gnue.forms import UIpyncurses
-      ui=UIpyncurses.GFUserInterface(fp)
+      ui=UIpyncurses.GFUserInterface()
 
     if self.ui_type == 'text' : 
       from gnue.forms import UIcurses
-      ui=UIcurses.GFUserInterface(fp)
+      ui=UIcurses.GFUserInterface()
+
+    #
+    # get the form file handler
+    # we have to deal with win32 urllib thinking the the c: in c:/foo/bar is a 
protocol 
+    drive = os.path.splitdrive(self.formfile) 
+    try:
+      if len(drive[0]):
+        fp = open(self.formfile,'r')
+      else:
+        fp = urllib.urlopen(self.formfile)
+    except:
+      print "The file %s doesn't seem to exist.\n%s\n%s" % (self.formfile, 
sys.exc_info()[0], sys.exc_info()[1])
+      sys.exit()
+
+    #
+    # Build the form tree
+    #
+    print "Building the form"
+    form = GFForm()
+    control = GFController(form, ui)
+    form.run(fp)
+    fp.close()
 
     # pass control to UI
+    #print "I'm there"
+    ui.buildForm(form)
+    ui.activateForm(form)
     ui.mainLoop()
       
 if __name__ == '__main__':
Index: gnue/gnuef/src/GFForm.py
diff -u gnue/gnuef/src/GFForm.py:1.71 gnue/gnuef/src/GFForm.py:1.72
--- gnue/gnuef/src/GFForm.py:1.71       Tue Feb 20 11:57:13 2001
+++ gnue/gnuef/src/GFForm.py    Wed Feb 21 13:42:17 2001
@@ -79,7 +79,8 @@
     self.borderPercentage = 10
     self.textPercentage   = 7.5
 
-  def run(self, URL):    
+  def run(self, URL):
+    print "Parsing...."
     # Create a parser
     parser = saxexts.make_parser()
     
@@ -94,6 +95,7 @@
     # set the initial focus
     self.walk(self.setInitialFocus)
 
+    print "Initing dbs...."
     # Connect to the defined databases
     self.walk(self.initDatabaseObjects)
 
@@ -107,6 +109,7 @@
     GFDebug.printMesg(3,  "Datasource Dictionary")
     GFDebug.printMesg(3,  "%s"%self.datasourceDictionary)
 
+    print "Initing trigger system...."
     #Set trigger namespace, we'll need something more
     #detailed than this including widgets etc. Also attaches
     #named triggers to thier placeholders
@@ -125,6 +128,7 @@
     self.triggerns['GFMsgBox'] = GFMsgBox
     self.walk(self.initTriggers)      
 
+
     self.updateStatus()
     
   #
@@ -164,6 +168,7 @@
       self.databaseDictionary[object.name]=object
       while 1:
         try:
+          print "dispatching login...."
           #Login
           authcode = ["", "", object]
           self.dispatchEvent( GFEvent('getLogin', authcode) )
Index: gnue/gnuef/src/UIbase.py
diff -u gnue/gnuef/src/UIbase.py:1.18 gnue/gnuef/src/UIbase.py:1.19
--- gnue/gnuef/src/UIbase.py:1.18       Mon Feb 19 18:47:24 2001
+++ gnue/gnuef/src/UIbase.py    Wed Feb 21 13:42:17 2001
@@ -22,71 +22,60 @@
 # Provides basic functionality.
 #
 class GFUserInterfaceBase(GFEventAware):
-  def __init__(self, fp):
+  def __init__(self):
+    print "I'm in base __init__"
     GFEventAware.__init__(self)
-    self.fp = fp
-    
-  def onMain(self):
 
-    # Setup form
-    form = self.form = GFForm()
+    
+    # __import__( self.getModule() )
 
-    # register event controller
-    control = GFController(form, self)
-    form.run(self.fp)
-    self.fp.close()
 
+    print self.getModule() 
+    #
+    # incommintEvents
+    #
+    self.incommingEvent = {'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,
+                           'msgBoxUI'        : self.msgBox,
+                           'getLogin'        : self.getLogin
+                           }
+    
     self.formToUI = {}                   # the GFObj to UI widget cross ref
-
-    # FYI: Used in building the UI only
-    self.currentObject = [form]          # the current GFForm object
-    self.currentWidget = [self]          # the current UI widget
-    # End: Used in building the UI only
+    self.formToUIWidget = {}                   # the GFObj to UI widget cross 
ref
     
     self.containerWidgets= ['GFPage']    # GFForm objects that contain others
-
+    
     self.pageList = []                   # A list of pages
     
     self.keyEvents = {}                  # Keyboard events from the widget set 
the
                                          # UI is expected to respond to
-    self.incommingEvents = {}            # Events the UI is expected to 
respond to
-    
-
-    self.widgetConstructorFunction = {   # A dictionary of functions used by 
buildUI
-      'GFPage': self.pageHandler,        # to build the widgets.  Can override 
in 
-      'GFLabel': self.stdHandler,        # UI specific module if necessary
-      'GFBox': self.stdHandler,          
-      'GFScrollBar': self.stdHandler,    
-      'GFButton': self.buttonHandler,
-      'GFEntry': self.entryHandler,
-      'GFForm': self.formHandler
-      }
-
-    #
-    # Python code used by the stdConstructor method
-    # Must override in specific UI modules
-    #
-    self.widgetConstructorCode = {
-      'GFLabel': """print 'GFLabel not defined'""",
-      'GFEntry': """print 'GFEntry not defined'""",
-      'GFForm' : """print 'GFForm not defined'"""
+    # A dictionary of functions used by buildUI
+    # to build the widgets.  Can override in
+    # UI specific module if necessary
+    self.widgetConstructorFunction = {
+      'GFBox'         : self.stdHandler,          
+      'GFButton'      : self.stdHandler,
+      'GFEntry'       : self.stdHandler,
+      'GFForm'        : self.stdHandler,
+      'GFLabel'       : self.stdHandler,       
+      'GFScrollBar'   : self.stdHandler,    
+      'GFPage'        : self.stdHandler,     
       }
 
-    #
-    # Call the UI specific onInit function
-    #
-    self.onInit()
-
-  #
-  # placeholder Handlers that should be overriden
-  # in the UI specific module
-  #
   def stdHandler(self):
-    GFDebug.printMesg(2, "Warning : stdHandler for UI not defined" )
-  def formHandler(self):
-    GFDebug.printMesg(2, "Warning : formHandler for UI not defined" )
-  def pageHandler(self):
-    GFDebug.printMesg(2, "Warning : pageHandler for UI not defined" )
+    object = self.currentObject[0]
+    container = self.currentWidget[0]
+    newWidget = self.widgets[object.getObjectType()](object,container, 
self.textWidth, self.textHeight, self.widgetWidth, self.widgetHeight, self)
+    return newWidget
+
 
   #
   # buildUI
@@ -98,18 +87,17 @@
   #
   def buildUI(self):
     try:
-      newWidget = 
self.widgetConstructorFunction[self.currentObject[0].getObjectType()] ()
+      uiWidget = 
self.widgetConstructorFunction[self.currentObject[0].getObjectType()] ()
+      widget = uiWidget.widgets
+      GFDebug.printMesg(2, "Widget is %s" % widget)
 
-      if type(newWidget) != type ([]):
-        widget = [newWidget]
-      else:
-        widget = newWidget
+      self.formToUIWidget[self.currentObject[0]]=uiWidget
 
+      # If the widget list is not empty then do the following
       if not widget == []:
         # Create a cross reference to the GFObject that created
         # one or more UI widgets
         self.formToUI[self.currentObject[0]] = [widget,0]
-
         # If the current object is a container then add the
         # just created first created widget to it's widget list
         if self.currentObject[0].getObjectType() in self.containerWidgets:
@@ -126,6 +114,159 @@
 
     if self.currentObject[0].getObjectType() in self.containerWidgets:
       self.currentWidget.pop(0)
+  #############################################################################
+  #
+  # Generic Incomming Event Handlers
+  #
+  # Handles incomming events and calls UI instance specific functions to
+  # execute the actions
+  #
+  
 
+  #
+  # exitApplication
+  #
+  # Form has told the application to close so call the UIs private exit routine
+  #
+  def exitApplication(self,event):
+    self._exit()
+
+  #
+  # updateStatusBar
+  #
+  # Calls the UIs function to update status
+  def updateStatusBar(self,event):
+    statusValues = {'saved':'OK',
+                    'modified':'MOD',
+                    'deleted':'DEL'}
+
+    tip, recordStatus, insertMode, currentRecord, maxRecord, currentPage, 
maxPage =event.data
+    
+    status = statusValues[recordStatus]
 
+    insertValue = ""
+    if insertMode != None:
+      if int(insertMode) == 1:
+        insertValue = 'INS'
+      else:
+        insertValue = 'OVR'
+
+    self._setStatusBar(tip, status, insertValue, currentRecord, maxRecord, 
currentPage, maxPage)
+    
+  #
+  # 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._exit()
+
+  #
+  # aboutBox
+  #
+  # Displays a modal about box on the screen.
+  #
+  def aboutBox(self, event):
+    #print self.__class__.__file__
+    programVersion = event.data[0]
+    formName = event.data[1]
+    formVersion = event.data[2]
+    author = event.data[3]
+    description = event.data[4]
+
+    
+    statement = "from %s import UIAbout" % self.getModule()
+    exec statement
+    about = UIAbout(self.mainWindow, programVersion, formName, formVersion, 
author, description)
+
+    about.showModal()
+    about.destroy()
+                            
+  #
+  # adjustMultiView
+  #
+  # 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
+    
+    if event.getEvent() == 'uiPREVRECORD':
+      adjustment = -1
+    else:
+      adjustment = 1
+
+    # Need to figure out what the currentRecord is
+    # about to switch to. It hasn't yet.
+    currentRecord = block.currentRecord + adjustment
+    if currentRecord < 0 : currentRecord = block.recordCount
+    if currentRecord > block.recordCount : currentRecord = 0
+
+    for entry in block.entryList:
+      if not hasattr(entry, 'hidden'):
+        index = self.formToUI[entry][1]
+        index = index + adjustment
+        
+        if index < 0 : index = 0
+        
+        # Don't let index pass the number of widgets on screen
+        if index >= int(entry.visibleCount):
+          index = int(entry.visibleCount)-1
+          
+        # Don't let the index past the number of records in the
+        # system
+        lowestVisible = currentRecord - index
+        if lowestVisible < 0 : lowestVisible = 0
+        if lowestVisible + index > block.recordCount:
+          index = index -1
+
+        # If the current record has rolled around
+        # from the top to the bottom then reset
+        # the counter
+        if currentRecord == 0:
+          index = 0
+          
+        # if the current record has rolled from
+        # bottom to top then flip to bottom keeping
+        # in mind the number of records in memory
+        if currentRecord == block.recordCount:
+          if block.recordCount > int(entry.visibleCount)-1:
+            index = int(entry.visibleCount)-1
+          else:
+            index = block.recordCount
+            
+        self.formToUI[entry][1] = index                                        
                                                                                
                                                                                
    
+
+class UIWidget:
+  def __init__(self, object, container, textWidth, textHeight, widgetWidth, 
widgetHeight, interface):
+    self.widgets = []
+    
+    if not hasattr(object,'visibleCount'):
+      self.visibleCount = 1
+    else:
+      self.visibleCount = int(object.visibleCount)
+
+    if hasattr(object,'gap'):
+      self.gap = int(object.gap)
+    else:
+      self.gap = 0
+
+    if hasattr(object,'width'):
+      self.itemWidth = int(object.width)*int(textWidth)
+      self.itemHeight = int(object.height)*int(textHeight)
+    else:
+      self.itemWidth = -1
+      self.itemHeight = -1
+      
+    if not hasattr(object,'hidden'):
+      for spacer in range(int(self.visibleCount)):
+        newWidget = self.createWidget(object, container, textWidth, 
textHeight, widgetWidth, widgetHeight, interface, spacer)
+        self.widgets.append(newWidget)
+        
+  def createWidget(self, object, container, textWidth, textHeight, 
widgetWidth, widgetHeight, interface, spacer):
+    GFDebug.printMesg(1,"UI doesn't support %s" % self.__class__)
+    
 
+                                                                               
                    
Index: gnue/gnuef/src/UIwxpython.py
diff -u gnue/gnuef/src/UIwxpython.py:1.70 gnue/gnuef/src/UIwxpython.py:1.71
--- gnue/gnuef/src/UIwxpython.py:1.70   Tue Feb 20 11:57:13 2001
+++ gnue/gnuef/src/UIwxpython.py        Wed Feb 21 13:42:17 2001
@@ -28,45 +28,11 @@
 # All UIs must provide this class
 #
 class GFUserInterface(wxApp,GFUserInterfaceBase):
-  def __init__(self, fp):
+  def __init__(self):
+    print "GFUI __init__"    
     wxApp.__init__(self,0)
-    GFUserInterfaceBase.__init__(self, fp)
-    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)
-  #
-  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.updateStatusBar,
-                                'uiABOUT'         : self.aboutBox,
-                                'exitApplication' : self.exitApplication
-                          })
-    
-
-    self.widgetConstructorFunction['GFLabel'] = self.labelHandler
-    self.widgetConstructor = {
-                              'GFBox':
-                              """wxStaticBox(container,-1,str(object.label),
-                                
wxPoint(int(object.x)*int(self.widgetWidth)+(int(self.widgetWidth)/2),
-                                        
(int(object.y)+spacer)*int(self.widgetHeight)+(int(self.widgetHeight)/2)),
-                                
wxSize(int(object.width)*int(self.widgetWidth)-(int(self.widgetWidth)/2),
-                                       
int(object.height)*int(self.widgetHeight)-(int(self.widgetHeight)/2)))""",
-                              'GFScrollBar':
-                              """wxScrollBar(container,-1,
-                              
wxPoint(int(object.x)*int(self.widgetWidth),(int(object.y)+spacer)*int(self.widgetHeight)),
-                              
wxSize(int(object.width)*int(self.widgetWidth),int(object.height)*int(self.widgetHeight)),
-                              wxSB_VERTICAL)"""
-                              }
-    
+    GFUserInterfaceBase.__init__(self)
+
     self.keyEvents = {WXK_PRIOR:  GFEvent('requestPREVBLOCK'),
                       WXK_NEXT:   GFEvent('requestNEXTBLOCK'),
                       WXK_TAB:    GFEvent('requestNEXTENTRY'),                 
       
@@ -89,43 +55,59 @@
                       WXK_F11:    GFEvent('requestROLLBACK'),
                       WXK_F12:    GFEvent('requestNEWRECORD'),
                      }
+    self.widgets = {'GFLabel'     : UILabel,
+                    'GFBox'       : UIBox,
+                    'GFPage'      : UIPage,
+                    'GFForm'      : UIForm,
+                    'GFEntry'     : UIEntry,
+                    'GFButton'    : UIButton,
+                    'GFScrollBar' : UIScrollBar}
 
-    # Create the UI from the GFForm passed in
-    self.buildUI()
-
-    # Make the first page of the UI visible
-    self.pageList[0].Show(TRUE)
-
-    # Only one page at a time can be visible
-    self.visiblePage = self.pageList[0]
 
-    self.frame.Show(TRUE)
-    self.splash.Destroy()
-    
+    self.forms = {}
+  #
+  # mainLoop
   #
-  # Misc functions
+  # The primary loop of the user interface.  Called once the UI is 
+  # fully activated
   #
   def mainLoop(self):
     self.MainLoop() # simply call the wxApp's MainLoop method
-    
+
+  #
+  #
+  #
+  def getModule(self):
+    print type(GFUserInterface.__module__)
+    return GFUserInterface.__module__
+
+  #
+  # OnInit
+  #
+  # Routine called by wxWindows when wxApp instance is created
+  # It is used the build the basic UI
+  #
   def OnInit(self):
-    # SplashScreen Stuff
+    print "I'm in OnInit"
+
+    wxInitAllImageHandlers()
+    
+    #
+    # SplashScreen
+    # 
     # 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,
+                               duration=2000, # callback=self.onMain,
                                style=wxSIMPLE_BORDER|wxCENTRE_ON_SCREEN )
-
     swidth,sheight = self.splash.GetSizeTuple()
 
-    # Make the text print white
+    # Make the splash text print white
     self.splash.SetForegroundColour(wxColour(0xFF, 0xFF, 0xFF))
     self.splash.SetFont(wxFont(20,wxSWISS,wxNORMAL,wxBOLD))
 
-    
+
     text = "GNU Enterprise Forms"
     twidth,theight = self.splash.GetTextExtent(text)
     wxStaticText(parent=self.splash, id=-1, label=str(text),
@@ -146,15 +128,190 @@
     text = "Protected by GNU General Public Licence 2.0 or greater"
     wxStaticText(self.splash, -1, str(text),
                  
wxPoint(1,sheight-(theight+10)),wxSize(swidth-5,theight),wxALIGN_RIGHT)
+        
+    self.splash.Show(true)
+    self.splash.CenterOnScreen()
+
+    #
+    # Create the main window
+    #
+    self.mainWindow = wxFrame(NULL, -1, "", wxDefaultPosition)
     
+    
self.mainWindow.SetFont(wxFont(GFOptions.pointSize,wxMODERN,wxNORMAL,wxNORMAL))
+
+    maxWidth, maxHeight, maxDescent, maxLeading = [0,0,0,0]
+
+    for letter in "WOyg-\|":
+      width,height,descent,leading = self.mainWindow.GetFullTextExtent(letter)
+      maxWidth = maxWidth > width and maxWidth or width
+      maxHeight = maxHeight > height and maxHeight or height
+      maxDescent = maxDescent > descent and maxDescent or descent
+      maxLeading = maxLeading > leading and maxLeading or leading
+
+    self.charWidth = maxWidth+maxLeading
+    self.charHeight = maxHeight+maxDescent
     
+    self.borderPercentage = (GFOptions.borderPercentage / 100.0)
+    self.textPercentage = (GFOptions.textPercentage / 100.0)
+
+    self.widgetWidth = (self.charWidth * self.borderPercentage)
+    self.widgetHeight = (self.charHeight * self.borderPercentage) + 3
+    self.textWidth = self.charWidth * self.textPercentage
+    self.textHeight = self.charHeight * self.textPercentage
+
+    self.menu_sb_space=4 # the extra spaces needed by the menu, toolbar and 
statusbar
     
-    self.splash.Show(true)
-    self.splash.CenterOnScreen()
+    self.statusBar = self.mainWindow.CreateStatusBar()
+    self.statusBar.SetFieldsCount(5)
+    self.statusBar.SetStatusWidths([-1,50,50,100,100])
+    
self.statusBar.SetFont(wxFont(GFOptions.pointSize,wxMODERN,wxNORMAL,wxNORMAL))
+    
+    self.mainWindow.SetStatusText( "Let's get started" )
+
+    fileMenu = wxMenu()
+    fileMenu.Append( 100, "Commit     (F6)",GFOptions.msg_commit)
+    EVT_MENU(self, 100, lambda event, l=self: 
l.dispatchEvent(GFEvent('requestCOMMIT')))
+    fileMenu.Append( 102, "Rollback  (F11)",GFOptions.msg_rollback)
+    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.menuExitEvent)
+     
+    dataMenu = wxMenu()
+    dataMenu.Append( 201, "Next Record             (Up)",GFOptions.msg_next)
+    EVT_MENU(self, 201, lambda event, l=self: 
l.dispatchEvent(GFEvent('requestNEXTRECORD')))
+    dataMenu.Append( 202, "Previous Record   (Down)",GFOptions.msg_previous)
+    EVT_MENU(self, 202, lambda event, l=self: 
l.dispatchEvent(GFEvent('requestPREVRECORD')))
+    dataMenu.Append( 203, "New Record           (F12)",GFOptions.msg_insert)
+    EVT_MENU(self, 203, lambda event, l=self: 
l.dispatchEvent(GFEvent('requestNEWRECORD')))
+    dataMenu.Append( 204, "Delete Record          (F5)",GFOptions.msg_delete)
+    EVT_MENU(self, 204, lambda event, l=self: 
l.dispatchEvent(GFEvent('requestMARKFORDELETE')))
+    dataMenu.AppendSeparator()
+    dataMenu.Append( 205, "Next Block           
(PgDn)",GFOptions.msg_next_block)
+    EVT_MENU(self, 205, lambda event, l=self: 
l.dispatchEvent(GFEvent('requestNEXTBLOCK')))
+    dataMenu.Append( 206, "Previous Block     
(PgUp)",GFOptions.msg_previous_block)
+    EVT_MENU(self, 206, lambda event, l=self: 
l.dispatchEvent(GFEvent('requestPREVBLOCK')))
+    dataMenu.AppendSeparator()
+    dataMenu.Append( 207, "Enter Query            
(F8)",GFOptions.msg_query_prep)
+    EVT_MENU(self, 207, lambda event, l=self: 
l.dispatchEvent(GFEvent('requestQUERY')))
+    dataMenu.Append( 208, "Execute Query        (F9)", GFOptions.msg_query)
+    EVT_MENU(self, 208, lambda event, l=self: 
l.dispatchEvent(GFEvent('executeQUERY')))
+    
+    helpMenu = wxMenu()
+    helpMenu.Append( 300, "&About...", GFOptions.msg_help)
+    EVT_MENU(self, 300, lambda event, l=self: 
l.dispatchEvent(GFEvent('requestABOUT')))
+
+    menuBar = wxMenuBar()
+    menuBar.Append( fileMenu, "&File" )
+    menuBar.Append( dataMenu, "&Data" )
+    menuBar.Append( helpMenu, "&Help" )
+
+    self.mainWindow.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
+    #
+    if sys.platform == 'win32':
+      mainToolBar = self.mainWindow.CreateToolBar()
+    else:
+      mainToolBar = 
self.mainWindow.CreateToolBar(wxTB_HORIZONTAL|wxTB_DOCKABLE)
+
+    mainToolBar.SetToolBitmapSize(wxSize(24,24))
+    mainToolBar.AddSimpleTool(100, wxImage(GFOptions.tb_commit, 
wxBITMAP_TYPE_PNG).ConvertToBitmap(), "Commit Changes", GFOptions.msg_commit)
+    mainToolBar.AddSimpleTool(203, wxImage(GFOptions.tb_insert, 
wxBITMAP_TYPE_PNG).ConvertToBitmap(), "Insert Record", GFOptions.msg_insert)
+    mainToolBar.AddSimpleTool(102, wxImage(GFOptions.tb_rollback, 
wxBITMAP_TYPE_PNG).ConvertToBitmap(), "Rollback Changes", 
GFOptions.msg_rollback)
+    mainToolBar.AddSimpleTool(204, wxImage(GFOptions.tb_delete, 
wxBITMAP_TYPE_PNG).ConvertToBitmap(), "Delete Record", GFOptions.msg_delete)
+    mainToolBar.AddSeparator()
+    mainToolBar.AddSimpleTool(202, wxImage(GFOptions.tb_previous, 
wxBITMAP_TYPE_PNG).ConvertToBitmap(), "Previous Record",GFOptions.msg_previous)
+    mainToolBar.AddSimpleTool(201, wxImage(GFOptions.tb_next, 
wxBITMAP_TYPE_PNG).ConvertToBitmap(), "Next Record",GFOptions.msg_next)
+    mainToolBar.AddSeparator()
+    mainToolBar.AddSimpleTool(207, wxImage(GFOptions.tb_query_prep, 
wxBITMAP_TYPE_PNG).ConvertToBitmap(), "Prepare Query", GFOptions.msg_query_prep)
+    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)
+    mainToolBar.Realize()
+
+
+    self.mainWindow.panel = wxPanel(self.mainWindow,-1, 
wxDefaultPosition,self.mainWindow.GetSize())
+    EVT_CHAR(self.mainWindow.panel, self.uiEventTrap)
+
+    self.currentWidget = [self.mainWindow.panel]
+    self.SetTopWindow(self.mainWindow)
+
+    EVT_CLOSE(self.mainWindow,self.closeTrap)
+
+    self.mainWindow.Show(true)
     return true
+
+  #
+  #Note: new api. onInit is called during the main event loop of
+  #      the UI (i.e. wxPython.mainLoop in this case)
+  #
+  def buildForm(self, form):
+    print form.title
+    self.currentObject = [form]
+    self.form = form
+    # Create the UI from the GFForm passed in
+    self.buildUI()
+    print self.formToUIWidget
+
+  def activateForm(self, form):
+    self.mainWindow.SetSize(wxSize(int(self.form.width)*int(self.widgetWidth),
+                              
int(int(self.form.height)+self.menu_sb_space)*int(self.widgetHeight)))
+    self.mainWindow.SetTitle(str(self.form.title))
+    self.mainWindow.panel =  self.pageList[0]
+    
self.mainWindow.panel.SetSize(wxSize(int(self.form.width)*int(self.widgetWidth),
+                              
int(int(self.form.height)+self.menu_sb_space)*int(self.widgetHeight)))
+    self.pageList[0].Show(TRUE)
+
+    # Only one page at a time can be visible
+    self.visiblePage = self.pageList[0]
+
     
+
   #############################################################################
   #
+  # Private UIBase support functions
+  #
+  # Called in UIbase functions to perform UI interaction with this specific
+  # widget set.
+  #
+   
+  #
+  # _exit
+  #
+  # Tells the application to close it's main window
+  #
+  def _exit(self):
+    self.mainWindow.Close(true)
+
+  #
+  # _setStatusBar
+  # 
+  def _setStatusBar(self,tip, statusValue, insertValue, currentRecord, 
maxRecord, currentPage, maxPage):
+    
+    if tip != None: self.statusBar.SetStatusText(str(tip),0)
+
+    if statusValue != None:
+      self.statusBar.SetStatusText(statusValue,1)
+
+    if insertValue != None:
+      self.statusBar.SetStatusText(insertValue,2)
+      
+    if currentRecord != None and  maxRecord != None:
+      self.statusBar.SetStatusText(string.strip("%s/%s" % 
(currentRecord,maxRecord)),3)
+
+    if currentPage != None and  maxPage != None:
+      self.statusBar.SetStatusText(string.strip("%s/%s" % 
(currentPage,maxPage)),4)
+
+
+
+
+    
+  #############################################################################
+  #
   # Incomming Event Processors
   #
   # Processes the incomming events from other objects
@@ -211,61 +368,61 @@
         self.formToUI[event.data][0][count].SetEvtHandlerEnabled(TRUE)
       count = count +1   
 
-  #
-  # adjustMultiView
-  #
-  # 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
-
-    if event.getEvent() == 'uiPREVRECORD':
-      adjustment = -1
-    else:
-      adjustment = 1
-
-    # Need to figure out what the currentRecord is
-    # about to switch to. It hasn't yet.
-    currentRecord = block.currentRecord + adjustment
-    if currentRecord < 0 : currentRecord = block.recordCount
-    if currentRecord > block.recordCount : currentRecord = 0
+##  #
+##  # adjustMultiView
+##  #
+##  # 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
+
+##    if event.getEvent() == 'uiPREVRECORD':
+##      adjustment = -1
+##    else:
+##      adjustment = 1
+
+##    # Need to figure out what the currentRecord is
+##    # about to switch to. It hasn't yet.
+##    currentRecord = block.currentRecord + adjustment
+##    if currentRecord < 0 : currentRecord = block.recordCount
+##    if currentRecord > block.recordCount : currentRecord = 0
     
-    for entry in block.entryList:
-      if not hasattr(entry, 'hidden'):
+##    for entry in block.entryList:
+##      if not hasattr(entry, 'hidden'):
         
-        index = self.formToUI[entry][1] 
-        index = index + adjustment
+##        index = self.formToUI[entry][1] 
+##        index = index + adjustment
 
-        if index < 0 : index = 0
+##        if index < 0 : index = 0
 
-        # Don't let index pass the number of widgets on screen
-        if index >= int(entry.visibleCount):
-          index = int(entry.visibleCount)-1
-
-        # Don't let the index past the number of records in the
-        # system
-        lowestVisible = currentRecord - index
-        if lowestVisible < 0 : lowestVisible = 0
-        if lowestVisible + index > block.recordCount:
-          index = index -1
-
-        # If the current record has rolled around
-        # from the top to the bottom then reset
-        # the counter
-        if currentRecord == 0:
-          index = 0
-
-        # if the current record has rolled from
-        # bottom to top then flip to bottom keeping
-        # in mind the number of records in memory
-        if currentRecord == block.recordCount:
-          if block.recordCount > int(entry.visibleCount)-1:
-            index = int(entry.visibleCount)-1
-          else:
-            index = block.recordCount
+##        # Don't let index pass the number of widgets on screen
+##        if index >= int(entry.visibleCount):
+##          index = int(entry.visibleCount)-1
+
+##        # Don't let the index past the number of records in the
+##        # system
+##        lowestVisible = currentRecord - index
+##        if lowestVisible < 0 : lowestVisible = 0
+##        if lowestVisible + index > block.recordCount:
+##          index = index -1
+
+##        # If the current record has rolled around
+##        # from the top to the bottom then reset
+##        # the counter
+##        if currentRecord == 0:
+##          index = 0
+
+##        # if the current record has rolled from
+##        # bottom to top then flip to bottom keeping
+##        # in mind the number of records in memory
+##        if currentRecord == block.recordCount:
+##          if block.recordCount > int(entry.visibleCount)-1:
+##            index = int(entry.visibleCount)-1
+##          else:
+##            index = block.recordCount
 
-        self.formToUI[entry][1] = index
+##        self.formToUI[entry][1] = index
 
   #
   # switchFocus
@@ -287,6 +444,8 @@
     self.formToUI[event.data][0][index].Show(TRUE)
     self.visiblePage = self.formToUI[event.data][0][index]
     self.visiblePage.Show(TRUE)
+    self.visiblePage.SetSize(wxSize(int(self.form.width)*int(self.widgetWidth),
+                                
int(int(self.form.height)+self.menu_sb_space)*int(self.widgetHeight)))
 
   #
   # formAlert
@@ -298,33 +457,6 @@
     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
   #
@@ -332,7 +464,7 @@
   #
   def msgBox(self, event):
     if hasattr(self,'frame'):
-      parent = wxPyTypeCast( self.frame, 'wxWindow' )
+      parent = wxPyTypeCast( self.mainWindow, 'wxWindow' )
     else:
       parent = NULL
       
@@ -342,48 +474,7 @@
     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:
-      self.statusBar.SetStatusText(str(tip),0)
-
-    if recordStatus != None:
-      self.statusBar.SetStatusText(statusValues[recordStatus],1)
-
-    if insertMode != None:
-      if int(insertMode) == 1:
-        self.statusBar.SetStatusText('INS',2)
-      else:
-        self.statusBar.SetStatusText('OVR',2)
-      
-    if currentRecord != None and  maxRecord != None:
-      self.statusBar.SetStatusText(string.strip("%s/%s" % 
(currentRecord,maxRecord)),3)
-
-    if currentPage != None and  maxPage != None:
-      self.statusBar.SetStatusText(string.strip("%s/%s" % 
(currentPage,maxPage)),4)
-
-
+  
   #############################################################################
   #
   # Internal Event Processors
@@ -398,7 +489,7 @@
   # trigger the closeTrap method
   #
   def menuExitEvent(self, event):
-    self.frame.Close()
+    self.mainWindow.Close()
 
   #
   # closeTrap
@@ -477,7 +568,6 @@
     #
     elif event.GetEventType() == wxEVT_COMMAND_COMBOBOX_SELECTED:
 
-      #print "received combobox event"
       #
       # Begin duplicate of the mouse handling code to see
       # if it will allow me proper focus control w/
@@ -543,315 +633,8 @@
     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
-
-
   #############################################################################
   #
-  # Object Handlers
-  #
-  # handlers "handle" the creation of UI widgets used to represent objects
-  # on a form.
-  #
-
-  def stdHandler(self):
-    object = self.currentObject[0]
-    container = self.currentWidget[0]
-    widget = []
-
-    if not hasattr(object,'hidden'):
-      if not hasattr(object,'visibleCount'):
-        object.visibleCount = 1
-      
-      count = int(object.visibleCount)
-
-      for spacer in range(count):
-        spacer = int(spacer)
-        newWidget = eval(self.widgetConstructor[object.getObjectType()])
-       
newWidget.SetFont(wxFont(GFOptions.pointSize,wxMODERN,wxNORMAL,wxNORMAL))
-
-        widget.append(newWidget)
-        EVT_CHAR(newWidget, self.uiEventTrap)
-        EVT_MOUSE_EVENTS(newWidget, self.uiEventTrap)
-
-    return widget
-
-  def buttonHandler(self):
-    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)
-
-      for spacer in range(count):
-        spacer = int(spacer)
-        newWidget = wxButton(container,-1,str(object.label),
-                             
wxPoint(int(object.x)*int(self.widgetWidth),(int(object.y)+spacer)*int(self.widgetHeight)),
-                             
wxSize(int(object.width)*int(self.widgetWidth),int(object.height)*int(self.widgetHeight))
-                             )
-        
-       
newWidget.SetFont(wxFont(GFOptions.pointSize,wxMODERN,wxNORMAL,wxNORMAL))
-        widget.append(newWidget)
-        EVT_BUTTON(newWidget,newWidget.GetId(),self.uiEventTrap)
-                           
-    return widget
-
-  def labelHandler(self):
-    object    = self.currentObject[0]
-    container = self.currentWidget[0]
-    widget = []
-
-    if not hasattr(object,'hidden'):
-      if not hasattr(object,'visibleCount'):
-        object.visibleCount = 1
-      
-      if hasattr(object,'gap'):
-        gap = int(object.gap)
-      else:
-        gap = 0
-
-      count = int(object.visibleCount)
-
-      style = wxALIGN_LEFT|wxST_NO_AUTORESIZE
-
-      if hasattr(object,'alignment'):
-        if object.alignment == 'center':
-          print "I'm a center"
-          style = wxALIGN_CENTRE|wxST_NO_AUTORESIZE
-        elif object.alignment == 'right':
-          style = wxALIGN_RIGHT|wxST_NO_AUTORESIZE
-
-      if hasattr(object,'width'):
-        size = wxSize(int(object.width)*int(self.textWidth),
-                      int(object.height)*int(self.textHeight))
-      else:
-        size = wxDefaultSize
-
-      for spacer in range(count):
-        spacer = int(spacer)        
-        newWidget = wxStaticText(container, -1, str(object.text),
-                                 wxPoint(int(object.x)*int(self.widgetWidth),
-                                         
(int(object.y)+spacer+(spacer*gap))*int(self.widgetHeight)),
-                                 size, style)
-        
-        #eval(self.widgetConstructor[object.getObjectType()])
-       
newWidget.SetFont(wxFont(GFOptions.pointSize,wxMODERN,wxNORMAL,wxNORMAL))
-
-        widget.append(newWidget)
-        EVT_CHAR(newWidget, self.uiEventTrap)
-        EVT_MOUSE_EVENTS(newWidget, self.uiEventTrap)
-
-    return widget
-    
-  def pageHandler(self):
-    object    = self.currentObject[0]
-    container = self.currentWidget[0]
-
-    widget = wxPanel(container, -1,wxDefaultPosition,container.GetSize())
-    widget.Show(FALSE)
-    
-    EVT_CHAR(widget, self.uiEventTrap)
-    widget.SetFont(wxFont(GFOptions.pointSize,wxMODERN,wxNORMAL,wxNORMAL))
-    self.pageList.append(widget)
-    return widget
-
-  def formHandler(self):
-    self.frame = wxFrame(NULL, -1, "",
-                    wxDefaultPosition, wxSize(int(self.form.width), 
int(self.form.height)))
-
-
-    # Got to be a bettwe way
-    self.frame.SetFont(wxFont(GFOptions.pointSize,wxMODERN,wxNORMAL,wxNORMAL))
-    maxWidth, maxHeight, maxDescent, maxLeading = [0,0,0,0]
-    for letter in "WOyg-\|":
-      width,height,descent,leading = self.frame.GetFullTextExtent(letter)
-      maxWidth = maxWidth > width and maxWidth or width
-      maxHeight = maxHeight > height and maxHeight or height
-      maxDescent = maxDescent > descent and maxDescent or descent
-      maxLeading = maxLeading > leading and maxLeading or leading
-
-    self.charWidth = maxWidth+maxLeading
-    self.charHeight = maxHeight+maxDescent
-    
-    self.borderPercentage = (GFOptions.borderPercentage / 100.0)
-    self.textPercentage = (GFOptions.textPercentage / 100.0)
-
-    self.widgetWidth = (self.charWidth * self.borderPercentage)
-    self.widgetHeight = (self.charHeight * self.borderPercentage) + 3
-    self.textWidth = self.charWidth * self.textPercentage
-    self.textHeight = self.charHeight * self.textPercentage
-
-    menu_sb_space=4 # the extra spaces needed by the menu, toolbar and 
statusbar
-
-    self.frame.SetSize(wxSize(int(self.form.width)*int(self.widgetWidth),
-                              
int(int(self.form.height)+menu_sb_space)*int(self.widgetHeight)))
-
-    
-    self.statusBar = self.frame.CreateStatusBar()
-    self.statusBar.SetFieldsCount(5)
-    self.statusBar.SetStatusWidths([-1,50,50,100,100])
-    
self.statusBar.SetFont(wxFont(GFOptions.pointSize,wxMODERN,wxNORMAL,wxNORMAL))
-    
-    self.frame.SetStatusText( "Let's get started" )
-
-    fileMenu = wxMenu()
-    fileMenu.Append( 100, "Commit     (F6)",GFOptions.msg_commit)
-    EVT_MENU(self, 100, lambda event, l=self: 
l.dispatchEvent(GFEvent('requestCOMMIT')))
-    fileMenu.Append( 102, "Rollback  (F11)",GFOptions.msg_rollback)
-    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.menuExitEvent)
-     
-    dataMenu = wxMenu()
-    dataMenu.Append( 201, "Next Record             (Up)",GFOptions.msg_next)
-    EVT_MENU(self, 201, lambda event, l=self: 
l.dispatchEvent(GFEvent('requestNEXTRECORD')))
-    dataMenu.Append( 202, "Previous Record   (Down)",GFOptions.msg_previous)
-    EVT_MENU(self, 202, lambda event, l=self: 
l.dispatchEvent(GFEvent('requestPREVRECORD')))
-    dataMenu.Append( 203, "New Record           (F12)",GFOptions.msg_insert)
-    EVT_MENU(self, 203, lambda event, l=self: 
l.dispatchEvent(GFEvent('requestNEWRECORD')))
-    dataMenu.Append( 204, "Delete Record          (F5)",GFOptions.msg_delete)
-    EVT_MENU(self, 204, lambda event, l=self: 
l.dispatchEvent(GFEvent('requestMARKFORDELETE')))
-    dataMenu.AppendSeparator()
-    dataMenu.Append( 205, "Next Block           
(PgDn)",GFOptions.msg_next_block)
-    EVT_MENU(self, 205, lambda event, l=self: 
l.dispatchEvent(GFEvent('requestNEXTBLOCK')))
-    dataMenu.Append( 206, "Previous Block     
(PgUp)",GFOptions.msg_previous_block)
-    EVT_MENU(self, 206, lambda event, l=self: 
l.dispatchEvent(GFEvent('requestPREVBLOCK')))
-    dataMenu.AppendSeparator()
-    dataMenu.Append( 207, "Enter Query            
(F8)",GFOptions.msg_query_prep)
-    EVT_MENU(self, 207, lambda event, l=self: 
l.dispatchEvent(GFEvent('requestQUERY')))
-    dataMenu.Append( 208, "Execute Query        (F9)", GFOptions.msg_query)
-    EVT_MENU(self, 208, lambda event, l=self: 
l.dispatchEvent(GFEvent('executeQUERY')))
-    
-    helpMenu = wxMenu()
-    helpMenu.Append( 300, "&About...", GFOptions.msg_help)
-    EVT_MENU(self, 300, lambda event, l=self: 
l.dispatchEvent(GFEvent('requestABOUT')))
-
-
-    menuBar = wxMenuBar()
-    menuBar.Append( fileMenu, "&File" )
-    menuBar.Append( dataMenu, "&Data" )
-    menuBar.Append( helpMenu, "&Help" )
-
-    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
-
-
-    if sys.platform == 'win32':
-      mainToolBar = self.frame.CreateToolBar()
-    else:
-      mainToolBar = self.frame.CreateToolBar(wxTB_HORIZONTAL|wxTB_DOCKABLE)
-
-    mainToolBar.SetToolBitmapSize(wxSize(24,24))
-    mainToolBar.AddSimpleTool(100, wxImage(GFOptions.tb_commit, 
wxBITMAP_TYPE_PNG).ConvertToBitmap(), "Commit Changes", GFOptions.msg_commit)
-    mainToolBar.AddSimpleTool(203, wxImage(GFOptions.tb_insert, 
wxBITMAP_TYPE_PNG).ConvertToBitmap(), "Insert Record", GFOptions.msg_insert)
-    mainToolBar.AddSimpleTool(102, wxImage(GFOptions.tb_rollback, 
wxBITMAP_TYPE_PNG).ConvertToBitmap(), "Rollback Changes", 
GFOptions.msg_rollback)
-    mainToolBar.AddSimpleTool(204, wxImage(GFOptions.tb_delete, 
wxBITMAP_TYPE_PNG).ConvertToBitmap(), "Delete Record", GFOptions.msg_delete)
-    mainToolBar.AddSeparator()
-    mainToolBar.AddSimpleTool(202, wxImage(GFOptions.tb_previous, 
wxBITMAP_TYPE_PNG).ConvertToBitmap(), "Previous Record",GFOptions.msg_previous)
-    mainToolBar.AddSimpleTool(201, wxImage(GFOptions.tb_next, 
wxBITMAP_TYPE_PNG).ConvertToBitmap(), "Next Record",GFOptions.msg_next)
-    mainToolBar.AddSeparator()
-    mainToolBar.AddSimpleTool(207, wxImage(GFOptions.tb_query_prep, 
wxBITMAP_TYPE_PNG).ConvertToBitmap(), "Prepare Query", GFOptions.msg_query_prep)
-    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)
-    mainToolBar.Realize()
-
-
-    self.frame.panel = wxPanel(self.frame,-1, 
wxDefaultPosition,self.frame.GetSize())
-    self.frame.SetTitle(str(self.form.title))
-    EVT_CHAR(self.frame.panel, self.uiEventTrap)
-
-    self.currentWidget = [self.frame.panel]
-    self.SetTopWindow(self.frame)
-
-    EVT_CLOSE(self.frame,self.closeTrap)
-    
-    return self.frame
-
-  def entryHandler(self):
-    object    = self.currentObject[0]
-    container = self.currentWidget[0]
-
-    widget = []
-    if not hasattr(object,'hidden'):
-      if not hasattr(object,'visibleCount'):
-        object.visibleCount = 1
-      
-      count = int(object.visibleCount)
-
-      if hasattr(object,'style'):
-        style = object.style
-      else:
-        style = 'text'
-
-      if hasattr(object,'gap'):
-        gap = int(object.gap)
-      else:
-        gap = 0
-
-      for spacer in range(count):
-        spacer = int(spacer)
-
-        if style == 'dropdown':
-          choices = []
-          values = object.allowedValues()
-          for key in values.keys():
-            choices.append(values[key])
-          choices.sort()
-
-          newWidget = wxComboBox(container, -1, "",
-                                 wxPoint(int(object.x)*int(self.widgetWidth),
-                                         
(int(object.y)+spacer+(gap*spacer))*int(self.widgetHeight)),
-                                 wxSize(int(object.width)*int(self.textWidth),
-                                        
int(object.height)*int(self.textHeight)),
-                                 choices, wxCB_DROPDOWN)
-          newWidget.SetValue("")
-
-          EVT_CHAR(newWidget, self.uiEventTrap)
-          EVT_COMBOBOX(newWidget, newWidget.GetId(), self.uiEventTrap)         
-        else:
-          styles = wxTE_PROCESS_TAB
-          if int(object.height) > 1:
-            styles = styles|wxTE_MULTILINE
-
-          newWidget = wxTextCtrl(container, -1, object.value,
-                                 wxPoint(int(object.x)*int(self.widgetWidth),
-                                         
(int(object.y)+spacer+(gap*spacer))*int(self.widgetHeight)),
-                                 wxSize(int(object.width)*int(self.textWidth),
-                                        
int(object.height)*int(self.textHeight)),styles)
-          
-
-          EVT_CHAR(newWidget, self.uiEventTrap)
-          EVT_MOUSE_EVENTS(newWidget, self.uiEventTrap)
-      
-        
newWidget.SetFont(wxFont(GFOptions.pointSize-1,wxMODERN,wxNORMAL,wxNORMAL))
-        widget.append(newWidget)
-
-    return widget
-
-
-  #############################################################################
-  #
   # Login support
   #
   # All methods below this point are only used to present the initial login box
@@ -863,6 +646,7 @@
   # creates the login dialog and displays it modal
   #
   def getLogin(self, event):
+    print "Getting login"
     self.logindata = event.data
     self.dlg = wxDialog(NULL, -1, "Login Required for %s" % 
str(event.data[2].dbname),wxPoint(-1,-1),wxSize(250,150))
     self.dlg.SetBackgroundColour(wxWHITE)
@@ -883,6 +667,7 @@
 
     self.dlg.Raise()
     self.dlg.CenterOnScreen()
+    print "showing login"
     self.dlg.ShowModal()
     self.dlg.Destroy()
     
@@ -910,10 +695,186 @@
     else:
       event.Skip()
 
+#############################################################################
+#
+# 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
+#
 
+#
+# UIHelper
+#
+# Provides a UI widget set of std functions to reduce the number of functions
+# require in each UIclass listed below
 
+class UIHelper:
+  def showModal(self):
+    self.ShowModal()
 
+  def show(self):
+    self.Show(TRUE)
 
+  def destroy(self):
+    self.Destroy()
+    
+#
+# UILabel
+#
+# Widget set specific function that creates a single instance of a label
+#
+class UILabel(UIWidget):
+  def createWidget(self, object, container, textWidth, textHeight, 
widgetWidth, widgetHeight,interface,spacer):
+    style = wxALIGN_LEFT|wxST_NO_AUTORESIZE
+
+    if hasattr(object,'alignment'):
+      if object.alignment == 'center':
+        style = wxALIGN_CENTRE|wxST_NO_AUTORESIZE
+      elif object.alignment == 'right':
+        style = wxALIGN_RIGHT|wxST_NO_AUTORESIZE
+
+    newWidget = wxStaticText(container, -1, str(object.text),
+                             wxPoint(int(object.x)*int(widgetWidth),
+                                     
(int(object.y)+spacer+(spacer*self.gap))*int(widgetHeight)),
+                             wxSize(self.itemWidth,self.itemHeight), style)
+    newWidget.SetFont(wxFont(GFOptions.pointSize,wxMODERN,wxNORMAL,wxNORMAL))
+    return newWidget
 
+#
+# UIBox
+#
+# Widget set specific function that creates a single instance of a border box
+#
+class UIBox(UIWidget):
+  def createWidget(self, object, container, textWidth, textHeight, 
widgetWidth, widgetHeight,interface,spacer):
+    newWidget = wxStaticBox(container,-1,str(object.label),
+                            
wxPoint(int(object.x)*int(widgetWidth)+(int(widgetWidth)/2),
+                                    
(int(object.y)+spacer)*int(widgetHeight)+(int(widgetHeight)/2)),
+                            
wxSize(int(object.width)*int(widgetWidth)-(int(widgetWidth)/2),
+                                   
int(object.height)*int(widgetHeight)-(int(widgetHeight)/2)))
+    newWidget.SetFont(wxFont(GFOptions.pointSize,wxMODERN,wxNORMAL,wxNORMAL))
+    return newWidget
+              
+#
+# UIScrollBar
+#
+# Widget set specific function that creates a single instance of a scroll bar 
used
+# to navigate multiple records
+#
+class UIScrollBar(UIWidget):
+  def createWidget(self, object, container, textWidth, textHeight, 
widgetWidth, widgetHeight,interface,spacer):
+    newWidget =wxScrollBar(container,-1,
+                           
wxPoint(int(object.x)*int(widgetWidth),(int(object.y)+spacer)*int(widgetHeight)),
+                           
wxSize(int(object.width)*int(widgetWidth),int(object.height)*int(widgetHeight)),
+                           wxSB_VERTICAL)      
+    newWidget.SetFont(wxFont(GFOptions.pointSize,wxMODERN,wxNORMAL,wxNORMAL))
+    return newWidget
+#
+# UIButton
+#
+# Widget set specific function that creates a single instance of a button
+#
+class UIButton(UIWidget):
+  def createWidget(self, object, container, textWidth, textHeight, 
widgetWidth, widgetHeight,interface,spacer):
+    newWidget = wxButton(container,-1,str(object.label),
+                         
wxPoint(int(object.x)*int(widgetWidth),(int(object.y)+spacer)*int(widgetHeight)),
+                         
wxSize(int(object.width)*int(widgetWidth),int(object.height)*int(widgetHeight))
+                         )
+    
+    newWidget.SetFont(wxFont(GFOptions.pointSize,wxMODERN,wxNORMAL,wxNORMAL))
+    EVT_BUTTON(newWidget,newWidget.GetId(),interface.uiEventTrap)
+    return newWidget
+
+#
+# UIPage
+#
+# Widget set specific function that creates a single instance of a page
+#
+class UIPage(UIWidget):
+  def createWidget(self, object, container, textWidth, textHeight, 
widgetWidth, widgetHeight,interface,spacer):
+    newWidget = wxPanel(container, -1,wxDefaultPosition,container.GetSize())
+    newWidget.Show(FALSE)
+    
+    EVT_CHAR(newWidget, interface.uiEventTrap)
+    newWidget.SetFont(wxFont(GFOptions.pointSize,wxMODERN,wxNORMAL,wxNORMAL))
+    interface.pageList.append(newWidget)
+    return newWidget
 
+#
+# UIEntry
+#
+# Widget set specific function that creates a single instance of a data entry 
widget
+#
+class UIEntry(UIWidget):
+  def createWidget(self, object, container, textWidth, textHeight, 
widgetWidth, widgetHeight,interface,spacer):
+    if hasattr(object,'style'):
+      style = object.style
+    else:
+      style = 'text'
+      
+    if style == 'dropdown':
+      choices = []
+      values = object.allowedValues()
+      for key in values.keys():
+        choices.append(values[key])
+      choices.sort()
+      
+      newWidget = wxComboBox(container, -1, "",
+                             wxPoint(int(object.x)*int(widgetWidth),
+                                     
(int(object.y)+spacer+(self.gap*spacer))*int(widgetHeight)),
+                             wxSize(int(object.width)*int(textWidth),
+                                    int(object.height)*int(textHeight)),
+                             choices, wxCB_DROPDOWN)
+      newWidget.SetValue("")
 
+      EVT_CHAR(newWidget, interface.uiEventTrap)
+      EVT_COMBOBOX(newWidget, newWidget.GetId(), interface.uiEventTrap)        
 
+    else:
+      styles = wxTE_PROCESS_TAB
+      if int(object.height) > 1:
+        styles = styles|wxTE_MULTILINE
+
+      newWidget = wxTextCtrl(container, -1, object.value,
+                             wxPoint(int(object.x)*int(widgetWidth),
+                                     
(int(object.y)+spacer+(self.gap*spacer))*int(widgetHeight)),
+                             wxSize(int(object.width)*int(textWidth),
+                                    
int(object.height)*int(textHeight)),styles)      
+      EVT_CHAR(newWidget, interface.uiEventTrap)
+      EVT_MOUSE_EVENTS(newWidget, interface.uiEventTrap)
+      
+      
newWidget.SetFont(wxFont(GFOptions.pointSize-1,wxMODERN,wxNORMAL,wxNORMAL))
+    return newWidget
+
+#
+# UIForm
+#
+# Widget set specific function that creates a single instance of a Form widget
+#
+class UIForm(UIWidget):
+  def createWidget(self, object, container, textWidth, textHeight, 
widgetWidth, widgetHeight,interface,spacer):
+    print "building a form"
+    newWidget = wxPanel(interface.mainWindow.panel,-1, wxDefaultPosition)
+    EVT_CLOSE(interface.mainWindow,interface.closeTrap)
+    
+    return newWidget
+
+#
+# UIAbout
+#
+# A dialog box providing about info
+#
+class UIAbout(wxMessageDialog, UIHelper):
+  def __init__(self, interface, programVersion, formName, formVersion, author, 
description):
+    wxMessageDialog.__init__(self, interface,
+                             "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)



reply via email to

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