Permalink
Browse files

Merge pull request #1221 from efiring/revert_1125_oo_helper

revert PR #1125 and #1201
closes #1218 and #1212
  • Loading branch information...
2 parents 32dc947 + b0807ae commit 8b8d24f32dffd584f88dd24c265147ac69f74a9b @efiring efiring committed Sep 8, 2012
@@ -41,17 +41,6 @@ Features that depend on the Python Imaging Library, such as JPEG
handling, do not work, since the version of PIL for Python 3.x is not
sufficiently mature.
-Object-oriented interface
--------------------------
-
-Damon McDougall has reduced some of the boilerplate code needed to interact
-with the object-oriented interface. Now a figure canvas is set up by default::
-
- >>> from matplotlib.figure import Figure
- >>> fig = Figure()
- >>> ax = fig.add_subplot(1, 1, 1)
- >>> fig.savefig('figure.pdf')
-
PGF/TikZ backend
----------------
Peter Würtz wrote a backend that allows matplotlib to export figures as
@@ -515,5 +515,3 @@ def print_to_buffer(self):
(int(renderer.width), int(renderer.height)))
renderer.dpi = original_dpi
return result
-
-FigureCanvas = FigureCanvasAgg
@@ -512,5 +512,3 @@ def _save (self, fo, format, **kwargs):
ctx.show_page()
surface.finish()
-
-FigureCanvas = FigureCanvasCairo
@@ -89,7 +89,7 @@ def stop_event_loop(self):
FigureCanvasBase.stop_event_loop_default(self)
stop_event_loop.__doc__=FigureCanvasBase.stop_event_loop_default.__doc__
-FigureCanvas = FigureCanvasCocoaAgg
+
NibClassBuilder.extractClasses('Matplotlib.nib', mplBundle)
@@ -727,8 +727,6 @@ def print_emf(self, filename, dpi=300, **kwargs):
def get_default_filetype(self):
return 'emf'
-FigureCanvas = FigureCanvasEMF
-
class FigureManagerEMF(FigureManagerBase):
"""
Wrap everything up into a window for the pylab interface
@@ -231,8 +231,6 @@ def stop_event_loop(self):
FigureCanvasBase.stop_event_loop_default(self)
stop_event_loop.__doc__=FigureCanvasBase.stop_event_loop_default.__doc__
-FigureCanvas = FigureCanvasFltkAgg
-
def destroy_figure(ptr, figman):
figman.window.hide()
Fltk.Fl.wait(0) # This is needed to make the last figure vanish.
@@ -434,7 +434,7 @@ def new_figure_manager_given_figure(num, figure):
return manager
-class FigureCanvasGDK(FigureCanvasBase):
+class FigureCanvasGDK (FigureCanvasBase):
def __init__(self, figure):
FigureCanvasBase.__init__(self, figure)
@@ -472,5 +472,3 @@ def _print_image(self, filename, format, *args, **kwargs):
0, 0, 0, 0, width, height)
pixbuf.save(filename, format)
-
-FigureCanvas = FigureCanvasGDK
@@ -144,7 +144,7 @@ def _on_timer(self):
return False
-class FigureCanvasGTK(gtk.DrawingArea, FigureCanvasBase):
+class FigureCanvasGTK (gtk.DrawingArea, FigureCanvasBase):
keyvald = {65507 : 'control',
65505 : 'shift',
65513 : 'alt',
@@ -519,8 +519,6 @@ def stop_event_loop(self):
FigureCanvasBase.stop_event_loop_default(self)
stop_event_loop.__doc__=FigureCanvasBase.stop_event_loop_default.__doc__
-FigureCanvas = FigureCanvasGTK
-
class FigureManagerGTK(FigureManagerBase):
"""
Public attributes
@@ -98,7 +98,7 @@ def _on_timer(self):
self._timer = None
return False
-class FigureCanvasGTK3(Gtk.DrawingArea, FigureCanvasBase):
+class FigureCanvasGTK3 (Gtk.DrawingArea, FigureCanvasBase):
keyvald = {65507 : 'control',
65505 : 'shift',
65513 : 'alt',
@@ -67,7 +67,6 @@ def print_png(self, filename, *args, **kwargs):
agg = self.switch_backends(backend_agg.FigureCanvasAgg)
return agg.print_png(filename, *args, **kwargs)
-FigureCanvas = FigureCanvasGTK3Agg
class FigureManagerGTK3Agg(backend_gtk3.FigureManagerGTK3):
pass
@@ -34,7 +34,6 @@ def on_draw_event(self, widget, ctx):
return False # finish event propagation?
-FigureCanvas = FigureCanvasGTK3Cairo
class FigureManagerGTK3Cairo(backend_gtk3.FigureManagerGTK3):
pass
@@ -111,7 +111,6 @@ def print_png(self, filename, *args, **kwargs):
agg = self.switch_backends(FigureCanvasAgg)
return agg.print_png(filename, *args, **kwargs)
-FigureCanvas = FigureCanvasGTKAgg
"""\
Traceback (most recent call last):
@@ -55,7 +55,6 @@ def _renderer_init(self):
if _debug: print('%s.%s()' % (self.__class__.__name__, _fn_name()))
self._renderer = RendererGTKCairo (self.figure.dpi)
-FigureCanvas = FigureCanvasGTKCairo
class FigureManagerGTKCairo(FigureManagerGTK):
def _get_toolbar(self, canvas):
@@ -352,7 +352,6 @@ def new_timer(self, *args, **kwargs):
"""
return TimerMac(*args, **kwargs)
-FigureCanvas = FigureCanvasMac
class FigureManagerMac(_macosx.FigureManager, FigureManagerBase):
"""
@@ -2299,8 +2299,6 @@ def print_pdf(self, filename, **kwargs):
else: # we opened the file above; now finish it off
file.close()
-FigureCanvas = FigureCanvasPdf
-
class FigureManagerPdf(FigureManagerBase):
pass
@@ -838,8 +838,6 @@ def _render_texts_pgf(self, fh):
def get_renderer(self):
return RendererPgf(self.figure, None)
-FigureCanvas = FigureCanvasPgf
-
class FigureManagerPgf(FigureManagerBase):
def __init__(self, *args):
FigureManagerBase.__init__(self, *args)
@@ -1357,8 +1357,6 @@ def write(self, *kl, **kwargs):
shutil.move(tmpfile, outfile)
os.chmod(outfile, mode)
-FigureCanvas = FigureCanvasPS
-
def convert_psfrags(tmpfile, psfrags, font_preamble, custom_preamble,
paperWidth, paperHeight, orientation):
"""
@@ -203,8 +203,6 @@ def stop_event_loop(self):
FigureCanvasBase.stop_event_loop_default(self)
stop_event_loop.__doc__=FigureCanvasBase.stop_event_loop_default.__doc__
-FigureCanvas = FigureCanvasQT
-
class FigureManagerQT( FigureManagerBase ):
"""
Public attributes
@@ -377,8 +377,6 @@ def idle_draw(*args):
self._idle = True
if d: QtCore.QTimer.singleShot(0, idle_draw)
-FigureCanvas = FigureCanvasQT
-
class FigureManagerQT( FigureManagerBase ):
"""
Public attributes
@@ -145,5 +145,3 @@ def blit(self, bbox=None):
def print_figure(self, *args, **kwargs):
FigureCanvasAgg.print_figure(self, *args, **kwargs)
self.draw()
-
-FigureCanvas = FigureCanvasQTAgg
@@ -156,5 +156,3 @@ def blit(self, bbox=None):
def print_figure(self, *args, **kwargs):
FigureCanvasAgg.print_figure(self, *args, **kwargs)
self.draw()
-
-FigureCanvas = FigureCanvasQTAgg
@@ -1143,8 +1143,6 @@ def _print_svg(self, filename, svgwriter, fh_to_close=None, **kwargs):
def get_default_filetype(self):
return 'svg'
-FigureCanvas = FigureCanvasSVG
-
class FigureManagerSVG(FigureManagerBase):
pass
@@ -245,8 +245,6 @@ def print_foo(self, filename, *args, **kwargs):
def get_default_filetype(self):
return 'foo'
-FigureCanvas = FigureCanvasTemplate
-
class FigureManagerTemplate(FigureManagerBase):
"""
Wrap everything up into a window for the pylab interface
@@ -505,8 +505,6 @@ def stop_event_loop(self):
FigureCanvasBase.stop_event_loop_default(self)
stop_event_loop.__doc__=FigureCanvasBase.stop_event_loop_default.__doc__
-FigureCanvas = FigureCanvasTkAgg
-
class FigureManagerTkAgg(FigureManagerBase):
"""
Public attributes
@@ -1400,7 +1400,6 @@ def _onEnter(self, evt):
"""Mouse has entered the window."""
FigureCanvasBase.enter_notify_event(self, guiEvent = evt)
-FigureCanvas = FigureCanvasWx
########################################################################
#
@@ -105,8 +105,6 @@ def print_figure(self, filename, *args, **kwargs):
if self._isDrawn:
self.draw()
-FigureCanvas = FigureCanvasWxAgg
-
class NavigationToolbar2WxAgg(NavigationToolbar2Wx):
def get_canvas(self, frame, fig):
return FigureCanvasWxAgg(frame, -1, fig)
@@ -318,7 +318,7 @@ def __init__(self,
self.patch.set_aa(False)
self._hold = rcParams['axes.hold']
- self.canvas = self._setup_canvas()
+ self.canvas = None
if subplotpars is None:
subplotpars = SubplotParams()
@@ -330,14 +330,6 @@ def __init__(self,
self.clf()
self._cachedRenderer = None
- def _setup_canvas(self):
- """
- Return the FigureCanvas instance defined by the currently loaded backend.
- """
- import matplotlib.backends as mbackends # lazy import
- backend_mod = mbackends.pylab_setup()[0]
- return backend_mod.FigureCanvas(self)
-
def show(self, warn=True):
"""
If using a GUI backend with pyplot, display the figure window.

0 comments on commit 8b8d24f

Please sign in to comment.