dabo Commit
Revision 5172
Date: 2009-04-06 17:32:26 -0700 (Mon, 06 Apr 2009)
Author: Ed
Trac: http://trac.dabodev.com/changeset/5172

Changed:
U   trunk/dabo/ui/uiwx/dDateTextBox.py

Log:
Fixed a problem reported by Sibylle Koczian that prevented the modifier keys 
from working when the value of the control was None.


Diff:
Modified: trunk/dabo/ui/uiwx/dDateTextBox.py
===================================================================
--- trunk/dabo/ui/uiwx/dDateTextBox.py  2009-04-03 22:08:38 UTC (rev 5171)
+++ trunk/dabo/ui/uiwx/dDateTextBox.py  2009-04-07 00:32:26 UTC (rev 5172)
@@ -169,7 +169,8 @@
                        if val:
                                valDt = self.Value
                                if valDt is None:
-                                       adjust = False
+                                       adjust = (val == 
self.Application.NoneDisplay)
+                                       evt.Continue = not adjust
                                else:
                                        # They've just finished typing a new 
date, or are just
                                        # positioned on the field. Either way, 
update the stored 
@@ -185,7 +186,7 @@
                elif evt.keyCode in range(32, 129):
                        # key is in ascii range, but isn't one of the above
                        # allowed key sets. Disallow.
-                       evt.stop()
+                       evt.Continue = False
                else:
                        # Pass the key up the chain to process - perhaps a Tab, 
Enter, or Backspace...
                        pass
@@ -211,8 +212,12 @@
                except AttributeError:
                        # Value isn't a date for some reason
                        val = self.Value
-                       dabo.errorLog.write(_("Non-date value in %s: '%s' is 
type '%s'") % (self.Name, val, type(val)))
-                       return
+                       if val is None:
+                               # Probably just a null value
+                               orig = None
+                       else:
+                               dabo.errorLog.write(_("Non-date value in %s: 
'%s' is type '%s'") % (self.Name, val, type(val)))
+                               return
                # Default direction
                forward = True
                # Flag to indicate errors in date processing
@@ -221,6 +226,12 @@
                checkBoundary = True
                # Are we working with dates or datetimes
                isDateTime = isinstance(self.Value, datetime.datetime)
+               if orig is None:
+                       if isDateTime:
+                               self.Value = datetime.datetime.now()
+                       else:
+                               self.Value = datetime.date.today()
+
                # Did the key move to a boundary?
                toBoundary = False
                



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to