commit-gnue
[Top][All Lists]
Advanced

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

gnue designer/src/LayoutEditor.py designer/src/...


From: Jason Cater
Subject: gnue designer/src/LayoutEditor.py designer/src/...
Date: Mon, 21 Jan 2002 20:41:57 -0500

CVSROOT:        /home/cvs
Module name:    gnue
Changes by:     Jason Cater <address@hidden>    02/01/21 20:41:55

Modified files:
        designer/src   : LayoutEditor.py 
        designer/src/forms: LayoutEditorTools.py 
        forms/src      : GFEvent.py UIcurses.py 

Log message:
        finished the layout editor toolbar support; misc old bugfixes in layout 
editor

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/src/LayoutEditor.py.diff?cvsroot=OldCVS&tr1=1.38&tr2=1.39&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/designer/src/forms/LayoutEditorTools.py.diff?cvsroot=OldCVS&tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/forms/src/GFEvent.py.diff?cvsroot=OldCVS&tr1=1.17&tr2=1.18&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/forms/src/UIcurses.py.diff?cvsroot=OldCVS&tr1=1.11&tr2=1.12&r1=text&r2=text

Patches:
Index: gnue/designer/src/LayoutEditor.py
diff -c gnue/designer/src/LayoutEditor.py:1.38 
gnue/designer/src/LayoutEditor.py:1.39
*** gnue/designer/src/LayoutEditor.py:1.38      Mon Jan 21 18:56:46 2002
--- gnue/designer/src/LayoutEditor.py   Mon Jan 21 20:41:55 2002
***************
*** 57,62 ****
--- 57,64 ----
      EVT_SIZE(self, self.OnSize)
  
      self.page = None
+     self.block = None
+     self.lastBlock = None
      self.panel = None
      self._notebookMap = {}
      self._pageList = []  # Needed by UIwxpython
***************
*** 106,111 ****
--- 108,115 ----
  
      if page != None and page != self.page:
        self.page = page
+       self.block = None
+ 
        self.notebook.SetSelection(self._notebookMap[page])
        try:
          self.workspace = page.__workspace
***************
*** 115,120 ****
--- 119,136 ----
          # our notebook for the first time.
          pass
  
+     block = isinstance(object, GFObjects.GFBlock) and object or \
+             object.findParentOfType('GFBlock')
+ 
+     if block != None:
+       self.block = block
+     elif self.block is None and self.page is not None:
+       # Set block to the initial block
+       for child in self.page._children:
+         if isinstance(child,GFObjects.GFBlock):
+           self.block = child
+           break
+ 
  
    def __setCurrentObject(self,object):
      if hasattr(object, '_widgetHandler'):
***************
*** 153,167 ****
          if page: 
            self._setCurrentPage(page)
          
!       if object in (self.rootObject, self.page) or object in self.widgetList: 
          self.refreshPage(self.page)
  
  
    def onDeleteObject (self, object, handler):
!     if object == None: 
        return
      if handler != __name__:
!       if object._type == 'GFPage': 
          index = self._notebookMap[object]
          for i in range(index+1, len(self._notebookMap.keys())/2):
            self._notebookMap[i-1] = self._notebookMap[i]
--- 169,183 ----
          if page: 
            self._setCurrentPage(page)
          
!       if object in (self.rootObject, self.page) or object in self.widgetList:
          self.refreshPage(self.page)
  
  
    def onDeleteObject (self, object, handler):
!     if object == None:
        return
      if handler != __name__:
!       if object._type == 'GFPage':
          index = self._notebookMap[object]
          for i in range(index+1, len(self._notebookMap.keys())/2):
            self._notebookMap[i-1] = self._notebookMap[i]
***************
*** 230,238 ****
        self.gridWidth = self.widgetWidth
        self.gridHeight = self.widgetHeight
  
!       self.menu_sb_space=2 # the extra spaces needed by the menu, toolbar and 
statusbar    
  
!       self.panel.SetClientSize(wxSize(int(width)*int(self.widgetWidth), 
                         int(height)*int(self.widgetHeight)))
        self.panel.Refresh()
  
--- 246,254 ----
        self.gridWidth = self.widgetWidth
        self.gridHeight = self.widgetHeight
  
!       self.menu_sb_space=2 # the extra spaces needed by the menu, toolbar and 
statusbar
  
!       self.panel.SetClientSize(wxSize(int(width)*int(self.widgetWidth),
                         int(height)*int(self.widgetHeight)))
        self.panel.Refresh()
  
***************
*** 241,247 ****
  
  
      EVT_CHAR(self.panel, self.keyTrap)
! #    EVT_LEFT_UP(self.panel, self.OnLeftUp)
  #    EVT_LEFT_DOWN(self.panel, self.OnLeftDown)
      EVT_RIGHT_UP(self.panel, self.OnRightUp)
  #    EVT_MOTION(self.panel, self.OnMotion)
--- 257,263 ----
  
  
      EVT_CHAR(self.panel, self.keyTrap)
!     EVT_LEFT_UP(self.panel, self.OnLeftUp)
  #    EVT_LEFT_DOWN(self.panel, self.OnLeftDown)
      EVT_RIGHT_UP(self.panel, self.OnRightUp)
  #    EVT_MOTION(self.panel, self.OnMotion)
***************
*** 283,289 ****
      self._instance.onSetCurrentObject(b, None)
  
  
!   def OnLeftDown(self, event):
  
      if self.mode == 'move':
        return
--- 299,305 ----
      self._instance.onSetCurrentObject(b, None)
  
  
!   def OnLeftUp(self, event):
  
      if self.mode == 'move':
        return
***************
*** 297,304 ****
      self.toolbar.resetTool(mode)
      self.mode = 'move'
  
!     if mode in ('scrollbar','box','button'):
!       pass
  
  
  
--- 313,350 ----
      self.toolbar.resetTool(mode)
      self.mode = 'move'
  
!     type = None
!     attributes = {'x':x,'y':y}
!     parent = self.block
! 
!     if mode in ('box','button','label'):
!       parent = self.page
!       type = mode
! 
!     elif modeEntryMap.has_key(mode):
!       type = 'entry'
!       attributes.update(modeEntryMap[mode])
! 
!     elif mode in ('scrollbar',):
!       type = 'scrollbar'
!       attributes['bob'] = self.block.name
! 
! 
!     if type is not None:
!       print "creating %s on %s.%s" % (type, self.page.name, self.block.name)
!       #
!       # Create our new object
!       #
!       Incubator.createObject(
!               self._instance,
!               self._instance.rootObject,
!               type,
!               parent=parent,
!               attributes=attributes)
!       print "done"
! 
! 
! 
  
  
  
***************
*** 346,352 ****
              widget.relativeResize(0,1)
        else: 
          if event.KeyCode() == WXK_LEFT: 
!           for widget in self._currentSelection.keys(): 
              widget.relativeMove(-1,0)
          if event.KeyCode() == WXK_RIGHT:
            for widget in self._currentSelection.keys():
--- 392,398 ----
              widget.relativeResize(0,1)
        else: 
          if event.KeyCode() == WXK_LEFT: 
!           for widget in self._currentSelection.keys():
              widget.relativeMove(-1,0)
          if event.KeyCode() == WXK_RIGHT:
            for widget in self._currentSelection.keys():
***************
*** 399,416 ****
  
      self.widget.Refresh()
  
!   def recalcBoundaries(self): 
      x1,y1,x2,y2 = (9999999,9999999,0,0)
  
      for widget in self.mainWidget.widgets:
        tx, ty = widget.GetPositionTuple()
        tw, th = widget.GetSizeTuple()
        self.instance.positionMappings[widget] = [tx,ty,tx+tw-1,ty+tw-1,self]
!       if tx < x1: 
          x1 = tx
!       if ty < y1: 
          y1 = ty
!       if tw + tx > x2: 
          x2 = tw + tx
        if th + ty > y2: 
          y2 = th + ty
--- 445,462 ----
  
      self.widget.Refresh()
  
!   def recalcBoundaries(self):
      x1,y1,x2,y2 = (9999999,9999999,0,0)
  
      for widget in self.mainWidget.widgets:
        tx, ty = widget.GetPositionTuple()
        tw, th = widget.GetSizeTuple()
        self.instance.positionMappings[widget] = [tx,ty,tx+tw-1,ty+tw-1,self]
!       if tx < x1:
          x1 = tx
!       if ty < y1:
          y1 = ty
!       if tw + tx > x2:
          x2 = tw + tx
        if th + ty > y2: 
          y2 = th + ty
***************
*** 558,581 ****
        self.instance._instance.onModifyObject(self.object, __name__, changes)
        self.recalcBoundaries()
  
!   # 
    # Recursively destroy this widget set
    #
!   def Destroy(self): 
      self.highlightBox.Destroy()
!     for widget in self.mainWidget.widgets: 
        widget.Destroy()
  
  #
  #
  #
! class WidgetHighlighter: 
  
!   def __init__(self, parent): 
      self.selected = 0
      self.parent = parent
      self.x1 = 1
!     self.y1 = 1       
      self.x2 = 2
      self.y2 = 2
      self.west = None
--- 604,627 ----
        self.instance._instance.onModifyObject(self.object, __name__, changes)
        self.recalcBoundaries()
  
!   #
    # Recursively destroy this widget set
    #
!   def Destroy(self):
      self.highlightBox.Destroy()
!     for widget in self.mainWidget.widgets:
        widget.Destroy()
  
  #
  #
  #
! class WidgetHighlighter:
  
!   def __init__(self, parent):
      self.selected = 0
      self.parent = parent
      self.x1 = 1
!     self.y1 = 1
      self.x2 = 2
      self.y2 = 2
      self.west = None
***************
*** 584,643 ****
      self.south = None
      panelColor = parent.GetBackgroundColour()
      self.inactiveBorderColor = wxColour(panelColor.Red()-16,
!                  panelColor.Green()-16,    
                   panelColor.Blue()-16)
      self.activeBorderColor = wxBLUE
  
!   def createHighlights(self): 
!     self.north = wxWindow(self.parent, -1) 
!     self.south = wxWindow(self.parent, -1) 
!     self.east = wxWindow(self.parent, -1) 
!     self.west = wxWindow(self.parent, -1) 
      for object in (self.north,self.south,self.east,self.west):
        EVT_PAINT(object, self.OnPaint)
      self.setBoundary(self.x1, self.y1, self.x2, self.y2)
  
!   def setBoundary(self, x1, y1, x2, y2): 
       self.x1 = x1
       self.y1 = y1
       self.x2 = x2
       self.y2 = y2
  
!      if self.west: 
!        self.west.SetPosition(wxPoint(x1,y1))  
!        self.west.SetSize(wxSize(1,y2-y1+1)) 
!      if self.east: 
         self.east.SetPosition(wxPoint(x2,y1))
         self.east.SetSize(wxSize(1,y2-y1+1))
       if self.south:
!        self.south.SetPosition(wxPoint(x1,y2))  
!        self.south.SetSize(wxSize(x2-x1+1,1)) 
       if self.north:
!        self.north.SetPosition(wxPoint(x1,y1))  
!        self.north.SetSize(wxSize(x2-x1+1,1)) 
  
    def GetChildren(self):
      if self.west:
        return (self.north, self.south, self.east, self.west)
!     else: 
        return ()
  
!   def Refresh(self): 
!     for object in (self.north,self.south,self.east,self.west): 
!       object.Refresh()    
  
-   def Destroy(self): 
-     self.setSelected(0) 
  
!   def setSelected (self, selected): 
!     if selected: 
        self.selected = selected
        self.createHighlights()
        self.Refresh()
!     else: 
!       if self.west: 
          self.west.Destroy()
!       if self.east: 
          self.east.Destroy()
        if self.north:
          self.north.Destroy()
--- 630,693 ----
      self.south = None
      panelColor = parent.GetBackgroundColour()
      self.inactiveBorderColor = wxColour(panelColor.Red()-16,
!                  panelColor.Green()-16,
                   panelColor.Blue()-16)
      self.activeBorderColor = wxBLUE
  
