Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1e7b473

Browse files
committed
Try again to make temporary fix for backend case-sensitivity
svn path=/trunk/matplotlib/; revision=5435
1 parent 1c555f9 commit 1e7b473

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

lib/matplotlib/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,10 @@ def use(arg, warn=True):
772772
rcParams['cairo.format'] = validate_cairo_format(be_parts[1])
773773

774774
def get_backend():
775-
return rcParams['backend'].lower()
775+
# Validation is needed because the rcParams entry might have
776+
# been set directly rather than via "use()".
777+
return validate_backend(rcParams['backend'])
778+
#return rcParams['backend'].lower()
776779

777780
def interactive(b):
778781
"""

lib/matplotlib/backends/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11

22
import matplotlib
33
from matplotlib.rcsetup import interactive_bk
4+
from matplotlib.rcsetup import non_interactive_bk
5+
from matplotlib.rcsetup import all_backends
46
from matplotlib.rcsetup import validate_backend
57

68
__all__ = ['backend','show','draw_if_interactive',
79
'new_figure_manager', 'backend_version']
810

9-
backend = matplotlib.get_backend() # makes sure it is lower case
10-
validate_backend(backend)
11+
backend = matplotlib.get_backend() # validates, to match all_backends
1112

1213
def pylab_setup():
1314
'return new_figure_manager, draw_if_interactive and show for pylab'
1415
# Import the requested backend into a generic module object
1516

1617
backend_name = 'backend_'+backend
18+
backend_name = backend_name.lower() # until we banish mixed case
1719
backend_mod = __import__('matplotlib.backends.'+backend_name,
1820
globals(),locals(),[backend_name])
1921

@@ -36,7 +38,7 @@ def show(): pass
3638

3739
# Additional imports which only happen for certain backends. This section
3840
# should probably disappear once all backends are uniform.
39-
if backend in ['wx','wxagg']:
41+
if backend.lower() in ['wx','wxagg']:
4042
Toolbar = backend_mod.Toolbar
4143
__all__.append('Toolbar')
4244

lib/matplotlib/pyplot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def figure(num=None, # autoincrement if None, else integer from 1-N
185185

186186
figManager = _pylab_helpers.Gcf.get_fig_manager(num)
187187
if figManager is None:
188-
if get_backend()=='PS': dpi = 72
188+
if get_backend().lower() == 'ps': dpi = 72
189189

190190
figManager = new_figure_manager(num, figsize=figsize,
191191
dpi=dpi,

0 commit comments

Comments
 (0)