commit-gnue
[Top][All Lists]
Advanced

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

gnue/forms/src GFForm.py GFInstance.py GFObject...


From: Jason Cater
Subject: gnue/forms/src GFForm.py GFInstance.py GFObject...
Date: Sat, 15 Jun 2002 17:15:09 -0400

CVSROOT:        /home/cvs
Module name:    gnue
Changes by:     Jason Cater <address@hidden>    02/06/15 17:15:09

Modified files:
        forms/src      : GFForm.py GFInstance.py 
        forms/src/GFObjects: GFButton.py 
        forms/src/uidrivers/wx: UIdriver.py 

Log message:
        [ticket #80] Modified GFButton code so that GFButtons are 
tab-stops/navigable

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/forms/src/GFForm.py.diff?cvsroot=OldCVS&tr1=1.169&tr2=1.170&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/forms/src/GFInstance.py.diff?cvsroot=OldCVS&tr1=1.52&tr2=1.53&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/forms/src/GFObjects/GFButton.py.diff?cvsroot=OldCVS&tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/forms/src/uidrivers/wx/UIdriver.py.diff?cvsroot=OldCVS&tr1=1.176&tr2=1.177&r1=text&r2=text

Patches:
Index: gnue/forms/src/GFForm.py
diff -c gnue/forms/src/GFForm.py:1.169 gnue/forms/src/GFForm.py:1.170
*** gnue/forms/src/GFForm.py:1.169      Sat Jun 15 15:51:35 2002
--- gnue/forms/src/GFForm.py    Sat Jun 15 17:15:08 2002
***************
*** 46,52 ****
  
  # Defines which objects are "Tab Stops"
  TabStops = ('GFEntry','GFButton')
- #TabStops = ('GFEntry',)
  
  class GFForm(GFObj, GRootObj, GFEventAware):
    def __init__(self, parent=None, app=None):
--- 46,51 ----
***************
*** 187,193 ****
      entry = None
  
      if isinstance(object, GFObj):
!       if object._type == 'GFEntry' and not object.hidden:
          return object
        else:
          for child in object._children:
--- 186,194 ----
      entry = None
  
      if isinstance(object, GFObj):
!       if (object._type in TabStops and
!           (not object.hidden) and ((not object.readonly) or
!          (self._currentBlock.mode=='query' and object._queryable))):
          return object
        else:
          for child in object._children:
***************
*** 547,562 ****
      lastEntry = self._currentEntry
  
      for object in self._currentEntry._block._children:
!       if object._type in TabStops and \
!          not object.hidden and (not object.readonly or \
!          (self._currentBlock.mode=='query' and object._queryable)):
          nextEntry = object
          lastEntry = object
  
      keepNext = 0
      for object in self._currentEntry._block._children:
        # Put the first field as the next to rollover
!       if object._type in TabStops and not object.hidden and not 
object.readonly:
          if object == self._currentEntry:
            break
  
--- 548,565 ----
      lastEntry = self._currentEntry
  
      for object in self._currentEntry._block._children:
!       if (object._type in TabStops and
!           (not object.hidden) and ((not object.readonly) or
!          (self._currentBlock.mode=='query' and object._queryable))):
          nextEntry = object
          lastEntry = object
  
      keepNext = 0
      for object in self._currentEntry._block._children:
        # Put the first field as the next to rollover
!       if (object._type in TabStops and
!           (not object.hidden) and ((not object.readonly) or
!          (self._currentBlock.mode=='query' and object._queryable))):
          if object == self._currentEntry:
            break
  
Index: gnue/forms/src/GFInstance.py
diff -c gnue/forms/src/GFInstance.py:1.52 gnue/forms/src/GFInstance.py:1.53
*** gnue/forms/src/GFInstance.py:1.52   Sat Jun 15 15:51:35 2002
--- gnue/forms/src/GFInstance.py        Sat Jun 15 17:15:08 2002
***************
*** 172,177 ****
--- 172,178 ----
          messageBox = GFMsgBox(self, event.__errortext__)
          messageBox.show()
  
+ 
    #
    # nextEntry
    #
Index: gnue/forms/src/GFObjects/GFButton.py
diff -c gnue/forms/src/GFObjects/GFButton.py:1.7 
gnue/forms/src/GFObjects/GFButton.py:1.8
*** gnue/forms/src/GFObjects/GFButton.py:1.7    Sat Jun 15 15:51:36 2002
--- gnue/forms/src/GFObjects/GFButton.py        Sat Jun 15 17:15:09 2002
***************
*** 47,50 ****
  
  
  
- 
--- 47,49 ----
Index: gnue/forms/src/uidrivers/wx/UIdriver.py
diff -c gnue/forms/src/uidrivers/wx/UIdriver.py:1.176 
gnue/forms/src/uidrivers/wx/UIdriver.py:1.177
*** gnue/forms/src/uidrivers/wx/UIdriver.py:1.176       Thu Jun  6 14:06:11 2002
--- gnue/forms/src/uidrivers/wx/UIdriver.py     Sat Jun 15 17:15:09 2002
***************
*** 45,51 ****
  from gnue.common import lineWrap
  
  _LOOPTRAP = 0
- _EVENTPROCESSOR = None
  _PROMPTFORRECORD = None
  _charWidth = 0
  _IdToWxObj = {}
--- 45,50 ----
***************
*** 112,119 ****
      self._disableSplash = disableSplash
      GFUserInterfaceBase.__init__(self,eventController)
  
-     global _EVENTPROCESSOR
-     _EVENTPROCESSOR = self.dispatchEvent
      global _PROMPTFORRECORD
      _PROMPTFORRECORD = self.promptForRecordNumber
  
--- 111,116 ----
***************
*** 380,385 ****
--- 377,389 ----
  
      
self.statusBar.SetStatusWidths([tipWidth,statusWidth,insertWidth,recordWidth,pageWidth])
  
+ 
+   # Can be used by UI drivers to add more attributes to the creation event.
+   def _updateCreateEvent(self, event):
+     event.eventHandler = self.dispatchEvent
+     return event
+ 
+ 
    
#############################################################################
    #
    # Incoming Event Processors
***************
*** 681,688 ****
                           
wxSize(object.width*event.widgetWidth,object.height*event.widgetHeight)
                           )
      if event.initialize:
        EVT_BUTTON(newWidget,newWidget.GetId(),self.buttonHandler)
