From: <ef...@us...> - 2009-03-11 20:40:45
|
Revision: 6973 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6973&view=rev Author: efiring Date: 2009-03-11 19:45:23 +0000 (Wed, 11 Mar 2009) Log Message: ----------- Merged revisions 6972 via svnmerge from https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_98_5_maint ........ r6972 | efiring | 2009-03-11 09:36:22 -1000 (Wed, 11 Mar 2009) | 2 lines Ensure wx version >= 2.8; Sandro Tosi patch plus change to backend ........ Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/examples/user_interfaces/embedding_in_wx2.py trunk/matplotlib/examples/user_interfaces/embedding_in_wx3.py trunk/matplotlib/examples/user_interfaces/embedding_in_wx4.py trunk/matplotlib/examples/user_interfaces/embedding_in_wx5.py trunk/matplotlib/lib/matplotlib/backends/backend_wx.py trunk/matplotlib/lib/matplotlib/backends/backend_wxagg.py Property Changed: ---------------- trunk/matplotlib/ trunk/matplotlib/doc/pyplots/README trunk/matplotlib/doc/sphinxext/gen_gallery.py trunk/matplotlib/doc/sphinxext/gen_rst.py trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6960 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-6972 Modified: svn:mergeinfo - /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960 + /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972 Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2009-03-11 19:36:22 UTC (rev 6972) +++ trunk/matplotlib/CHANGELOG 2009-03-11 19:45:23 UTC (rev 6973) @@ -1,3 +1,6 @@ +2009-03-11 Ensure wx version >= 2.8; thanks to Sandro Tosi and + Chris Barker. - EF + 2009-03-10 Fix join style bug in pdf. - JKS 2009-03-07 Add pyplot access to figure number list - EF Property changes on: trunk/matplotlib/doc/pyplots/README ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960 + /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972 Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960 + /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972 Property changes on: trunk/matplotlib/doc/sphinxext/gen_rst.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960 + /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972 Modified: trunk/matplotlib/examples/user_interfaces/embedding_in_wx2.py =================================================================== --- trunk/matplotlib/examples/user_interfaces/embedding_in_wx2.py 2009-03-11 19:36:22 UTC (rev 6972) +++ trunk/matplotlib/examples/user_interfaces/embedding_in_wx2.py 2009-03-11 19:45:23 UTC (rev 6973) @@ -4,6 +4,10 @@ toolbar - comment out the setA_toolbar line for no toolbar """ +# Used to guarantee to use at least Wx2.8 +import wxversion +wxversion.ensureMinimal('2.8') + from numpy import arange, sin, pi import matplotlib @@ -20,15 +24,15 @@ from matplotlib.figure import Figure -from wx import * +import wx -class CanvasFrame(Frame): +class CanvasFrame(wx.Frame): def __init__(self): - Frame.__init__(self,None,-1, + wx.Frame.__init__(self,None,-1, 'CanvasFrame',size=(550,350)) - self.SetBackgroundColour(NamedColor("WHITE")) + self.SetBackgroundColour(wx.NamedColor("WHITE")) self.figure = Figure() self.axes = self.figure.add_subplot(111) @@ -38,8 +42,8 @@ self.axes.plot(t,s) self.canvas = FigureCanvas(self, -1, self.figure) - self.sizer = BoxSizer(VERTICAL) - self.sizer.Add(self.canvas, 1, LEFT | TOP | GROW) + self.sizer = wx.BoxSizer(wx.VERTICAL) + self.sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW) self.SetSizer(self.sizer) self.Fit() @@ -49,7 +53,7 @@ def add_toolbar(self): self.toolbar = NavigationToolbar2Wx(self.canvas) self.toolbar.Realize() - if Platform == '__WXMAC__': + if wx.Platform == '__WXMAC__': # Mac platform (OSX 10.3, MacPython) does not seem to cope with # having a toolbar in a sizer. This work-around gets the buttons # back, but at the expense of having the toolbar at the top @@ -62,8 +66,8 @@ # By adding toolbar in sizer, we are able to put it at the bottom # of the frame - so appearance is closer to GTK version. # As noted above, doesn't work for Mac. - self.toolbar.SetSize(Size(fw, th)) - self.sizer.Add(self.toolbar, 0, LEFT | EXPAND) + self.toolbar.SetSize(wx.Size(fw, th)) + self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND) # update the axes menu on the toolbar self.toolbar.update() @@ -71,7 +75,7 @@ def OnPaint(self, event): self.canvas.draw() -class App(App): +class App(wx.App): def OnInit(self): 'Create the main window and insert the custom frame' Modified: trunk/matplotlib/examples/user_interfaces/embedding_in_wx3.py =================================================================== --- trunk/matplotlib/examples/user_interfaces/embedding_in_wx3.py 2009-03-11 19:36:22 UTC (rev 6972) +++ trunk/matplotlib/examples/user_interfaces/embedding_in_wx3.py 2009-03-11 19:45:23 UTC (rev 6973) @@ -18,6 +18,11 @@ Thanks to matplotlib and wx teams for creating such great software! """ + +# Used to guarantee to use at least Wx2.8 +import wxversion +wxversion.ensureMinimal('2.8') + import sys, time, os, gc import matplotlib matplotlib.use('WXAgg') @@ -26,18 +31,18 @@ from matplotlib.figure import Figure import numpy as npy -from wx import * -from wx.xrc import * +import wx +import wx.xrc as xrc ERR_TOL = 1e-5 # floating point slop for peak-detection matplotlib.rc('image', origin='lower') -class PlotPanel(Panel): +class PlotPanel(wx.Panel): def __init__(self, parent): - Panel.__init__(self, parent, -1) + wx.Panel.__init__(self, parent, -1) self.fig = Figure((5,4), 75) self.canvas = FigureCanvasWxAgg(self, -1, self.fig) @@ -46,11 +51,11 @@ #self.toolbar.set_active([0,1]) # Now put all into a sizer - sizer = BoxSizer(VERTICAL) + sizer = wx.BoxSizer(wx.VERTICAL) # This way of adding to sizer allows resizing - sizer.Add(self.canvas, 1, LEFT|TOP|GROW) + sizer.Add(self.canvas, 1, wx.LEFT|wx.TOP|wx.GROW) # Best to allow the toolbar to resize! - sizer.Add(self.toolbar, 0, GROW) + sizer.Add(self.toolbar, 0, wx.GROW) self.SetSizer(sizer) self.Fit() @@ -94,43 +99,43 @@ # this is supposed to prevent redraw flicker on some X servers... pass -class MyApp(App): +class MyApp(wx.App): def OnInit(self): xrcfile = os.path.join(os.path.dirname(__file__),"..","data", "embedding_in_wx3.xrc") - self.res = XmlResource(xrcfile) + self.res = xrc.XmlResource(xrcfile) # main frame and panel --------- self.frame = self.res.LoadFrame(None,"MainFrame") - self.panel = XRCCTRL(self.frame,"MainPanel") + self.panel = xrc.XRCCTRL(self.frame,"MainPanel") # matplotlib panel ------------- # container for matplotlib panel (I like to make a container # panel for our panel so I know where it'll go when in XRCed.) - plot_container = XRCCTRL(self.frame,"plot_container_panel") - sizer = BoxSizer(VERTICAL) + plot_container = xrc.XRCCTRL(self.frame,"plot_container_panel") + sizer = wx.BoxSizer(wx.VERTICAL) # matplotlib panel itself self.plotpanel = PlotPanel(plot_container) self.plotpanel.init_plot_data() # wx boilerplate - sizer.Add(self.plotpanel, 1, EXPAND) + sizer.Add(self.plotpanel, 1, wx.EXPAND) plot_container.SetSizer(sizer) # whiz button ------------------ - whiz_button = XRCCTRL(self.frame,"whiz_button") - EVT_BUTTON(whiz_button, whiz_button.GetId(), - self.plotpanel.OnWhiz) + whiz_button = xrc.XRCCTRL(self.frame,"whiz_button") + wx.EVT_BUTTON(whiz_button, whiz_button.GetId(), + self.plotpanel.OnWhiz) # bang button ------------------ - bang_button = XRCCTRL(self.frame,"bang_button") - EVT_BUTTON(bang_button, bang_button.GetId(), - self.OnBang) + bang_button = xrc.XRCCTRL(self.frame,"bang_button") + wx.EVT_BUTTON(bang_button, bang_button.GetId(), + self.OnBang) # final setup ------------------ Modified: trunk/matplotlib/examples/user_interfaces/embedding_in_wx4.py =================================================================== --- trunk/matplotlib/examples/user_interfaces/embedding_in_wx4.py 2009-03-11 19:36:22 UTC (rev 6972) +++ trunk/matplotlib/examples/user_interfaces/embedding_in_wx4.py 2009-03-11 19:45:23 UTC (rev 6973) @@ -4,6 +4,10 @@ toolbar """ +# Used to guarantee to use at least Wx2.8 +import wxversion +wxversion.ensureMinimal('2.8') + from numpy import arange, sin, pi import matplotlib @@ -16,13 +20,13 @@ from matplotlib.figure import Figure from numpy.random import rand -from wx import * +import wx class MyNavigationToolbar(NavigationToolbar2WxAgg): """ Extend the default wx toolbar with your own event handlers """ - ON_CUSTOM = NewId() + ON_CUSTOM = wx.NewId() def __init__(self, canvas, cankill): NavigationToolbar2WxAgg.__init__(self, canvas) @@ -30,7 +34,7 @@ # probably want to add your own. self.AddSimpleTool(self.ON_CUSTOM, _load_bitmap('stock_left.xpm'), 'Click me', 'Activate custom contol') - EVT_TOOL(self, self.ON_CUSTOM, self._on_custom) + wx.EVT_TOOL(self, self.ON_CUSTOM, self._on_custom) def _on_custom(self, evt): # add some text to the axes in a random location in axes (0,1) @@ -51,13 +55,13 @@ evt.Skip() -class CanvasFrame(Frame): +class CanvasFrame(wx.Frame): def __init__(self): - Frame.__init__(self,None,-1, + wx.Frame.__init__(self,None,-1, 'CanvasFrame',size=(550,350)) - self.SetBackgroundColour(NamedColor("WHITE")) + self.SetBackgroundColour(wx.NamedColor("WHITE")) self.figure = Figure(figsize=(5,4), dpi=100) self.axes = self.figure.add_subplot(111) @@ -68,14 +72,14 @@ self.canvas = FigureCanvas(self, -1, self.figure) - self.sizer = BoxSizer(VERTICAL) - self.sizer.Add(self.canvas, 1, TOP | LEFT | EXPAND) + self.sizer = wx.BoxSizer(wx.VERTICAL) + self.sizer.Add(self.canvas, 1, wx.TOP | wx.LEFT | wx.EXPAND) # Capture the paint message - EVT_PAINT(self, self.OnPaint) + wx.EVT_PAINT(self, self.OnPaint) self.toolbar = MyNavigationToolbar(self.canvas, True) self.toolbar.Realize() - if Platform == '__WXMAC__': + if wx.Platform == '__WXMAC__': # Mac platform (OSX 10.3, MacPython) does not seem to cope with # having a toolbar in a sizer. This work-around gets the buttons # back, but at the expense of having the toolbar at the top @@ -88,8 +92,8 @@ # By adding toolbar in sizer, we are able to put it at the bottom # of the frame - so appearance is closer to GTK version. # As noted above, doesn't work for Mac. - self.toolbar.SetSize(Size(fw, th)) - self.sizer.Add(self.toolbar, 0, LEFT | EXPAND) + self.toolbar.SetSize(wx.Size(fw, th)) + self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND) # update the axes menu on the toolbar self.toolbar.update() @@ -101,7 +105,7 @@ self.canvas.draw() event.Skip() -class App(App): +class App(wx.App): def OnInit(self): 'Create the main window and insert the custom frame' Modified: trunk/matplotlib/examples/user_interfaces/embedding_in_wx5.py =================================================================== --- trunk/matplotlib/examples/user_interfaces/embedding_in_wx5.py 2009-03-11 19:36:22 UTC (rev 6972) +++ trunk/matplotlib/examples/user_interfaces/embedding_in_wx5.py 2009-03-11 19:45:23 UTC (rev 6973) @@ -1,3 +1,7 @@ +# Used to guarantee to use at least Wx2.8 +import wxversion +wxversion.ensureMinimal('2.8') + import wx import wx.aui import matplotlib as mpl Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wx.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2009-03-11 19:36:22 UTC (rev 6972) +++ trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2009-03-11 19:45:23 UTC (rev 6973) @@ -108,12 +108,23 @@ import traceback, pdb _DEBUG_lvls = {1 : 'Low ', 2 : 'Med ', 3 : 'High', 4 : 'Error' } +missingwx = "Matplotlib backend_wx and backend_wxagg require wxPython >=2.8" try: + import wxversion +except ImportError: + raise ImportError(missingwx) + +try: + wxversion.ensureMinimal('2.8') +except wxversion.AlreadyImportedError: + pass + +try: import wx backend_version = wx.VERSION_STRING -except: - raise ImportError("Matplotlib backend_wx requires wxPython be installed") +except ImportError: + raise ImportError(missingwx) #!!! this is the call that is causing the exception swallowing !!! #wx.InitAllImageHandlers() Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wxagg.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_wxagg.py 2009-03-11 19:36:22 UTC (rev 6972) +++ trunk/matplotlib/lib/matplotlib/backends/backend_wxagg.py 2009-03-11 19:45:23 UTC (rev 6973) @@ -16,17 +16,16 @@ """ -import wx import matplotlib from matplotlib.figure import Figure from backend_agg import FigureCanvasAgg -import backend_wx +import backend_wx # already uses wxversion.ensureMinimal('2.8') from backend_wx import FigureManager, FigureManagerWx, FigureCanvasWx, \ FigureFrameWx, DEBUG_MSG, NavigationToolbar2Wx, error_msg_wx, \ draw_if_interactive, show, Toolbar, backend_version +import wx - class FigureFrameWxAgg(FigureFrameWx): def get_canvas(self, fig): return FigureCanvasWxAgg(self, -1, fig) Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960 + /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960 + /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960 + /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |