~ubuntu-branches/debian/sid/spyder/sid

« back to all changes in this revision

Viewing changes to spyderlib/widgets/ipython.py

  • Committer: Package Import Robot
  • Author(s): Picca Frédéric-Emmanuel
  • Date: 2013-09-06 21:24:11 UTC
  • mto: (1.1.21)
  • mto: This revision was merged to the branch mainline in revision 23.
  • Revision ID: package-import@ubuntu.com-20130906212411-4ubfco3gkvt0tccz
Tags: upstream-2.2.4+dfsg
Import upstream version 2.2.4+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
"""
10
10
 
11
11
# IPython imports
12
 
from IPython.frontend.qt.console.rich_ipython_widget import RichIPythonWidget
 
12
try:  # 1.0
 
13
    from IPython.qt.console.rich_ipython_widget import RichIPythonWidget
 
14
except ImportError: # 0.13
 
15
    from IPython.frontend.qt.console.rich_ipython_widget import RichIPythonWidget
13
16
 
14
17
# Qt imports
15
18
from spyderlib.qt.QtGui import QTextEdit, QKeySequence, QShortcut
18
21
 
19
22
# Local imports
20
23
from spyderlib.config import CONF
 
24
from spyderlib.utils import programs
21
25
from spyderlib.widgets.mixins import (BaseEditMixin, InspectObjectMixin,
22
26
                                      TracebackLinksMixin)
23
27
 
153
157
        banner = default_gui_banner
154
158
        
155
159
        pylab_o = CONF.get('ipython_console', 'pylab', True)
156
 
        if pylab_o:
 
160
        autoload_pylab_o = CONF.get('ipython_console', 'pylab/autoload', True)
 
161
        mpl_installed = programs.is_module_installed('matplotlib')
 
162
        if mpl_installed and (pylab_o and autoload_pylab_o):
157
163
            backend_o = CONF.get('ipython_console', 'pylab/backend', 0)
158
164
            backends = {0: 'module://IPython.zmq.pylab.backend_inline',
159
165
                        1: 'Qt4Agg', 2: 'Qt4Agg', 3: 'MacOSX', 4: 'GTKAgg',
167
173
        if sympy_o:
168
174
            lines = """
169
175
These commands were executed:
170
 
from __future__ import division
171
 
from sympy import *
172
 
x, y, z, t = symbols('x y z t')
173
 
k, m, n = symbols('k m n', integer=True)
174
 
f, g, h = symbols('f g h', cls=Function)
 
176
>>> from __future__ import division
 
177
>>> from sympy import *
 
178
>>> x, y, z, t = symbols('x y z t')
 
179
>>> k, m, n = symbols('k m n', integer=True)
 
180
>>> f, g, h = symbols('f g h', cls=Function)
175
181
"""
176
182
            banner = banner + lines
177
183
        return banner
185
191
        but only if the kernel is currently looking for raw input.
186
192
        """
187
193
        if self._reading:
188
 
            self.kernel_manager.stdin_channel.input(line)
 
194
            if programs.is_module_installed('IPython', '>=1.0'):
 
195
                self.kernel_client.stdin_channel.input(line)
 
196
            else:
 
197
                self.kernel_manager.stdin_channel.input(line)
189
198
 
190
199
    #---- IPython private methods ---------------------------------------------
191
200
    def _context_menu_make(self, pos):