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/GSASIIctrlGUI.py

    r3270 r3298  
    8080                                   defined where they are first used rather than be placed
    8181                                   yet a third location somewhere in this module.
     82:func:`askSaveFile`                Get a file name from user
     83:func:`askSaveDirectory`           Get a directory name from user
    8284================================  =================================================================
    8385
     
    36573659        else:
    36583660            evt.StopPropagation()
    3659            
     3661
     3662################################################################################
     3663#####  Get an output file or directory
     3664################################################################################           
     3665def askSaveFile(G2frame,defnam,extension,longFormatName):
     3666    '''Ask the user to supply a file name
     3667
     3668    :returns: a file name (str) or None if Cancel is pressed
     3669    '''
     3670
     3671    pth = GetExportPath(G2frame)
     3672    dlg = wx.FileDialog(
     3673        G2frame, 'Input name for file to write', pth, defnam,
     3674        longFormatName+' (*'+extension+')|*'+extension,
     3675        wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT)
     3676    dlg.CenterOnParent()
     3677    try:
     3678        if dlg.ShowModal() == wx.ID_OK:
     3679            filename = dlg.GetPath()
     3680            G2frame.LastExportDir = os.path.split(filename)[0]
     3681            filename = os.path.splitext(filename)[0]+extension # make sure extension is correct
     3682        else:
     3683            filename = None
     3684    finally:
     3685        dlg.Destroy()
     3686    return filename
     3687
     3688def askSaveDirectory(G2frame):
     3689    '''Ask the user to supply a directory name. Path name is used as the
     3690    starting point for the next export path search.
     3691
     3692    :returns: a directory name (str) or None if Cancel is pressed
     3693    '''
     3694    pth = GetExportPath(G2frame)
     3695    dlg = wx.DirDialog(
     3696            G2frame, 'Input directory where file(s) will be written', pth,
     3697            wx.DD_DEFAULT_STYLE)
     3698    dlg.CenterOnParent()
     3699    try:
     3700        if dlg.ShowModal() == wx.ID_OK:
     3701            filename = dlg.GetPath()
     3702            G2frame.LastExportDir = filename
     3703        else:
     3704            filename = None
     3705    finally:
     3706        dlg.Destroy()
     3707    return filename
     3708
    36603709################################################################################
    36613710#####  Customized Notebook
Note: See TracChangeset for help on using the changeset viewer.