!       #_setDefaultEventHandlers(newWidget,initialize)
  
      return newWidget
  
--- 685,693 ----
                           
wxSize(object.width*event.widgetWidth,object.height*event.widgetHeight)
                           )
      if event.initialize:
+       self._eventHandler = event.eventHandler
        EVT_BUTTON(newWidget,newWidget.GetId(),self.buttonHandler)
!       _setDefaultEventHandlers(newWidget, event.eventHandler, 
event.initialize)
  
      return newWidget
  
***************
*** 694,702 ****
        id = object.GetId()
        gfObject     = _IdToGFObj[id]
        action = GFEvent('fireTRIGGER',gfObject.trigger)
  
-       if action:
-         _EVENTPROCESSOR(action)
  
  #
  # UIPage
--- 699,706 ----
        id = object.GetId()
        gfObject     = _IdToGFObj[id]
        action = GFEvent('fireTRIGGER',gfObject.trigger)
+       self._eventHandler(action)
  
  
  #
  # UIPage
***************
*** 716,722 ****
        newWidget = wxPanel(event.container, 
-1,wxDefaultPosition,event.container.GetSize())
        newWidget.Show(0)
  
!     _setDefaultEventHandlers(newWidget,event.initialize)
  
      event.interface._pageList.append(newWidget)
      return newWidget
--- 720,726 ----
        newWidget = wxPanel(event.container, 
-1,wxDefaultPosition,event.container.GetSize())
        newWidget.Show(0)
  
!     _setDefaultEventHandlers(newWidget, event.eventHandler, event.initialize)
  
      event.interface._pageList.append(newWidget)
      return newWidget
***************
*** 775,781 ****
  
        newWidget = wxTextCtrl(event.container, -1, value, defaultPoint, 
defaultSize, styles)
  
!     _setDefaultEventHandlers(newWidget,event.initialize)
      return newWidget
  
    def comboHandler(self, event):
--- 779,786 ----
  
        newWidget = wxTextCtrl(event.container, -1, value, defaultPoint, 
defaultSize, styles)
  
!     self._eventHandler = event.eventHandler
!     _setDefaultEventHandlers(newWidget, event.eventHandler, event.initialize)
      return newWidget
  
    def comboHandler(self, event):
