/
usr
/
lib64
/
python2.6
/
site-packages
/
matplotlib
/
backends
/
/usr/lib64/python2.6/site-packages/matplotlib/backends
mkdir
upload
Name
Size
Mode
Actions
Matplotlib.nib/
-
0755
rm
backend_agg.py
13037
0644
edit
dl
rm
backend_agg.pyc
14578
0644
edit
dl
rm
backend_agg.pyo
13367
0644
edit
dl
rm
backend_cairo.py
16493
0644
edit
dl
rm
backend_cairo.pyc
18270
0644
edit
dl
rm
backend_cairo.pyo
18270
0644
edit
dl
rm
backend_cocoaagg.py
8988
0644
edit
dl
rm
backend_cocoaagg.pyc
11930
0644
edit
dl
rm
backend_cocoaagg.pyo
11930
0644
edit
dl
rm
backend_emf.py
22336
0644
edit
dl
rm
backend_emf.pyc
25220
0644
edit
dl
rm
backend_emf.pyo
25220
0644
edit
dl
rm
backend_fltkagg.py
20852
0644
edit
dl
rm
backend_fltkagg.pyc
26631
0644
edit
dl
rm
backend_fltkagg.pyo
26631
0644
edit
dl
rm
backend_gdk.py
15968
0644
edit
dl
rm
backend_gdk.pyc
17157
0644
edit
dl
rm
backend_gdk.pyo
17157
0644
edit
dl
rm
backend_gtk.py
40707
0644
edit
dl
rm
backend_gtk.pyc
45101
0644
edit
dl
rm
backend_gtk.pyo
45101
0644
edit
dl
rm
backend_gtkagg.py
4134
0644
edit
dl
rm
backend_gtkagg.pyc
5088
0644
edit
dl
rm
backend_gtkagg.pyo
5088
0644
edit
dl
rm
backend_gtkcairo.py
2079
0644
edit
dl
rm
backend_gtkcairo.pyc
3740
0644
edit
dl
rm
backend_gtkcairo.pyo
3740
0644
edit
dl
rm
backend_macosx.py
14644
0644
edit
dl
rm
backend_macosx.pyc
20536
0644
edit
dl
rm
backend_macosx.pyo
20439
0644
edit
dl
rm
backend_mixed.py
5166
0644
edit
dl
rm
backend_mixed.pyc
4844
0644
edit
dl
rm
backend_mixed.pyo
4773
0644
edit
dl
rm
backend_pdf.py
77716
0644
edit
dl
rm
backend_pdf.pyc
66626
0644
edit
dl
rm
backend_pdf.pyo
66508
0644
edit
dl
rm
backend_ps.py
51444
0644
edit
dl
rm
backend_ps.pyc
48055
0644
edit
dl
rm
backend_ps.pyo
48055
0644
edit
dl
rm
backend_qt.py
16846
0644
edit
dl
rm
backend_qt.pyc
21065
0644
edit
dl
rm
backend_qt.pyo
21065
0644
edit
dl
rm
backend_qt4.py
21006
0644
edit
dl
rm
backend_qt4.pyc
24697
0644
edit
dl
rm
backend_qt4.pyo
24697
0644
edit
dl
rm
backend_qt4agg.py
4799
0644
edit
dl
rm
backend_qt4agg.pyc
5883
0644
edit
dl
rm
backend_qt4agg.pyo
5883
0644
edit
dl
rm
backend_qtagg.py
4972
0644
edit
dl
rm
backend_qtagg.pyc
6014
0644
edit
dl
rm
backend_qtagg.pyo
6014
0644
edit
dl
rm
backend_svg.py
25951
0644
edit
dl
rm
backend_svg.pyc
24476
0644
edit
dl
rm
backend_svg.pyo
24368
0644
edit
dl
rm
backend_template.py
8806
0644
edit
dl
rm
backend_template.pyc
9385
0644
edit
dl
rm
backend_template.pyo
9385
0644
edit
dl
rm
backend_wx.py
78921
0644
edit
dl
rm
backend_wx.pyc
79007
0644
edit
dl
rm
backend_wx.pyo
78931
0644
edit
dl
rm
backend_wxagg.py
9099
0644
edit
dl
rm
backend_wxagg.pyc
9363
0644
edit
dl
rm
backend_wxagg.pyo
9363
0644
edit
dl
rm
_backend_agg.so
430792
0775
edit
dl
rm
_backend_gdk.so
8168
0775
edit
dl
rm
_gtkagg.so
143816
0775
edit
dl
rm
__init__.py
2225
0644
edit
dl
rm
__init__.pyc
2120
0644
edit
dl
rm
__init__.pyo
2120
0644
edit
dl
rm
Edit:
/usr/lib64/python2.6/site-packages/matplotlib/backends/backend_wxagg.py
(9099B)
from __future__ import division """ backend_wxagg.py A wxPython backend for Agg. This uses the GUI widgets written by Jeremy O'Donoghue (jeremy@o-donoghue.com) and the Agg backend by John Hunter (jdhunter@ace.bsd.uchicago.edu) Copyright (C) 2003-5 Jeremy O'Donoghue, John Hunter, Illinois Institute of Technology License: This work is licensed under the matplotlib license( PSF compatible). A copy should be included with this source code. """ import matplotlib from matplotlib.figure import Figure from backend_agg import FigureCanvasAgg 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) def _get_toolbar(self, statbar): if matplotlib.rcParams['toolbar']=='classic': toolbar = NavigationToolbarWx(self.canvas, True) elif matplotlib.rcParams['toolbar']=='toolbar2': toolbar = NavigationToolbar2WxAgg(self.canvas) toolbar.set_status_bar(statbar) else: toolbar = None return toolbar class FigureCanvasWxAgg(FigureCanvasAgg, FigureCanvasWx): """ The FigureCanvas contains the figure and does event handling. In the wxPython backend, it is derived from wxPanel, and (usually) lives inside a frame instantiated by a FigureManagerWx. The parent window probably implements a wxSizer to control the displayed control size - but we give a hint as to our preferred minimum size. """ def draw(self, drawDC=None): """ Render the figure using agg. """ DEBUG_MSG("draw()", 1, self) FigureCanvasAgg.draw(self) self.bitmap = _convert_agg_to_wx_bitmap(self.get_renderer(), None) self._isDrawn = True self.gui_repaint(drawDC=drawDC) def blit(self, bbox=None): """ Transfer the region of the agg buffer defined by bbox to the display. If bbox is None, the entire buffer is transferred. """ if bbox is None: self.bitmap = _convert_agg_to_wx_bitmap(self.get_renderer(), None) self.gui_repaint() return l, b, w, h = bbox.bounds r = l + w t = b + h x = int(l) y = int(self.bitmap.GetHeight() - t) srcBmp = _convert_agg_to_wx_bitmap(self.get_renderer(), None) srcDC = wx.MemoryDC() srcDC.SelectObject(srcBmp) destDC = wx.MemoryDC() destDC.SelectObject(self.bitmap) destDC.BeginDrawing() destDC.Blit(x, y, int(w), int(h), srcDC, x, y) destDC.EndDrawing() destDC.SelectObject(wx.NullBitmap) srcDC.SelectObject(wx.NullBitmap) self.gui_repaint() filetypes = FigureCanvasAgg.filetypes def print_figure(self, filename, *args, **kwargs): # Use pure Agg renderer to draw FigureCanvasAgg.print_figure(self, filename, *args, **kwargs) # Restore the current view; this is needed because the # artist contains methods rely on particular attributes # of the rendered figure for determining things like # bounding boxes. if self._isDrawn: self.draw() class NavigationToolbar2WxAgg(NavigationToolbar2Wx): def get_canvas(self, frame, fig): return FigureCanvasWxAgg(frame, -1, fig) def new_figure_manager(num, *args, **kwargs): """ Create a new figure manager instance """ # in order to expose the Figure constructor to the pylab # interface we need to create the figure here DEBUG_MSG("new_figure_manager()", 3, None) backend_wx._create_wx_app() FigureClass = kwargs.pop('FigureClass', Figure) fig = FigureClass(*args, **kwargs) frame = FigureFrameWxAgg(num, fig) figmgr = frame.get_figure_manager() if matplotlib.is_interactive(): figmgr.frame.Show() return figmgr # # agg/wxPython image conversion functions (wxPython <= 2.6) # def _py_convert_agg_to_wx_image(agg, bbox): """ Convert the region of the agg buffer bounded by bbox to a wx.Image. If bbox is None, the entire buffer is converted. Note: agg must be a backend_agg.RendererAgg instance. """ image = wx.EmptyImage(int(agg.width), int(agg.height)) image.SetData(agg.tostring_rgb()) if bbox is None: # agg => rgb -> image return image else: # agg => rgb -> image => bitmap => clipped bitmap => image return wx.ImageFromBitmap(_clipped_image_as_bitmap(image, bbox)) def _py_convert_agg_to_wx_bitmap(agg, bbox): """ Convert the region of the agg buffer bounded by bbox to a wx.Bitmap. If bbox is None, the entire buffer is converted. Note: agg must be a backend_agg.RendererAgg instance. """ if bbox is None: # agg => rgb -> image => bitmap return wx.BitmapFromImage(_py_convert_agg_to_wx_image(agg, None)) else: # agg => rgb -> image => bitmap => clipped bitmap return _clipped_image_as_bitmap( _py_convert_agg_to_wx_image(agg, None), bbox) def _clipped_image_as_bitmap(image, bbox): """ Convert the region of a wx.Image bounded by bbox to a wx.Bitmap. """ l, b, width, height = bbox.get_bounds() r = l + width t = b + height srcBmp = wx.BitmapFromImage(image) srcDC = wx.MemoryDC() srcDC.SelectObject(srcBmp) destBmp = wx.EmptyBitmap(int(width), int(height)) destDC = wx.MemoryDC() destDC.SelectObject(destBmp) destDC.BeginDrawing() x = int(l) y = int(image.GetHeight() - t) destDC.Blit(0, 0, int(width), int(height), srcDC, x, y) destDC.EndDrawing() srcDC.SelectObject(wx.NullBitmap) destDC.SelectObject(wx.NullBitmap) return destBmp # # agg/wxPython image conversion functions (wxPython >= 2.8) # def _py_WX28_convert_agg_to_wx_image(agg, bbox): """ Convert the region of the agg buffer bounded by bbox to a wx.Image. If bbox is None, the entire buffer is converted. Note: agg must be a backend_agg.RendererAgg instance. """ if bbox is None: # agg => rgb -> image image = wx.EmptyImage(int(agg.width), int(agg.height)) image.SetData(agg.tostring_rgb()) return image else: # agg => rgba buffer -> bitmap => clipped bitmap => image return wx.ImageFromBitmap(_WX28_clipped_agg_as_bitmap(agg, bbox)) def _py_WX28_convert_agg_to_wx_bitmap(agg, bbox): """ Convert the region of the agg buffer bounded by bbox to a wx.Bitmap. If bbox is None, the entire buffer is converted. Note: agg must be a backend_agg.RendererAgg instance. """ if bbox is None: # agg => rgba buffer -> bitmap return wx.BitmapFromBufferRGBA(int(agg.width), int(agg.height), agg.buffer_rgba(0, 0)) else: # agg => rgba buffer -> bitmap => clipped bitmap return _WX28_clipped_agg_as_bitmap(agg, bbox) def _WX28_clipped_agg_as_bitmap(agg, bbox): """ Convert the region of a the agg buffer bounded by bbox to a wx.Bitmap. Note: agg must be a backend_agg.RendererAgg instance. """ l, b, width, height = bbox.get_bounds() r = l + width t = b + height srcBmp = wx.BitmapFromBufferRGBA(int(agg.width), int(agg.height), agg.buffer_rgba(0, 0)) srcDC = wx.MemoryDC() srcDC.SelectObject(srcBmp) destBmp = wx.EmptyBitmap(int(width), int(height)) destDC = wx.MemoryDC() destDC.SelectObject(destBmp) destDC.BeginDrawing() x = int(l) y = int(int(agg.height) - t) destDC.Blit(0, 0, int(width), int(height), srcDC, x, y) destDC.EndDrawing() srcDC.SelectObject(wx.NullBitmap) destDC.SelectObject(wx.NullBitmap) return destBmp def _use_accelerator(state): """ Enable or disable the WXAgg accelerator, if it is present and is also compatible with whatever version of wxPython is in use. """ global _convert_agg_to_wx_image global _convert_agg_to_wx_bitmap if getattr(wx, '__version__', '0.0')[0:3] < '2.8': # wxPython < 2.8, so use the C++ accelerator or the Python routines if state and _wxagg is not None: _convert_agg_to_wx_image = _wxagg.convert_agg_to_wx_image _convert_agg_to_wx_bitmap = _wxagg.convert_agg_to_wx_bitmap else: _convert_agg_to_wx_image = _py_convert_agg_to_wx_image _convert_agg_to_wx_bitmap = _py_convert_agg_to_wx_bitmap else: # wxPython >= 2.8, so use the accelerated Python routines _convert_agg_to_wx_image = _py_WX28_convert_agg_to_wx_image _convert_agg_to_wx_bitmap = _py_WX28_convert_agg_to_wx_bitmap # try to load the WXAgg accelerator try: import _wxagg except ImportError: _wxagg = None # if it's present, use it _use_accelerator(True)
Save
cmd:
run