[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r9129 - trunk/gnue-forms/src/input/displayHandlers
From: |
reinhard |
Subject: |
[gnue] r9129 - trunk/gnue-forms/src/input/displayHandlers |
Date: |
Tue, 12 Dec 2006 06:53:56 -0600 (CST) |
Author: reinhard
Date: 2006-12-12 06:53:54 -0600 (Tue, 12 Dec 2006)
New Revision: 9129
Modified:
trunk/gnue-forms/src/input/displayHandlers/Checkbox.py
trunk/gnue-forms/src/input/displayHandlers/Cursor.py
trunk/gnue-forms/src/input/displayHandlers/Dropdown.py
trunk/gnue-forms/src/input/displayHandlers/Listbox.py
trunk/gnue-forms/src/input/displayHandlers/Password.py
Log:
Get rid of function _buildDisplay().
Modified: trunk/gnue-forms/src/input/displayHandlers/Checkbox.py
===================================================================
--- trunk/gnue-forms/src/input/displayHandlers/Checkbox.py 2006-12-12
11:19:13 UTC (rev 9128)
+++ trunk/gnue-forms/src/input/displayHandlers/Checkbox.py 2006-12-12
12:53:54 UTC (rev 9129)
@@ -68,7 +68,7 @@
def _moveCursorToBegin(self, event, selecting=False):
pass
- def _sanitizeValue(self, value):
+ def __sanitize_value(self, value):
if self.field._block.mode == 'query' and (value in [None, '']):
return None
@@ -82,7 +82,7 @@
# TODO: Replace with format mask
def _buildDisplayHelper(self, value, editing):
- return self._sanitizeValue(value)
+ return self.__sanitize_value(value)
# Helpers for user events:
@@ -91,8 +91,8 @@
def __set (self, value):
if value != self.work:
self.work = value
+ self.display = self.work
self.modified = True
- self._buildDisplay ()
self.updateFieldValue()
# Toggle value of checkbox
@@ -105,8 +105,8 @@
next = 0
self.work = allowed[next]
+ self.display = self.work
self.modified = True
- self._buildDisplay ()
self.updateFieldValue()
@@ -115,22 +115,20 @@
if not self.editing:
return
if event.data == None:
- self.__toggle ()
+ self.__toggle()
else:
- self.__set (self._sanitizeValue (event.data [1]))
+ self.__set(self.__sanitize_value(event.data[1]))
event.refreshDisplay = True
def beginEdit(self):
self.editing = self.field.isEditable()
+
+ self.work = self.__sanitize_value(self.field.getValue())
+ self.display = self.work
self.modified = False
- value = self.field.getValue()
- self.work = value
-
- self._buildDisplay()
-
self._cursor = 0
@@ -147,5 +145,4 @@
def build_display(self, value, editing):
- return self._sanitizeValue(value)
-
+ return self.__sanitize_value(value)
Modified: trunk/gnue-forms/src/input/displayHandlers/Cursor.py
===================================================================
--- trunk/gnue-forms/src/input/displayHandlers/Cursor.py 2006-12-12
11:19:13 UTC (rev 9128)
+++ trunk/gnue-forms/src/input/displayHandlers/Cursor.py 2006-12-12
12:53:54 UTC (rev 9129)
@@ -185,7 +185,7 @@
# TODO: Replace with formatter
value = self.field.getValue()
self.work = self._buildDisplayHelper(value, False)
- self._buildDisplay()
+ self.display = self.build_display(self.work, True)
self._cursor = len(self.display)
# Ensure cursor is properly placed.
@@ -292,7 +292,7 @@
event.__dropped__ = True
event.refreshDisplay = True
self.modified = True
- self._buildDisplay()
+ self.display = self.build_display(self.work, True)
# Update the field. This means PRE-CHANGE and POST-CHANGE will get fired
# now. For now, only do this here if we are a lookup.
@@ -650,23 +650,12 @@
return "%s" % value
- def _buildDisplay(self):
- """
- Private function that rebuilds the display string.
- """
- self.display = self._buildDisplayHelper(self.work, True)
-
-
# -------------------------------------------------------------------------
# Parse the display string
# -------------------------------------------------------------------------
def parse_display(self, display):
- if self.field._allowedValues:
- for disp in self.field._allowedValuesDescr:
- if disp.startswith(display):
- return disp
return display
@@ -681,8 +670,11 @@
if value is None:
return ""
- else:
- return unicode(value)
+ elif self.field._allowedValues:
+ for allowed in self.field._allowedValuesDescr:
+ if allowed.startswith(value):
+ return allowed
+ return unicode(value)
def updateFieldValue (self):
@@ -698,5 +690,5 @@
def __updateFieldValue(self):
- value = self.parse_display(self.work)
+ value = self.parse_display(self.display)
self.field.set_value(value)
Modified: trunk/gnue-forms/src/input/displayHandlers/Dropdown.py
===================================================================
--- trunk/gnue-forms/src/input/displayHandlers/Dropdown.py 2006-12-12
11:19:13 UTC (rev 9128)
+++ trunk/gnue-forms/src/input/displayHandlers/Dropdown.py 2006-12-12
12:53:54 UTC (rev 9129)
@@ -72,7 +72,7 @@
else:
self.work = ""
- self._buildDisplay()
+ self.display = self.build_display(self.work, True)
self._cursor = len(self.display)
# Make sure to keep the UI in sync !
@@ -98,8 +98,3 @@
return self.field._allowedValues ["%s" % value]
else:
return ""
-
- def _buildDisplay(self):
- self.display = self._buildDisplayHelper(self.work, True)
- if self._cursor > len(self.work):
- self.work = self.display
Modified: trunk/gnue-forms/src/input/displayHandlers/Listbox.py
===================================================================
--- trunk/gnue-forms/src/input/displayHandlers/Listbox.py 2006-12-12
11:19:13 UTC (rev 9128)
+++ trunk/gnue-forms/src/input/displayHandlers/Listbox.py 2006-12-12
12:53:54 UTC (rev 9129)
@@ -69,7 +69,7 @@
event.__errortext__ = u_("Invalid value '%s' for keyed pull-down "
"field") % value
- self._buildDisplay()
+ display = self.build_display(self.work, True)
self._cursor = len(self.display)
@@ -91,12 +91,6 @@
else:
return ""
- def _buildDisplay(self):
- self.display = self._buildDisplayHelper(self.work, True)
- if self._cursor > len(self.work):
- self.work = self.display
-
-
def _replaceText(self, event):
self._selection1 = 0
self._selection2 = len(self.display)
Modified: trunk/gnue-forms/src/input/displayHandlers/Password.py
===================================================================
--- trunk/gnue-forms/src/input/displayHandlers/Password.py 2006-12-12
11:19:13 UTC (rev 9128)
+++ trunk/gnue-forms/src/input/displayHandlers/Password.py 2006-12-12
12:53:54 UTC (rev 9129)
@@ -57,7 +57,7 @@
# TODO: Replace with formatter
value = self.field.getValue()
self.work = value or ""
- self._buildDisplay()
+ self.display = self.build_display(self.work, True)
self.cursor = len(self.display)
# Ensure cursor is properly placed.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r9129 - trunk/gnue-forms/src/input/displayHandlers,
reinhard <=