***************
*** 790,796 ****
        eventdata = [gfObject, event.GetString()]
        action = GFEvent('requestREPLACEVALUE',object=gfObject,
                                index=selection, text=event.GetString())
!     _EVENTPROCESSOR(action)
  
    def checkboxHandler(self,event):
      if event.GetEventType() == wxEVT_COMMAND_CHECKBOX_CLICKED:
--- 795,801 ----
        eventdata = [gfObject, event.GetString()]
        action = GFEvent('requestREPLACEVALUE',object=gfObject,
                                index=selection, text=event.GetString())
!     self._eventHandler(action)
  
    def checkboxHandler(self,event):
      if event.GetEventType() == wxEVT_COMMAND_CHECKBOX_CLICKED:
***************
*** 841,846 ****
--- 846,852 ----
      if event.initialize:
        EVT_CLOSE(event.interface.mainWindow,event.interface.closeTrap)
  
+     self._eventHandler = event.eventHandler
      return newWidget
  
    def notebookTabHandler(self,event):
***************
*** 854,860 ****
        _LOOPTRAP = not _LOOPTRAP # flip the value
  
      if action:
!       _EVENTPROCESSOR(action)
  
  #####################################################################
  ##
--- 860,866 ----
        _LOOPTRAP = not _LOOPTRAP # flip the value
  
      if action:
!       self._eventHandler(action)
  
  #####################################################################
  ##
***************
*** 921,932 ****
  ##
  #####################################################################
  
! def _setDefaultEventHandlers(newWidget, initialize):
!   global _EVENTPROCESSOR
    if initialize:
      # TODO: this should use one instance
!     newWidget.PushEventHandler(mouseEvtHandler(_EVENTPROCESSOR))
!     newWidget.PushEventHandler(keyboardEvtHandler(_EVENTPROCESSOR))
  
  class uiBaseEvtHandler(wxEvtHandler):
    def __init__(self,eventList,eventProcessor):
--- 927,937 ----
  ##
  #####################################################################
  
! def _setDefaultEventHandlers(newWidget, eventHandler, initialize):
    if initialize:
      # TODO: this should use one instance
!     newWidget.PushEventHandler(mouseEvtHandler(eventHandler))
!     newWidget.PushEventHandler(keyboardEvtHandler(eventHandler))
  
  class uiBaseEvtHandler(wxEvtHandler):
    def __init__(self,eventList,eventProcessor):
***************
*** 959,964 ****
--- 964,971 ----
      self._eventProcessor(GFEvent('requestFOCUS',gfObject))
      self._eventProcessor(GFEvent('requestJUMPRECORD',count - 
gfObject._visibleIndex))
      self._eventProcessor(GFEvent('requestCURSORMOVE',position=cursorPosition))
+     if gfObject._type == 'GFButton':
+       self._eventProcessor(GFEvent('fireTRIGGER',gfObject.trigger))
  
      event.Skip()
  
***************
*** 978,985 ****
      action = None
      # hack for swig shortcomming needed by wxPython 2.2.x (2.3 does not need 
this)
      # compute the location of the character in the widget
!     object = _eventObjTowxWindow(event)
! 
  
      keycode = event.KeyCode()
  
--- 985,991 ----
      action = None
      # hack for swig shortcomming needed by wxPython 2.2.x (2.3 does not need 
this)
      # compute the location of the character in the widget
!     object = _IdToGFObj[_eventObjTowxWindow(event).GetId()]
  
      keycode = event.KeyCode()
  
***************
*** 991,997 ****
          not event.ControlDown() and \
          not event.AltDown() and \
          int (gConfig('enterIsNewLine')) and \
!         _IdToGFObj[_eventObjTowxWindow(event).GetId()].height > 1:
  
        command = 'NEWLINE'
  
--- 997,1003 ----
          not event.ControlDown() and \
          not event.AltDown() and \
          int (gConfig('enterIsNewLine')) and \
!         object.height > 1:
  
        command = 'NEWLINE'
  
***************
*** 1018,1023 ****
--- 1024,1032 ----
  
      elif command:
        action = GFEvent('request%s' % command)
+ 
+     elif object._type == 'GFButton':
+       action = GFEvent('fireTRIGGER',object.trigger)
  
      else:
        try:



reply via email to

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