##// END OF EJS Templates
Switch correctly to the user's default matplotlib backend after inline....
Switch correctly to the user's default matplotlib backend after inline. If '%matplotlib inline' was called first, we'd incorrectly revert to inline when plain '%matplotlib' was called, instead of loading the user's default GUI. If the user called '%matplotlib' first (without 'inline') it worked correctly, but not in the other order. The fix is to read the backend from the original defaults, not from the runtime data structure.

File last commit:

r11547:917c213a
r12593:bbb4baa8
Show More
datatypefilter.py
33 lines | 1.2 KiB | text/x-python | PythonLexer
"""Filter used to select the first preferred output format available.
The filter contained in the file allows the converter templates to select
the output format that is most valuable to the active export format. The
value of the different formats is set via
NbConvertBase.display_data_priority
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Classes and functions
#-----------------------------------------------------------------------------
from ..utils.base import NbConvertBase
__all__ = ['DataTypeFilter']
class DataTypeFilter(NbConvertBase):
""" Returns the preferred display format """
def __call__(self, output):
""" Return the first available format in the priority """
for fmt in self.display_data_priority:
if fmt in output:
return [fmt]
return []