[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r7491 - trunk/gnue-forms/src/uidrivers/curses/widgets
From: |
johannes |
Subject: |
[gnue] r7491 - trunk/gnue-forms/src/uidrivers/curses/widgets |
Date: |
Wed, 27 Apr 2005 03:33:56 -0500 (CDT) |
Author: johannes
Date: 2005-04-27 03:33:55 -0500 (Wed, 27 Apr 2005)
New Revision: 7491
Modified:
trunk/gnue-forms/src/uidrivers/curses/widgets/entry.py
Log:
Don't get out of bounds if a field has no maxLength
Modified: trunk/gnue-forms/src/uidrivers/curses/widgets/entry.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/curses/widgets/entry.py 2005-04-26
20:04:07 UTC (rev 7490)
+++ trunk/gnue-forms/src/uidrivers/curses/widgets/entry.py 2005-04-27
08:33:55 UTC (rev 7491)
@@ -42,6 +42,9 @@
self.__style = event.object.style
if self.__style in ['default', 'password', 'label', 'dropdown', 'listbox']:
self.__length = event.object ['Char:width']
+ else:
+ self.__length = None
+
self.__value = {}
self.__selection = {}
self.__enabled = {}
@@ -95,7 +98,18 @@
if self.__style != 'checkbox':
self._setCursor (position, 0)
+
# ---------------------------------------------------------------------------
+ # Move the cursor up to the maximum entry width, but not any further !
+ # ---------------------------------------------------------------------------
+
+ def _setCursor (self, x, y):
+
+ if self.__length and x <= self.__length:
+ UIHelper._setCursor (self, x, y)
+
+
+ # ---------------------------------------------------------------------------
# Set start and end of selection area
# ---------------------------------------------------------------------------
@@ -119,10 +133,12 @@
if self.__style in ['default', 'label', 'dropdown', 'listbox']:
text = value or ''
text += ' ' * (self.__length - len (text))
+ text = text [-self.__length:]
elif self.__style == 'password':
text = '*' * len (value or '')
text += ' ' * (self.__length - len (text))
+ text = text [-self.__length:]
elif self.__style == 'checkbox':
if self.__value [index]:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r7491 - trunk/gnue-forms/src/uidrivers/curses/widgets,
johannes <=