(fit, options, callback)
| 65 | |
| 66 | |
| 67 | def exportEft(fit, options, callback): |
| 68 | |
| 69 | mutaData = MutationExportData() |
| 70 | |
| 71 | # EFT formatted export is split in several sections, each section is |
| 72 | # separated from another using 2 blank lines. Sections might have several |
| 73 | # sub-sections, which are separated by 1 blank line |
| 74 | sections = [] |
| 75 | |
| 76 | header = '[{}, {}]'.format(fit.ship.item.typeName, fit.name) |
| 77 | |
| 78 | # Section 1: modules, rigs, subsystems, services |
| 79 | moduleExport = exportModules(fit.modules, options, mutaData=mutaData) |
| 80 | if moduleExport: |
| 81 | sections.append(moduleExport) |
| 82 | |
| 83 | # Section 2: drones, fighters |
| 84 | minionSection = [] |
| 85 | droneExport = exportDrones( |
| 86 | fit.drones, exportMutants=options[PortEftOptions.MUTATIONS], |
| 87 | mutaData=mutaData, standAlone=False) |
| 88 | if droneExport: |
| 89 | minionSection.append(droneExport) |
| 90 | fighterExport = exportFighters(fit.fighters) |
| 91 | if fighterExport: |
| 92 | minionSection.append(fighterExport) |
| 93 | if minionSection: |
| 94 | sections.append('\n\n'.join(minionSection)) |
| 95 | |
| 96 | # Section 3: implants, boosters |
| 97 | charSection = [] |
| 98 | if options[PortEftOptions.IMPLANTS]: |
| 99 | implantExport = exportImplants(fit.implants) |
| 100 | if implantExport: |
| 101 | charSection.append(implantExport) |
| 102 | if options[PortEftOptions.BOOSTERS]: |
| 103 | boosterExport = exportBoosters(fit.boosters) |
| 104 | if boosterExport: |
| 105 | charSection.append(boosterExport) |
| 106 | if charSection: |
| 107 | sections.append('\n\n'.join(charSection)) |
| 108 | |
| 109 | # Section 4: cargo |
| 110 | if options[PortEftOptions.CARGO]: |
| 111 | cargoExport = exportCargo(fit.cargo) |
| 112 | if cargoExport: |
| 113 | sections.append(cargoExport) |
| 114 | |
| 115 | # Section 5: mutated items' details |
| 116 | if options[PortEftOptions.MUTATIONS]: |
| 117 | mutationExport = mutaData.formatMutants() |
| 118 | if mutationExport: |
| 119 | sections.append(mutationExport) |
| 120 | |
| 121 | text = '{}\n\n{}'.format(header, '\n\n\n'.join(sections)) |
| 122 | |
| 123 | if callback: |
| 124 | callback(text) |
no test coverage detected