Changeset 4343 for trunk/GSASIIimgGUI.py
- Timestamp:
- Mar 5, 2020 10:48:06 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIimgGUI.py
r4338 r4343 2940 2940 sizer = wx.BoxSizer(wx.HORIZONTAL) 2941 2941 sizer.Add(wx.StaticText(mnpnl, wx.ID_ANY,'Select format(s):')) 2942 for dfmt in self.fmtlist: 2942 # format choice selection 2943 usedfmt = [] 2944 self.multipleFmtChoices = {} 2945 for dfmt in sorted(self.fmtlist[0]): 2943 2946 sizer.Add((6,2)) # add a bit of extra space 2944 2947 fmt = dfmt[1:] 2945 2948 self.params[fmt] = False 2946 btn = G2G.G2CheckBox(mnpnl,dfmt,self.params,fmt) 2947 sizer.Add(btn) 2949 if fmt in usedfmt: # is extension used more than once 2950 self.multipleFmtChoices[fmt] = None 2951 else: 2952 usedfmt.append(fmt) 2953 btn = G2G.G2CheckBox(mnpnl,dfmt,self.params,fmt, 2954 OnChange=self.TestInput) 2955 sizer.Add(btn) 2948 2956 lblsizr.Add(sizer) 2949 2957 sizer = wx.BoxSizer(wx.HORIZONTAL) … … 3010 3018 self.Show() 3011 3019 showPDFctrls(None) 3020 3021 def TestInput(self,event): 3022 for fmt in self.multipleFmtChoices: 3023 if not self.params[fmt]: continue 3024 if self.multipleFmtChoices[fmt]: continue 3025 choices = [] 3026 for f,l in zip(self.fmtlist[0],self.fmtlist[1]): 3027 if f[1:] == fmt: choices.append(l) 3028 if len(choices) < 2: 3029 print('Error: why no choices in TestInput?') 3030 return 3031 # select the format here 3032 dlg = G2G.G2SingleChoiceDialog(self, 3033 'There is more than one format with a '+ 3034 '.{} output. Choose the one to use'.format(fmt), 3035 'Choose output format',choices) 3036 dlg.clb.SetSelection(0) # force a selection 3037 if dlg.ShowModal() == wx.ID_OK and dlg.GetSelection() >= 0: 3038 self.multipleFmtChoices[fmt] = choices[dlg.GetSelection()] 3039 dlg.Destroy() 3040 else: 3041 dlg.Destroy() 3042 return 3012 3043 3013 3044 def checkPDFprm(self,ShowContents=False): … … 3196 3227 fileroot += namenum 3197 3228 # loop over selected formats 3198 for dfmt in self.fmtlist: 3199 if not self.params[dfmt[1:]]: continue 3229 for fmt in self.params: 3230 if not self.params[fmt]: continue 3231 if '.'+fmt not in self.fmtlist[0]: continue 3200 3232 if self.params['SeparateDir']: 3201 subdir = dfmt[1:]3233 subdir = fmt 3202 3234 else: 3203 3235 subdir = '' 3236 hint = '' 3237 if self.multipleFmtChoices.get(fmt): 3238 hint = self.multipleFmtChoices.get(fmt) 3204 3239 fil = os.path.join(self.params['outdir'],subdir,fileroot) 3205 G2IO.ExportPowder(G2frame,treename,fil+'.x', dfmt) # dummy extension (.x) is replaced before write)3240 G2IO.ExportPowder(G2frame,treename,fil+'.x','.'+fmt,hint=hint) # dummy extension (.x) is replaced before write) 3206 3241 3207 3242 def EnableButtons(self,flag): … … 3275 3310 # make sure all output directories exist 3276 3311 if self.params['SeparateDir']: 3277 for dfmt in self.fmtlist :3312 for dfmt in self.fmtlist[0]: 3278 3313 if not self.params[dfmt[1:]]: continue 3279 3314 dir = os.path.join(self.params['outdir'],dfmt[1:])
Note: See TracChangeset
for help on using the changeset viewer.