def showExportDialog(self, event): """ Export active fit """ sFit = 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, defaultFile=defaultFile) if dlg.ShowModal() == wx.ID_OK: self.supress_left_up = True format_ = dlg.GetFilterIndex() path = dlg.GetPath() if format_ == 0: output = Port.exportXml(None, fit) if '.' not in os.path.basename(path): path += ".xml" else: print(("oops, invalid fit format %d" % format_)) try: dlg.Destroy() except RuntimeError: pyfalog.error("Tried to destroy an object that doesn't exist in <showExportDialog>.") return with open(path, "w", encoding="utf-8") as openfile: openfile.write(output) openfile.close() try: dlg.Destroy() except RuntimeError: pyfalog.error("Tried to destroy an object that doesn't exist in <showExportDialog>.")
def showExportDialog(self, event): """ Export active fit """ sFit = 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, defaultFile=defaultFile) if dlg.ShowModal() == wx.ID_OK: self.supress_left_up = True format_ = dlg.GetFilterIndex() path = dlg.GetPath() if format_ == 0: output = Port.exportXml([fit], None) if '.' not in os.path.basename(path): path += ".xml" else: pyfalog.warning("oops, invalid fit format %d" % format_) try: dlg.Destroy() except RuntimeError: pyfalog.error("Tried to destroy an object that doesn't exist in <showExportDialog>.") return with open(path, "w", encoding="utf-8") as openfile: openfile.write(output) openfile.close() try: dlg.Destroy() except RuntimeError: pyfalog.error("Tried to destroy an object that doesn't exist in <showExportDialog>.")
def OnShowExportDialog(self, event): """ Export active fit """ sFit = Fit.getInstance() fit = sFit.getFit(self.getActiveFit()) defaultFile = "%s - %s.xml" % (fit.ship.item.name, fit.name) if fit else None with wx.FileDialog(self, "Save Fitting As...", wildcard="EVE XML fitting files (*.xml)|*.xml", style=wx.FD_SAVE, defaultFile=defaultFile) as dlg: if dlg.ShowModal() == wx.ID_OK: self.supress_left_up = True format_ = dlg.GetFilterIndex() path = dlg.GetPath() if format_ == 0: output = Port.exportXml([fit], None) if '.' not in os.path.basename(path): path += ".xml" with open(path, "w", encoding="utf-8") as openfile: openfile.write(output) openfile.close() else: pyfalog.warning("oops, invalid fit format %d" % format_) return
def exportXml(self, *fitIDs): fits = map(lambda fitID: eos.db.getFit(fitID), fitIDs) return Port.exportXml(*fits)
def exportXml(self, callback=None, *fitIDs): fits = map(lambda fitID: eos.db.getFit(fitID), fitIDs) return Port.exportXml(callback, *fits)
def clipboardXml(self): fit = db_getFit(self.getActiveFit()) toClipboard(Port.exportXml(None, fit))
def exportXml(self, options, callback): fit = getFit(self.mainFrame.getActiveFit()) Port.exportXml([fit], None, callback)
def clipboardXml(self, options): fit = db_getFit(self.getActiveFit()) toClipboard(Port.exportXml(None, fit))