Ignore:
Timestamp:
Jul 18, 2018 3:46:38 PM (3 years ago)
Author:
vondreele
Message:

made suggested change from Jeremy Kropf for reading in multiple peak lists.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIdataGUI.py

    r3473 r3485  
    29102910        if not pth: pth = '.'
    29112911        dlg = wx.FileDialog(self, 'Choose file with peak list', pth, '',
    2912             'peak files (*.txt)|*.txt|All files (*.*)|*.*',wx.FD_OPEN)
     2912            'peak files (*.txt)|*.txt|All files (*.*)|*.*',wx.FD_MULTIPLE)
    29132913        try:
    29142914            if dlg.ShowModal() == wx.ID_OK:
    2915                 self.HKL = []
    2916                 self.powderfile = dlg.GetPath()
    2917                 comments,peaks,limits,wave = G2IO.GetPowderPeaks(self.powderfile)
    2918                 Id = self.GPXtree.AppendItem(parent=self.root,text='PKS '+os.path.basename(self.powderfile))
    2919                 data = ['PKS',wave,0.0]
    2920                 names = ['Type','Lam','Zero']
    2921                 codes = [0,0,0]
    2922                 inst = [G2fil.makeInstDict(names,data,codes),{}]
    2923                 self.GPXtree.SetItemPyData(self.GPXtree.AppendItem(Id,text='Instrument Parameters'),inst)
    2924                 self.GPXtree.SetItemPyData(self.GPXtree.AppendItem(Id,text='Comments'),comments)
    2925                 self.GPXtree.SetItemPyData(self.GPXtree.AppendItem(Id,text='Limits'),[tuple(limits),limits])
    2926                 self.GPXtree.SetItemPyData(self.GPXtree.AppendItem(Id,text='Index Peak List'),[peaks,[]])
    2927                 self.GPXtree.SetItemPyData(self.GPXtree.AppendItem(Id,text='Unit Cells List'),[])             
    2928                 self.GPXtree.Expand(Id)
    2929                 self.GPXtree.SelectItem(Id)
     2915                for file_ajk in dlg.GetPaths():
     2916                    self.HKL = []
     2917                    self.powderfile = file_ajk
     2918                    comments,peaks,limits,wave = G2IO.GetPowderPeaks(self.powderfile)
     2919                    Id = self.GPXtree.AppendItem(parent=self.root,text='PKS '+os.path.basename(self.powderfile))
     2920                    data = ['PKS',wave,0.0]
     2921                    names = ['Type','Lam','Zero']
     2922                    codes = [0,0,0]
     2923                    inst = [G2fil.makeInstDict(names,data,codes),{}]
     2924                    self.GPXtree.SetItemPyData(self.GPXtree.AppendItem(Id,text='Instrument Parameters'),inst)
     2925                    self.GPXtree.SetItemPyData(self.GPXtree.AppendItem(Id,text='Comments'),comments)
     2926                    self.GPXtree.SetItemPyData(self.GPXtree.AppendItem(Id,text='Limits'),[tuple(limits),limits])
     2927                    self.GPXtree.SetItemPyData(self.GPXtree.AppendItem(Id,text='Index Peak List'),[peaks,[]])
     2928                    self.GPXtree.SetItemPyData(self.GPXtree.AppendItem(Id,text='Unit Cells List'),[])             
     2929                    self.GPXtree.Expand(Id)
     2930                    self.GPXtree.SelectItem(Id)
    29302931                os.chdir(dlg.GetDirectory())           # to get Mac/Linux to change directory!
    29312932        finally:
Note: See TracChangeset for help on using the changeset viewer.