Changeset 3298 for trunk/GSASIIIO.py


Ignore:
Timestamp:
Feb 28, 2018 10:49:30 PM (4 years ago)
Author:
toby
Message:

add publication quality Rietveld plots

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIIO.py

    r3260 r3298  
    827827    print (' XY data saved to: '+filename)
    828828           
    829 def askSaveDirectory(G2frame):
    830     '''Ask the user to supply a directory name. Path name is used as the
    831     starting point for the next export path search.
    832 
    833     :returns: a directory name (str) or None if Cancel is pressed
    834     '''
    835     pth = G2G.GetExportPath(G2frame)
    836     dlg = wx.DirDialog(
    837             G2frame, 'Input directory where file(s) will be written', pth,
    838             wx.DD_DEFAULT_STYLE)
    839     dlg.CenterOnParent()
    840     try:
    841         if dlg.ShowModal() == wx.ID_OK:
    842             filename = dlg.GetPath()
    843             G2frame.LastExportDir = filename
    844         else:
    845             filename = None
    846     finally:
    847         dlg.Destroy()
    848     return filename
    849 
    850 def askSaveFile(G2frame,defnam,extension,longFormatName):
    851     '''Ask the user to supply a file name
    852 
    853     :returns: a file name (str) or None if Cancel is pressed
    854     '''
    855 
    856     pth = G2G.GetExportPath(G2frame)
    857     dlg = wx.FileDialog(
    858         G2frame, 'Input name for file to write', pth, defnam,
    859         longFormatName+' (*'+extension+')|*'+extension,
    860         wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT)
    861     dlg.CenterOnParent()
    862     try:
    863         if dlg.ShowModal() == wx.ID_OK:
    864             filename = dlg.GetPath()
    865             G2frame.LastExportDir = os.path.split(filename)[0]
    866             filename = os.path.splitext(filename)[0]+extension # make sure extension is correct
    867         else:
    868             filename = None
    869     finally:
    870         dlg.Destroy()
    871     return filename
    872 
    873829def PDFSave(G2frame,exports,PDFsaves):
    874830    'Save a PDF I(Q), S(Q), F(Q) and G(r)  in column formats'
    875831    import scipy.interpolate as scintp
    876832    if len(exports) > 1:
    877         dirname = askSaveDirectory(G2frame)
     833        dirname = G2G.askSaveDirectory(G2frame)
    878834        if not dirname: return
    879835    else:
    880836        defnam = exports[0].replace(' ','_')[5:]
    881         filename = askSaveFile(G2frame,defnam,'.gr','G(r) file, etc.')
     837        filename = G2G.askSaveFile(G2frame,defnam,'.gr','G(r) file, etc.')
    882838        if not filename: return
    883839        dirname,filename = os.path.split(filename)
     
    17551711
    17561712        :returns: a file name (str) or None if Cancel is pressed
     1713
     1714        TODO: Can this be replaced with G2G.askSaveFile?
    17571715        '''
    17581716       
     
    17821740
    17831741        :returns: a directory name (str) or None if Cancel is pressed
     1742
     1743        TODO: Can this be replaced with G2G.askSaveDirectory?
    17841744        '''
    17851745        pth = G2G.GetExportPath(self.G2frame)
Note: See TracChangeset for help on using the changeset viewer.