!   def createHighlights(self):
!     self.north = wxWindow(self.parent, -1)
!     self.south = wxWindow(self.parent, -1)
!     self.east = wxWindow(self.parent, -1)
!     self.west = wxWindow(self.parent, -1)
      for object in (self.north,self.south,self.east,self.west):
        EVT_PAINT(object, self.OnPaint)
      self.setBoundary(self.x1, self.y1, self.x2, self.y2)
  
!   def setBoundary(self, x1, y1, x2, y2):
       self.x1 = x1
       self.y1 = y1
       self.x2 = x2
       self.y2 = y2
  
!      if self.west:
!        self.west.SetPosition(wxPoint(x1,y1))
!        self.west.SetSize(wxSize(1,y2-y1+1))
!      if self.east:
         self.east.SetPosition(wxPoint(x2,y1))
         self.east.SetSize(wxSize(1,y2-y1+1))
       if self.south:
!        self.south.SetPosition(wxPoint(x1,y2))
!        self.south.SetSize(wxSize(x2-x1+1,1))
       if self.north:
!        self.north.SetPosition(wxPoint(x1,y1))
!        self.north.SetSize(wxSize(x2-x1+1,1))
  
    def GetChildren(self):
      if self.west:
        return (self.north, self.south, self.east, self.west)
!     else:
        return ()
  
!   def Refresh(self):
!     for object in (self.north,self.south,self.east,self.west):
!       object.Refresh()
! 
!   def Destroy(self):
!     for object in (self.north,self.south,self.east,self.west):
!       if object != None:
!         object.Destroy()
!     self.north = self.south = self.east = self.west = None
  
  
!   def setSelected (self, selected):
!     if selected:
        self.selected = selected
        self.createHighlights()
        self.Refresh()
!     else:
!       if self.west:
          self.west.Destroy()
!       if self.east:
          self.east.Destroy()
        if self.north:
          self.north.Destroy()
***************
*** 652,658 ****
      self.Refresh()
  
    def OnPaint(self, event):
!     object = wxPyTypeCast(event.GetEventObject(),'wxWindow') 
      dc = wxPaintDC(object)
      dc.BeginDrawing()
      dc.SetBackground(wxBrush(self.parent.GetBackgroundColour(),wxTRANSPARENT))
--- 702,708 ----
      self.Refresh()
  
    def OnPaint(self, event):
!     object = wxPyTypeCast(event.GetEventObject(),'wxWindow')
      dc = wxPaintDC(object)
      dc.BeginDrawing()
      dc.SetBackground(wxBrush(self.parent.GetBackgroundColour(),wxTRANSPARENT))
***************
*** 1017,1021 ****
--- 1067,1081 ----
      return d  # what is returned signals the source what to do
                # with the original data (move, copy, etc.)  In this
                # case we just return the suggested value given to us.
+ 
+ 
+ modeEntryMap = {
+      'entrynum':   { 'typecast': 'number'},
+      'entrytext':  { 'typecast': 'text'  },
+      'entrydate':  { 'typecast': 'date'  },
+      'entrydrop':  { 'typecast': 'text',
+                      'style':'dropdown'  },
+      'entrycheck': { 'typecast': 'text',
+                      'style':'checkbox'  } }
  
  
Index: gnue/designer/src/forms/LayoutEditorTools.py
diff -c gnue/designer/src/forms/LayoutEditorTools.py:1.2 
gnue/designer/src/forms/LayoutEditorTools.py:1.3
*** gnue/designer/src/forms/LayoutEditorTools.py:1.2    Mon Jan 21 18:56:46 2002
--- gnue/designer/src/forms/LayoutEditorTools.py        Mon Jan 21 20:41:55 2002
***************
*** 72,86 ****
  
    def OnButtonSelected(self, event):
      handle, descr = self.mapping[event.GetId()]
-     self.resetTool(self.editor.mode)
-     self.editor.mode = handle
-     self.editor.frame.SetStatusText('Click on the gridded Layout '
-            'Editor to create a new %s.' % descr)
- 
- 
- 
- 
  
  
  
  
--- 72,85 ----
  
    def OnButtonSelected(self, event):
      handle, descr = self.mapping[event.GetId()]
  
+     if self.editor.mode == handle:
+       self.editor.mode = 'move'
+     else:
+       self.resetTool(self.editor.mode)
+       self.editor.mode = handle
  
+     self.editor.frame.SetStatusText('Click on the gridded Layout '
+            'Editor to create a new %s.' % descr)
  
  
Index: gnue/forms/src/GFEvent.py
diff -c gnue/forms/src/GFEvent.py:1.17 gnue/forms/src/GFEvent.py:1.18
*** gnue/forms/src/GFEvent.py:1.17      Mon Oct  8 08:38:13 2001
--- gnue/forms/src/GFEvent.py   Mon Jan 21 20:41:55 2002
***************
*** 6,19 ****
  # License as published by the Free Software Foundation; either 
  # version 2, or (at your option) any later version.
  #
! # GNU Enterprise is distributed in the hope that it will be 
! # useful, but WITHOUT ANY WARRANTY; without even the implied 
! # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
  # PURPOSE. See the GNU General Public License for more details.
  #
! # You should have received a copy of the GNU General Public 
! # License along with program; see the file COPYING. If not, 
! # write to the Free Software Foundation, Inc., 59 Temple Place 
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
  # Copyright 2000, 2001 Free Software Foundation
--- 6,19 ----
  # License as published by the Free Software Foundation; either 
  # version 2, or (at your option) any later version.
  #
! # GNU Enterprise is distributed in the hope that it will be
! # useful, but WITHOUT ANY WARRANTY; without even the implied
! # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  # PURPOSE. See the GNU General Public License for more details.
  #
! # You should have received a copy of the GNU General Public
! # License along with program; see the file COPYING. If not,
! # write to the Free Software Foundation, Inc., 59 Temple Place
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
  # Copyright 2000, 2001 Free Software Foundation
***************
*** 25,45 ****
  # Basic event passed between the GFForm, GFView, and GFController objects
  #
  # NOTES:
! #  
  
  from gnue.common import GDebug
  
  #
  # Basic event passed between items
  #
  class GFEvent:
!   def __init__(self, event, data = None):
      self.event = event
      self.data  = data
      
    def getEvent(self):
      return self.event
  
  #
  # Base for and object that sends and receives events
  #
--- 25,54 ----
  # Basic event passed between the GFForm, GFView, and GFController objects
  #
  # NOTES:
! #
  
  from gnue.common import GDebug
  
  #
  # Basic event passed between items
  #
+ # If event = GFEvent('MYEVENT',x=1, y=2, object=MyObject), then
+ #   event.event == 'MYEVENT', event.x = 1,
+ #   event.y == 2, and event.object == MyObject
  class GFEvent:
!   def __init__(self, event, data=None, **parms):
! 
!     self.__dict__.update(parms)
      self.event = event
+ 
+     # TODO: Get rid of data=
      self.data  = data
+ 
      
    def getEvent(self):
      return self.event
  
+ 
  #
  # Base for and object that sends and receives events
  #
***************
*** 51,57 ****
    #
    # registerEventListener
    #
!   # method to allow systems to register listener 
    # methods that should be passed events
    #
    def registerEventListener(self, listener):
--- 60,66 ----
    #
    # registerEventListener
    #
!   # method to allow systems to register listener
    # methods that should be passed events
    #
    def registerEventListener(self, listener):
***************
*** 65,71 ****
    def dispatchEvent(self, event):
      for function in self.eventListener:
        function(event)
!               
    #
    # processEvent
    #
--- 74,80 ----
    def dispatchEvent(self, event):
      for function in self.eventListener:
        function(event)
! 
    #
    # processEvent
    #
Index: gnue/forms/src/UIcurses.py
diff -c gnue/forms/src/UIcurses.py:1.11 gnue/forms/src/UIcurses.py:1.12
*** gnue/forms/src/UIcurses.py:1.11     Thu Oct 11 00:36:08 2001
--- gnue/forms/src/UIcurses.py  Mon Jan 21 20:41:55 2002
***************
*** 1,19 ****
  #
  # This file is part of GNU Enterprise.
  #
! # GNU Enterprise is free software; you can redistribute it 
! # and/or modify it under the terms of the GNU General Public 
! # License as published by the Free Software Foundation; either 
  # version 2, or (at your option) any later version.
  #
