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

Method __addInputField

graphs/gui/ctrlPanel.py:225–256  ·  view source on GitHub ↗
(self, inputDef, handledHandles, mainInput=False)

Source from the content-addressed store, hash-verified

223 vector.SetDirectionOnly(vectorDef.lengthHandle == mainInputHandle)
224
225 def __addInputField(self, inputDef, handledHandles, mainInput=False):
226 if not self.__checkInputConditions(inputDef):
227 return
228 handledHandles.add(inputDef.handle)
229 fieldSizer = wx.BoxSizer(wx.HORIZONTAL)
230 tooltipText = (inputDef.mainTooltip if mainInput else inputDef.secondaryTooltip) or ''
231 if mainInput:
232 fieldTextBox = FloatRangeBox(self, self._storedRanges.get((inputDef.handle, inputDef.unit), inputDef.defaultRange))
233 fieldTextBox.Bind(wx.EVT_TEXT, self.OnMainInputChanged)
234 else:
235 fieldTextBox = FloatBox(self, self._storedConsts.get((inputDef.handle, inputDef.unit), inputDef.defaultValue))
236 fieldTextBox.Bind(wx.EVT_TEXT, self.OnNonMainInputChanged)
237 fieldTextBox.SetToolTip(wx.ToolTip(tooltipText))
238 fieldSizer.Add(fieldTextBox, 0, wx.EXPAND | wx.RIGHT, 5)
239 fieldIcon = None
240 if inputDef.iconID is not None:
241 icon = BitmapLoader.getBitmap(inputDef.iconID, 'icons')
242 if icon is not None:
243 fieldIcon = wx.StaticBitmap(self)
244 fieldIcon.SetBitmap(icon)
245 fieldIcon.SetToolTip(wx.ToolTip(tooltipText))
246 fieldSizer.Add(fieldIcon, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 3)
247 fieldLabel = wx.StaticText(self, wx.ID_ANY, self.formatLabel(inputDef))
248 fieldLabel.SetToolTip(wx.ToolTip(tooltipText))
249 fieldSizer.Add(fieldLabel, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 0)
250 self.inputsSizer.Add(fieldSizer, 0, wx.EXPAND | wx.BOTTOM, 5)
251 # Store info about added input box
252 inputBox = InputBox(handle=inputDef.handle, unit=inputDef.unit, textBox=fieldTextBox, icon=fieldIcon, label=fieldLabel)
253 if mainInput:
254 self._mainInputBox = inputBox
255 else:
256 self._miscInputBoxes.append(inputBox)
257
258 def __addInputCheckbox(self, checkboxDef, handledHandles):
259 if not self.__checkInputConditions(checkboxDef):

Callers 1

_updateInputsMethod · 0.95

Calls 8

formatLabelMethod · 0.95
FloatRangeBoxClass · 0.90
FloatBoxClass · 0.90
SetBitmapMethod · 0.80
getMethod · 0.45
getBitmapMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected