commit-gnue
[Top][All Lists]
Advanced

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

[gnue] r7863 - in trunk/gnue-forms/src: . input input/displayHandlers ui


From: jamest
Subject: [gnue] r7863 - in trunk/gnue-forms/src: . input input/displayHandlers uidrivers/_base uidrivers/_base/widgets uidrivers/curses uidrivers/curses/widgets uidrivers/gtk2 uidrivers/qt uidrivers/win32/widgets uidrivers/wx
Date: Sat, 13 Aug 2005 19:51:50 -0500 (CDT)

Author: jamest
Date: 2005-08-13 19:51:48 -0500 (Sat, 13 Aug 2005)
New Revision: 7863

Added:
   trunk/gnue-forms/src/input/GFKeyMapper.py
Removed:
   trunk/gnue-forms/src/GFKeyMapper.py
Modified:
   trunk/gnue-forms/src/GFInstance.py
   trunk/gnue-forms/src/input/displayHandlers/Checkbox.py
   trunk/gnue-forms/src/input/displayHandlers/Cursor.py
   trunk/gnue-forms/src/input/displayHandlers/DateTime.py
   trunk/gnue-forms/src/input/displayHandlers/Dropdown.py
   trunk/gnue-forms/src/input/displayHandlers/Listbox.py
   trunk/gnue-forms/src/uidrivers/_base/UserActions.py
   trunk/gnue-forms/src/uidrivers/_base/widgets/_base.py
   trunk/gnue-forms/src/uidrivers/curses/UIdriver.py
   trunk/gnue-forms/src/uidrivers/curses/widgets/form.py
   trunk/gnue-forms/src/uidrivers/gtk2/common.py
   trunk/gnue-forms/src/uidrivers/qt/common.py
   trunk/gnue-forms/src/uidrivers/win32/widgets/_base.py
   trunk/gnue-forms/src/uidrivers/wx/common.py
Log:
move GFKeyMapper to gnue.forms.input
docstrings and cleanup


Modified: trunk/gnue-forms/src/GFInstance.py
===================================================================
--- trunk/gnue-forms/src/GFInstance.py  2005-08-13 20:40:30 UTC (rev 7862)
+++ trunk/gnue-forms/src/GFInstance.py  2005-08-14 00:51:48 UTC (rev 7863)
@@ -39,7 +39,7 @@
 from gnue.forms.GFForm import *
 from gnue.forms.GFParser import loadFile
 from gnue.forms import VERSION
-from gnue.forms import GFKeyMapper
+from gnue.forms.input import GFKeyMapper
 from gnue.common.apps import i18n, errors
 from gnue.common.datasources import Exceptions, GConnections
 from gnue.common.datasources.GDataSource import getAppserverResource

Deleted: trunk/gnue-forms/src/GFKeyMapper.py
===================================================================
--- trunk/gnue-forms/src/GFKeyMapper.py 2005-08-13 20:40:30 UTC (rev 7862)
+++ trunk/gnue-forms/src/GFKeyMapper.py 2005-08-14 00:51:48 UTC (rev 7863)
@@ -1,359 +0,0 @@
-#
-# 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 2002-2005 Free Software Foundation
-#
-# FILE:
-# GFKeyMapper.py
-#
-# DESCRIPTION:
-"""
-Handles physical to logical key mapping for GNUe Forms.
-Also performs logical key to Events mapping.
-"""
-#
-# NOTES:
-#
-
-
-import string, sys
-from gnue.common.apps import errors
-
-
-class InvalidKeystrokeName (errors.SystemError):
-  pass
-
-
-##
-##
-##
-class BaseKeyMapper:
-  """
-  A basic key mapper. This will normally
-  serve most UI's input needs.
-  """
-
-  def __init__(self, userKeyMap):
-    self.__functionMap = userKeyMap
-    self.__keyTranslations = {}
-
-  #
-  # This should be called by the UI class to set their
-  # key mappings (i.e., we need to know what wxPython
-  # thinks F1 is, etc)
-  #
-  def setUIKeyMap(self, keyset):
-    self.__keyTranslations = keyset
-    self._translateUserKeyMap()
-
-  #
-  # Install a key/event mapping.
-  # This can be called by the app,
-  # but more than likely, the app
-  # will call loadUserKeyMap which
-  # calls this.
-  #
-  def setUserKeyMap(self, keymap):
-    self.__functionMap.update (keymap)
-    self._translateUserKeyMap()
-
-
-  #
-  # Given a hash of the form:
-  # { 'PREVBLOCK': 'Ctrl-F1' }
-  # decode the key events and save into our usermap
-  #
-  def loadUserKeyMap(self, dict):
-    usermap = {}
-
-    for event in dict.keys ():
-      val = dict [event]
-
-      # Save any actual '+' keystrokes
-      if val[:1] == '-':
-        val = 'NEG' + val[1:]
-      if val[-1:] == '-':
-        val = val[:-2] + 'NEG'
-      val = string.replace(string.replace(val,' ',''),'--','-NEG')
-
-      keys = val.split ('-')
-
-      base    = None
-      shifted = False
-      meta    = False
-      ctrl    = False
-
-      for key in keys:
-        current = key.upper ()
-
-        if current in ('CTRL','CONTROL'):
-          ctrl = True
-        elif current in ('META','ALT'):
-          meta = True
-        elif current in ('SHFT','SHIFT'):
-          shifted = True
-        elif vk.__dict__.has_key (current):
-          base = vk.__dict__ [current]
-
-        elif len(current) == 1:
-          # We have to use the given key, so Ctrl-r is different than Ctrl-R
-          base = ord (key)
-        else:
-          raise InvalidKeystrokeName, \
-            u_("Invalid keystroke id '%(key)s' in keymap for '%(event)s'") \
-            % {'key': key, 'event': event}
-
-      if base is None:
-        raise InvalidKeystrokeName, \
-          u_("Invalid keystroke combination '%(comb)s' in keymap "
-             "for '%(event)s'") \
-          % {'comb' : dict [event],
-             'event': event}
-
-      usermap [(base, shifted, ctrl, meta)] = event.upper ()
-
-
-    # Now, load any default keys they forgot to bind
-    for key in DefaultMapping.keys():
-      if  DefaultMapping[key] not in usermap.values() and \
-          not usermap.has_key(key):
-        usermap[key] = DefaultMapping[key]
-
-    # Just in case...
-    usermap.update( {
-          (vk.TAB,      False, False, False) : 'NEXTENTRY',
-          (vk.ENTER,    False, False, False) : 'ENTER',
-          (vk.RETURN,   False, False, False) : 'ENTER'} )
-
-    self.setUserKeyMap(usermap)
-
-
-  #
-  # Return the (virtual) keystroke assigned to
-  # a given event. (e.g., if event = 'PREVBLOCK'
-  # then return vk.PAGEUP)
-  #
-  def getEventKeystroke(self, event):
-    for key in self.__functionMap.keys():
-      if self.__functionMap[key] == event:
-        return key
-    return None
-
-
-  # ---------------------------------------------------------------------------
-  # Return a keystroke assigned to a given event using the UI keymap
-  # ---------------------------------------------------------------------------
-
-  def getUIEventKeyStroke (self, event):
-    for (key, value) in self._translatedUserKeyMap.items ():
-      if value == event and key [0] >= 0:
-        return key
-    return None
-
-
-  #
-  # Same as getEventKeystroke except that
-  # a text representation is return ('F1')
-  # instead of the numerical code. Useful
-  # for building "Menus" or "Help Screens"
-  #
-  def getEventKeystrokeRepr(self, event, metamappings={}, separator="+"):
-     keystroke = self.getEventKeystroke(event)
-
-     if keystroke is None:
-       return None
-
-     base, shifted, ctrl, meta = keystroke
-     rv = ""
-     if ctrl:
-       rv += metamappings.get("CONTROL","Ctrl") + separator
-     if meta:
-       rv += metamappings.get("META","Alt") + separator
-     if shifted:
-       rv += metamappings.get("SHIFT","Shift") + separator
-
-     v = reverseLookup(base)
-
-     return "%s%s" % (rv, metamappings.get(v,v))
-
-
-
-  #
-  # Translate a keystroke into an event.
-  # (keystroke is the UI-specific keystroke,
-  # not our virtual keys.)  Returns None if
-  # the keystroke isn't tied to an event.
-  #
-  # This needs to stay as simple as possible
-  # as it gets called for each keystroke
-  #
-  def getEvent(self, basekey, shift=False, ctrl=False, meta=False):
-    try:
-      if ctrl and basekey == ord ('e'):
-        raise errors.SystemError, ('Foobar And The Gang')
-      return self._translatedUserKeyMap[(basekey, shift, ctrl, meta)]
-    except KeyError:
-      return None
-
-  #
-  # Used internally to create a quick lookup
-  # hash for time-sensitive methods.
-  #
-  def _translateUserKeyMap(self):
-    self._translatedUserKeyMap = {}
-    for keys in self.__functionMap.keys():
-      base, sh, ctrl, meta = keys
-      if self.__keyTranslations.has_key(base):
-        base = self.__keyTranslations[base]
-      self._translatedUserKeyMap[(base,sh,ctrl,meta)] = 
self.__functionMap[keys]
-
-
-#####################################################################
-#
-#
-class _VirtualKeys:
-  """
-  Create a container class for the
-  Virtual Key definitions... this
-  is to keep our namespace clean.
-  """
-
-  def __init__(self):
-    self.F1 = -999
-    self.F2 = -998
-    self.F3 = -997
-    self.F4 = -996
-    self.F5 = -995
-    self.F6 = -994
-    self.F7 = -993
-    self.F8 = -992
-    self.F9 = -991
-    self.F10 = -990
-    self.F11 = -989
-    self.F12 = -988
-    self.INSERT = -987
-    self.DELETE = -986
-    self.HOME = -985
-    self.END = -984
-    self.PAGEUP = -983
-    self.PAGEDOWN = -982
-    self.UP = -981
-    self.DOWN = -980
-    self.LEFT = -979
-    self.RIGHT = -978
-    self.TAB = -977
-    self.ENTER = -976
-    self.RETURN = -975
-    self.BACKSPACE = -974
-    self.X = -973
-    self.V = -972
-    self.C = -971
-    self.A = -970
-
-
-#
-# ..and the application will only
-#   need one instance, so create one.
-#
-vk = _VirtualKeys()
-
-
-#
-# Given a keycode value (e.g., -999), return
-# the text representation as a string (e.g., 'F1')
-#
-def reverseLookup(keyvalue):
-  """
-  Given a keycode value (e.g., -999), return
-  the text representation as a string (e.g., 'F1')
-  """
-
-  # This is done for efficiency of real-time lookups;
-  # i.e., we don't often do reverseLookups, but a
-  # regular lookup must happen as efficiently as
-  # possible as a lookup happens each time a key is
-  # pressed!
-
-  for key in dir(vk):
-    if getattr(vk,key) == keyvalue:
-      return key
-  if keyvalue >= 0 and keyvalue <= 255:
-    return string.upper (chr (keyvalue))
-  return None
-
-
-#####################################################################
-#
-# Default event mappings
-#
-DefaultMapping = {
-
-      # (Key, Shifted, Ctrl'd, Meta/Alt'd)
-      (vk.A,        False, True,  False) : 'SELECTALL',
-      (vk.C,        False, True,  False) : 'COPY',
-      (vk.V,        False, True,  False) : 'PASTE',
-      (vk.X,        False, True,  False) : 'CUT',
-      (ord ('a'),   False, True,  False) : 'SELECTALL',
-      (ord ('c'),   False, True,  False) : 'COPY',
-      (ord ('q'),   False, True,  False) : 'EXIT',
-      (ord ('v'),   False, True,  False) : 'PASTE',
-      (ord ('x'),   False, True,  False) : 'CUT',
-      (vk.PAGEUP,   True,  False, False) : 'JUMPROWSUP',
-      (vk.PAGEDOWN, True,  False, False) : 'JUMPROWSDOWN',
-      (vk.PAGEUP,   False, True,  False) : 'PREVPAGE',
-      (vk.PAGEDOWN, False, True,  False) : 'NEXTPAGE',
-      (vk.PAGEUP,   False, False, False) : 'PREVBLOCK',
-      (vk.PAGEDOWN, False, False, False) : 'NEXTBLOCK',
-      (vk.TAB,      False, False, False) : 'NEXTENTRY',
-      (vk.ENTER,    False, False, False) : 'ENTER',
-      (vk.RETURN,   False, False, False) : 'ENTER',
-      (vk.TAB,      True,  False, False) : 'PREVENTRY',
-      (vk.LEFT,     False, False, False) : 'CURSORLEFT',
-      (vk.RIGHT,    False, False, False) : 'CURSORRIGHT',
-      (vk.END,      False, False, False) : 'CURSOREND',
-      (vk.HOME,     False, False, False) : 'CURSORHOME',
-      (vk.LEFT,     True,  False, False) : 'SELECTLEFT',
-      (vk.RIGHT,    True,  False, False) : 'SELECTRIGHT',
-      (vk.END,      True,  False, False) : 'SELECTTOEND',
-      (vk.HOME,     True,  False, False) : 'SELECTTOHOME',
-      (vk.BACKSPACE,False, False, False) : 'BACKSPACE',
-      (vk.INSERT,   False, False, False) : 'MODETOGGLE',
-      (vk.DELETE,   False, False, False) : 'DELETE',
-      (vk.UP,       False, False, False) : 'PREVRECORD',
-      (vk.DOWN,     False, False, False) : 'NEXTRECORD',
-      (vk.UP,       False, True,  False) : 'FIRSTRECORD',
-      (vk.DOWN,     False, True,  False) : 'LASTRECORD',
-      (vk.F2,       False, False, False) : 'ENTEREDIT',
-      (vk.F3,       False, False, False) : 'JUMPPROMPT',
-      (vk.F5,       False, False, False) : 'MARKFORDELETE',
-      (vk.F6,       False, False, False) : 'COMMIT',
-      (vk.F8,       False, False, False) : 'ENTERQUERY',
-      (vk.F8,       True,  False, False) : 'COPYQUERY',
-      (vk.F9,       False, False, False) : 'EXECQUERY',
-      (vk.F9,       True,  False, False) : 'CANCELQUERY',
-      (vk.F11,      False, False, False) : 'ROLLBACK',
-      (vk.F12,      False, False, False) : 'NEWRECORD',
-      (vk.ENTER,    True,  False, False) : 'NEWLINE',
-   }
-
-
-#
-# The application will only
-# need one instance, so create one.
-#
-KeyMapper = BaseKeyMapper(DefaultMapping)

