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

Method toggleContext

gui/builtinStatsViews/resourcesViewFull.py:56–81  ·  view source on GitHub ↗
(self, context)

Source from the content-addressed store, hash-verified

54 event.Skip()
55
56 def toggleContext(self, context):
57 # Apparently you cannot .Hide(True) on a Window, otherwise I would just .Hide(context !== x).
58 # This is a gimpy way to toggle this shit
59 for x in self.contexts:
60 bitmap = getattr(self, "bitmapFull{}Bay".format(x.capitalize()))
61 base = getattr(self, "baseFull{}Bay".format(x.capitalize()))
62
63 if context == x:
64 bitmap.Show()
65 base.Show(True)
66 else:
67 bitmap.Hide()
68 base.Hide(True)
69
70 fighter_sizer = getattr(self, "boxSizerFighter")
71 drone_sizer = getattr(self, "boxSizerDrones")
72
73 if context != "fighter":
74 fighter_sizer.ShowItems(False)
75 drone_sizer.ShowItems(True)
76 else:
77 fighter_sizer.ShowItems(True)
78 drone_sizer.ShowItems(False)
79
80 self.panel.Layout()
81 self.headerPanel.Layout()
82
83 def getHeaderText(self, fit):
84 return _t("Resources")

Callers 2

pageChangedMethod · 0.95
populatePanelMethod · 0.95

Calls 2

HideMethod · 0.80
ShowMethod · 0.45

Tested by

no test coverage detected