commit-gnue
[Top][All Lists]
Advanced

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

[gnue] r9284 - trunk/gnue-forms/src/input/displayHandlers


From: reinhard
Subject: [gnue] r9284 - trunk/gnue-forms/src/input/displayHandlers
Date: Fri, 12 Jan 2007 06:46:30 -0600 (CST)

Author: reinhard
Date: 2007-01-12 06:46:29 -0600 (Fri, 12 Jan 2007)
New Revision: 9284

Modified:
   trunk/gnue-forms/src/input/displayHandlers/Cursor.py
Log:
Improved behaviour for wrong input.


Modified: trunk/gnue-forms/src/input/displayHandlers/Cursor.py
===================================================================
--- trunk/gnue-forms/src/input/displayHandlers/Cursor.py        2007-01-12 
12:36:06 UTC (rev 9283)
+++ trunk/gnue-forms/src/input/displayHandlers/Cursor.py        2007-01-12 
12:46:29 UTC (rev 9284)
@@ -131,12 +131,6 @@
             selection1, selection2 = selection
             self.entry.uiWidget._ui_set_selected_area_(index, selection1, 
selection2)
 
-    def __beep(self):
-        """
-        Generates an event requesting that the UI beep.
-        """
-        self.entry._form.beep()
-
     def isPending(self):
         """
         Return True if the display handler is in edit mode and has modified 
text
@@ -284,7 +278,7 @@
 
         # Don't accept any changes if we aren't editing.
         if not self.editing:
-            self.generateRefreshEvent() # reset the UI to old state.
+            self.__error(u_("This field can not be changed"))
             return
 
         # Get the text to be added forcing to specific case if necessary.
@@ -297,7 +291,7 @@
         if (self.field._numeric and self.field._block.mode == 'normal'):
             for char in text:
                 if not (char.isdigit() or char in '.-'):
-                    self.__beep()
+                    self.__error(u_("This field allows numeric input only"))
                     return
 
         # Now, assemble the new text.
@@ -305,7 +299,7 @@
 
         # Check if max length isn't exceeded.
         if self.field.length is not None and len(new_text) > self.field.length:
-            self.__beep()
+            self.__error(u_("Maximum input length reached"))
             return
 
         # If text was added at the end, do autocompletion.
@@ -583,3 +577,13 @@
                 self.modified = False
             finally:
                 self.__updating = False
+
+
+    # -------------------------------------------------------------------------
+    # Helper function to display error message in status bar and beep
+    # -------------------------------------------------------------------------
+
+    def __error(self, message):
+
+        self.entry._form.alert_message(message)
+        self.generateRefreshEvent()





reply via email to

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