Skip to content

Commit

Permalink
Re #5939. Run mantidplotrc on IPython startup.
Browse files Browse the repository at this point in the history
This is in place of importing the individual mantid & mantidplot
modules and means that code completion in the 'F3 script window'
still works.
  • Loading branch information
RussellTaylor committed Oct 4, 2013
1 parent f73e296 commit abcea42
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Code/Mantid/MantidPlot/ipython_widget/mantid_ipython_widget.py
Expand Up @@ -12,10 +12,15 @@ def __init__(self, *args, **kw):
kernel = kernel_manager.kernel
kernel.gui = 'qt4'

import mantidplot
kernel.shell.push(mantidplot.__dict__)
import mantid.simpleapi
kernel.shell.push(mantid.simpleapi.__dict__)
# Figure out the full path to the mantidplotrc.py file and then %run it
from os import path
mantidplotpath = path.split(path.dirname(__file__))[0]
if not mantidplotpath:
# If the the file is in the cwd, then path.dirname returns an empty string
mantidplotrc = 'mantidplotrc.py'
else:
mantidplotrc = mantidplotpath + '/mantidplotrc.py'
kernel.shell.run_line_magic('run',mantidplotrc)

kernel_client = kernel_manager.client()
kernel_client.start_channels()
Expand Down

0 comments on commit abcea42

Please sign in to comment.