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

Method __init__

gui/copySelectDialog.py:44–137  ·  view source on GitHub ↗
(self, parent)

Source from the content-addressed store, hash-verified

42 copyFormatFitStats = 6
43
44 def __init__(self, parent):
45 self.MULTIBUY_OPTIONS = (
46 (PortMultiBuyOptions.LOADED_CHARGES, _t('Loaded Charges'), _t('Export charges loaded into modules'), True),
47 (PortMultiBuyOptions.IMPLANTS, _t('Implants'), _t('Export implants'), False),
48 (PortMultiBuyOptions.BOOSTERS, _t('Boosters'), _t('Export boosters'), False),
49 (PortMultiBuyOptions.CARGO, _t('Cargo'), _t('Export cargo contents'), True),
50 (PortMultiBuyOptions.OPTIMIZE_PRICES, _t('Optimize Prices'), _t('Replace items by cheaper alternatives'), False),
51 )
52 self.EFT_OPTIONS = (
53 (PortEftOptions.LOADED_CHARGES, _t('Loaded Charges'), _t('Export charges loaded into modules'), True),
54 (PortEftOptions.MUTATIONS, _t('Mutated Attributes'), _t('Export mutated modules\' stats'), True),
55 (PortEftOptions.IMPLANTS, _t('Implants'), _t('Export implants'), True),
56 (PortEftOptions.BOOSTERS, _t('Boosters'), _t('Export boosters'), True),
57 (PortEftOptions.CARGO, _t('Cargo'), _t('Export cargo hold contents'), True))
58 self.DNA_OPTIONS = (
59 (PortDnaOptions.FORMATTING, _t('Formatting Tags'), _t('Include formatting tags to paste fit directly into corp bulletins, MOTD, etc.'), True),
60 )
61
62 super().__init__(parent, id=wx.ID_ANY, title=_t("Select a format"), size=(-1, -1), style=wx.DEFAULT_DIALOG_STYLE)
63
64 self.CopySelectDict = {
65 CopySelectDialog.copyFormatEft: self.exportEft,
66 CopySelectDialog.copyFormatXml: self.exportXml,
67 CopySelectDialog.copyFormatDna: self.exportDna,
68 CopySelectDialog.copyFormatEsi: self.exportEsi,
69 CopySelectDialog.copyFormatMultiBuy: self.exportMultiBuy,
70 CopySelectDialog.copyFormatEfs: self.exportEfs,
71 CopySelectDialog.copyFormatFitStats: self.exportFitStats
72 }
73
74 self.mainFrame = parent
75 mainSizer = wx.BoxSizer(wx.VERTICAL)
76
77 self.copyFormats = OrderedDict((
78 ("EFT", (CopySelectDialog.copyFormatEft, self.EFT_OPTIONS)),
79 ("MultiBuy", (CopySelectDialog.copyFormatMultiBuy, self.MULTIBUY_OPTIONS)),
80 ("ESI", (CopySelectDialog.copyFormatEsi, None)),
81 ("DNA", (CopySelectDialog.copyFormatDna, self.DNA_OPTIONS)),
82 ("EFS", (CopySelectDialog.copyFormatEfs, None)),
83 ("Stats", (CopySelectDialog.copyFormatFitStats, None)),
84 # ("XML", (CopySelectDialog.copyFormatXml, None)),
85 ))
86
87 defaultFormatOptions = {}
88 for formatId, formatOptions in self.copyFormats.values():
89 if formatOptions is None:
90 continue
91 defaultFormatOptions[formatId] = {opt[0]: opt[3] for opt in formatOptions}
92
93 self.settings = SettingsProvider.getInstance().getSettings("pyfaExport", {"format": self.copyFormatEft, "options": defaultFormatOptions})
94 # Options used to be stored as int (EFT export options only),
95 # overwrite them with new format when needed
96 if isinstance(self.settings["options"], int):
97 self.settings["options"] = defaultFormatOptions
98
99 self.options = {}
100
101 initialized = False

Callers

nothing calls this directly

Calls 8

toggleOptionsMethod · 0.95
valuesMethod · 0.80
getSettingsMethod · 0.80
itemsMethod · 0.80
_tFunction · 0.50
getInstanceMethod · 0.45
SetValueMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected