Skip to content

Commit

Permalink
Always import old python API. Refs #4399
Browse files Browse the repository at this point in the history
  • Loading branch information
martyngigg committed Apr 17, 2012
1 parent d6e3866 commit 626b9bb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 20 deletions.
8 changes: 0 additions & 8 deletions Code/Mantid/Framework/PythonAPI/MantidFramework.py
Original file line number Diff line number Diff line change
Expand Up @@ -1423,21 +1423,13 @@ def load_modules(self, refresh=False):
if len(dir_list) == 0:
mtd.sendLogMessage('PyAlgLoader.load_modules: no python algorithm directory found')
return

# Disable factory updates while everything is (re)imported
mtd._observeAlgFactoryUpdates(False,False)

# Check defined Python algorithm directories and load any modules
changes = False
for path in dir_list:
if path == '':
continue
if self._importAlgorithms(path, refresh):
changes = True

# Now connect the relevant signals to monitor for algorithm factory updates
mtd._observeAlgFactoryUpdates(True, (refresh and changes))

#
# ------- Private methods --------------
#
Expand Down
25 changes: 13 additions & 12 deletions Code/Mantid/MantidPlot/mantidplotrc.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,23 @@ def get_default_python_api():
return api_version

if __name__ == '__main__':
# Make Mantid available
from MantidFramework import *
# Initialize the Mantid framework
mtd.initialise()
# For some reason the algorithm definitions are not available within IPython
# Adding this fixes that and appears to do no harm elsewhere
from mantidsimple import *
# Make Mantid available without requiring users to import scripts
_api = get_default_python_api()
if _api == 1:
# Make Mantid available
from MantidFramework import *
# Initialize the Mantid framework
mtd.initialise()
# For some reason the algorithm definitions are not available within IPython
# Adding this fixes that and appears to do no harm elsewhere
from mantidsimple import *
elif _api == 2:
# Create simple API
if _api == 2:
# Put the new one on top
from mantid import *
from mantid.simpleapi import *
from mantid.simpleapi import *
elif _api != 1:
raise RuntimeError("Unknown Python API version requested: %d" % _api)
else:
raise Runtime("Unknown Python API version requested: %d" % _api)
pass

# Import MantidPlot python commands
from mantidplot import *
Expand Down

0 comments on commit 626b9bb

Please sign in to comment.