Changeset 2554
- Timestamp:
- Dec 1, 2016 10:10:00 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIpwdGUI.py
r2553 r2554 1601 1601 File.write(item+':'+str(data[item][1])+'\n') 1602 1602 File.close() 1603 print 'Instrument parameters saved to: '+filename 1603 1604 finally: 1604 1605 dlg.Destroy() … … 5050 5051 5051 5052 def OnSavePDFControls(event): 5052 print 'save PDF controls? TBD' 5053 5053 pth = G2G.GetExportPath(G2frame) 5054 dlg = wx.FileDialog(G2frame, 'Choose GSAS-II PDF controls file', pth, '', 5055 'PDF controls files (*.pdfprm)|*.pdfprm',wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT) 5056 try: 5057 if dlg.ShowModal() == wx.ID_OK: 5058 filename = dlg.GetPath() 5059 # make sure extension is .pdfprm 5060 filename = os.path.splitext(filename)[0]+'.pdfprm' 5061 File = open(filename,'w') 5062 File.write("#GSAS-II PDF controls file; do not add/delete items!\n") 5063 for item in data: 5064 File.write(item+':'+unicode(data[item])+'\n') 5065 File.close() 5066 print 'PDF controls saved to: '+filename 5067 finally: 5068 dlg.Destroy() 5069 5054 5070 def OnLoadPDFControls(event): 5055 print 'Load PDF controls? TBD' 5071 pth = G2G.GetExportPath(G2frame) 5072 dlg = wx.FileDialog(G2frame, 'Choose GSAS-II PDF controls file', pth, '', 5073 'PDF controls files (*.pdfprm)|*.pdfprm',wx.OPEN) 5074 try: 5075 if dlg.ShowModal() == wx.ID_OK: 5076 filename = dlg.GetPath() 5077 File = open(filename,'r') 5078 newdata = {} 5079 S = File.readline() 5080 while S: 5081 if '#' in S: 5082 S = File.readline() 5083 continue 5084 key,val = S.split(':',1) 5085 try: 5086 newdata[key] = eval(val) 5087 except SyntaxError: 5088 newdata[key] = val 5089 S = File.readline() 5090 data.update(newdata) 5091 finally: 5092 dlg.Destroy() 5093 OnComputePDF(event) 5094 UpdatePDFGrid(G2frame,data) 5056 5095 5057 5096 def OnAddElement(event):
Note: See TracChangeset
for help on using the changeset viewer.