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

Method OnPaint

gui/chrome_tabs.py:1180–1240  ·  view source on GitHub ↗
(self, event)

Source from the content-addressed store, hash-verified

1178 self.Refresh()
1179
1180 def OnPaint(self, event):
1181 mdc = wx.AutoBufferedPaintDC(self)
1182
1183 # if 'wxMac' in wx.PlatformInfo:
1184 # color = wx.Colour(0, 0, 0)
1185 # brush = wx.Brush(color)
1186 # # @todo: what needs to be changed with wxPheonix?
1187 # from Carbon.Appearance import kThemeBrushDialogBackgroundActive
1188 # brush.MacSetTheme(kThemeBrushDialogBackgroundActive)
1189 # else:
1190 color = wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DFACE)
1191 brush = wx.Brush(color)
1192
1193 if "wxGTK" not in wx.PlatformInfo:
1194 mdc.SetBackground(brush)
1195 mdc.Clear()
1196
1197 selected = None
1198
1199 if self.show_add_button:
1200 ax, ay = self.add_button.GetPosition()
1201 mdc.DrawBitmap(self.add_button.Render(), round(ax), round(ay), True)
1202
1203 for i in range(len(self.tabs) - 1, -1, -1):
1204 tab = self.tabs[i]
1205 posx, posy = tab.GetPosition()
1206
1207 if not tab.IsSelected():
1208 # drop shadow first
1209 mdc.DrawBitmap(self.fxBmps[tab], round(posx), (posy), True)
1210 bmp = tab.Render()
1211 img = bmp.ConvertToImage()
1212 img = img.AdjustChannels(1, 1, 1, 0.85)
1213 bmp = wx.Bitmap(img)
1214 mdc.DrawBitmap(bmp, round(posx), (posy), True)
1215
1216 mdc.SetDeviceOrigin(round(posx), round(posy))
1217 tab.DrawText(mdc)
1218 mdc.SetDeviceOrigin(0, 0)
1219 else:
1220 selected = tab
1221
1222 # we draw selected tab separately (instead of in else) so as to not hide
1223 # the front bit behind the preceding tab
1224 if selected:
1225 posx, posy = selected.GetPosition()
1226 # drop shadow first
1227 mdc.DrawBitmap(self.fxBmps[selected], round(posx), round(posy), True)
1228
1229 bmp = selected.Render()
1230
1231 if self.dragging:
1232 img = bmp.ConvertToImage()
1233 img = img.AdjustChannels(1.2, 1.2, 1.2, 0.7)
1234 bmp = wx.Bitmap(img)
1235
1236 mdc.DrawBitmap(bmp, round(posx), round(posy), True)
1237

Callers

nothing calls this directly

Calls 6

IsSelectedMethod · 0.80
AdjustChannelsMethod · 0.80
DrawTextMethod · 0.80
ClearMethod · 0.45
GetPositionMethod · 0.45
RenderMethod · 0.45

Tested by

no test coverage detected