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

Class RaceSelector

gui/builtinShipBrowser/raceSelector.py:15–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13
14
15class RaceSelector(wx.Window):
16 def __init__(self, parent, id=wx.ID_ANY, label="", pos=wx.DefaultPosition, size=wx.DefaultSize, style=0,
17 layout=wx.VERTICAL, animate=False):
18 wx.Window.__init__(self, parent, id, pos=pos, size=size, style=style)
19
20 self.animTimerID = wx.NewId()
21 self.animTimer = wx.Timer(self, self.animTimerID)
22 self.animPeriod = 25
23 self.animDuration = 250
24 self.animStep = 0
25 self.maxWidth = 24
26 self.minWidth = 5 if animate else self.maxWidth
27 self.maxHeight = 24
28 self.minHeight = 10 if animate else self.maxHeight
29
30 self.direction = 0 if animate else 1
31 self.layout = layout
32 self.animate = animate
33
34 if layout == wx.VERTICAL:
35 self.SetSize(wx.Size(self.minWidth, -1))
36 self.SetMinSize(wx.Size(self.minWidth, -1))
37 else:
38 self.SetSize(wx.Size(-1, self.minHeight))
39 self.SetMinSize(wx.Size(-1, self.minHeight))
40
41 self.checkTimerID = wx.NewId()
42 self.checkTimer = wx.Timer(self, self.checkTimerID)
43 self.checkPeriod = 250
44 self.checkMaximize = True
45 self.shipBrowser = self.Parent
46 self.raceBmps = []
47 self.raceNames = []
48 self.hoveredItem = None
49
50 if layout == wx.VERTICAL:
51 self.buttonsBarPos = (4, 0)
52 else:
53 self.buttonsBarPos = (0, 4)
54
55 self.buttonsPadding = 4
56
57 if layout == wx.VERTICAL:
58 self.bmpArrow = BitmapLoader.getBitmap("down-arrow2", "gui")
59 else:
60 self.bmpArrow = BitmapLoader.getBitmap("up-arrow2", "gui")
61
62 # Make the bitmaps have the same color as window text
63
64 sysTextColour = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWTEXT)
65
66 img = self.bmpArrow.ConvertToImage()
67 if layout == wx.VERTICAL:
68 img = img.Rotate90(False)
69 img.Replace(0, 0, 0, sysTextColour[0], sysTextColour[1], sysTextColour[2])
70 if layout == wx.VERTICAL:
71 img = img.Scale(round(self.minWidth), 8, wx.IMAGE_QUALITY_HIGH)
72

Callers 1

__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected