commit-gnue
[Top][All Lists]
Advanced

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

gnue common/src/GDataSource.py forms/src/uidriv...


From: James Thompson
Subject: gnue common/src/GDataSource.py forms/src/uidriv...
Date: Tue, 03 Dec 2002 22:05:28 -0500

CVSROOT:        /cvsroot/gnue
Module name:    gnue
Changes by:     James Thompson <address@hidden> 02/12/03 22:05:28

Modified files:
        common/src     : GDataSource.py 
        forms/src/uidrivers/_base: UIWidget.py UIdriver.py 
        forms/src/uidrivers/wx: UIdriver.py 

Log message:
        remove GFObj referece from common
        moving things about and adding notes to ui drivers in preperation
        for some changes

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/GDataSource.py.diff?tr1=1.53&tr2=1.54&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/uidrivers/_base/UIWidget.py.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/uidrivers/_base/UIdriver.py.diff?tr1=1.81&tr2=1.82&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/src/uidrivers/wx/UIdriver.py.diff?tr1=1.220&tr2=1.221&r1=text&r2=text

Patches:
Index: gnue/common/src/GDataSource.py
diff -c gnue/common/src/GDataSource.py:1.53 gnue/common/src/GDataSource.py:1.54
*** gnue/common/src/GDataSource.py:1.53 Wed Nov 20 20:39:36 2002
--- gnue/common/src/GDataSource.py      Tue Dec  3 22:05:28 2002
***************
*** 387,393 ****
  ######
  class GConnection(GObjects.GObj):
    def __init__(self, parent=None):
!     GFObj.__init__(self, parent, "GCConnection")
      self.comment = ""
      self.name = ""
      self._inits =[self.initialize]
--- 387,393 ----
  ######
  class GConnection(GObjects.GObj):
    def __init__(self, parent=None):
!     GObjects.GObj.__init__(self, parent, "GCConnection")
      self.comment = ""
      self.name = ""
      self._inits =[self.initialize]
Index: gnue/forms/src/uidrivers/_base/UIWidget.py
diff -c gnue/forms/src/uidrivers/_base/UIWidget.py:1.6 
gnue/forms/src/uidrivers/_base/UIWidget.py:1.7
*** gnue/forms/src/uidrivers/_base/UIWidget.py:1.6      Thu Oct 24 00:39:02 2002
--- gnue/forms/src/uidrivers/_base/UIWidget.py  Tue Dec  3 22:05:28 2002
***************
*** 29,38 ****
  # NOTES:
  #
  
- #from GFForm import *
- #from gnue.common import events
- #from gnue.common.GObjects import *
- 
  class UIWidget:
    def __init__(self, event):
  
--- 29,34 ----
Index: gnue/forms/src/uidrivers/_base/UIdriver.py
diff -c gnue/forms/src/uidrivers/_base/UIdriver.py:1.81 
gnue/forms/src/uidrivers/_base/UIdriver.py:1.82
*** gnue/forms/src/uidrivers/_base/UIdriver.py:1.81     Thu Nov 28 01:07:59 2002
--- gnue/forms/src/uidrivers/_base/UIdriver.py  Tue Dec  3 22:05:28 2002
***************
*** 22,94 ****
  # UIbase.py
  #
  # DESCRIPTION:
! # A base class for UI modules.  Everything in here better
! # not contain any specific UI widgetisms
  #
  # NOTES:
  #
  
- from gnue.forms.GFForm import *
  from gnue.common import events
  from gnue.common.GObjects import *
  
! # Used in updating the status bar
! 
! statusValues = {'saved':'OK',
!                 'modified':'MOD',
!                 'deleted':'DEL',
!                 'query':'QRY'}
! 
! 
! # Creating base dictionary for language font encodings
! 
! encodings = {
!              'iso8859-1':None,
!              'iso8859-2':None,
!              'iso8859-3':None,
!              'iso8859-4':None,
!              'iso8859-5':None,
!              'iso8859-6':None,
!              'iso8859-7':None,
!              'iso8859-8':None,
!              'iso8859-9':None,
!              'iso8859-10':None,
!              'iso8859-11':None,
!              'iso8859-12':None,
!              'iso8859-13':None,
!              'iso8859-14':None,
!              'iso8859-15':None,
!              'koi8':None,       # TODO: not sure about these
!            'koi8-r':None,
!              'cp1250':None,
!              'cp1251':None,
!              'cp1252':None
!             }
  
  #
  # GFUserInterfaceBase
  #
! # Convience class to be inheritance by other GFUserInterface's
  # Provides basic functionality.
  #
  class GFUserInterfaceBase(events.EventAware):
    def __init__(self, eventHandler):
      events.EventAware.__init__(self, eventHandler)
      #
!     # Events I monitor...
      #
      self.registerEventListeners( {
              'gotoENTRY'        : self.switchFocus,
              'updateENTRY'      : self.updateEntry,
              'updateEntryEditor': self.updateEntryEditor,
              'gotoPAGE'         : self.gotoPage,
!             'formALERT'        : self.formAlert,
              'beginWAIT'        : self.beginWait,
              'endWAIT'          : self.endWait,
-             'uiUPDATESTATUS'   : self.updateStatusBar,
-             'uiABOUT'          : self.aboutBox,
-             'exitApplication'  : self.exitApplication,
              'msgBoxUI'         : self.msgBox,
  
              # Clipboard contents
              'setCLIPBOARD'     : self.setClipboardContents,
--- 22,65 ----
  # UIbase.py
  #
  # DESCRIPTION:
! # A base class for UI modules.  This class is to be inherited by
! # specific UI drivers.
  #
  # NOTES:
  #
+ import sys
  
  from gnue.common import events
  from gnue.common.GObjects import *
  
! from gnue.forms.GFForm import *
  
  #
  # GFUserInterfaceBase
  #
! # Convience class to be inherited by other GFUserInterface's
  # Provides basic functionality.
  #
  class GFUserInterfaceBase(events.EventAware):
    def __init__(self, eventHandler):
      events.EventAware.__init__(self, eventHandler)
      #
!     # Configure event handling
      #
      self.registerEventListeners( {
              'gotoENTRY'        : self.switchFocus,
              'updateENTRY'      : self.updateEntry,
              'updateEntryEditor': self.updateEntryEditor,
              'gotoPAGE'         : self.gotoPage,
!             'exitApplication'  : self.exitApplication,
!             
!             # User feedback events from the virtual form to the UI
              'beginWAIT'        : self.beginWait,
              'endWAIT'          : self.endWait,
              'msgBoxUI'         : self.msgBox,
+             'formALERT'        : self.formAlert,
+             'uiABOUT'          : self.aboutBox,
+             'uiUPDATESTATUS'   : self.updateStatusBar,
  
              # Clipboard contents
              'setCLIPBOARD'     : self.setClipboardContents,
***************
*** 108,115 ****
  
      self._pageList = []                   # A list of page widgets created by 
the form
  
!     self.keyEvents = {}                   # Keyboard events from the widget 
set the
!                                           # UI is expected to respond to
  
      # A dictionary of functions used by buildUI to build the widgets.  Can 
override in
      # UI specific module if necessary.
--- 79,88 ----
  
      self._pageList = []                   # A list of page widgets created by 
the form
  
!     self.statusValues = {'saved':'OK',    # dictionary of mappings from 
record status to 
!                          'modified':'MOD',# what is displayed on the status 
bar
!                          'deleted':'DEL',
!                          'query':'QRY'}
  
      # A dictionary of functions used by buildUI to build the widgets.  Can 
override in
      # UI specific module if necessary.
***************
*** 123,148 ****
        'GFPage'        : self._stdHandler,
        }
  
-   def _stdHandler(self):
-     object = self._currentObject[0]
-     event = self._updateCreateEvent(events.Event('CreateUIWidget',None,
-                    object=object,
-                    container=self.currentWidget[0],
-                    textWidth=self.textWidth,
-                    textHeight=self.textHeight,
-                    widgetWidth=self.widgetWidth,
-                    widgetHeight=self.widgetHeight,
-                    interface=self,
-                    initialize=1))
- 
-     newWidget = self.widgets[object._type](event)
-     return newWidget
- 
-   # Can be used by UI drivers to add more attributes to the event.
-   def _updateCreateEvent(self, event):
-     return event
- 
- 
    #
    # buildUI
    #
--- 96,101 ----
***************
*** 172,178 ****
      except KeyError:
        pass
  
- 
      if self._currentObject[0]._children:
       for child in self._currentObject[0]._children:
          if isinstance(child, GObj):
--- 125,130 ----
***************
*** 183,188 ****
--- 135,161 ----
      if self._currentObject[0]._type in self.containerWidgets:
        self.currentWidget.pop(0)
  
+   #
+   # _stdHandler
+   #
+   # The default function that builds a specific widget
+   #
+   def _stdHandler(self):
+     object = self._currentObject[0]
+     event = self._updateCreateEvent(events.Event('CreateUIWidget',None,
+                    object=object,
+                    container=self.currentWidget[0],
+                    textWidth=self.textWidth,
+                    textHeight=self.textHeight,
+                    widgetWidth=self.widgetWidth,
+                    widgetHeight=self.widgetHeight,
+                    interface=self,
+                    initialize=1))
+     newWidget = self.widgets[object._type](event)
+     return newWidget
+ 
+ 
+ 
    
#############################################################################
    #
    # Public Interface
***************
*** 204,270 ****
      self._buildUI()
  
  
- 
- 
    
#############################################################################
    #
!   # Generic Incoming Event Handlers
    #
    # Handles incoming events and calls UI instance specific functions to
    # execute the actions.  These events come from the forms back end.
    #
  
    #
-   # Clipboard routines
-   #
-   # If a particular UI has a system-wide clipboard,
-   # these methods should be overridden to use that
-   # clipboard.
-   #
-   def getClipboardContents(self, event):
-     GDebug.printMesg(5, "Getting clipboard '%s'" % self.__clipboard)
-     event.__result__ = "%s" % self.__clipboard
- 
-   def setClipboardContents(self, event):
-     GDebug.printMesg(5, "Setting clipboard '%s'" % event.text)
-     self.__clipboard = "%s" % event.text
- 
-   #
-   # 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):
- 
-     #tip, recordStatus, insertMode, currentRecord, maxRecord, currentPage, 
maxPage =event.data
- 
-     status = None
-     if event.recordStatus != None:
-       status = statusValues[event.recordStatus]
- 
-     insertValue = None
-     if event.insertMode != None:
-       insertValue = event.insertMode and 'INS' or  'OVR'
-     self._setStatusBar(event.tip, status, insertValue, event.currentRecord, 
event.maxRecord, event.currentPage, event.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()
- 
-   #
    # switchFocus
    #
    # Moves the focus to a specific UI widget
--- 177,191 ----
      self._buildUI()
  
  
    
#############################################################################
    #
!   # EVENT FUNCTIONS
    #
    # Handles incoming events and calls UI instance specific functions to
    # execute the actions.  These events come from the forms back end.
    #
  
    #
    # switchFocus
    #
    # Moves the focus to a specific UI widget
***************
*** 277,324 ****
  
      self.dispatchEvent(events.Event('beginEDITMODE', formObject))
  
- 
-   #
-   # 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]
- 
-     about = self._DIALOGS['about'](self.mainWindow, programVersion, formName, 
formVersion, author, description)
-     about.showModal()
-     about.destroy()
- 
-   #
-   # msgBox
-   #
-   def msgBox(self,event):
-     message = event.data.message
-     caption = event.data.caption
-     
-     dialog = self._DIALOGS['messageBox'](self.mainWindow, message, caption)
-     dialog.showModal()
-     dialog.destroy()
- 
-   #
-   # updateEntryEditor
-   #
-   def updateEntryEditor(self, event):
-     index = event.object._visibleIndex
-     widget = self._formToUIWidget[event.object]
-     widget.setValue(event.display, index)
-     widget.setCursorPosition(event.cursor, index)
- 
-     if event.selection != None:
-       selection1, selection2 = event.selection
-       widget.setSelectedArea(selection1, selection2, index)
- 
- 
    #
    # updateEntry
    #
--- 198,203 ----
***************
*** 371,389 ****
  
      handler.editing = prehandling
  
  
    # Called whenever forms goes into a "wait" state in which user cannot
    # interact with interface (e.g., while waiting for a query or a commit)
    def beginWait (self, event):
      pass
! 
! 
    # Called whenever forms leaves a "wait" state
    def endWait (self, event):
      pass
  
  
  
  
  
  
--- 250,416 ----
  
      handler.editing = prehandling
  
+   #
+   # updateEntryEditor
+   #
+   def updateEntryEditor(self, event):
+     index = event.object._visibleIndex
+     widget = self._formToUIWidget[event.object]
+     widget.setValue(event.display, index)
+     widget.setCursorPosition(event.cursor, index)
+ 
+     if event.selection != None:
+       selection1, selection2 = event.selection
+       widget.setSelectedArea(selection1, selection2, index)
+ 
+ 
+   #
+   # Clipboard routines
+   #
+   # If a particular UI has a system-wide clipboard,
+   # these methods should be overridden to use that
+   # clipboard.
+   #
+   def getClipboardContents(self, event):
+     GDebug.printMesg(5, "Getting clipboard '%s'" % self.__clipboard)
+     event.__result__ = "%s" % self.__clipboard
+ 
+   def setClipboardContents(self, event):
+     GDebug.printMesg(5, "Setting clipboard '%s'" % event.text)
+     self.__clipboard = "%s" % event.text
+ 
+   #
+   # updateStatusBar
+   #
+   # Calls the UIs function to update status
+   def updateStatusBar(self,event):
+ 
+     #tip, recordStatus, insertMode, currentRecord, maxRecord, currentPage, 
maxPage =event.data
+ 
+     status = None
+     if event.recordStatus != None:
+       status = self.statusValues[event.recordStatus]
+ 
+     insertValue = None
+     if event.insertMode != None:
+       insertValue = event.insertMode and 'INS' or  'OVR'
+     self._setStatusBar(event.tip, status, insertValue, event.currentRecord, 
event.maxRecord, event.currentPage, event.maxPage)
+ 
+   #
+   # msgBox
+   #
+   def msgBox(self,event):
+     message = event.data.message
+     caption = event.data.caption
+     
+     dialog = self._DIALOGS['messageBox'](self.mainWindow, message, caption)
+     dialog.showModal()
+     dialog.destroy()
+ 
+   #
+   # 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]
+ 
+     about = self._DIALOGS['about'](self.mainWindow, programVersion, formName, 
formVersion, author, description)
+     about.showModal()
+     about.destroy()
  
+ 
+ 
+   
#############################################################################
+   #
+   # Optional Functions
+   #
+   # UIDrivers can override the following functions 
+   #
+ 
+   #
+   # beginWait
    # Called whenever forms goes into a "wait" state in which user cannot
    # interact with interface (e.g., while waiting for a query or a commit)
+   #
    def beginWait (self, event):
      pass
!   
!   #
!   # endWait
!   #
    # Called whenever forms leaves a "wait" state
+   #
    def endWait (self, event):
      pass
  
+   # exitApplication
+   #
+   # Form has told the application to close so call the UIs private exit 
routine
+   #
+   def exitApplication(self,event):
+     self._exit()
+ 
+   #
+   # _updateCreateEvent
+   #
+   # Can be used by UI drivers to add more attributes to the event that 
+   # creates a widget.  Called by the _stdHandler during the building of the UI
+   #
+   def _updateCreateEvent(self, event):
+     return event
+ 
  
  
  
+   
#############################################################################
+   #
+   # Required Functions
+   #
+   # UIDrivers must implement the following functions 
+   #
  
+   #
+   # 
+   #
+   def activateForm(self):
+     GDebug.printMesg(0, "Fatal UI driver error.  Required function not 
implemented")
+     sys.exit(1)
+ 
+   def _exit(self):
+     GDebug.printMesg(0, "Fatal UI driver error.  Required function not 
implemented")
+     sys.exit(1)
+ 
+   def gotoPage(self,event):
+     GDebug.printMesg(0, "Fatal UI driver error.  Required function not 
implemented")
+     sys.exit(1)
+        
+ 
+ # Creating base dictionary for language font encodings
+ encodings = {
+              'iso8859-1':None,
+              'iso8859-2':None,
+              'iso8859-3':None,
+              'iso8859-4':None,
+              'iso8859-5':None,
+              'iso8859-6':None,
+              'iso8859-7':None,
+              'iso8859-8':None,
+              'iso8859-9':None,
+              'iso8859-10':None,
+              'iso8859-11':None,
+              'iso8859-12':None,
+              'iso8859-13':None,
+              'iso8859-14':None,
+              'iso8859-15':None,
+              'koi8':None,       # TODO: not sure about these
+            'koi8-r':None,
+              'cp1250':None,
+              'cp1251':None,
+              'cp1252':None
+             }
  
Index: gnue/forms/src/uidrivers/wx/UIdriver.py
diff -c gnue/forms/src/uidrivers/wx/UIdriver.py:1.220 
gnue/forms/src/uidrivers/wx/UIdriver.py:1.221
*** gnue/forms/src/uidrivers/wx/UIdriver.py:1.220       Tue Nov 26 21:29:38 2002
--- gnue/forms/src/uidrivers/wx/UIdriver.py     Tue Dec  3 22:05:28 2002
***************
*** 28,49 ****
  #  TODO: why does UIhelper not inherit from UIwidget?
  #
  
  from wxPython.wx import *
  from wxPython.lib.splashscreen import SplashScreen
- from gnue.forms.GFForm import *
- from gnue.common import events
- from gnue.forms import GFKeyMapper
- from gnue.forms.uidrivers._base.UIdriver import *
- from gnue.forms.uidrivers._base.UIWidget import *
  
! import os
! import sys
! import string
! from gnue.forms import VERSION
  from gnue.common import GDebug, GLoginHandler
  from gnue.common import GConfig
  from gnue.common.TextUtils import lineWrap
  
  _LOOPTRAP = 0
  _PROMPTFORRECORD = None
  _charWidth = 0
--- 28,49 ----
  #  TODO: why does UIhelper not inherit from UIwidget?
  #
  
+ import sys
+ import string
+ 
  from wxPython.wx import *
  from wxPython.lib.splashscreen import SplashScreen
  
! from gnue.common import events
  from gnue.common import GDebug, GLoginHandler
  from gnue.common import GConfig
  from gnue.common.TextUtils import lineWrap
  
+ from gnue.forms import VERSION
+ from gnue.forms.GFForm import *
+ from gnue.forms.uidrivers._base.UIdriver import *
+ from gnue.forms.uidrivers._base.UIWidget import *
+ 
  _LOOPTRAP = 0
  _PROMPTFORRECORD = None
  _charWidth = 0
***************
*** 54,59 ****
--- 54,64 ----
  
  _disabledColour = wxLIGHT_GREY
  
+ 
+ # Shortcut
+ images_dir = GConfig.getInstalledBase('forms_images','common_images') + '/'
+ 
+ 
  # Finishing creation of dictionary for language font encodings
  
  encodings = {
***************
*** 156,162 ****
      global _PROMPTFORRECORD
      _PROMPTFORRECORD = self.promptForRecordNumber
  
-     self.forms = {}
      self.init()
  
    #
--- 161,166 ----
***************
*** 244,250 ****
      initFont(self.statusBar,0)
  
  
-     #self.mainWindow.panel = wxPanel(self.mainWindow,-1, 
wxDefaultPosition,self.mainWindow.GetClientSize())
      self.mainWindow.panel = wxScrolledWindow(self.mainWindow,-1, 
wxDefaultPosition,self.mainWindow.GetClientSize())
  
  
--- 248,253 ----
***************
*** 252,258 ****
      _disabledColour = self.mainWindow.GetBackgroundColour()
  
      self.currentWidget = [self.mainWindow.panel]
-     #self._wxapp.SetTopWindow(self.mainWindow)
  
      EVT_CLOSE(self.mainWindow,self.closeTrap)
  
--- 255,260 ----
***************
*** 265,271 ****
      if not form._features['GUI:MENUBAR:SUPPRESS']:
        self.menu_sb_space += 2
  
- 
        # This will be a dict of the form { 'requestROLLBACK': 1001 }
        # where 1001 is the wxId associated with requestROLLBACK.
        self.__eventMenuMapping = {}
--- 267,272 ----
***************
*** 481,488 ****
    # Incoming Event Processors
    #
    # Processes the incoming events from other objects
!   #
! 
    #
    # mainLoop
    #
--- 482,489 ----
    # Incoming Event Processors
    #
    # Processes the incoming events from other objects
!   # From here down should be nothing but eventListeners listed
!   
    #
    # mainLoop
    #
***************
*** 601,607 ****
      dlg = wxTextEntryDialog(self.mainWindow, _('Enter record number to jump 
to'),
                                                          _('Which record?'))
      if dlg.ShowModal() == wxID_OK:
!       action = self.dispatchEvent(events.Event('requestRECORDNUMBER', 
dlg.GetValue()))
      else:
        action = None
  
--- 602,608 ----
      dlg = wxTextEntryDialog(self.mainWindow, _('Enter record number to jump 
to'),
                                                          _('Which record?'))
      if dlg.ShowModal() == wxID_OK:
!       action = self.dispatchEvent('requestRECORDNUMBER', dlg.GetValue())
      else:
        action = None
  
***************
*** 618,641 ****
    def closeTrap(self,event):
      object = _eventObjTowxWindow(event)
      if event.CanVeto():
!       self.dispatchEvent(events.Event('requestEXIT'))
      else:
        object.Destroy()
  
    # Called by SplashScreen when timer expires
    def onCloseSplash(self):
-     # If the splashscreen has timed out before the form is
-     # ready then go ahead and display what we've got.  This
-     # is a desperate attempt to eliminate the vile
-     #
-     # Gdk-ERROR **: BadWindow (invalid Window parameter)
-     #  serial 1228 error_code 3 request_code 15 minor_code 0
-     #
-     # on heavily loaded machines.  The key line seems to be
-     # wxYield() but I'm leaving the others there because I
-     # can :P  The fix works for me all the way down to a
-     # splash duration=1 millisecond
-     #
      self._wxapp.SetTopWindow(self.mainWindow)
      self.mainWindow.Show(true)
      wxYield() # Flush the pending queue to insure something is
--- 619,646 ----
    def closeTrap(self,event):
      object = _eventObjTowxWindow(event)
      if event.CanVeto():
!       self.dispatchEvent('requestEXIT')
      else:
        object.Destroy()
  
+   #
+   # onCloseSplash
+   #
    # Called by SplashScreen when timer expires
+   #
+   # If the splashscreen has timed out before the form is
+   # ready then go ahead and display what we've got.  This
+   # is a desperate attempt to eliminate the vile
+   #
+   # Gdk-ERROR **: BadWindow (invalid Window parameter)
+   #  serial 1228 error_code 3 request_code 15 minor_code 0
+   #
+   # on heavily loaded machines.  The key line seems to be
+   # wxYield() but I'm leaving the others there because I
+   # can :P  The fix works for me all the way down to a
+   # splash duration=1 millisecond
+   #
    def onCloseSplash(self):
      self._wxapp.SetTopWindow(self.mainWindow)
      self.mainWindow.Show(true)
      wxYield() # Flush the pending queue to insure something is
***************
*** 683,689 ****
      widget = self.widgets[index]
      widget.SetEvtHandlerEnabled(FALSE)
  
- 
      # Check if foreign key changed
      object = _IdToGFObj[widget.GetId()]
      try:
--- 688,693 ----
***************
*** 727,733 ****
      except (AttributeError, TypeError):
        pass  # For label-style & dropdown entries
  
- 
    def _addToCrossRef(self, widget,gfobject, uiobject):
      id = widget.GetId()
      _IdToWxObj[id]=widget
--- 731,736 ----
***************
*** 735,741 ****
      _IdToUIObj[id]=uiobject
      widget.__origBackgroundColor = widget.GetBackgroundColour()
  
- 
    def _deleteFromCrossRef(self, widget, object):
      id = widget.GetId()
      try:
--- 738,743 ----
***************
*** 745,753 ****
      except:
        pass
  
- 
    def createWidget(self, event, spacer):
- 
      newWidget = self._createWidget(event, spacer)
      initFont(newWidget)
      self._addToCrossRef(newWidget,event.object,self)
--- 747,753 ----
***************
*** 762,768 ****
        self.widgets.pop(0)
        self._deleteFromCrossRef(widget, object)
  
- 
  #
  # UILabel
  #
--- 762,767 ----
***************
*** 792,814 ****
    def _createWidget(self, event, spacer):
  
      object = event.object
- 
-     # this panel makes the GFBox be a container
- ##
- ## TODO: Commented out prior to 0.4.0 release
- ##    newPanel = wxPanel(event.container,-1,
- ##                       
wxPoint(object.Char__x*event.widgetWidth+(event.widgetWidth/2),
- ##                               
(object.Char__y+spacer+(spacer*object._gap))*event.widgetHeight+(event.widgetHeight/2)),
- ##                       wxSize((object.Char__width-1)*event.widgetWidth,
- ##                              (object.Char__height-1)*event.widgetHeight))
- ##    newWidget = wxStaticBox(newPanel,-1,str(object.label),
- ##                       wxPoint(0,0),
      newWidget = wxStaticBox(event.container,-1,str(object.label),
                         
wxPoint(object.Char__x*event.widgetWidth+(event.widgetWidth/2),
                                 
(object.Char__y+spacer+(spacer*object._gap))*event.widgetHeight+(event.widgetHeight/2)),
                         wxSize((object.Char__width-1)*event.widgetWidth,
                                 (object.Char__height-1)*event.widgetHeight))
- ##    return newPanel
      return newWidget
  
  #
--- 791,801 ----
***************
*** 1049,1054 ****
--- 1036,1042 ----
  ## Keymapper Support
  ##
  #####################################################################
+ from gnue.forms import GFKeyMapper
  from gnue.forms.GFKeyMapper import vk
  
  # Translate from wx keystrokes to our virtual keystrokes
***************
*** 1091,1096 ****
--- 1079,1090 ----
    def _processEvent(self,event):
      GDebug.printMesg(0,"uiBaseEvtHandler _processEvent was called?!?")
  
+ #
+ # mouseEvtHandler
+ #
+ # Traps most mouse events and translates them into
+ # GNUe events passed back to the form
+ #
  class mouseEvtHandler(uiBaseEvtHandler):
    def __init__(self,eventProcessor):
      eventList = [wxEVT_LEFT_DOWN]
***************
*** 1116,1123 ****
      count        = _IdToUIObj[id].widgets.index(screenWidget)
  
      if event.GetTimestamp():
!       self._eventProcessor(events.Event('requestFOCUS',gfObject))
!       self._eventProcessor(events.Event('requestJUMPRECORD',count - 
gfObject._visibleIndex))
  
        if isinstance(screenWidget,wxTextCtrl):
          event.SetTimestamp(0)
--- 1110,1117 ----
      count        = _IdToUIObj[id].widgets.index(screenWidget)
  
      if event.GetTimestamp():
!       self._eventProcessor('requestFOCUS',gfObject)
!       self._eventProcessor('requestJUMPRECORD',count - gfObject._visibleIndex)
  
        if isinstance(screenWidget,wxTextCtrl):
          event.SetTimestamp(0)
***************
*** 1126,1153 ****
      else:
        textObject= wxPyTypeCast(object, 'wxTextCtrl')
        cursorPosition = textObject.GetInsertionPoint()
!       
self._eventProcessor(events.Event('requestCURSORMOVE',position=cursorPosition))
  
-     #if isinstance(screenWidget,wxCheckBox):
-     #  self._eventProcessor(events.Event('requestTOGGLECHKBOX'))
-       
      event.Skip()
-     #  if isinstance(screenWidget,wxTextCtrl):
-     #    event.SetTimestamp(0)
-     #    self.AddPendingEvent(event)
-     #else:
-     #  textObject= wxPyTypeCast(object, 'wxTextCtrl')
-     #  cursorPosition = textObject.GetInsertionPoint()
-     #  print cursorPosition
- 
- #    if gfObject._type == 'GFButton':
- #      self._eventProcessor(events.Event('buttonActivated',gfObject))
- 
  
  
  #
  # keyboardEvtHandler
  #
  # Note: wxEVT_KEY_DOWN event seems to only return uppercase chars so
  #       i don't trap it.
  #
--- 1120,1136 ----
      else:
        textObject= wxPyTypeCast(object, 'wxTextCtrl')
        cursorPosition = textObject.GetInsertionPoint()
!       self._eventProcessor('requestCURSORMOVE',position=cursorPosition)
  
      event.Skip()
  
  
  #
  # keyboardEvtHandler
  #
+ # Traps most keypress events and translates them into
+ # GNUe events passed back to the form
+ #
  # Note: wxEVT_KEY_DOWN event seems to only return uppercase chars so
  #       i don't trap it.
  #
***************
*** 1220,1234 ****
                           text=char,
                           code=keycode)
        except ValueError:
!         pass #event.Skip()
  
      if action:
        self._eventProcessor(action)
  
  #####################################################################
  ##
  ## Login Support
  ##
  #####################################################################
  
  #
--- 1203,1232 ----
                           text=char,
                           code=keycode)
        except ValueError:
!         pass 
  
      if action:
        self._eventProcessor(action)
  
+ 
+ # Needed by Designer (AND FORMS! :)
+ WIDGETS = {'GFLabel'     : UILabel,
+            'GFBox'       : UIBox,
+            'GFPage'      : UIPage,
+            'GFForm'      : UIForm,
+            'GFEntry'     : UIEntry,
+            'GFButton'    : UIButton,
+            'GFScrollBar' : UIScrollBar,
+                      }
+ 
+ 
  #####################################################################
  ##
  ## Login Support
  ##
+ ## Everything below this point is in support of the wx drivers
+ ## UILoginHandler
+ ##  
  #####################################################################
  
  #
***************
*** 1456,1477 ****
      else:
        self.SetLabel("")
  
- 
- 
- 
- 
- # Needed by Designer
- WIDGETS = {'GFLabel'     : UILabel,
-            'GFBox'       : UIBox,
-            'GFPage'      : UIPage,
-            'GFForm'      : UIForm,
-            'GFEntry'     : UIEntry,
-            'GFButton'    : UIButton,
-            'GFScrollBar' : UIScrollBar,
-           }
- 
- 
- # Shortcut
- images_dir = GConfig.getInstalledBase('forms_images','common_images') + '/'
  
  
--- 1454,1458 ----




reply via email to

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