Fix XML export

This commit is contained in:
blitzmann
2015-01-17 13:41:49 -05:00
parent e520758334
commit 3a9e1f8b85
2 changed files with 9 additions and 5 deletions

View File

@@ -332,15 +332,19 @@ class MainFrame(wx.Frame):
def showExportDialog(self, event):
""" Export active fit """
sFit = service.Fit.getInstance()
fit = sFit.getFit(self.getActiveFit())
defaultFile = "%s - %s.xml"%(fit.ship.item.name, fit.name) if fit else None
dlg = wx.FileDialog(self, "Save Fitting As...",
wildcard = "EVE XML fitting files (*.xml)|*.xml",
style = wx.FD_SAVE)
style = wx.FD_SAVE,
defaultFile=defaultFile)
if dlg.ShowModal() == wx.ID_OK:
sFit = service.Fit.getInstance()
format = dlg.GetFilterIndex()
path = dlg.GetPath()
if format == 0:
output = sFit.exportXml(self.getActiveFit())
output = sFit.exportXml(None, self.getActiveFit())
if '.' not in os.path.basename(path):
path += ".xml"
else:
@@ -518,7 +522,7 @@ class MainFrame(wx.Frame):
def clipboardXml(self):
sFit = service.Fit.getInstance()
toClipboard(sFit.exportXml(self.getActiveFit()))
toClipboard(sFit.exportXml(None, self.getActiveFit()))
def importFromClipboard(self, event):
sFit = service.Fit.getInstance()

View File

@@ -760,7 +760,7 @@ class Fit(object):
fit = eos.db.getFit(fitID)
return Port.exportDna(fit)
def exportXml(self, callback = None, *fitIDs):
def exportXml(self, callback=None, *fitIDs):
fits = map(lambda fitID: eos.db.getFit(fitID), fitIDs)
return Port.exportXml(callback, *fits)