MCPcopy Create free account
hub / github.com/pyfa-org/Pyfa / getSubMenu

Method getSubMenu

gui/builtinContextMenus/fitPilotSecurity.py:46–74  ·  view source on GitHub ↗
(self, callingWindow, context, rootMenu, i, pitem)

Source from the content-addressed store, hash-verified

44 return menuItem
45
46 def getSubMenu(self, callingWindow, context, rootMenu, i, pitem):
47 fitID = self.mainFrame.getActiveFit()
48 fit = Fit.getInstance().getFit(fitID)
49 msw = True if "wxMSW" in wx.PlatformInfo else False
50 self.optionIds = {}
51 sub = wx.Menu()
52 presets = (-10, -8, -6, -4, -2, 0, 1, 2, 3, 4, 5)
53 # Inherit
54 char_sec_status = round(fit.character.secStatus, 2)
55 menuItem = self.addOption(rootMenu if msw else sub, _t('Character') + f' ({char_sec_status})', None)
56 sub.Append(menuItem)
57 menuItem.Check(fit.pilotSecurity is None)
58 # Custom
59 label = _t('Custom')
60 is_checked = False
61 if fit.pilotSecurity is not None and fit.pilotSecurity not in presets:
62 sec_status = round(fit.getPilotSecurity(), 2)
63 label += f' ({sec_status})'
64 is_checked = True
65 menuItem = self.addOptionCustom(rootMenu if msw else sub, label)
66 sub.Append(menuItem)
67 menuItem.Check(is_checked)
68 sub.AppendSeparator()
69 # Predefined options
70 for sec_status in presets:
71 menuItem = self.addOption(rootMenu if msw else sub, str(sec_status), sec_status)
72 sub.Append(menuItem)
73 menuItem.Check(fit.pilotSecurity == sec_status)
74 return sub
75
76 def handleMode(self, event):
77 optionValue = self.optionIds[event.Id]

Callers

nothing calls this directly

Calls 7

addOptionMethod · 0.95
addOptionCustomMethod · 0.95
getFitMethod · 0.80
getPilotSecurityMethod · 0.80
_tFunction · 0.50
getActiveFitMethod · 0.45
getInstanceMethod · 0.45

Tested by

no test coverage detected