Changeset 3319 for trunk/GSASIIIO.py


Ignore:
Timestamp:
Mar 22, 2018 1:09:57 PM (4 years ago)
Author:
toby
Message:

set a default name when the gpx file name is blank

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIIO.py

    r3298 r3319  
    17121712        :returns: a file name (str) or None if Cancel is pressed
    17131713
    1714         TODO: Can this be replaced with G2G.askSaveFile?
    17151714        '''
    1716        
    17171715        pth = G2G.GetExportPath(self.G2frame)
    1718         defnam = os.path.splitext(
    1719             os.path.split(self.G2frame.GSASprojectfile)[1]
    1720             )[0]+self.extension
    1721         dlg = wx.FileDialog(
    1722             self.G2frame, 'Input name for file to write', pth, defnam,
    1723             self.longFormatName+' (*'+self.extension+')|*'+self.extension,
    1724             wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT)
    1725         dlg.CenterOnParent()
    1726         try:
    1727             if dlg.ShowModal() == wx.ID_OK:
    1728                 filename = dlg.GetPath()
    1729                 self.G2frame.LastExportDir = os.path.split(filename)[0]
    1730                 filename = os.path.splitext(filename)[0]+self.extension # make sure extension is correct
    1731             else:
    1732                 filename = None
    1733         finally:
    1734             dlg.Destroy()
    1735         return filename
     1716        if self.G2frame.GSASprojectfile:
     1717            defnam = os.path.splitext(
     1718                os.path.split(self.G2frame.GSASprojectfile)[1]
     1719                )[0]+self.extension
     1720        else:
     1721            defnam = 'default' + self.extension
     1722        return G2G.askSaveFile(self.G2frame,defnam,self.extension,self.longFormatName)
    17361723
    17371724    def askSaveDirectory(self):
Note: See TracChangeset for help on using the changeset viewer.