Changeset 3348
- Timestamp:
- Apr 17, 2018 5:00:36 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIdataGUI.py
r3346 r3348 1497 1497 pth = G2G.GetImportPath(self) 1498 1498 if not pth: pth = '.' 1499 extOrd = [0,1] 1500 if GSASIIpath.GetConfigValue('Instprm_default',False): 1501 extOrd = [1,0] 1502 extList = ['GSAS iparm file (*.prm,*.inst,*.ins)|*.prm;*.inst;*.ins|','GSAS-II iparm file (*.instprm)|*.instprm|'] 1499 1503 dlg = wx.FileDialog(self, 1500 1504 u'Choose inst. param file for "'+rd.idstring+u'" (or Cancel for default)', 1501 pth, '', 1502 'GSAS iparm file (*.prm,*.inst,*.ins)|*.prm;*.inst;*.ins|' 1503 'GSAS-II iparm file (*.instprm)|*.instprm|' 1504 'All files (*.*)|*.*', wx.FD_OPEN) 1505 pth, '',extList[extOrd[0]]+extList[extOrd[1]]+'All files (*.*)|*.*', wx.FD_OPEN) 1505 1506 if os.path.exists(lastIparmfile): 1506 1507 dlg.SetFilename(lastIparmfile) … … 4920 4921 # PDR / Peak List 4921 4922 G2G.Define_wxId('wxID_UNDO', 'wxID_LSQPEAKFIT', 'wxID_LSQONECYCLE', 'wxID_RESETSIGGAM', 4922 'wxID_CLEARPEAKS', 'wxID_AUTOSEARCH','wxID_PEAKSCOPY', 'wxID_SEQPEAKFIT', )4923 'wxID_CLEARPEAKS', 'wxID_AUTOSEARCH','wxID_PEAKSCOPY', 'wxID_SEQPEAKFIT','wxID_PEAKLOAD','wxID_PEAKSAVE') 4923 4924 self.PeakMenu = wx.MenuBar() 4924 4925 self.PrefillDataMenu(self.PeakMenu) … … 4933 4934 self.PeakEdit.Append(G2G.wxID_RESETSIGGAM,'Reset sig and gam','Reset sigma and gamma to global fit' ) 4934 4935 self.PeakCopy = self.PeakEdit.Append(G2G.wxID_PEAKSCOPY,'Peak copy','Copy peaks to other histograms') 4936 self.PeakEdit.Append(G2G.wxID_PEAKLOAD,'Load peaks...','Load peak list from file') 4937 self.PeakEdit.Append(G2G.wxID_PEAKSAVE,'Save peaks...','Save peak list to file') 4935 4938 self.SeqPeakFit = self.PeakEdit.Append(G2G.wxID_SEQPEAKFIT,'Seq PeakFit', 4936 4939 'Sequential Peak fitting for all histograms' ) -
trunk/GSASIIpwdGUI.py
r3338 r3348 501 501 G2frame.GPXtree.SetItemPyData( 502 502 G2gd.GetGPXtreeItemId(G2frame,Id,'Peak List'),copy.deepcopy(data)) 503 504 def OnLoadPeaks(event): 505 pth = G2G.GetExportPath(G2frame) 506 dlg = wx.FileDialog(G2frame, 'Choose GSAS-II PWDR peaks list file', pth, '', 507 'PWDR peak list files (*.pkslst)|*.pkslst',wx.FD_OPEN) 508 try: 509 if dlg.ShowModal() == wx.ID_OK: 510 peaks = [] 511 filename = dlg.GetPath() 512 File = open(filename,'r') 513 S = File.readline() 514 while S: 515 if '#' in S: 516 S = File.readline() 517 continue 518 try: 519 peaks.append(eval(S)) 520 except: 521 break 522 S = File.readline() 523 File.close() 524 finally: 525 dlg.Destroy() 526 data = {'peaks':peaks,'sigDict':{}} 527 UpdatePeakGrid(G2frame,data) 528 G2plt.PlotPatterns(G2frame,plotType='PWDR') 529 530 def OnSavePeaks(event): 531 pth = G2G.GetExportPath(G2frame) 532 dlg = wx.FileDialog(G2frame, 'Choose GSAS-II PWDR peaks list file', pth, '', 533 'PWDR peak list files (*.pkslst)|*.pkslst',wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT) 534 try: 535 if dlg.ShowModal() == wx.ID_OK: 536 filename = dlg.GetPath() 537 # make sure extension is .pkslst 538 filename = os.path.splitext(filename)[0]+'.pkslst' 539 File = open(filename,'w') 540 File.write("#GSAS-II PWDR peaks list file; do not add/delete items!\n") 541 for item in data: 542 if item == 'peaks': 543 for pk in data[item]: 544 File.write(str(pk)+'\n') 545 File.close() 546 print ('PWDR peaks list saved to: '+filename) 547 finally: 548 dlg.Destroy() 549 503 550 504 551 def OnUnDo(event): … … 826 873 G2frame.Bind(wx.EVT_MENU, OnAutoSearch, id=G2G.wxID_AUTOSEARCH) 827 874 G2frame.Bind(wx.EVT_MENU, OnCopyPeaks, id=G2G.wxID_PEAKSCOPY) 875 G2frame.Bind(wx.EVT_MENU, OnSavePeaks, id=G2G.wxID_PEAKSAVE) 876 G2frame.Bind(wx.EVT_MENU, OnLoadPeaks, id=G2G.wxID_PEAKLOAD) 828 877 G2frame.Bind(wx.EVT_MENU, OnUnDo, id=G2G.wxID_UNDO) 829 878 G2frame.Bind(wx.EVT_MENU, OnRefineSelected, id=G2frame.dataWindow.peaksSel.GetId()) -
trunk/config_example.py
r3286 r3348 184 184 information on how this is done. 185 185 ''' 186 187 Instprm_default = False 188 '''when True, GSAS-II instprm file are shown as default; when False, old GSAS stype prm, etc files are default 189 '''
Note: See TracChangeset
for help on using the changeset viewer.