Exemplo n.º 1
0
    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>.")
Exemplo n.º 2
0
    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>.")
Exemplo n.º 3
0
    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
Exemplo n.º 4
0
 def exportXml(self, *fitIDs):
     fits = map(lambda fitID: eos.db.getFit(fitID), fitIDs)
     return Port.exportXml(*fits)
Exemplo n.º 5
0
 def exportXml(self, callback=None, *fitIDs):
     fits = map(lambda fitID: eos.db.getFit(fitID), fitIDs)
     return Port.exportXml(callback, *fits)
Exemplo n.º 6
0
 def clipboardXml(self):
     fit = db_getFit(self.getActiveFit())
     toClipboard(Port.exportXml(None, fit))
Exemplo n.º 7
0
 def exportXml(self, *fitIDs):
     fits = map(lambda fitID: eos.db.getFit(fitID), fitIDs)
     return Port.exportXml(*fits)
Exemplo n.º 8
0
Arquivo: fit.py Projeto: Bashta/Pyfa
 def exportXml(self, callback=None, *fitIDs):
     fits = map(lambda fitID: eos.db.getFit(fitID), fitIDs)
     return Port.exportXml(callback, *fits)
 def exportXml(self, options, callback):
     fit = getFit(self.mainFrame.getActiveFit())
     Port.exportXml([fit], None, callback)
Exemplo n.º 10
0
 def exportXml(self, options, callback):
     fit = getFit(self.mainFrame.getActiveFit())
     Port.exportXml([fit], None, callback)
Exemplo n.º 11
0
 def clipboardXml(self, options):
     fit = db_getFit(self.getActiveFit())
     toClipboard(Port.exportXml(None, fit))