Copied: trunk/gnue-forms/src/input/GFKeyMapper.py (from rev 7862, 
trunk/gnue-forms/src/GFKeyMapper.py)
===================================================================
--- trunk/gnue-forms/src/GFKeyMapper.py 2005-08-13 20:40:30 UTC (rev 7862)
+++ trunk/gnue-forms/src/input/GFKeyMapper.py   2005-08-14 00:51:48 UTC (rev 
7863)
@@ -0,0 +1,364 @@
+#
+# 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 2002-2005 Free Software Foundation
+#
+# FILE:
+# GFKeyMapper.py
+#
+# DESCRIPTION:
+"""
+Handles physical to logical key mapping for GNUe Forms.
+Also performs logical key to Events mapping.
+"""
+#
+# NOTES:
+#
+
+from gnue.common.apps import errors
+
+
+class InvalidKeystrokeName (errors.SystemError):
+  """
+  This class is used for exceptions indicating that a 
+  keystroke that was received was not valid.
+  """
+  pass
+
+
+##
+##
+##
+class BaseKeyMapper:
+  """
+  A basic key mapper. This will normally
+  serve most UI's input needs.
+  """
+
+  def __init__(self, userKeyMap):
+    """
+    Constructor
+    """
+    self.__functionMap = userKeyMap
+    self.__keyTranslations = {}
+
+  #
+  # This should be called by the UI class to set their
+  # key mappings (i.e., we need to know what wxPython
+  # thinks F1 is, etc)
+  #
+  def setUIKeyMap(self, keyset):
+    self.__keyTranslations = keyset
+    self._translateUserKeyMap()
+
+  #
+  # Install a key/event mapping.
+  # This can be called by the app,
+  # but more than likely, the app
+  # will call loadUserKeyMap which
+  # calls this.
+  #
+  def setUserKeyMap(self, keymap):
+    self.__functionMap.update (keymap)
+    self._translateUserKeyMap()
+
+
+  #
+  # Given a hash of the form:
+  # { 'PREVBLOCK': 'Ctrl-F1' }
+  # decode the key events and save into our usermap
+  #
+  def loadUserKeyMap(self, dict):
+    usermap = {}
+
+    for event in dict.keys ():
+      val = dict [event]
+
+      # Save any actual '+' keystrokes
+      if val[:1] == '-':
+        val = 'NEG' + val[1:]
+      if val[-1:] == '-':
+        val = val[:-2] + 'NEG'
+      val = val.replace(' ','').replace('--','-NEG')
+
+      keys = val.split ('-')
+
+      base    = None
+      shifted = False
+      meta    = False
+      ctrl    = False
+
+      for key in keys:
+        current = key.upper ()
+
+        if current in ('CTRL','CONTROL'):
+          ctrl = True
+        elif current in ('META','ALT'):
+          meta = True
+        elif current in ('SHFT','SHIFT'):
+          shifted = True
+        elif vk.__dict__.has_key (current):
+          base = vk.__dict__ [current]
+
+        elif len(current) == 1:
+          # We have to use the given key, so Ctrl-r is different than Ctrl-R
+          base = ord (key)
+        else:
+          raise InvalidKeystrokeName, \
+            u_("Invalid keystroke id '%(key)s' in keymap for '%(event)s'") \
+            % {'key': key, 'event': event}
+
+      if base is None:
+        raise InvalidKeystrokeName, \
+          u_("Invalid keystroke combination '%(comb)s' in keymap "
+             "for '%(event)s'") \
+          % {'comb' : dict [event],
+             'event': event}
+
+      usermap [(base, shifted, ctrl, meta)] = event.upper ()
+
+
+    # Now, load any default keys they forgot to bind
+    for key in DefaultMapping.keys():
+      if  DefaultMapping[key] not in usermap.values() and \
+          not usermap.has_key(key):
+        usermap[key] = DefaultMapping[key]
+
+    # Just in case...
+    usermap.update( {
+          (vk.TAB,      False, False, False) : 'NEXTENTRY',
+          (vk.ENTER,    False, False, False) : 'ENTER',
+          (vk.RETURN,   False, False, False) : 'ENTER'} )
+
+    self.setUserKeyMap(usermap)
+
+
+  #
+  # Return the (virtual) keystroke assigned to
+  # a given event. (e.g., if event = 'PREVBLOCK'
+  # then return vk.PAGEUP)
+  #
+  def getEventKeystroke(self, event):
+    for key in self.__functionMap.keys():
+      if self.__functionMap[key] == event:
+        return key
+    return None
+
+
+  # ---------------------------------------------------------------------------
+  # Return a keystroke assigned to a given event using the UI keymap
+  # ---------------------------------------------------------------------------
+
+  def getUIEventKeyStroke (self, event):
+    for (key, value) in self._translatedUserKeyMap.items ():
+      if value == event and key [0] >= 0:
+        return key
+    return None
+
+
+  #
+  # Same as getEventKeystroke except that
+  # a text representation is return ('F1')
+  # instead of the numerical code. Useful
+  # for building "Menus" or "Help Screens"
+  #
+  def getEventKeystrokeRepr(self, event, metamappings={}, separator="+"):
+    keystroke = self.getEventKeystroke(event)
+
+    if keystroke is None:
+      return None
+
+    base, shifted, ctrl, meta = keystroke
+    rv = ""
+    if ctrl:
+      rv += metamappings.get("CONTROL","Ctrl") + separator
+    if meta:
+      rv += metamappings.get("META","Alt") + separator
+    if shifted:
+      rv += metamappings.get("SHIFT","Shift") + separator
+
+    v = reverseLookup(base)
+
+    return "%s%s" % (rv, metamappings.get(v, v))
+
+
+
+  #
+  # Translate a keystroke into an event.
+  # (keystroke is the UI-specific keystroke,
+  # not our virtual keys.)  Returns None if
+  # the keystroke isn't tied to an event.
+  #
+  # This needs to stay as simple as possible
+  # as it gets called for each keystroke
+  #
+  def getEvent(self, basekey, shift=False, ctrl=False, meta=False):
+    try:
+      if ctrl and basekey == ord ('e'):
+        raise errors.SystemError, ('Foobar And The Gang')
+      return self._translatedUserKeyMap[(basekey, shift, ctrl, meta)]
+    except KeyError:
+      return None
+
+  #
+  # Used internally to create a quick lookup
+  # hash for time-sensitive methods.
+  #
+  def _translateUserKeyMap(self):
+    self._translatedUserKeyMap = {}
+    for keys in self.__functionMap.keys():
+      base, sh, ctrl, meta = keys
+      if self.__keyTranslations.has_key(base):
+        base = self.__keyTranslations[base]
+      self._translatedUserKeyMap[(base, sh, ctrl, meta)] = 
self.__functionMap[keys]
+
+
+#####################################################################
+#
+#
+class _VirtualKeys:
+  """
+  Create a container class for the
+  Virtual Key definitions... this
+  is to keep our namespace clean.
+  """
+
+  def __init__(self):
+    self.F1 = -999
+    self.F2 = -998
+    self.F3 = -997
+    self.F4 = -996
+    self.F5 = -995
+    self.F6 = -994
+    self.F7 = -993
+    self.F8 = -992
+    self.F9 = -991
+    self.F10 = -990
+    self.F11 = -989
+    self.F12 = -988
+    self.INSERT = -987
+    self.DELETE = -986
+    self.HOME = -985
+    self.END = -984
+    self.PAGEUP = -983
+    self.PAGEDOWN = -982
+    self.UP = -981
+    self.DOWN = -980
+    self.LEFT = -979
+    self.RIGHT = -978
+    self.TAB = -977
+    self.ENTER = -976
+    self.RETURN = -975
+    self.BACKSPACE = -974
+    self.X = -973
+    self.V = -972
+    self.C = -971
+    self.A = -970
+
+
+#
+# ..and the application will only
+#   need one instance, so create one.
+#
+vk = _VirtualKeys()
+
+
+#
+# Given a keycode value (e.g., -999), return
+# the text representation as a string (e.g., 'F1')
+#
+def reverseLookup(keyvalue):
+  """
+  Given a keycode value (e.g., -999), return
+  the text representation as a string (e.g., 'F1')
+  """
+
+  # This is done for efficiency of real-time lookups;
+  # i.e., we don't often do reverseLookups, but a
+  # regular lookup must happen as efficiently as
+  # possible as a lookup happens each time a key is
+  # pressed!
+
+  for key in dir(vk):
+    if getattr(vk, key) == keyvalue:
+      return key
+  if keyvalue >= 0 and keyvalue <= 255:
+    return chr (keyvalue).upper()
+  return None
+
+
+#####################################################################
+#
+# Default event mappings
+#
+DefaultMapping = {
+
+      # (Key, Shifted, Ctrl'd, Meta/Alt'd)
+      (vk.A,         False, True,  False) : 'SELECTALL',
+      (vk.C,         False, True,  False) : 'COPY',
+      (vk.V,         False, True,  False) : 'PASTE',
+      (vk.X,         False, True,  False) : 'CUT',
+      (ord ('a'),    False, True,  False) : 'SELECTALL',
+      (ord ('c'),    False, True,  False) : 'COPY',
+      (ord ('q'),    False, True,  False) : 'EXIT',
+      (ord ('v'),    False, True,  False) : 'PASTE',
+      (ord ('x'),    False, True,  False) : 'CUT',
+      (vk.PAGEUP,    True,  False, False) : 'JUMPROWSUP',
+      (vk.PAGEDOWN,  True,  False, False) : 'JUMPROWSDOWN',
+      (vk.PAGEUP,    False, True,  False) : 'PREVPAGE',
+      (vk.PAGEDOWN,  False, True,  False) : 'NEXTPAGE',
+      (vk.PAGEUP,    False, False, False) : 'PREVBLOCK',
+      (vk.PAGEDOWN,  False, False, False) : 'NEXTBLOCK',
+      (vk.TAB,       False, False, False) : 'NEXTENTRY',
+      (vk.ENTER,     False, False, False) : 'ENTER',
+      (vk.RETURN,    False, False, False) : 'ENTER',
+      (vk.TAB,       True,  False, False) : 'PREVENTRY',
+      (vk.LEFT,      False, False, False) : 'CURSORLEFT',
+      (vk.RIGHT,     False, False, False) : 'CURSORRIGHT',
+      (vk.END,       False, False, False) : 'CURSOREND',
+      (vk.HOME,      False, False, False) : 'CURSORHOME',
+      (vk.LEFT,      True,  False, False) : 'SELECTLEFT',
+      (vk.RIGHT,     True,  False, False) : 'SELECTRIGHT',
+      (vk.END,       True,  False, False) : 'SELECTTOEND',
+      (vk.HOME,      True,  False, False) : 'SELECTTOHOME',
+      (vk.BACKSPACE, False, False, False) : 'BACKSPACE',
+      (vk.INSERT,    False, False, False) : 'MODETOGGLE',
+      (vk.DELETE,    False, False, False) : 'DELETE',
+      (vk.UP,        False, False, False) : 'PREVRECORD',
+      (vk.DOWN,      False, False, False) : 'NEXTRECORD',
+      (vk.UP,        False, True,  False) : 'FIRSTRECORD',
+      (vk.DOWN,      False, True,  False) : 'LASTRECORD',
+      (vk.F2,        False, False, False) : 'ENTEREDIT',
+      (vk.F3,        False, False, False) : 'JUMPPROMPT',
+      (vk.F5,        False, False, False) : 'MARKFORDELETE',
+      (vk.F6,        False, False, False) : 'COMMIT',
+      (vk.F8,        False, False, False) : 'ENTERQUERY',
+      (vk.F8,        True,  False, False) : 'COPYQUERY',
+      (vk.F9,        False, False, False) : 'EXECQUERY',
+      (vk.F9,        True,  False, False) : 'CANCELQUERY',
+      (vk.F11,       False, False, False) : 'ROLLBACK',
+      (vk.F12,       False, False, False) : 'NEWRECORD',
+      (vk.ENTER,     True,  False, False) : 'NEWLINE',
+   }
+
+
+#
+# The application will only
+# need one instance, so create one.
+#
+KeyMapper = BaseKeyMapper(DefaultMapping)

