From 81d61d7e29127c9cc34c9a64cd4ed4b815639317 Mon Sep 17 00:00:00 2001 From: blitzmann Date: Sat, 24 Feb 2018 13:49:17 -0500 Subject: [PATCH] lol context management not available in 4.0.0b2, and can't update to >4.0 until #1421 is addressed --- gui/builtinShipBrowser/pfBitmapFrame.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/gui/builtinShipBrowser/pfBitmapFrame.py b/gui/builtinShipBrowser/pfBitmapFrame.py index dd2d888d5..85ad487d6 100644 --- a/gui/builtinShipBrowser/pfBitmapFrame.py +++ b/gui/builtinShipBrowser/pfBitmapFrame.py @@ -55,9 +55,11 @@ class PFBitmapFrame(wx.Frame): # (like the sexy fade-in animation) rect = self.GetRect() canvas = wx.Bitmap(rect.width, rect.height) - with wx.BufferedPaintDC(self) as mdc: - mdc.SelectObject(canvas) - mdc.DrawBitmap(self.bitmap, 0, 0) - mdc.SetPen(wx.Pen("#000000", width=1)) - mdc.SetBrush(wx.TRANSPARENT_BRUSH) - mdc.DrawRectangle(0, 0, rect.width, rect.height) + # todo: convert to context manager after updating to wxPython >v4.0.1 (4.0.1 has a bug, see #1421) + # See #1418 for discussion + mdc = wx.BufferedPaintDC(self) + mdc.SelectObject(canvas) + mdc.DrawBitmap(self.bitmap, 0, 0) + mdc.SetPen(wx.Pen("#000000", width=1)) + mdc.SetBrush(wx.TRANSPARENT_BRUSH) + mdc.DrawRectangle(0, 0, rect.width, rect.height)