Revision: 6181
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6181&view=rev
Author:   jdh2358
Date:     2008-10-13 18:10:39 +0000 (Mon, 13 Oct 2008)

Log Message:
-----------
updates to formatters

Modified Paths:
--------------
    trunk/matplotlib/lib/matplotlib/mlab.py
    trunk/matplotlib/lib/mpl_toolkits/exceltools.py

Modified: trunk/matplotlib/lib/matplotlib/mlab.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mlab.py     2008-10-11 18:27:35 UTC (rev 
6180)
+++ trunk/matplotlib/lib/matplotlib/mlab.py     2008-10-13 18:10:39 UTC (rev 
6181)
@@ -2173,15 +2173,19 @@
 #    def tostr(self, x):
 #        return '"%r"'%self.toval(x)
 
+
+
 class FormatFormatStr(FormatObj):
     def __init__(self, fmt):
         self.fmt = fmt
 
     def tostr(self, x):
         if x is None: return 'None'
-        return self.fmt%self.toval(x)
+        return (self.fmt%self.toval(x)).rstrip('.')
 
 
+
+
 class FormatFloat(FormatFormatStr):
     def __init__(self, precision=4, scale=1.):
         FormatFormatStr.__init__(self, '%%1.%df'%precision)
@@ -2198,6 +2202,10 @@
 
 
 class FormatInt(FormatObj):
+
+    def tostr(self, x):
+        return '%d'%int(x)
+
     def toval(self, x):
         return int(x)
 

Modified: trunk/matplotlib/lib/mpl_toolkits/exceltools.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/exceltools.py     2008-10-11 18:27:35 UTC 
(rev 6180)
+++ trunk/matplotlib/lib/mpl_toolkits/exceltools.py     2008-10-13 18:10:39 UTC 
(rev 6181)
@@ -99,10 +99,11 @@
 
     ind = np.arange(len(r.dtype.names))
     for row in r:
+        #print 'row',
         for i in ind:
             val = row[i]
             format = formats[i]
-            val = format.toval(val)
+
             if mlab.safe_isnan(val):
                 ws.write(rownum, colnum+i, nanstr)
             elif mlab.safe_isinf(val):
@@ -111,15 +112,14 @@
                 else: s = '-%s'%infstr
                 ws.write(rownum, colnum+i, s)
             elif format.xlstyle is None:
+                val = format.toval(val)
                 ws.write(rownum, colnum+i, val)
             else:
+                val = format.toval(val)
+                #print (i, r.dtype.names[i], val, format.toval(val)),
                 ws.write(rownum, colnum+i, val, format.xlstyle)
         rownum += 1
 
     if autosave:
         wb.save(filename)
     return rownum
-
-
-
-


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-checkins mailing list
Matplotlib-checkins@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to