Changeset 3426 for trunk/GSASIIIO.py


Ignore:
Timestamp:
Jun 9, 2018 4:39:58 PM (3 years ago)
Author:
toby
Message:

Add scan of .gpx objects; try to fix bug on drag

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIIO.py

    r3373 r3426  
    563563    File.close()
    564564    return
     565
     566objectScanIgnore = [int,bool,float,str,np.float64,np.ndarray]
     567if '2' in platform.python_version_tuple()[0]:
     568    objectScanIgnore += [unicode,]
     569   
     570def objectScan(data,tag,indexStack=[]):
     571    '''Scan an object looking for unexpected data types'''
     572    if type(data) is list or type(data) is tuple:
     573        for i in range(len(data)):
     574            objectScan(data[i],tag,indexStack+[i])
     575    elif type(data) is dict:
     576        for key in data:
     577            objectScan(data[key],tag,indexStack+[key])
     578    elif data is None:
     579        return
     580    elif type(data) in objectScanIgnore:
     581        return
     582    else:
     583        s = 'unexpected object in '+tag
     584        for i in indexStack:
     585            s += "[{}]".format(i)
     586        #print(s,data.__class__.__name__) # loses full name of class
     587        print(s,type(data))
    565588   
    566589def ProjFileOpen(G2frame,showProvenance=True):
     
    584607                break
    585608            datum = data[0]
    586            
     609            # scan the GPX file for unexpected objects
     610            if GSASIIpath.GetConfigValue('debug'):
     611                objectScan(data,datum[0])
    587612            Id = G2frame.GPXtree.AppendItem(parent=G2frame.root,text=datum[0])
    588613            if datum[0].startswith('PWDR'):               
Note: See TracChangeset for help on using the changeset viewer.