diff --git a/spyderlib/config.py b/spyderlib/config.py index 39dcddb558a..1fd1854a801 100644 --- a/spyderlib/config.py +++ b/spyderlib/config.py @@ -253,10 +253,7 @@ def is_ubuntu(): 'qt/api': 'default', 'pyqt/api_version': 2, 'pyqt/ignore_sip_setapi_errors': False, - 'matplotlib/backend/enabled': True, - 'matplotlib/backend/value': 'MacOSX' if (sys.platform == 'darwin' \ - and os.environ.get('QT_API') == 'pyside')\ - else 'Qt4Agg', + 'matplotlib/backend/value': 0, 'umr/enabled': True, 'umr/verbose': True, 'umr/namelist': ['guidata', 'guiqwt'], @@ -745,7 +742,7 @@ def is_ubuntu(): # 2. If you want to *remove* options that are no longer needed in our codebase, # you need to do a MAJOR update in version, e.g. from 3.0.0 to 4.0.0 # 3. You don't need to touch this value if you're just adding a new option -CONF_VERSION = '18.1.0' +CONF_VERSION = '19.0.0' # XXX: Previously we had load=(not DEV) here but DEV was set to *False*. # Check if it *really* needs to be updated or not diff --git a/spyderlib/plugins/externalconsole.py b/spyderlib/plugins/externalconsole.py index cbd6681d2d5..4850cde09ab 100644 --- a/spyderlib/plugins/externalconsole.py +++ b/spyderlib/plugins/externalconsole.py @@ -318,29 +318,37 @@ def setup_page(self): pyqt_layout.addWidget(ignore_api_box) pyqt_group.setLayout(pyqt_layout) qt_layout.addWidget(pyqt_group) - + # Matplotlib Group - mpl_group = QGroupBox(_("Matplotlib")) - mpl_backend_box = newcb('', 'matplotlib/backend/enabled', True) - mpl_backend_edit = self.create_lineedit(_("GUI backend:"), - 'matplotlib/backend/value', - tip=_("Set the GUI toolkit used by
" - "Matplotlib to show figures " - "(default: Qt4Agg)"), - alignment=Qt.Horizontal) - mpl_backend_box.toggled.connect(mpl_backend_edit.setEnabled) - mpl_backend_layout = QHBoxLayout() - mpl_backend_layout.addWidget(mpl_backend_box) - mpl_backend_layout.addWidget(mpl_backend_edit) - mpl_backend_edit.setEnabled( - self.get_option('matplotlib/backend/enabled')) + mpl_group = QGroupBox(_("Graphics")) + mpl_label = QLabel(_("Decide which backend to use to display graphics. " + "If unsure, please select the Qt " + "backend.

" + "Note: We support a very limited amount " + "of backends in our Python consoles. If you " + "prefer to work with a different one, please use " + "an IPython console.")) + mpl_label.setWordWrap(True) + + backends = [("Qt", 0)] + if programs.is_module_installed('_tkinter'): + backends.append( ("Tkinter", 1) ) + if sys.platform == 'darwin': + backends.append( ("Mac OSX", 2) ) + backends = tuple(backends) + + mpl_backend_box = self.create_combobox( _("Backend:")+" ", backends, + 'matplotlib/backend/value', + tip=_("This option will be applied the " + "next time a console is opened.")) + mpl_installed = programs.is_module_installed('matplotlib') - mpl_layout = QVBoxLayout() - mpl_layout.addLayout(mpl_backend_layout) + mpl_layout.addWidget(mpl_label) + mpl_layout.addWidget(mpl_backend_box) mpl_group.setLayout(mpl_layout) mpl_group.setEnabled(mpl_installed) - + # ETS Group ets_group = QGroupBox(_("Enthought Tool Suite")) ets_label = QLabel(_("Enthought Tool Suite (ETS) supports " @@ -786,10 +794,7 @@ def start(self, fname, wdir=None, args='', interact=False, debug=False, else: pythonstartup = self.get_option('pythonstartup', None) monitor_enabled = self.get_option('monitor/enabled') - if self.get_option('matplotlib/backend/enabled'): - mpl_backend = self.get_option('matplotlib/backend/value') - else: - mpl_backend = None + mpl_backend = self.get_option('matplotlib/backend/value') ets_backend = self.get_option('ets_backend') qt_api = self.get_option('qt/api') if qt_api not in ('pyqt', 'pyside'): diff --git a/spyderlib/widgets/externalshell/pythonshell.py b/spyderlib/widgets/externalshell/pythonshell.py index ac30a2566d3..e87ea4f107b 100644 --- a/spyderlib/widgets/externalshell/pythonshell.py +++ b/spyderlib/widgets/externalshell/pythonshell.py @@ -467,8 +467,9 @@ def create_process(self): # External modules options env.append('ETS_TOOLKIT=%s' % self.ets_backend) - if self.mpl_backend: - env.append('MATPLOTLIB_BACKEND=%s' % self.mpl_backend) + if self.mpl_backend is not None: + backends = {0: 'Qt4Agg', 1: 'TkAgg', 2: 'MacOSX'} + env.append('MATPLOTLIB_BACKEND=%s' % backends[self.mpl_backend]) if self.qt_api: env.append('QT_API=%s' % self.qt_api) env.append('COLORIZE_SYS_STDERR=%s' % self.colorize_sys_stderr) diff --git a/spyderlib/widgets/externalshell/sitecustomize.py b/spyderlib/widgets/externalshell/sitecustomize.py index d3afefda62e..1d26c1f3884 100644 --- a/spyderlib/widgets/externalshell/sitecustomize.py +++ b/spyderlib/widgets/externalshell/sitecustomize.py @@ -596,9 +596,9 @@ def __init__(self, namelist=None, pathlist=None): if namelist is None: namelist = [] spy_modules = ['sitecustomize', 'spyderlib', 'spyderplugins'] - mpl_modules = ['matplotlib', 'tkinter', 'Tkinter', 'gtk'] + mpl_modules = ['matplotlib', 'tkinter', 'Tkinter'] self.namelist = namelist + spy_modules + mpl_modules - + if pathlist is None: pathlist = [] self.pathlist = pathlist