8000 wx backend should not attempt to render jpeg/tiff if PIL is present. · matplotlib/matplotlib@9192c2e · GitHub
[go: up one dir, main page]

Skip to content

Commit 9192c2e

Browse files
author
Daniel Hyams
committed
wx backend should not attempt to render jpeg/tiff if PIL is present.
If PIL is present, the wx backend needs to allow the base class to get the job done for print_jpeg and print_tiff, instead of trying to take over duties itself.
1 parent 9bb698a commit 9192c2e

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

lib/matplotlib/backends/backend_wx.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ def bind(actor,event,action,id=None):
128128
FigureCanvasBase, FigureManagerBase, NavigationToolbar2, \
129129
cursors, TimerBase
130130
from matplotlib.backend_bases import ShowBase
131+
from matplotlib.backend_bases import _has_pil
131132

132133
from matplotlib._pylab_helpers import Gcf
133134
from matplotlib.artist import Artist
@@ -1132,19 +1133,21 @@ def print_figure(self, filename, *args, **kwargs):
11321133
def print_bmp(self, filename, *args, **kwargs):
11331134
return self._print_image(filename, wx.BITMAP_TYPE_BMP, *args, **kwargs)
11341135

1135-
def print_jpeg(self, filename, *args, **kwargs):
1136-
return self._print_image(filename, wx.BITMAP_TYPE_JPEG, *args, **kwargs)
1137-
print_jpg = print_jpeg
1136+
if not _has_pil:
1137+
def print_jpeg(self, filename, *args, **kwargs):
1138+
return self._print_image(filename, wx.BITMAP_TYPE_JPEG, *args, **kwargs)
1139+
print_jpg = print_jpeg
11381140

11391141
def print_pcx(self, filename, *args, **kwargs):
11401142
return self._print_image(filename, wx.BITMAP_TYPE_PCX, *args, **kwargs)
11411143

11421144
def print_png(self, filename, *args, **kwargs):
11431145
return self._print_image(filename, wx.BITMAP_TYPE_PNG, *args, **kwargs)
11441146

1145-
def print_tiff(self, filename, *args, **kwargs):
1146-
return self._print_image(filename, wx.BITMAP_TYPE_TIF, *args, **kwargs)
1147-
print_tif = print_tiff
1147+
if not _has_pil:
1148+
def print_tiff(self, filename, *args, **kwargs):
1149+
return self._print_image(filename, wx.BITMAP_TYPE_TIF, *args, **kwargs)
1150+
print_tif = print_tiff
11481151

11491152
def print_xpm(self, filename, *args, **kwargs):
11501153
return self._print_image(filename, wx.BITMAP_TYPE_XPM, *args, **kwargs)

0 commit comments

Comments
 (0)
0