Improved file-extension handling.
This commit is contained in:
@@ -34,6 +34,7 @@ from gui.preferenceDialog import PreferenceDialog
|
||||
import aboutData
|
||||
import gui.fittingView as fv
|
||||
from wx._core import PyDeadObjectError
|
||||
import os.path
|
||||
|
||||
class MainFrame(wx.Frame):
|
||||
__instance = None
|
||||
@@ -183,11 +184,11 @@ class MainFrame(wx.Frame):
|
||||
path = dlg.GetPath()
|
||||
if (format == 0):
|
||||
output = sFit.exportFit(self.getActiveFit())
|
||||
if not path.endswith(".cfg"):
|
||||
if '.' not in os.path.basename(path):
|
||||
path += ".cfg"
|
||||
elif (format == 1):
|
||||
output = sFit.exportXml(self.getActiveFit())
|
||||
if not path.endswith(".xml"):
|
||||
if '.' not in os.path.basename(path):
|
||||
path += ".xml"
|
||||
else:
|
||||
print "oops, invalid fit format %d" % format
|
||||
@@ -281,7 +282,7 @@ class MainFrame(wx.Frame):
|
||||
style = wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
|
||||
if (saveDialog.ShowModal() == wx.ID_OK):
|
||||
filePath = saveDialog.GetPath()
|
||||
if not filePath.endswith(".xml"):
|
||||
if '.' not in os.path.basename(filePath):
|
||||
filePath += ".xml"
|
||||
sFit.backupFits(filePath )
|
||||
saveDialog.Destroy()
|
||||
|
||||
Reference in New Issue
Block a user