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