MCPcopy Index your code
hub / github.com/pyfa-org/Pyfa / OnShowExportDialog

Method OnShowExportDialog

gui/mainFrame.py:458–483  ·  view source on GitHub ↗

Export active fit

(self, event)

Source from the content-addressed store, hash-verified

456 ImplantSetEditor.openOne(parent=self)
457
458 def OnShowExportDialog(self, event):
459 """ Export active fit """
460 sFit = Fit.getInstance()
461 fit = sFit.getFit(self.getActiveFit())
462 defaultFile = "%s - %s.xml" % (fit.ship.item.name, fit.name) if fit else None
463
464 with wx.FileDialog(
465 self, _t("Save Fitting As..."),
466 wildcard=_t("EVE XML fitting files") + " (*.xml)|*.xml",
467 style=wx.FD_SAVE,
468 defaultFile=defaultFile
469 ) as dlg:
470 if dlg.ShowModal() == wx.ID_OK:
471 self.supress_left_up = True
472 format_ = dlg.GetFilterIndex()
473 path = dlg.GetPath()
474 if format_ == 0:
475 output = Port.exportXml([fit], None)
476 if '.' not in os.path.basename(path):
477 path += ".xml"
478 with open(path, "w", encoding="utf-8") as openfile:
479 openfile.write(output)
480 openfile.close()
481 else:
482 pyfalog.warning("oops, invalid fit format %d" % format_)
483 return
484
485 def OnShowPreferenceDialog(self, event):
486 with PreferenceDialog(self) as dlg:

Callers

nothing calls this directly

Calls 6

getActiveFitMethod · 0.95
getFitMethod · 0.80
_tFunction · 0.50
getInstanceMethod · 0.45
exportXmlMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected