commit-gnue
[Top][All Lists]
Advanced

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

r5778 - trunk/gnue-forms/src


From: jamest
Subject: r5778 - trunk/gnue-forms/src
Date: Mon, 3 May 2004 20:17:56 -0500 (CDT)

Author: jamest
Date: 2004-05-03 20:17:56 -0500 (Mon, 03 May 2004)
New Revision: 5778

Modified:
   trunk/gnue-forms/src/GFDisplayHandler.py
Log:
adjust numeric type handler some it doesn't truncate 123.40 as 123.4


Modified: trunk/gnue-forms/src/GFDisplayHandler.py
===================================================================
--- trunk/gnue-forms/src/GFDisplayHandler.py    2004-05-04 00:47:47 UTC (rev 
5777)
+++ trunk/gnue-forms/src/GFDisplayHandler.py    2004-05-04 01:17:56 UTC (rev 
5778)
@@ -593,13 +593,14 @@
     if value in (None,""):
       value = None
     else:
-      value = float(value)
+      value = value
 
     return FieldDisplayHandler.setValue(self, value)
 
 
   # TODO: Replace with format mask
   def _buildDisplayHelper(self, val, editing):
+    print val
     try:
       if val in (None,""):
         return ""
@@ -608,20 +609,18 @@
 
     if editing and type(val) == types.StringType:
       return val
-
-    try:
-      value = float(val)
-    except ValueError:
-      return str(val)
-
-    try:
-      if int(value) == value:
-        value = "%d" % value
-      else:
+    
+    if float(val) == val:
+      value = val
+      try:
+        if int(value) == value:
+          value = "%d" % value
+        else:
+          value = "%s" % value
+      except OverflowError:
         value = "%s" % value
-    except OverflowError:
-      value = "%s" % value
-
+    else:
+      value = "%s" % val
 #     if not editing:
 #       # Comma-fy (Temporary!)
 #       if value[:1] == '-':
@@ -652,7 +651,8 @@
       return True
 
     try:
-      self.value = float(self.work)
+      dummy = float(self.work)
+      self.value = self.work
       return True
     except ValueError:
       return False
@@ -814,9 +814,9 @@
   def replaceText(self, event):
     self.selection1 = 0
     self.selection2 = len(self.display)
-    self.addText(event)
-
-# TODO: Kills dropdown handling with keyboard on win32
+    self.addText(event)
+
+# TODO: Kills dropdown handling with keyboard on win32
 # TODO: needs more work :(
 #    self.endEdit(event) # Hack: allows dropdowns to change field
                         # value immediately (causes post-change





reply via email to

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