Export active fit
(self, event)
| 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: |
nothing calls this directly
no test coverage detected