Modified: trunk/gnue-forms/src/input/displayHandlers/Checkbox.py
===================================================================
--- trunk/gnue-forms/src/input/displayHandlers/Checkbox.py      2005-08-13 
20:40:30 UTC (rev 7862)
+++ trunk/gnue-forms/src/input/displayHandlers/Checkbox.py      2005-08-14 
00:51:48 UTC (rev 7863)
@@ -19,11 +19,11 @@
 # Copyright 2002-2005 Free Software Foundation
 #
 # FILE:
-# GFDisplayHandler.py
+# Checkbox.py
 #
-# $Id$
+# $Id:$
 """
-DisplayHandler classes for Forms input validation
+Display handler for entries of type checkbox
 """
 __revision__ = "$Id$"
 
@@ -114,7 +114,7 @@
 
     self._buildDisplay()
 
-    self.cursor = 0
+    self._cursor = 0
 
 
   # Correctly handle requestKEYPRESS event

Modified: trunk/gnue-forms/src/input/displayHandlers/Cursor.py
===================================================================
--- trunk/gnue-forms/src/input/displayHandlers/Cursor.py        2005-08-13 
20:40:30 UTC (rev 7862)
+++ trunk/gnue-forms/src/input/displayHandlers/Cursor.py        2005-08-14 
00:51:48 UTC (rev 7863)
@@ -1,4 +1,4 @@
-
+#
 # This file is part of GNU Enterprise.
 #
 # GNU Enterprise is free software; you can redistribute it
@@ -22,9 +22,17 @@
 # GFDisplayHandler.py
 #
 # $Id$
+#
+# pylint: disable-msg=E0602
+#
 """
-DisplayHandler classes for Forms input validation
+The base display handler for entries that deal with cursor based
+input (aka text).
+
+This class should not be used directly.  Other handlers should 
+inherit from this one.
 """
+
 __revision__ = "$Id$"
 
 import sys
@@ -34,20 +42,21 @@
 # TODO: When Base is used inherit from that instead
 class BaseCursor(events.EventAware):
   """
-  The base display handler.
+  The base display handler for entries that deal with cursor based
+  input (aka text).
   
-  This display handler is not to be used directly.  Other
-  display handlers inherit from this one.
+  This class should not be used directly.  Other handlers should 
+  inherit from this one.
   """
 
   def __init__(self, entry, eventHandler, subEventHandler, formatter=None):
     """
-    Class initializer
+    Constructor
 
-    @param entry
-    @param eventHandler
-    @param subEventHandler
-    @param formatter
+    @param entry: The GFEntry instance associated with this handler
+    @param eventHandler: The 
+    @param subEventHandler:
+    @param formatter:
     """
     events.EventAware.__init__(self, eventHandler)
     
@@ -58,12 +67,14 @@
     self.value = None             # The latest db-compat value
     self.work = ""                # Our working value
     self.display = ""             # The latest display-formatted value
-    self.selection1 = None        # Start of highlight
-    self.selection2 = None        # End of highlight
-    self.cursor = 0               # Cursor position
     self._loadedAllowedValues = False # Have allowed values been loaded
     self.subEventHandler = subEventHandler
 
+    # Cursor based vars
+    self._selection1 = None        # Start of highlight
+    self._selection2 = None        # End of highlight
+    self._cursor = 0               # Cursor position
+
     # TODO: replace w/an event that asks the
     # TODO: UIdriver if this should happen!
     self.handleCR = sys.platform == "win32"
@@ -75,7 +86,6 @@
     
                  # "Entry" events
                  'requestKEYPRESS'     : self._addText,
-                 'requestENTER'        : self.__handleENTER,
                  'requestCURSORLEFT'   : self._moveCursorLeft,
                  'requestCURSORRIGHT'  : self._moveCursorRight,
                  'requestCURSOREND'    : self._moveCursorToEnd,
@@ -85,17 +95,18 @@
                  'requestDELETE'       : self._delete,
                  'beginEDITMODE'       : self._beginEdit,
                  'endEDITMODE'         : self._endEdit,
+                 'requestENTER'        : self.__handleENTER,
 
                  # Selection/clipboard events
                  'requestSELECTWITHMOUSE' : self._selectWithMouse,
-                 'requestSELECTALL'    : self._selectAll,
-                 'requestSELECTTOHOME' : self._selectToBegin,
-                 'requestSELECTTOEND'  : self._selectToEnd,
-                 'requestSELECTLEFT'   : self._selectLeft,
-                 'requestSELECTRIGHT'  : self._selectRight,
-                 'requestCOPY'         : self._clipboardCopy,
-                 'requestCUT'          : self._clipboardCut,
-                 'requestPASTE'        : self._clipboardPaste,
+                 'requestSELECTALL'       : self._selectAll,
+                 'requestSELECTTOHOME'    : self._selectToBegin,
+                 'requestSELECTTOEND'     : self._selectToEnd,
+                 'requestSELECTLEFT'      : self._selectLeft,
+                 'requestSELECTRIGHT'     : self._selectRight,
+                 'requestCOPY'            : self._clipboardCopy,
+                 'requestCUT'             : self._clipboardCut,
+                 'requestPASTE'           : self._clipboardPaste,
 
                  # Request for direct buffer manipulation
                  'requestINSERTAT'     : self._insertTextAt,
@@ -145,14 +156,14 @@
       self.dispatchEvent(events.Event('updateEntryEditor',
            object = self.field,
            display=self.display,
-           cursor=self.cursor + 
len(self.display[:self.cursor+1].split('\n'))-1,
+           cursor=self._cursor + 
len(self.display[:self._cursor+1].split('\n'))-1,
            selection=self.getSelectionArea(),
          ))
     else:
       self.dispatchEvent(events.Event('updateEntryEditor',
            object = self.entry,
            display=self.display,
-           cursor=self.cursor,
+           cursor=self._cursor,
            selection=self.getSelectionArea(),
          ))
 
@@ -190,7 +201,7 @@
     self.work = self._buildDisplayHelper(self.value, False)
     self._buildDisplay()
 
-    self.cursor = len(self.display)
+    self._cursor = len(self.display)
     # Ensure cursor is properly placed.
     self.generateRefreshEvent()
 
@@ -215,7 +226,7 @@
     # if the field was modified and the event's
     # result is the final entry value.
 
-    self.selection1 = None
+    self._selection1 = None
 
     if self.modified:
       if self._buildValue():
@@ -285,31 +296,31 @@
     # To do overstrike, we'll fudge by first "highlighting"
     # the character to replace, then use the selection logic.
 
-    if  getattr(event, 'overstrike', False) and self.selection1 is None:
-      self.selection1 = self.cursor
-      self.selection2 = self.selection1 + 1
+    if  getattr(event, 'overstrike', False) and self._selection1 is None:
+      self._selection1 = self._cursor
+      self._selection2 = self._selection1 + 1
         
-    if self.selection1 is not None:
+    if self._selection1 is not None:
       # If text is selected, then we will replace
 
-      minSelectionPos = min(self.selection1, self.selection2)
-      maxSelectionPos = max(self.selection1, self.selection2)
+      minSelectionPos = min(self._selection1, self._selection2)
+      maxSelectionPos = max(self._selection1, self._selection2)
 
       self.work = self.work[:minSelectionPos]  \
                    + value        \
                    + self.work[maxSelectionPos:]
 
-      self.selection1 = None
-      self.cursor = minSelectionPos + len(value)
+      self._selection1 = None
+      self._cursor = minSelectionPos + len(value)
 
     else:
       # Otherwise just graft the new text in place
 
-      self.work = self.work[:self.cursor] \
+      self.work = self.work[:self._cursor] \
                    + value                \
-                   + self.work[self.cursor:]
+                   + self.work[self._cursor:]
 
-      self.cursor += len(value)
+      self._cursor += len(value)
 
 
     event.__dropped__ = True
@@ -334,7 +345,7 @@
       return
 
     # set cursor position
-    self.cursor = event.position
+    self._cursor = event.position
 
     # add the event text
     self._addText(event)
@@ -351,9 +362,9 @@
         self.entry.name )
       return
 
-    self.selection1 = event.start_pos
-    self.selection2 = event.end_pos
-    self.cursor     = event.position
+    self._selection1 = event.start_pos
+    self._selection2 = event.end_pos
+    self._cursor     = event.position
     self._delete (event)
 
   def __handleENTER(self, event):
@@ -387,14 +398,14 @@
 
 
     # If we have a "selection", then act like a "delete"
-    if self.selection1 != None:
+    if self._selection1 != None:
       self._delete(event)
       return
 
-    precurs = self.cursor
+    precurs = self._cursor
     self._moveCursorLeft(event)
 
-    if self.cursor != precurs:
+    if self._cursor != precurs:
       event.overstrike = True
       event.text = ""
 
@@ -426,9 +437,9 @@
                       as part of the cursor move
     """
     if not selecting:
-      self.selection1 = None
+      self._selection1 = None
 
-    self.cursor = min(event.position, len(self.display))
+    self._cursor = min(event.position, len(self.display))
     event.refreshDisplay = True
 
 
@@ -441,10 +452,10 @@
                       as part of the cursor move
     """
     if not selecting:
-      self.selection1 = None
+      self._selection1 = None
 
-    if self.cursor > 0:
-      self.cursor -= 1
+    if self._cursor > 0:
+      self._cursor -= 1
       event.refreshDisplay = True
 
   def _moveCursorRight(self, event, selecting=False):
@@ -456,10 +467,10 @@
                       as part of the cursor move
     """    
     if not selecting:
-      self.selection1 = None
+      self._selection1 = None
 
-    if self.cursor < len(self.display):
-      self.cursor += 1
+    if self._cursor < len(self.display):
+      self._cursor += 1
       event.refreshDisplay = True
 
   def _moveCursorToEnd(self, event, selecting=False):
@@ -471,9 +482,9 @@
                       as part of the cursor move
     """
     if not selecting:
-      self.selection1 = None
+      self._selection1 = None
 
-    self.cursor = len(self.display)
+    self._cursor = len(self.display)
     event.refreshDisplay = True
 
 
@@ -486,9 +497,9 @@
                       as part of the cursor move
     """
     if not selecting:
-      self.selection1 = None
+      self._selection1 = None
 
-    self.cursor = 0
+    self._cursor = 0
     event.refreshDisplay = True
 
 
@@ -505,8 +516,8 @@
     @param cursor1: A starting or ending position for the selection 
     @param cursor2: A starting or ending position for the selection
     """
-    self.selection1 = min(cursor1, cursor2)
-    self.selection2 = max(cursor1, cursor2)
+    self._selection1 = min(cursor1, cursor2)
+    self._selection2 = max(cursor1, cursor2)
 
   def getSelectionArea(self):
     """
@@ -514,11 +525,11 @@
     
     @return: The selected area as a tuple or None if no selection
     """
-    if self.selection1 == None:
+    if self._selection1 == None:
       return None
     else:
-      return ( min(self.selection1, self.selection2),
-               max(self.selection1, self.selection2) )
+      return ( min(self._selection1, self._selection2),
+               max(self._selection1, self._selection2) )
 
 
   def _selectWithMouse(self, event):
@@ -527,12 +538,12 @@
         
     @param event: The GFEvent making the request
     """
-    self.selection1 = event.position1
-    self.selection2 = event.position2
-    if self.cursor == self.selection2:
-      event.position = self.selection1
+    self._selection1 = event.position1
+    self._selection2 = event.position2
+    if self._cursor == self._selection2:
+      event.position = self._selection1
     else:
-      event.position = self.selection2
+      event.position = self._selection2
     self._moveCursor(event, True)
 
 
@@ -542,9 +553,9 @@
         
     @param event: The GFEvent making the request    
     """
-    self.selection1 = 0
+    self._selection1 = 0
     self._moveCursorToEnd (event, True)
-    self.selection2 = self.cursor
+    self._selection2 = self._cursor
 
 
   def _selectLeft(self, event):
