Added support for backing up fittings.
This uses the standard EvE XML fitting format.
This commit is contained in:
@@ -183,6 +183,8 @@ class MainFrame(wx.Frame):
|
||||
self.Bind(wx.EVT_MENU, self.showExportDialog, id=wx.ID_SAVEAS)
|
||||
# Import from Clipboard
|
||||
self.Bind(wx.EVT_MENU, self.importFromClipboard, id=wx.ID_PASTE)
|
||||
# Backup fits
|
||||
self.Bind(wx.EVT_MENU, self.backupToXml, id=menuBar.backupFitsId)
|
||||
# Preference dialog
|
||||
self.Bind(wx.EVT_MENU, self.showPreferenceDialog, id=wx.ID_PREFERENCES)
|
||||
|
||||
@@ -227,6 +229,21 @@ class MainFrame(wx.Frame):
|
||||
else:
|
||||
clip.Close()
|
||||
return None
|
||||
|
||||
def backupToXml(self, event):
|
||||
sFit = service.Fit.getInstance()
|
||||
saveDialog = wx.FileDialog(
|
||||
self,
|
||||
"Choose where to save the backup: ",
|
||||
wildcard = "EvE XML fitting file (*.xml)|*.xml",
|
||||
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()
|
||||
|
||||
def toggleShipBrowser(self, event):
|
||||
self.GetToolBar().toggleShipBrowser(event)
|
||||
|
||||
@@ -26,12 +26,14 @@ class MainMenuBar(wx.MenuBar):
|
||||
def __init__(self):
|
||||
self.characterEditorId = wx.NewId()
|
||||
self.damagePatternEditorId = wx.NewId()
|
||||
self.backupFitsId = wx.NewId()
|
||||
|
||||
wx.MenuBar.__init__(self)
|
||||
|
||||
# File menu
|
||||
fileMenu = wx.Menu()
|
||||
self.Append(fileMenu, "&File")
|
||||
fileMenu.Append(self.backupFitsId, "&Backup fits", "Backup all fittings to a XML file")
|
||||
if 'wxMSW' in wx.PlatformInfo:
|
||||
fileMenu.Append(wx.ID_CLOSE, "&Close\tCTRL+W", "Close the currently open fit")
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user