From 81f8c41a243e74f1d2402bd7b310c64a8f34707d Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 6 Sep 2017 16:54:03 -0700 Subject: [PATCH] Fix missing imports needed for drawing the legend --- CHANGES.rst | 4 +++- wx/lib/plot/plotcanvas.py | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 680e055a..37433da0 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -30,7 +30,7 @@ Changes in this release include the following: * New tool wxget, (a minimal wx implementation of wget) -* New tools wxdocs and wxdemos to launch the respective items fetching and +* New tools wxdocs and wxdemos to launch the respective items, fetching and unpacking as required. (#437) * Fixes to ensure that the locale message catalogs are included in the @@ -70,6 +70,8 @@ Changes in this release include the following: * Add wx.Simplebook class. +* Fix missing imports needed for drawing the legend in wx.lib.plot. (#503) + diff --git a/wx/lib/plot/plotcanvas.py b/wx/lib/plot/plotcanvas.py index 6ca81e59..af4884dd 100644 --- a/wx/lib/plot/plotcanvas.py +++ b/wx/lib/plot/plotcanvas.py @@ -2234,10 +2234,15 @@ class PlotCanvas(wx.Panel): # 1.1 used as space between lines lineHeight = max(legendSymExt[1], legendTextExt[1]) * 1.1 dc.SetFont(self._getFont(self._fontSizeLegend)) + + from .polyobjects import PolyLine + from .polyobjects import PolyMarker + from .polyobjects import PolyBoxPlot + for i in range(len(graphics)): o = graphics[i] s = i * lineHeight - if isinstance(o, PolyMarker) or isinstance(o, BoxPlot): + if isinstance(o, PolyMarker) or isinstance(o, PolyBoxPlot): # draw marker with legend pnt = (trhc[0] + legendLHS + legendSymExt[0] / 2., trhc[1] + s + lineHeight / 2.)