@@ -553,11 +564,11 @@
         
     @param event: The GFEvent making the request
     """
-    if self.selection1 == None:
-      self.selection1 = self.cursor
+    if self._selection1 == None:
+      self._selection1 = self._cursor
 
     self._moveCursorLeft(event, True)
-    self.selection2 = self.cursor
+    self._selection2 = self._cursor
 
 
   def _selectRight(self, event):
@@ -566,11 +577,11 @@
         
     @param event: The GFEvent making the request
     """ 
-    if self.selection1 == None:
-      self.selection1 = self.cursor
+    if self._selection1 == None:
+      self._selection1 = self._cursor
 
     self._moveCursorRight(event, True)
-    self.selection2 = self.cursor
+    self._selection2 = self._cursor
 
 
   
@@ -580,11 +591,11 @@
         
     @param event: The GFEvent making the request
     """
-    if self.selection1 == None:
-      self.selection1 = self.cursor
+    if self._selection1 == None:
+      self._selection1 = self._cursor
 
     self._moveCursorToBegin(event, True)
-    self.selection2 = self.cursor
+    self._selection2 = self._cursor
 
 
   
@@ -595,11 +606,11 @@
     @param event: The GFEvent making the request
     """
 
-    if self.selection1 == None:
-      self.selection1 = self.cursor
+    if self._selection1 == None:
+      self._selection1 = self._cursor
 
     self._moveCursorToEnd(event, True)
-    self.selection2 = self.cursor
+    self._selection2 = self._cursor
 
   # ---------------------------------------------------------------------------
   # Clipboard Support
