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

Method DrawItem

gui/builtinShipBrowser/shipItem.py:233–280  ·  view source on GitHub ↗
(self, mdc)

Source from the content-addressed store, hash-verified

231 self.thoverw = wlabel
232
233 def DrawItem(self, mdc):
234 # rect = self.GetRect()
235
236 windowColor = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)
237 textColor = colorUtils.GetSuitable(windowColor, 1)
238
239 mdc.SetTextForeground(textColor)
240
241 self.UpdateElementsPos(mdc)
242
243 self.toolbar.SetPosition((self.toolbarx, self.toolbary))
244
245 if self.GetState() & SFItem.SB_ITEM_HIGHLIGHTED:
246 shipEffBk = self.shipEffBkMirrored
247 else:
248 shipEffBk = self.shipEffBk
249
250 mdc.DrawBitmap(shipEffBk, round(self.shipEffx), round(self.shipEffy), 0)
251
252 mdc.DrawBitmap(self.shipBmp, round(self.shipBmpx), round(self.shipBmpy), 0)
253
254 mdc.DrawBitmap(self.raceDropShadowBmp, round(self.raceBmpx + 1), round(self.raceBmpy + 1))
255 mdc.DrawBitmap(self.raceBmp, round(self.raceBmpx), round(self.raceBmpy))
256
257 shipName, shipTrait, fittings = self.shipFittingInfo
258
259 if fittings < 1:
260 fformat = "No fits"
261 elif fittings == 1:
262 fformat = "%d fit"
263 else:
264 fformat = "%d fits"
265
266 mdc.SetFont(self.fontNormal)
267 mdc.DrawText(fformat % fittings if fittings > 0 else fformat, round(self.textStartx), round(self.fittingsy))
268
269 mdc.SetFont(self.fontSmall)
270 mdc.DrawText(self.toolbar.hoverLabel, round(self.thoverx), round(self.thovery))
271
272 mdc.SetFont(self.fontBig)
273
274 psname = drawUtils.GetPartialText(mdc, shipName,
275 self.toolbarx - self.textStartx - self.padding * 2 - self.thoverw)
276
277 mdc.DrawText(psname, round(self.textStartx), round(self.shipNamey))
278
279 if self.tcFitName.IsShown():
280 self.AdjustControlSizePos(self.tcFitName, self.textStartx, self.toolbarx - self.editWidth - self.padding)
281
282 def AdjustControlSizePos(self, editCtl, start, end):
283 fnEditSize = editCtl.GetSize()

Callers

nothing calls this directly

Calls 5

UpdateElementsPosMethod · 0.95
AdjustControlSizePosMethod · 0.95
DrawTextMethod · 0.80
SetPositionMethod · 0.45
GetStateMethod · 0.45

Tested by

no test coverage detected