Diff of /branches/rel_0_2/ocempgui/ocempgui/widgets/Editable.py [r569] .. [r570] Maximize Restore

  Switch to side-by-side view

--- a/branches/rel_0_2/ocempgui/ocempgui/widgets/Editable.py
+++ b/branches/rel_0_2/ocempgui/ocempgui/widgets/Editable.py
@@ -1,4 +1,4 @@
-# $Id: Editable.py,v 1.29.2.6 2007-03-23 11:57:14 marcusva Exp $
+# $Id: Editable.py,v 1.29.2.7 2008-02-05 22:33:47 marcusva Exp $
 #
 # Copyright (c) 2004-2007, Marcus von Appen
 # All rights reserved.
@@ -239,6 +239,7 @@
         Receives the SIG_KEYDOWN events and updates the text.
         """
         handled = False
+        caret = self._caret
         
         if event.key == K_ESCAPE:
             if self.editable:
@@ -254,23 +255,23 @@
             
         # Move caret right and left on the corresponding key press.
         elif event.key == K_RIGHT:
-            if self._caret < len (self._text):
-                self._caret += 1
+            if caret < len (self._text):
+                caret += 1
             handled = True
 
         elif event.key == K_LEFT:
-            if self._caret > 0:
-                self._caret -= 1
+            if caret > 0:
+                caret -= 1
             handled = True
 
         # Go the start (home) of the text.
         elif event.key == K_HOME:
-            self._caret = 0
+            caret = 0
             handled = True
 
         # Go to the end (end) of the text.
         elif event.key == K_END:
-            self._caret = len (self._text)
+            caret = len (self._text)
             handled = True
 
         # The next statements directly influence the text, thus we have
@@ -278,17 +279,15 @@
         elif self.editable:
             # Delete at the position (delete).
             if event.key == K_DELETE:
-                if self._caret < len (self._text):
-                    self._text = self._text[:self._caret] + \
-                                 self._text[self._caret + 1:]
+                if caret < len (self._text):
+                    self._text = self._text[:caret] + self._text[caret + 1:]
                 handled = True
 
             # Delete backwards (backspace).
             elif event.key == K_BACKSPACE:
-                if self._caret > 0:
-                    self._text = self._text[:self._caret - 1] + \
-                                 self._text[self._caret:]
-                    self._caret -= 1
+                if caret > 0:
+                    self._text = self._text[:caret - 1] + self._text[caret:]
+                    caret -= 1
                 handled = True
 
             # Non-printable characters or maximum exceeded.
@@ -299,12 +298,12 @@
 
             # Any other case is okay, so show it.
             else:
-                self._text = self._text[:self._caret] + event.unicode + \
-                             self._text[self._caret:]
-                self._caret += 1
+                self._text = self._text[:caret] + event.unicode + \
+                             self._text[caret:]
+                caret += 1
                 handled = True
 
-        self.dirty = True
+        self.set_caret (caret)
         return handled
 
     # properties