Changeset 4343 for trunk/GSASIIautoInt.py
- Timestamp:
- Mar 5, 2020 10:48:06 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIautoInt.py
r4335 r4343 182 182 183 183 def TestInput(*args,**kwargs): 184 'Determine if the start button should be enabled' 184 '''Determine if the start button should be enabled and 185 ask for the exporter type with ambiguous extensions 186 ''' 187 for dfmt,obj in self.fmtlist.items(): 188 fmt = dfmt[1:] 189 if not self.params['outsel'][fmt]: continue 190 if fmt in self.multipleFmtChoices: continue 191 if type(obj) is not list: continue # only one exporter for this 192 choices = [] 193 for e in obj: 194 choices.append(e.formatName) 195 if len(choices) == 0: 196 print('Error: why 0 choices in TestInput?') 197 continue 198 if len(choices) == 1: 199 print('Error: why 1 choice in TestInput?') 200 self.multipleFmtChoices[fmt] = obj[0].formatName 201 continue 202 # select the format here 203 dlg = G2G.G2SingleChoiceDialog(self, 204 'There is more than one format with a '+ 205 '.{} output. Choose the one to use'.format(fmt), 206 'Choose output format',choices) 207 dlg.clb.SetSelection(0) # force a selection 208 if dlg.ShowModal() == wx.ID_OK and dlg.GetSelection() >= 0: 209 self.multipleFmtChoices[fmt] = choices[dlg.GetSelection()] 210 dlg.Destroy() 211 185 212 writingSomething = False 186 213 writingPDF = False … … 426 453 self.params['outdir'] = os.getcwd() 427 454 self.PDFformats = ('I(Q)', 'S(Q)', 'F(Q)', 'G(r)', 'PDFgui') 455 self.multipleFmtChoices = {} 428 456 #GSASIIpath.IPyBreak_base() 429 457 … … 492 520 sizer = wx.BoxSizer(wx.HORIZONTAL) 493 521 sizer.Add(wx.StaticText(mnpnl, wx.ID_ANY,'Select format(s):')) 494 for dfmt in s elf.fmtlist:522 for dfmt in sorted(self.fmtlist): 495 523 sizer.Add((6,2)) # add a bit of extra space 496 524 fmt = dfmt[1:] … … 758 786 PDFformats = self.PDFformats 759 787 fmtlist = self.fmtlist 760 outputModes = (outputSelect,PDFformats,fmtlist,outdir) 788 outputModes = (outputSelect,PDFformats,fmtlist,outdir, 789 self.multipleFmtChoices) 761 790 if PDFobj: 762 791 PDFdict = PDFobj.data … … 786 815 :param tuple outputModes: 787 816 ''' 788 GSASIIpath.IPyBreak()789 817 (TableMode,ComputePDF,SeparateDir,optPDF) = calcModes 790 (outputSelect,PDFformats,fmtlist,outdir ) = outputModes818 (outputSelect,PDFformats,fmtlist,outdir,multipleFmtChoices) = outputModes 791 819 gpxout = G2sc.G2Project(filename=os.path.splitext(newImage)[0]+'.gpx') 792 820 print('creating',gpxout.filename) … … 807 835 fmt = dfmt[1:] 808 836 if not outputSelect[fmt]: continue 837 hint = '' 838 if fmt in multipleFmtChoices: 839 hint = multipleFmtChoices[fmt] 809 840 if SeparateDir: 810 841 savedir = os.path.join(outdir,fmt) … … 817 848 try: 818 849 fil = os.path.join(savedir,fname) 819 print('Wrote',h.Export(fil,dfmt ))850 print('Wrote',h.Export(fil,dfmt,hint)) 820 851 except Exception as msg: 821 852 print('Failed to write {} as {}. Error msg\n{}'
Note: See TracChangeset
for help on using the changeset viewer.