From ec06a93a35c3f6c8a2f2b75ce862d0e98dab35e1 Mon Sep 17 00:00:00 2001 From: wernerfb Date: Wed, 27 May 2015 12:57:25 +0200 Subject: [PATCH 1/4] add show, as otherwise line 51 in backends.__init__ returns the do_nothing_show method --- lib/matplotlib/backends/backend_wxagg.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/matplotlib/backends/backend_wxagg.py b/lib/matplotlib/backends/backend_wxagg.py index 3fb31bb5a4b8..8acd2b9e4cd5 100644 --- a/lib/matplotlib/backends/backend_wxagg.py +++ b/lib/matplotlib/backends/backend_wxagg.py @@ -16,6 +16,9 @@ import wx +show = backend_wx.Show() + + class FigureFrameWxAgg(FigureFrameWx): def get_canvas(self, fig): return FigureCanvasWxAgg(self, -1, fig) From e90bfe9de939e034a5d349d3dc5543abb4b358d2 Mon Sep 17 00:00:00 2001 From: wernerfb Date: Wed, 27 May 2015 12:59:05 +0200 Subject: [PATCH 2/4] handle GetSizeTuple for Phoenix use wx.Yield instead of WakeUpIdle --- lib/matplotlib/backends/backend_wx.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/matplotlib/backends/backend_wx.py b/lib/matplotlib/backends/backend_wx.py index 3f25350c4965..6cf87a77b7db 100644 --- a/lib/matplotlib/backends/backend_wx.py +++ b/lib/matplotlib/backends/backend_wx.py @@ -1271,8 +1271,12 @@ def __init__(self, num, fig): self.toolbar.Realize() # On Windows platform, default window size is incorrect, so set # toolbar width to figure width. - tw, th = self.toolbar.GetSizeTuple() - fw, fh = self.canvas.GetSizeTuple() + if wxc.is_phoenix: + tw, th = self.toolbar.GetSize() + fw, fh = self.canvas.GetSize() + else: + tw, th = self.toolbar.GetSizeTuple() + fw, fh = self.canvas.GetSizeTuple() # By adding toolbar in sizer, we are able to put it at the bottom # of the frame - so appearance is closer to GTK version. self.toolbar.SetSize(wx.Size(fw, th)) @@ -1370,9 +1374,10 @@ def show(self): def destroy(self, *args): DEBUG_MSG("destroy()", 1, self) self.frame.Destroy() - #if self.tb is not None: self.tb.Destroy() - # wx.GetApp().ProcessIdle() - wx.WakeUpIdle() + wxapp = wx.GetApp() + if wxapp: + wxapp.Yield() + def get_window_title(self): return self.window.GetTitle() From af9deb375ae6f5701dd359eb26022b4937384ea3 Mon Sep 17 00:00:00 2001 From: wernerfb Date: Wed, 27 May 2015 13:29:06 +0200 Subject: [PATCH 3/4] pep8 correction --- lib/matplotlib/backends/backend_wx.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/matplotlib/backends/backend_wx.py b/lib/matplotlib/backends/backend_wx.py index 6cf87a77b7db..0dc47caee48d 100644 --- a/lib/matplotlib/backends/backend_wx.py +++ b/lib/matplotlib/backends/backend_wx.py @@ -1377,7 +1377,6 @@ def destroy(self, *args): wxapp = wx.GetApp() if wxapp: wxapp.Yield() - def get_window_title(self): return self.window.GetTitle() From 3523f9e406678be0e7ec252a18fd94519b6326a7 Mon Sep 17 00:00:00 2001 From: wernerfb Date: Wed, 27 May 2015 13:36:37 +0200 Subject: [PATCH 4/4] a couple more GetSizeTuple uses and a GetPositionTuple --- lib/matplotlib/backends/backend_wx.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/backends/backend_wx.py b/lib/matplotlib/backends/backend_wx.py index 0dc47caee48d..1c2a578edcd3 100644 --- a/lib/matplotlib/backends/backend_wx.py +++ b/lib/matplotlib/backends/backend_wx.py @@ -1461,8 +1461,12 @@ def Destroy(self): def _onMenuButton(self, evt): """Handle menu button pressed.""" - x, y = self.GetPositionTuple() - w, h = self.GetSizeTuple() + if wxc.is_phoenix: + x, y = self.GetPosition() + w, h = self.GetSize() + else: + x, y = self.GetPositionTuple() + w, h = self.GetSizeTuple() self.PopupMenuXY(self._menu, x, y + h - 4) # When menu returned, indicate selection in button evt.Skip() @@ -1783,7 +1787,10 @@ def OnPrintPage(self, page): (ppw, pph) = self.GetPPIPrinter() # printer's pixels per in (pgw, pgh) = self.GetPageSizePixels() # page size in pixels (dcw, dch) = dc.GetSize() - (grw, grh) = self.canvas.GetSizeTuple() + if wxc.is_phoenix: + (grw, grh) = self.canvas.GetSize() + else: + (grw, grh) = self.canvas.GetSizeTuple() # save current figure dpi resolution and bg color, # so that we can temporarily set them to the dpi of