commit-gnue
[Top][All Lists]
Advanced

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

[gnue] r9342 - in trunk/gnue-forms/src: GFObjects input/displayHandlers


From: johannes
Subject: [gnue] r9342 - in trunk/gnue-forms/src: GFObjects input/displayHandlers
Date: Tue, 30 Jan 2007 09:21:09 -0600 (CST)

Author: johannes
Date: 2007-01-30 09:21:09 -0600 (Tue, 30 Jan 2007)
New Revision: 9342

Modified:
   trunk/gnue-forms/src/GFObjects/GFTabStop.py
   trunk/gnue-forms/src/input/displayHandlers/Cursor.py
   trunk/gnue-forms/src/input/displayHandlers/datehandler.py
Log:
displayhandler can return a tip


Modified: trunk/gnue-forms/src/GFObjects/GFTabStop.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFTabStop.py 2007-01-30 15:02:16 UTC (rev 
9341)
+++ trunk/gnue-forms/src/GFObjects/GFTabStop.py 2007-01-30 15:21:09 UTC (rev 
9342)
@@ -306,7 +306,8 @@
         elif isinstance(self, GFFieldBound) and self._field.get_option('tip'):
             tip = self._field.get_option('tip')
         else:
-            tip = ''
+            tip = self._displayHandler.get_tip()
+
         self._form.update_tip(tip)
 
     # -------------------------------------------------------------------------

Modified: trunk/gnue-forms/src/input/displayHandlers/Cursor.py
===================================================================
--- trunk/gnue-forms/src/input/displayHandlers/Cursor.py        2007-01-30 
15:02:16 UTC (rev 9341)
+++ trunk/gnue-forms/src/input/displayHandlers/Cursor.py        2007-01-30 
15:21:09 UTC (rev 9342)
@@ -175,6 +175,20 @@
 
 
     # -------------------------------------------------------------------------
+    # Return a tip displayed in the statusbar
+    # -------------------------------------------------------------------------
+
+    def get_tip(self):
+        """
+        Descendands can override this method to return a tip which will be
+        displayed in the statusbar if neither the entry nor the field provide
+        such a tip.
+        """
+        return u''
+
+
+
+    # -------------------------------------------------------------------------
     # Text manipulation
     # -------------------------------------------------------------------------
 

Modified: trunk/gnue-forms/src/input/displayHandlers/datehandler.py
===================================================================
--- trunk/gnue-forms/src/input/displayHandlers/datehandler.py   2007-01-30 
15:02:16 UTC (rev 9341)
+++ trunk/gnue-forms/src/input/displayHandlers/datehandler.py   2007-01-30 
15:21:09 UTC (rev 9342)
@@ -23,7 +23,7 @@
 """
 DisplayHandler classes for input validation of date, time and datetime values
 """
-__revision__ = "$Id:$"
+__revision__ = "$Id$"
 
 import sys
 import time
@@ -138,6 +138,25 @@
 
 
     # -------------------------------------------------------------------------
+    # Build a tip for the date field
+    # -------------------------------------------------------------------------
+
+    def get_tip(self):
+        """
+        Derive the apropriate tip from the sample date.
+        """
+        sample = datetime.date(1978, 3, 21)
+        result = sample.strftime(str(self._input_mask))
+        result = result.replace('21', u_('D') * 2)
+        result = result.replace('03', u_('M') * 2)
+        result = result.replace('3', u_('M'))
+        result = result.replace('78', u_('Y') * 2)
+        result = result.replace('19', u_('Y') * 2)
+
+        return result
+
+
+    # -------------------------------------------------------------------------
     # Try to figure out which date the user meant
     # -------------------------------------------------------------------------
 





reply via email to

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