moved some logic into the fit service

This commit is contained in:
Lucas Thode
2010-10-26 09:01:04 -05:00
parent 10f779fa96
commit 580d69ea5e
2 changed files with 8 additions and 5 deletions

View File

@@ -239,11 +239,7 @@ class MainFrame(wx.Frame):
style = wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
if (saveDialog.ShowModal() == wx.ID_OK):
filePath = saveDialog.GetPath()
allFits = map(lambda x: x[0], sFit.getAllFits())
backedUpFits = sFit.exportXml(*allFits)
backupFile = open(filePath, "w")
backupFile.write(backedUpFits)
backupFile.close()
sFit.backupFits(filePath)
def toggleShipBrowser(self, event):
self.GetToolBar().toggleShipBrowser(event)

View File

@@ -335,6 +335,13 @@ class Fit(object):
def exportXml(self, *fitIDs):
fits = map(lambda id: eos.db.getFit(id), fitIDs)
return eos.types.Fit.exportXml(*fits)
def backupFits(self, path):
allFits = map(lambda x: x[0], self.getAllFits())
backedUpFits = self.exportXml(*allFits)
backupFile = open(path, "w")
backupFile.write(backedUpFits)
backupFile.close()
def importFit(self, path):
f = file(path)