@@ -226,13 +226,14 @@ def OnFileSel(event):
226226 style = wx .FD_OPEN ,wildcard = fil + '(*.*)|*.*' )
227227 if dlg .ShowModal () == wx .ID_OK :
228228 fpath ,fName = os .path .split (dlg .GetPath ())
229- if os .path .exists (fName ): # is there a file by this name in the current directory?
229+ if os .path .exists (os . path . join ( G2frame . LastGPXdir , fName ) ): # is there a file by this name in the current directory?
230230 RMCPdict ['files' ][fil ][0 ] = fName
231231 else : # nope, copy it
232232 # TODO: is G2frame.LastGPXdir the right choice here or
233233 # do I want the current working directory (same?)
234234 shutil .copy (dlg .GetPath (), os .path .join (G2frame .LastGPXdir ,fName ))
235- if not os .path .exists (fName ): # sanity check
235+ RMCPdict ['files' ][fil ][0 ] = fName
236+ if not os .path .exists (os .path .join (G2frame .LastGPXdir ,fName )): # sanity check
236237 print (f'Error: file { fName } not found in .gpx directory ({ G2frame .LastGPXdir } )' )
237238 return
238239 G2frame .LastImportDir = fpath #set so next file is found in same place
@@ -260,7 +261,10 @@ def OnFileSel(event):
260261 def OnFileFormat (event ):
261262 Obj = event .GetEventObject ()
262263 fil = Indx [Obj .GetId ()]
263- RMCPdict ['files' ][fil ][3 ] = Obj .GetStringSelection ()
264+ Fmt = Obj .GetStringSelection ()
265+ RMCPdict ['files' ][fil ][3 ] = Fmt
266+ if 'PDF' in Fmt :
267+ RMCPdict ['files' ][fil ][2 ] = 'G(r)P'
264268
265269 def OnPlotBtn (event ):
266270 Obj = event .GetEventObject ()
@@ -270,7 +274,7 @@ def OnPlotBtn(event):
270274 XY = np .empty ((1 ,2 ))
271275 while XY .shape [0 ] == 1 :
272276 try :
273- XY = np .loadtxt (fileItem [0 ],skiprows = start )
277+ XY = np .loadtxt (os . path . join ( G2frame . LastGPXdir , fileItem [0 ]) ,skiprows = start )
274278 except ValueError :
275279 start += 1
276280 if start > 500 : #absurd number of header lines!
@@ -345,7 +349,7 @@ def OnSeqReverse(event):
345349 mainSizer .Add (topSizer )
346350 Heads = ['Name' ,'File' ,'type' ,'Plot' ,'Delete' ]
347351 fileSizer = wx .FlexGridSizer (5 ,5 ,5 )
348- Formats = ['RMC' ,'GUDRUN' ,'STOG' ]
352+ Formats = ['RMC' ,'GUDRUN' ,'STOG' , 'PDFGET' ]
349353 for head in Heads :
350354 fileSizer .Add (wx .StaticText (G2frame .FRMC ,label = head ),0 ,WACV )
351355 for fil in RMCPdict ['files' ]:
@@ -411,7 +415,7 @@ def OnSeqReverse(event):
411415 if G2frame .RMCchoice == 'PDFfit' and RMCPdict ['refinement' ] == 'sequential' :
412416
413417 def OnAddPDF (event ):
414- ''' Add PDF G(r)s while maintanining original sequence
418+ ''' Add PDF G(r)s while maintaining original sequence
415419 '''
416420 usedList = RMCPdict ['seqfiles' ]
417421 PDFlist = [item [1 :][0 ] for item in G2frame .GetFileList ('PDF' )]
@@ -534,7 +538,7 @@ def OnSetVal(event):
534538 # RMCProfile & PDFfit (Normal)
535539 Heads = ['Name' ,'File' ,'Format' ,'Weight' ,'Plot' ,'Delete' ]
536540 fileSizer = wx .FlexGridSizer (6 ,5 ,5 )
537- Formats = ['RMC' ,'GUDRUN' ,'STOG' ]
541+ Formats = ['RMC' ,'GUDRUN' ,'STOG' , 'PDFGET' ]
538542 for head in Heads :
539543 fileSizer .Add (wx .StaticText (G2frame .FRMC ,label = head ),0 ,WACV )
540544 for fil in RMCPdict ['files' ]:
@@ -547,11 +551,13 @@ def OnSetVal(event):
547551 Indx [filSel .GetId ()] = fil
548552 fileSizer .Add (filSel ,0 ,WACV )
549553 nform = 3
554+ if 'G(r)' in fil :
555+ nform = 4
550556 Name = 'Ndata'
551557 if 'Xray' in fil :
552558 nform = 1
553559 Name = 'Xdata'
554- if Rfile and os .path .exists (Rfile ): #incase .gpx file is moved away from G(R), F(Q), etc. files
560+ if Rfile and os .path .exists (os . path . join ( G2frame . LastGPXdir , Rfile ) ): #incase .gpx file is moved away from G(R), F(Q), etc. files
555561 fileFormat = wx .ComboBox (G2frame .FRMC ,choices = Formats [:nform ],style = wx .CB_DROPDOWN | wx .TE_READONLY )
556562 fileFormat .SetStringSelection (RMCPdict ['files' ][fil ][3 ])
557563 Indx [fileFormat .GetId ()] = fil
0 commit comments