! # GNU Enterprise is distributed in the hope that it will be 
  # useful, but WITHOUT ANY WARRANTY; without even the implied
! # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
  # PURPOSE. See the GNU General Public License for more details.
  #
! # You should have received a copy of the GNU General Public 
! # License along with program; see the file COPYING. If not, 
! # write to the Free Software Foundation, Inc., 59 Temple Place 
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
  # Copyright 2000 Free Software Foundation
--- 1,19 ----
  #
  # This file is part of GNU Enterprise.
  #
! # GNU Enterprise is free software; you can redistribute it
! # and/or modify it under the terms of the GNU General Public
! # License as published by the Free Software Foundation; either
  # version 2, or (at your option) any later version.
  #
! # GNU Enterprise is distributed in the hope that it will be
  # useful, but WITHOUT ANY WARRANTY; without even the implied
! # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  # PURPOSE. See the GNU General Public License for more details.
  #
! # You should have received a copy of the GNU General Public
! # License along with program; see the file COPYING. If not,
! # write to the Free Software Foundation, Inc., 59 Temple Place
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
  # Copyright 2000 Free Software Foundation
***************
*** 25,35 ****
  # A pyncurses based user interface for GNUE forms.
  #
  # NOTES:
! #  
  from GFForm import *
  from UIbase import *
  from gnue.common import GDebug
  import sys
  
  import curses
  import string
--- 25,36 ----
  # A pyncurses based user interface for GNUE forms.
  #
  # NOTES:
! #
  from GFForm import *
  from UIbase import *
  from gnue.common import GDebug
  import sys
+ import atexit
  
  import curses
  import string
***************
*** 50,64 ****
      self.fields=[]
      self.ncfield = None
      self.exiteventloop=FALSE
      #
      # Ensure program exits cleanly(only supported in Python2.0 and above)
      #
!     if int(sys.version[0])>=2:
!       import atexit
!       def cleanup(self=self):
!         if not curses.isendwin():
!           curses.endwin()
!       atexit.register(cleanup)
  
      GFUserInterfaceBase.__init__(self)
      self.incommingEvent.update({'msgBoxUI' : self.msgBox,
--- 51,64 ----
      self.fields=[]
      self.ncfield = None
      self.exiteventloop=FALSE
+ 
      #
      # Ensure program exits cleanly(only supported in Python2.0 and above)
      #
!     def cleanup(self=self):
!       if not curses.isendwin():
!         curses.endwin()
!     atexit.register(cleanup)
  
      GFUserInterfaceBase.__init__(self)
      self.incommingEvent.update({'msgBoxUI' : self.msgBox,
***************
*** 69,75 ****
      self.widgetConstructorFunction['GFBox'] = self.boxHandler
      self.widgetConstructorFunction['GFForm'] = self._formHandler
      self.widgetConstructorFunction['GFPage'] = self.pageHandler
!     
      self.keyEvents = {curses.KEY_PPAGE:       GFEvent('requestPREVBLOCK'),
                        curses.KEY_NPAGE:       GFEvent('requestNEXTBLOCK'),
                        curses.KEY_ENTER:       GFEvent('requestEXIT'),
--- 69,75 ----
      self.widgetConstructorFunction['GFBox'] = self.boxHandler
      self.widgetConstructorFunction['GFForm'] = self._formHandler
      self.widgetConstructorFunction['GFPage'] = self.pageHandler
! 
      self.keyEvents = {curses.KEY_PPAGE:       GFEvent('requestPREVBLOCK'),
                        curses.KEY_NPAGE:       GFEvent('requestNEXTBLOCK'),
                        curses.KEY_ENTER:       GFEvent('requestEXIT'),
***************
*** 89,97 ****
                        curses.KEY_F12:         GFEvent('requestNEWRECORD') ,
                        # Hacks for odd mismatch of keycodes returns vs 
curses.KEY_*
                        9             :         GFEvent('requestNEXTENTRY'),
!                       127           :         GFEvent('requestBACKSPACE'),    
       
                        }
!     
      self.incommingEvent.update( {'gotoENTRY'  : self.switchFocus,
                                   'updateENTRY': self.updateEntry,
                                 'gotoPAGE': self.gotoPage,
--- 89,97 ----
                        curses.KEY_F12:         GFEvent('requestNEWRECORD') ,
                        # Hacks for odd mismatch of keycodes returns vs 
curses.KEY_*
                        9             :         GFEvent('requestNEXTENTRY'),
!                       127           :         GFEvent('requestBACKSPACE'),
                        }
! 
      self.incommingEvent.update( {'gotoENTRY'  : self.switchFocus,
                                   'updateENTRY': self.updateEntry,
                                 'gotoPAGE': self.gotoPage,
***************
*** 102,108 ****
                                   })
  
      self.containerWidgets= ['GFPage', 'GFForm']
!     
      self.newPage = 1
      self._currentPage = -1
      self.buildUI()
--- 102,108 ----
                                   })
  
      self.containerWidgets= ['GFPage', 'GFForm']
! 
      self.newPage = 1
      self._currentPage = -1
      self.buildUI()
***************
*** 181,187 ****
        
        if not hasattr(object,'_rows'):
          object._rows = 1
!       
        count = int(object._rows)
  
        if hasattr(object,'style'):
--- 181,187 ----
        
        if not hasattr(object,'_rows'):
          object._rows = 1
! 
        count = int(object._rows)
  
        if hasattr(object,'style'):
***************
*** 357,363 ****
            if style == 'dropdown':
              value = event.data.allowedValues()[value]
          self._formToUI[event.data][0][count].setText(value)
!       count = count +1   
      #self.frame.refresh()
      curses.doupdate()
  
--- 357,363 ----
            if style == 'dropdown':
              value = event.data.allowedValues()[value]
          self._formToUI[event.data][0][count].setText(value)
!       count = count +1
      #self.frame.refresh()
      curses.doupdate()
  
***************
*** 643,655 ****
  ##class UIMessageBox(wxMessageDialog, UIHelper):
  ##  def __init__(self, interface, message, caption):
  ##    wxMessageDialog.__init__(self, interface, message, caption, 
style=wxOK|wxICON_EXCLAMATION)
!     
!                                                                               
                                      
  #############################################################################
  #
  #  NC Widgets
  #
! #  Custom widgets to implement featuers in curses.  
  #
  
  #
--- 643,655 ----
  ##class UIMessageBox(wxMessageDialog, UIHelper):
  ##  def __init__(self, interface, message, caption):
  ##    wxMessageDialog.__init__(self, interface, message, caption, 
style=wxOK|wxICON_EXCLAMATION)
! 
! 
  #############################################################################
  #
  #  NC Widgets
  #
! #  Custom widgets to implement featuers in curses.
  #
  
  #
***************
*** 713,719 ****
              smaxy, smaxc = book.window.getmaxyx()
              pminrow, pmincol = ( 0, 0)
              page.window.nooutrefresh()
!             
  ##    if (self._parent == None):
  ##      widget = self
  ##      while (widget.focus != None):
--- 713,719 ----
              smaxy, smaxc = book.window.getmaxyx()
              pminrow, pmincol = ( 0, 0)
              page.window.nooutrefresh()
! 
  ##    if (self._parent == None):
  ##      widget = self
  ##      while (widget.focus != None):
***************
*** 887,907 ****
      bottommsg1=("F5  Delete Record   F6  Commit Record      ")
      bottommsg2=("F8  Enter Query     F9  Run Query          |")
      bottommsg3=("F12 New Record      F11 Rollback           ")
!     
      statusmsg="Welcome to GNUe Forms!  Would someone please tell us we can 
stop coding?"
  
      self.main = NCForm(self, lines - 5, cols, 1, 0)
!     
      # A top window for title etc.
      self.top = NCForm(self, 1, cols, 0, 0)
!     self.topmsg = NCLabel( self.top, 0, 2, topmsg, attr=curses.A_REVERSE ) 
  
      # ncurses statusbar
      self.bottom = NCForm( self, 3, cols, lines-4, 0)
      self.bottommsg1 = NCLabel(self.bottom, 0, 2, bottommsg1, 
attr=curses.A_NORMAL)
      self.bottommsg2 = NCLabel(self.bottom, 1, 2, bottommsg2, 
attr=curses.A_NORMAL)
      self.bottommsg3 = NCLabel(self.bottom, 2, 2, bottommsg3, 
attr=curses.A_NORMAL)
!     
      # GNUef statusbar
      self.status = NCForm( self, 1, cols, lines-1, 0)
      self.statusmesg = NCLabel(self.status, 0, 2, 
string.ljust(statusmsg,cols-4), attr=curses.A_REVERSE)
--- 887,907 ----
      bottommsg1=("F5  Delete Record   F6  Commit Record      ")
      bottommsg2=("F8  Enter Query     F9  Run Query          |")
      bottommsg3=("F12 New Record      F11 Rollback           ")
! 
      statusmsg="Welcome to GNUe Forms!  Would someone please tell us we can 
stop coding?"
  
      self.main = NCForm(self, lines - 5, cols, 1, 0)
! 
      # A top window for title etc.
      self.top = NCForm(self, 1, cols, 0, 0)
!     self.topmsg = NCLabel( self.top, 0, 2, topmsg, attr=curses.A_REVERSE )
  
      # ncurses statusbar
      self.bottom = NCForm( self, 3, cols, lines-4, 0)
      self.bottommsg1 = NCLabel(self.bottom, 0, 2, bottommsg1, 
attr=curses.A_NORMAL)
      self.bottommsg2 = NCLabel(self.bottom, 1, 2, bottommsg2, 
attr=curses.A_NORMAL)
      self.bottommsg3 = NCLabel(self.bottom, 2, 2, bottommsg3, 
attr=curses.A_NORMAL)
! 
      # GNUef statusbar
      self.status = NCForm( self, 1, cols, lines-1, 0)
      self.statusmesg = NCLabel(self.status, 0, 2, 
string.ljust(statusmsg,cols-4), attr=curses.A_REVERSE)
***************
*** 920,926 ****
  
    def addBox( self, height, width, x, y ):
      self.boxes.append( (height, width, x, y) )
!     
    def draw(self):
      # Update tips
      focus = self.main.focus
--- 920,926 ----
  
    def addBox( self, height, width, x, y ):
      self.boxes.append( (height, width, x, y) )
! 
    def draw(self):
      # Update tips
      focus = self.main.focus
***************
*** 928,933 ****
--- 928,956 ----
        pass
      elif 0: #(focus, NCChoice):
        pass
+ 
+ #
+ # Translate from wx keystrokes
+ # to our virtual keystrokes
+ #
+ from GFKeyMapper import vk
+ 
+ cursesKeyTranslations = {
+    curses.KEY_F1        : vk.F1,        curses.KEY_F2      : vk.F2,
+    curses.KEY_F3        : vk.F3,        curses.KEY_F4      : vk.F4,
+    curses.KEY_F5        : vk.F5,        curses.KEY_F6      : vk.F6,
+    curses.KEY_F7        : vk.F7,        curses.KEY_F8      : vk.F8,
+    curses.KEY_F9        : vk.F9,        curses.KEY_F10     : vk.F10,
+    curses.KEY_F11       : vk.F11,       curses.KEY_F12     : vk.F12,
+    curses.KEY_INSERT    : vk.INSERT,    curses.KEY_DC      : vk.DELETE,
+    curses.KEY_HOME      : vk.HOME,      curses.KEY_END     : vk.END,
+    curses.KEY_NPAGE     : vk.PAGEUP,    curses.KEY_NPAGE   : vk.PAGEDOWN,
+    curses.KEY_UP        : vk.UP,        curses.KEY_DOWN    : vk.DOWN,
+    curses.KEY_LEFT      : vk.LEFT,      curses.KEY_RIGHT   : vk.RIGHT,
+    curses.KEY_TAB       : vk.TAB,       curses.KEY_ENTER   : vk.ENTER,
+    curses.KEY_BACKSPACE : vk.BACKSPACE }
+ 
+ GFKeyMapper.KeyMapper.setUIKeyMap(wxKeyTranslations)
  
  
  WIDGETS = {'GFLabel'     : UILabel,



reply via email to

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