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

Method __init__

gui/builtinItemStatsViews/itemMutator.py:70–173  ·  view source on GitHub ↗
(self, parent, stuff)

Source from the content-addressed store, hash-verified

68class ItemMutatorList(wx.ScrolledWindow):
69
70 def __init__(self, parent, stuff):
71 wx.ScrolledWindow.__init__(self, parent)
72 self.SetScrollRate(0, 15)
73 self.carryingFitID = gui.mainFrame.MainFrame.getInstance().getActiveFit()
74 self.initialMutations = {}
75 self.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW))
76 self.stuff = stuff
77 self.timer = None
78 self.isModified = False
79
80 goodColor = wx.Colour(96, 191, 0)
81 badColor = wx.Colour(255, 64, 0)
82 font = parent.GetFont()
83 font.SetWeight(wx.BOLD)
84
85 sizer = wx.BoxSizer(wx.VERTICAL)
86
87 self.event_mapping = {}
88 higOverrides = {
89 ('Stasis Web', 'speedFactor'): False,
90 ('Damage Control', 'duration'): True,
91 ('Siege Module', 'siegeLocalLogisticsDurationBonus'): False
92 }
93 first = True
94 for m in sorted(stuff.mutators.values(), key=lambda x: x.attribute.displayName):
95 if m.baseValue == 0:
96 continue
97 if not first:
98 sizer.Add(wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL), 0, wx.ALL | wx.EXPAND, 5)
99 first = False
100
101 self.initialMutations[m.attrID] = m.value
102
103 highIsGood = higOverrides.get((stuff.item.group.name, m.attribute.name), m.highIsGood)
104 # Format: [raw value, modifier applied to base raw value, display value]
105 range1 = (m.minValue, self._simplifyValue(m, m.minValue))
106 range2 = (m.maxValue, self._simplifyValue(m, m.maxValue))
107
108 # minValue/maxValue do not always correspond to min/max, because these are
109 # just base value multiplied by minMod/maxMod, and in case base is negative
110 # minValue is actually bigger than maxValue
111 if range1[0] <= range2[0]:
112 minRange = range1
113 maxRange = range2
114 else:
115 minRange = range2
116 maxRange = range1
117
118 if (highIsGood and minRange[0] >= maxRange[0]) or (not highIsGood and minRange[0] <= maxRange[0]):
119 betterRange = minRange
120 worseRange = maxRange
121 else:
122 betterRange = maxRange
123 worseRange = minRange
124
125 if minRange[1] >= maxRange[1]:
126 displayMaxRange = minRange
127 displayMinRange = maxRange

Callers 1

__init__Method · 0.45

Calls 11

_simplifyValueMethod · 0.95
_preformatValueMethod · 0.95
SetValueMethod · 0.95
AttributeSliderClass · 0.85
SetBackgroundColourMethod · 0.80
valuesMethod · 0.80
getStaticBitmapMethod · 0.80
FormatValueMethod · 0.80
getActiveFitMethod · 0.45
getInstanceMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected