3939
4040import copy
4141import gtk , gobject
42- import numpy as npy
42+ import numpy as np
4343import matplotlib .cbook as cbook
44+ from matplotlib .cbook import warn_deprecated
4445import matplotlib .mlab as mlab
4546
4647
48+ warn_deprecated ("2.0" , name = "mpl_toolkits.gtktools" , obj_type = "module" )
49+
50+
4751def error_message (msg , parent = None , title = None ):
4852 """
4953 create an error message dialog with string msg. Optionally set
@@ -164,7 +168,7 @@ def __call__(self, column):
164168 val = model .get_value (thisiter , self .i )
165169 try : val = float (val .strip ().rstrip ('%' ))
166170 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
168172 dsu .append ((val , rownum ))
169173 dsu .sort ()
170174 if not self .num % 2 : dsu .reverse ()
@@ -326,19 +330,15 @@ def rec2gtk(r, formatd=None, rownum=0, autowin=True):
326330 format = formatd .get (name )
327331 if format is None :
328332 format = mlab .defaultformatd .get (dt .type , mlab .FormatObj ())
329- #print 'gtk fmt factory', i, name, format, type(format)
330333 format = gtkformat_factory (format , i )
331334 formatd [name ] = format
332335
333-
334336 colheaders = r .dtype .names
335337 scroll = SortedStringsScrolledWindow (colheaders , formatd )
336338
337- ind = npy .arange (len (r .dtype .names ))
338339 for row in r :
339340 scroll .add_row (row )
340341
341-
342342 if autowin :
343343 win = gtk .Window ()
344344 win .set_default_size (800 ,600 )
@@ -387,7 +387,7 @@ def __init__(self, r, formatd=None, stringd=None):
387387 formatd = mlab .get_formatd (r )
388388
389389 self .stringd = stringd
390- self .callbacks = cbook .CallbackRegistry ([ 'cell_changed' ] )
390+ self .callbacks = cbook .CallbackRegistry ()
391391
392392 self .r = r
393393
@@ -586,9 +586,6 @@ def edit_recarray(r, formatd=None, stringd=None, constant=None, autowin=True):
586586if __name__ == '__main__' :
587587
588588 import datetime
589- import gtk
590- import numpy as np
591- import matplotlib .mlab as mlab
592589 N = 10
593590 today = datetime .date .today ()
594591 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):
599596 clientid = list (xrange (N )) # ints
600597
601598 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' ) )
603600
604601 # some custom formatters
605602 formatd = mlab .get_formatd (r )
0 commit comments