39
39
40
40
import copy
41
41
import gtk , gobject
42
- import numpy as npy
42
+ import numpy as np
43
43
import matplotlib .cbook as cbook
44
+ from matplotlib .cbook import warn_deprecated
44
45
import matplotlib .mlab as mlab
45
46
46
47
48
+ warn_deprecated ("2.0" , name = "mpl_toolkits.gtktools" , obj_type = "module" )
49
+
50
+
47
51
def error_message (msg , parent = None , title = None ):
48
52
"""
49
53
create an error message dialog with string msg. Optionally set
@@ -164,7 +168,7 @@ def __call__(self, column):
164
168
val = model .get_value (thisiter , self .i )
165
169
try : val = float (val .strip ().rstrip ('%' ))
166
170
except ValueError : pass
167
- if mlab .safe_isnan (val ): val = npy .inf # force nan to sort uniquely
171
+ if mlab .safe_isnan (val ): val = np .inf # force nan to sort uniquely
168
172
dsu .append ((val , rownum ))
169
173
dsu .sort ()
170
174
if not self .num % 2 : dsu .reverse ()
@@ -326,19 +330,15 @@ def rec2gtk(r, formatd=None, rownum=0, autowin=True):
326
330
format = formatd .get (name )
327
331
if format is None :
328
332
format = mlab .defaultformatd .get (dt .type , mlab .FormatObj ())
329
- #print 'gtk fmt factory', i, name, format, type(format)
330
333
format = gtkformat_factory (format , i )
331
334
formatd [name ] = format
332
335
333
-
334
336
colheaders = r .dtype .names
335
337
scroll = SortedStringsScrolledWindow (colheaders , formatd )
336
338
337
- ind = npy .arange (len (r .dtype .names ))
338
339
for row in r :
339
340
scroll .add_row (row )
340
341
341
-
342
342
if autowin :
343
343
win = gtk .Window ()
344
344
win .set_default_size (800 ,600 )
@@ -387,7 +387,7 @@ def __init__(self, r, formatd=None, stringd=None):
387
387
formatd = mlab .get_formatd (r )
388
388
389
389
self .stringd = stringd
390
- self .callbacks = cbook .CallbackRegistry ([ 'cell_changed' ] )
390
+ self .callbacks = cbook .CallbackRegistry ()
391
391
392
392
self .r = r
393
393
@@ -586,9 +586,6 @@ def edit_recarray(r, formatd=None, stringd=None, constant=None, autowin=True):
586
586
if __name__ == '__main__' :
587
587
588
588
import datetime
589
- import gtk
590
- import numpy as np
591
- import matplotlib .mlab as mlab
592
589
N = 10
593
590
today = datetime .date .today ()
594
591
dates = [today + datetime .timedelta (days = i ) for i in range (N )] # datetimes
@@ -599,7 +596,7 @@ def edit_recarray(r, formatd=None, stringd=None, constant=None, autowin=True):
599
596
clientid = list (xrange (N )) # ints
600
597
601
598
r = np .rec .fromarrays ([clientid , dates , weekdays , gains , prices , up ],
602
- names = 'clientid,date,weekdays,gains,prices,up' )
599
+ names = str ( 'clientid,date,weekdays,gains,prices,up' ) )
603
600
604
601
# some custom formatters
605
602
formatd = mlab .get_formatd (r )
0 commit comments