@@ -612,7 +623,7 @@
         
     @param event: The GFEvent making the request
     """
-    if self.selection1 != None:
+    if self._selection1 != None:
       sel1, sel2 = self.getSelectionArea ()
       self.dispatchEvent (events.Event ('setCLIPBOARD',
                text = self.display [sel1:sel2]))

Modified: trunk/gnue-forms/src/input/displayHandlers/DateTime.py
===================================================================
--- trunk/gnue-forms/src/input/displayHandlers/DateTime.py      2005-08-13 
20:40:30 UTC (rev 7862)
+++ trunk/gnue-forms/src/input/displayHandlers/DateTime.py      2005-08-14 
00:51:48 UTC (rev 7863)
@@ -24,7 +24,7 @@
 """
 DisplayHandler classes for Forms input validation
 """
-__revision__ = "$Id$"
+__revision__ = "$Id:$"
 
 import sys, time
 
@@ -55,7 +55,7 @@
 
 
   def setValue(self, value):
-    return FieldDisplayHandler.setValue(self, value)
+    return BaseCursor.setValue(self, value)
 
 
   # TODO: Replace with format mask
@@ -84,7 +84,7 @@
 
     if not len(self.work):
       self.value = None
-      return 1
+      return True
 
     # TODO: Replace with format mask
     if self.__inputMask:
@@ -92,8 +92,9 @@
         # mx.DateTime.strptime is not available under windows
         self.value = mktime (time.strptime (self.work, self.__inputMask))
       except:
-        return 0
-      return 1
+        return False
+      return True
+    
     try:
       # TODO: Candidate for maketrans?
       value = self.work.replace('.','/').replace('-','/')
@@ -116,6 +117,6 @@
 
       self.value = DateTime(year, int(month), int(day))
 
-      return 1
+      return True
     except:
-      return 0
+      return False

Modified: trunk/gnue-forms/src/input/displayHandlers/Dropdown.py
===================================================================
--- trunk/gnue-forms/src/input/displayHandlers/Dropdown.py      2005-08-13 
20:40:30 UTC (rev 7862)
+++ trunk/gnue-forms/src/input/displayHandlers/Dropdown.py      2005-08-14 
00:51:48 UTC (rev 7863)
@@ -73,10 +73,8 @@
 
     self._buildDisplay()
 
-    self.cursor = len(self.display)
+    self._cursor = len(self.display)
 
-
-
   # TODO: Replace with format mask
   def _buildDisplayHelper(self, value, editing):
     if value in (None, ""):
@@ -98,7 +96,7 @@
   def _buildDisplay(self):
     if self.editing:
       self.display = self._buildDisplayHelper(self.work, True)
-      if self.cursor > len(self.work):
+      if self._cursor > len(self.work):
         self.work = self.display
     else:
       self.display = self._buildDisplayHelper(self.value, False)
@@ -108,8 +106,8 @@
     if not self.editing:
       return
 
-    self.selection1 = 0
-    self.selection2 = len (self.display)
+    self._selection1 = 0
+    self._selection2 = len (self.display)
     self._addText (event)
 
 # TODO: Kills dropdown handling with keyboard on win32

Modified: trunk/gnue-forms/src/input/displayHandlers/Listbox.py
===================================================================
--- trunk/gnue-forms/src/input/displayHandlers/Listbox.py       2005-08-13 
20:40:30 UTC (rev 7862)
+++ trunk/gnue-forms/src/input/displayHandlers/Listbox.py       2005-08-14 
00:51:48 UTC (rev 7863)
@@ -70,7 +70,7 @@
 
     self._buildDisplay()
 
-    self.cursor = len(self.display)
+    self._cursor = len(self.display)
 
   # TODO: Replace with format mask
   def _buildDisplayHelper(self, value, editing):
@@ -93,13 +93,13 @@
   def _buildDisplay(self):
     if self.editing:
       self.display = self._buildDisplayHelper(self.work, True)
-      if self.cursor > len(self.work):
+      if self._cursor > len(self.work):
         self.work = self.display
     else:
       self.display = self._buildDisplayHelper(self.value, False)
 
 
   def _replaceText(self, event):
-    self.selection1 = 0
-    self.selection2 = len(self.display)
+    self._selection1 = 0
+    self._selection2 = len(self.display)
     self._addText(event)

Modified: trunk/gnue-forms/src/uidrivers/_base/UserActions.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/_base/UserActions.py 2005-08-13 20:40:30 UTC 
(rev 7862)
+++ trunk/gnue-forms/src/uidrivers/_base/UserActions.py 2005-08-14 00:51:48 UTC 
(rev 7863)
@@ -28,7 +28,7 @@
 #
 
 from gnue.common.apps import GConfig
-from gnue.forms import GFKeyMapper
+from gnue.forms.input import GFKeyMapper
 import os
 
 _iconpath = GConfig.getInstalledBase('form_images', 'common_images')

Modified: trunk/gnue-forms/src/uidrivers/_base/widgets/_base.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/_base/widgets/_base.py       2005-08-13 
20:40:30 UTC (rev 7862)
+++ trunk/gnue-forms/src/uidrivers/_base/widgets/_base.py       2005-08-14 
00:51:48 UTC (rev 7863)
@@ -36,7 +36,7 @@
 from gnue.common import events
 from gnue.common.apps import GDebug
 from gnue.common.definitions.GObjects import GObj
-from gnue.forms.GFKeyMapper import KeyMapper
+from gnue.forms.input.GFKeyMapper import KeyMapper
 
 class UIWidget(GObj):
   def __init__(self, event):

Modified: trunk/gnue-forms/src/uidrivers/curses/UIdriver.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/curses/UIdriver.py   2005-08-13 20:40:30 UTC 
(rev 7862)
+++ trunk/gnue-forms/src/uidrivers/curses/UIdriver.py   2005-08-14 00:51:48 UTC 
(rev 7863)
@@ -27,7 +27,7 @@
 
 from gnue.common.apps import i18n
 from gnue.common.datasources import GLoginHandler
-from gnue.forms.GFKeyMapper import vk, KeyMapper
+from gnue.forms.input.GFKeyMapper import vk, KeyMapper
 from gnue.forms.uidrivers._base.UIdriver import GFUserInterfaceBase
 from gnue.forms.uidrivers.curses import dialogs
 

Modified: trunk/gnue-forms/src/uidrivers/curses/widgets/form.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/curses/widgets/form.py       2005-08-13 
20:40:30 UTC (rev 7862)
+++ trunk/gnue-forms/src/uidrivers/curses/widgets/form.py       2005-08-14 
00:51:48 UTC (rev 7863)
@@ -24,7 +24,7 @@
 import curses
 import string
 
-from gnue.forms.GFKeyMapper import KeyMapper
+from gnue.forms.input.GFKeyMapper import KeyMapper
 
 from gnue.forms.uidrivers._base import UIdriver as BaseDriver
 from gnue.forms.uidrivers._base.widgets._base import UIWidget

Modified: trunk/gnue-forms/src/uidrivers/gtk2/common.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/gtk2/common.py       2005-08-13 20:40:30 UTC 
(rev 7862)
+++ trunk/gnue-forms/src/uidrivers/gtk2/common.py       2005-08-14 00:51:48 UTC 
(rev 7863)
@@ -98,8 +98,8 @@
 
 # TODO: Check if we can/want to take over global key maps (like gnome keymap)
 
-from gnue.forms import GFKeyMapper
-from gnue.forms.GFKeyMapper import vk
+from gnue.forms.input import GFKeyMapper
+from gnue.forms.input.GFKeyMapper import vk
 
 # Translate from wx keystrokes to our virtual keystrokes
 gtkKeyTranslations = {

Modified: trunk/gnue-forms/src/uidrivers/qt/common.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/qt/common.py 2005-08-13 20:40:30 UTC (rev 
7862)
+++ trunk/gnue-forms/src/uidrivers/qt/common.py 2005-08-14 00:51:48 UTC (rev 
7863)
@@ -180,8 +180,8 @@
 ## Keymapper Support
 ##
 #####################################################################
-from gnue.forms import GFKeyMapper
-from gnue.forms.GFKeyMapper import vk
+from gnue.forms.input import GFKeyMapper
+from gnue.forms.input.GFKeyMapper import vk
 
 # Translate from QT keystrokes to our virtual keystrokes
 qtKeyTranslations = {

Modified: trunk/gnue-forms/src/uidrivers/win32/widgets/_base.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/win32/widgets/_base.py       2005-08-13 
20:40:30 UTC (rev 7862)
+++ trunk/gnue-forms/src/uidrivers/win32/widgets/_base.py       2005-08-14 
00:51:48 UTC (rev 7863)
@@ -24,14 +24,14 @@
 #
 # NOTES:
 #
-
+
 import re
 import struct
 
-import win32ui
-import win32api
-import win32gui
-import win32con
+import win32ui
+import win32api
+import win32gui
+import win32con
 import commctrl
 
 from gnue.common import events
@@ -40,7 +40,7 @@
 from gnue.forms.uidrivers._base.widgets._base import *
 from gnue.forms.uidrivers.win32.common import *
 
-try:
+try:
   import Image
   import ImageWin
 except:
@@ -66,7 +66,7 @@
       parent._children.append(self)
 
     self._hwnd = win32gui.CreateWindowEx(styleEx, className, windowTitle, 
style, x,y, width,height, hparent, menu, instance, None)
-
+
     # this is only for SetFont
     self._PyCWnd = win32ui.CreateWindowFromHandle(self._hwnd)
 
@@ -81,7 +81,7 @@
     if msg == win32con.WM_LBUTTONDOWN:
       gfObject = self._uiDriver._IdToGFObj[self._id]
       uiObject = self._uiDriver._IdToUIObj[self._id]
-
+
       if 1: #not self.hasFocus():
       # Request Focus
         uiObject._eventHandler('requestFOCUS',gfObject,_form=gfObject._form)
@@ -125,7 +125,7 @@
       gfObject = self._uiDriver._IdToGFObj[self._id]
       if (keycode in NOT_WM_CHAR_KEYS):
 
-        if gfObject._type == 'GFButton' or \
+        if gfObject._type == 'GFButton' or \
           (gfObject._type == 'GFEntry' and gfObject.style != 'dropdown' and 
gfObject.style != 'listbox'):
           action = None
 
@@ -148,7 +148,7 @@
             uiObject = self._uiDriver._IdToUIObj[self._id]
             uiObject._eventHandler(action)
 
-        else:
+        else:
           return win32gui.CallWindowProc(self._oldWndProc, hwnd, msg, wParam, 
lParam)
 
     elif msg == win32con.WM_CHAR:
@@ -180,7 +180,7 @@
           gConfigForms('enterIsNewLine') and \
           (hasattr(gfObject,'Char__height') and gfObject.Char__height) > 1:
 
-        command = 'NEWLINE'
+        command = 'NEWLINE'
 
       else:
 
@@ -213,7 +213,7 @@
                          code=keycode)
         except ValueError:
           pass 
-
+
       if action:
       # Add the object's _form to the outgoing event
       # rather than every event in the function
@@ -226,10 +226,10 @@
           return win32gui.CallWindowProc(self._oldWndProc, hwnd, msg, wParam, 
lParam)
       
     elif msg == win32con.WM_COMMAND:
-      if win32api.HIWORD(wParam) == win32con.CBN_SELCHANGE:
+      if win32api.HIWORD(wParam) == win32con.CBN_SELCHANGE:
         gfObject = self._uiDriver._IdToGFObj[self._id]
         uiObject = self._uiDriver._IdToUIObj[self._id]
-        if gfObject.style == 'dropdown':
+        if gfObject.style == 'dropdown':
           selection = self.GetValue()
           string = gfObject._field.allowedValues()[1][selection]
           uiObject._eventHandler('requestREPLACEVALUE',object=gfObject,
@@ -237,15 +237,15 @@
                             _form=gfObject._form)
         return win32gui.CallWindowProc(self._oldWndProc, hwnd, msg, wParam, 
lParam)
 
-    elif msg == win32con.WM_PAINT:
+    elif msg == win32con.WM_PAINT:
       try:
-        gfObject = self._uiDriver._IdToGFObj[self._id]
+        gfObject = self._uiDriver._IdToGFObj[self._id]
       except:
-        return win32gui.CallWindowProc(self._oldWndProc, hwnd, msg, wParam, 
lParam)
+        return win32gui.CallWindowProc(self._oldWndProc, hwnd, msg, wParam, 
lParam)
 
       if gfObject._type == 'GFImage':
         win32gui.CallWindowProc(self._oldWndProc, hwnd, msg, wParam, lParam)
-        hdc = win32gui.GetDC(self._hwnd)
+        hdc = win32gui.GetDC(self._hwnd)
         self.dib.expose(hdc)
         win32gui.ReleaseDC(self._hwnd,hdc)
       else:
@@ -254,7 +254,7 @@
     else:
       return win32gui.CallWindowProc(self._oldWndProc, hwnd, msg, wParam, 
lParam)
 
-  def SetFont(self, font):
+  def SetFont(self, font):
       self._PyCWnd.SetFont(font,1)
 
   def GetId(self):
@@ -278,10 +278,10 @@
   def GetChildren(self):
     return self._children
 
-  def SetFocus(self):
+  def SetFocus(self):
     try:
-      win32gui.SetFocus(self._hwnd)
-    except:
+      win32gui.SetFocus(self._hwnd)
+    except:
       pass
 
   def Enable(self, enabled):
@@ -364,21 +364,21 @@
         else:
           val = win32con.BST_UNCHECKED
         win32gui.SendMessage(self._hwnd, win32con.BM_SETCHECK, val, 0)
-      elif gfObject.style == 'dropdown':
-        if value:
-          win32gui.SendMessage(self._hwnd, win32con.CB_SELECTSTRING, -1, value)
+      elif gfObject.style == 'dropdown':
+        if value:
+          win32gui.SendMessage(self._hwnd, win32con.CB_SELECTSTRING, -1, value)
         else:
-          win32gui.SendMessage(self._hwnd, win32con.CB_SETCURSEL, 0, 0)
+          win32gui.SendMessage(self._hwnd, win32con.CB_SETCURSEL, 0, 0)
       elif gfObject.style == 'listbox':
-        if value:
-          win32gui.SendMessage(self._hwnd, win32con.LB_SELECTSTRING, -1, value)
+        if value:
+          win32gui.SendMessage(self._hwnd, win32con.LB_SELECTSTRING, -1, value)
         else:
-          win32gui.SendMessage(self._hwnd, win32con.LB_SETCURSEL, 0, 0)
+          win32gui.SendMessage(self._hwnd, win32con.LB_SETCURSEL, 0, 0)
       else:
-        if hasattr(gfObject,'Char__height') and gfObject.Char__height > 1:
+        if hasattr(gfObject,'Char__height') and gfObject.Char__height > 1:
           corrvalue = '\r\n'.join (value.splitlines ())
           win32gui.SetWindowText(self._hwnd, corrvalue)
-        else:
+        else:
           win32gui.SetWindowText(self._hwnd, str(value))
     except:
       pass
@@ -420,8 +420,8 @@
   def getSelectedArea(self):
     gs = win32gui.SendMessage(self._hwnd, win32con.EM_GETSEL, 0, 0)
     return (win32api.LOWORD(gs), win32api.HIWORD(gs))
-
 
+
 class Win32Button(Win32Base):
   pass
 #  def OnWMCommand(self, hwnd, msg, wParam, lParam):
@@ -432,22 +432,22 @@
 
 class Win32Page(Win32Base):
 
-  def OnWMCommand(self, hwnd, msg, wParam, lParam):
+  def OnWMCommand(self, hwnd, msg, wParam, lParam):
     if win32api.HIWORD(wParam) == win32con.LBN_SELCHANGE:
       lbWindow = self._uiDriver._win32app._HwndToTkObj[lParam]
       id = lbWindow.GetId()
       gfObject = self._uiDriver._IdToGFObj[id]
       uiObject = self._uiDriver._IdToUIObj[id]
-      if gfObject.style == 'listbox':
+      if gfObject.style == 'listbox':
         selection = lbWindow.GetValue()
         string = gfObject._field.allowedValues()[1][selection]
         uiObject._eventHandler('requestREPLACEVALUE',object=gfObject,
                             index=selection, text=string,
                             _form=gfObject._form)
-    else:
+    else:
       window = self._uiDriver._win32app._HwndToTkObj[lParam]
       window.OnWMCommand(hwnd, msg, wParam, lParam)
-
+
   def OnWMVScroll(self, hwnd, msg, wParam, lParam):
     sbWindow = self._uiDriver._win32app._HwndToTkObj[lParam]
     id = sbWindow.GetId()
@@ -482,13 +482,13 @@
 
 class Win32Image(Win32Base):
     
-  def SetValue(self, value):
+  def SetValue(self, value):
     l,t,r,b = win32gui.GetWindowRect(self._hwnd)
-    scrx,scry = (r-l, b-t)
-    imgx, imgy = value.size
+    scrx,scry = (r-l, b-t)
+    imgx, imgy = value.size
     
-    gfObject = self._uiDriver._IdToGFObj[self._id]
-
+    gfObject = self._uiDriver._IdToGFObj[self._id]
+
     scalex = scaley = 1
 
     fit = gfObject.fit
@@ -505,23 +505,23 @@
     elif fit == "both":
       scalex = float(scrx) / imgx
       scaley = float(scry) / imgy
-
+
     if scalex != 1 or scaley != 1:
       value = value.resize((abs(int(imgx * (scalex))), abs(int(imgy * 
(scaley)))), Image.BICUBIC)
-
-    # clear the previous image
-    win32gui.SetWindowPos(self._hwnd, 0, 0, 0, 0, 0, win32con.SWP_NOMOVE | 
win32con.SWP_NOZORDER)
+
+    # clear the previous image
+    win32gui.SetWindowPos(self._hwnd, 0, 0, 0, 0, 0, win32con.SWP_NOMOVE | 
win32con.SWP_NOZORDER)
     
     # resize the bitmap holder to match the image size again
-    win32gui.SetWindowPos(self._hwnd, 0, 0, 0, scrx, scry, win32con.SWP_NOMOVE 
| win32con.SWP_NOZORDER)
-    
+    win32gui.SetWindowPos(self._hwnd, 0, 0, 0, scrx, scry, win32con.SWP_NOMOVE 
| win32con.SWP_NOZORDER)
+    
     # convert a PIL image to Dib
-    self.dib = ImageWin.Dib(value)
-    
+    self.dib = ImageWin.Dib(value)
+    
     # paint it
     win32gui.SendMessage(self._hwnd, win32con.WM_PAINT, 0, 0)
-
 
+
 #
 # UIHelper
 #
@@ -573,16 +573,16 @@
     try:
       if (gfObject.style == "dropdown" or gfObject.style == "listbox") and \
           not gfObject._field._allowedValues == widget._origAllowedValues:
-        widget._origAllowedValues = gfObject._field._allowedValues
-        if gfObject.style == "dropdown":
-          RESETCONTENT = win32con.CB_RESETCONTENT
-          ADDSTRING = win32con.CB_ADDSTRING
+        widget._origAllowedValues = gfObject._field._allowedValues
+        if gfObject.style == "dropdown":
+          RESETCONTENT = win32con.CB_RESETCONTENT
+          ADDSTRING = win32con.CB_ADDSTRING
         else:
-          RESETCONTENT = win32con.LB_RESETCONTENT
-          ADDSTRING = win32con.LB_ADDSTRING
-
+          RESETCONTENT = win32con.LB_RESETCONTENT
+          ADDSTRING = win32con.LB_ADDSTRING
+
         win32gui.SendMessage(widget.GetHwnd(), RESETCONTENT, 0, 0)
-        for value in gfObject._field.allowedValues()[1]:
+        for value in gfObject._field.allowedValues()[1]:
           win32gui.SendMessage(widget.GetHwnd(), ADDSTRING, 0, 
textEncode(value))
         widget.SetValue("")
     except AttributeError:
@@ -607,13 +607,13 @@
     if hasattr (gfObject, 'Char__y'):
       posY = gfObject.Char__y
       gap  = gfObject._gap + 1
-      self.itemY = (posY + spacer * gap) * event.widgetHeight
+      self.itemY = (posY + spacer * gap) * event.widgetHeight
 
     newWidget = self._createWidget(event, spacer)
     newWidget.SetFont(self._uiDriver._font)
     if event.initialize:
       self._eventHandler = event.eventHandler
-      self._addToCrossRef(newWidget,gfObject,self)
+      self._addToCrossRef(newWidget,gfObject,self)
 
     return newWidget
 
@@ -631,8 +631,8 @@
 ## Keymapper Support
 ##
 #####################################################################
-from gnue.forms import GFKeyMapper
-from gnue.forms.GFKeyMapper import vk
+from gnue.forms.input import GFKeyMapper
+from gnue.forms.input.GFKeyMapper import vk
 
 # Translate from Win32 keystrokes to our virtual keystrokes
 win32KeyTranslations = {

Modified: trunk/gnue-forms/src/uidrivers/wx/common.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx/common.py 2005-08-13 20:40:30 UTC (rev 
7862)
+++ trunk/gnue-forms/src/uidrivers/wx/common.py 2005-08-14 00:51:48 UTC (rev 
7863)
@@ -270,8 +270,8 @@
 ## Keymapper Support
 ##
 #####################################################################
-from gnue.forms import GFKeyMapper
-from gnue.forms.GFKeyMapper import vk
+from gnue.forms.input import GFKeyMapper
+from gnue.forms.input.GFKeyMapper import vk
 
 # Translate from wx keystrokes to our virtual keystrokes
 wxKeyTranslations = {





reply via email to

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