Commit 8badfad6 authored by Stephen Smith's avatar Stephen Smith Committed by Smith
Browse files

Remove python interfaces location from mantid.propertiesa

parent 437926be
......@@ -135,7 +135,6 @@ ConfigServiceImpl::ConfigServiceImpl()
setBaseDirectory();
m_configPaths.insert("mantidqt.python_interfaces_directory");
m_configPaths.insert("framework.plugins.directory");
m_configPaths.insert("mantidqt.plugins.directory");
m_configPaths.insert("instrumentDefinition.directory");
......
......@@ -25,9 +25,6 @@ mantidqt.python_interfaces = ILL/Drill.py Direct/DGS_Reduction.py Direct/DGSPlan
mantidqt.python_interfaces_io_registry = Engineering_Diffraction_register.py
# Directory containing the above startup scripts
mantidqt.python_interfaces_directory = @PYTHON_INTERFACES_DIR@
# Where to find mantid framework plugins
framework.plugins.directory = @FRAMEWORK_PLUGINS_DIR@
......
......@@ -118,7 +118,6 @@ class ConfigServiceTest(unittest.TestCase):
# test with single string
do_test(';'.join(new_path_list))
def test_appending_paths(self):
new_path_list = self._setup_test_areas()
try:
......@@ -155,7 +154,8 @@ class ConfigServiceTest(unittest.TestCase):
'workspace.sendto.SansView.arguments', 'workspace.sendto.SansView.saveusing', # related to SASview in menu
'workspace.sendto.SansView.target', 'workspace.sendto.SansView.visible', # related to SASview in menu
'workspace.sendto.name.SansView', # related to SASview in menu
'catalog.oncat.token.accessToken', 'catalog.oncat.token.expiresIn', 'catalog.oncat.token.refreshToken', 'catalog.oncat.token.scope', 'catalog.oncat.token.tokenType', # Shouldn't be changed by users.
# Shouldn't be changed by users.
'catalog.oncat.token.accessToken', 'catalog.oncat.token.expiresIn', 'catalog.oncat.token.refreshToken', 'catalog.oncat.token.scope', 'catalog.oncat.token.tokenType',
########## TODO should be documented!
'filefinder.casesensitive',
......@@ -173,8 +173,7 @@ class ConfigServiceTest(unittest.TestCase):
'curvefitting.defaultPeak', 'curvefitting.findPeaksFWHM', 'curvefitting.findPeaksTolerance', 'curvefitting.guiExclude',
'logging.channels.consoleChannel.class', 'logging.channels.consoleChannel.formatter', 'logging.formatters.f1.class', 'logging.formatters.f1.pattern', 'logging.formatters.f1.times', 'logging.loggers.root.channel.channel1', 'logging.loggers.root.channel.class',
'MantidOptions.ReusePlotInstances',
'mantidqt.python_interfaces', 'mantidqt.python_interfaces_directory'
]
'mantidqt.python_interfaces']
# create the list of things
undocumented = []
......@@ -193,7 +192,6 @@ class ConfigServiceTest(unittest.TestCase):
if len(undocumented) > 0:
raise AssertionError('{} undocumented properties: {}'.format(len(undocumented), undocumented))
def _setup_test_areas(self):
"""Create a new data search path string
"""
......@@ -225,5 +223,6 @@ class ConfigServiceTest(unittest.TestCase):
except OSError:
pass
if __name__ == '__main__':
unittest.main()
......@@ -35,8 +35,8 @@ class PythonInterfacesStartupTest(systemtesting.MantidSystemTest):
"""
def __init__(self):
super(PythonInterfacesStartupTest, self).__init__()
self._interface_directory = ConfigService.getString('mantidqt.python_interfaces_directory')
import mantidqtinterfaces
self._interface_directory = os.path.dirname(mantidqtinterfaces.__file__)
self._interface_scripts = [interface.split("/")[1] for interface in ConfigService.getString('mantidqt.python_interfaces').split()]
def runTest(self):
......
......@@ -66,6 +66,15 @@ def _get_splash_image():
Qt.SmoothTransformation)
def _get_interface_dir():
"""
Returns the path to the directory containing the mantidqt interfaces launch scripts
This is the path to the mantidqtinterfaces package
"""
import mantidqtinterfaces
return os.path.dirname(mantidqtinterfaces.__file__)
SPLASH = QSplashScreen(_get_splash_image(), Qt.WindowStaysOnTopHint)
SPLASH.show()
SPLASH.showMessage("Starting...", int(Qt.AlignBottom | Qt.AlignLeft
......@@ -369,7 +378,8 @@ class MainWindow(QMainWindow):
def populate_interfaces_menu(self):
"""Populate then Interfaces menu with all Python and C++ interfaces"""
self.interfaces_menu.clear()
interface_dir = ConfigService['mantidqt.python_interfaces_directory']
interface_dir = _get_interface_dir()
self.interface_list, registers_to_run = self._discover_python_interfaces(interface_dir)
self._discover_cpp_interfaces(self.interface_list)
hidden_interfaces = ConfigService['interfaces.categories.hidden'].split(';')
......
......@@ -10,6 +10,7 @@
"""
Defines the QMainWindow of the application and the main() entry point.
"""
import os
import unittest
import sys
......@@ -150,7 +151,6 @@ class MainWindowTest(unittest.TestCase):
@patch('workbench.app.mainwindow.add_actions')
def test_interfaces_menu_texts_are_correct(self, _):
interface_dir = './interfaces/'
example_interfaces = {
'General': ['TOFCalculator'],
'Direct': ['DGS_Reduction.py', 'DGSPlanner.py', 'PyChop.py', 'MSlice.py', 'ALF View']
......@@ -159,7 +159,6 @@ class MainWindowTest(unittest.TestCase):
with patch('workbench.app.mainwindow.ConfigService',
new={
'interfaces.categories.hidden': '',
'mantidqt.python_interfaces_directory': interface_dir
}):
self.main_window._discover_python_interfaces = Mock(return_value=(example_interfaces, {}))
self.main_window._discover_cpp_interfaces = Mock()
......@@ -180,7 +179,8 @@ class MainWindowTest(unittest.TestCase):
@patch('workbench.app.mainwindow.add_actions')
def test_that_populate_interfaces_menu_discovers_interfaces(self, _):
interface_dir = './interfaces/'
import mantidqtinterfaces
interface_dir = os.path.dirname(mantidqtinterfaces.__file__)
interfaces = {'category': ['interface.py']}
self.main_window._discover_python_interfaces = Mock(return_value=(interfaces, {}))
......@@ -189,7 +189,6 @@ class MainWindowTest(unittest.TestCase):
with patch('workbench.app.mainwindow.ConfigService',
new={
'interfaces.categories.hidden': '',
'mantidqt.python_interfaces_directory': interface_dir
}):
self.main_window.create_menus()
self.main_window.populate_interfaces_menu()
......@@ -198,14 +197,13 @@ class MainWindowTest(unittest.TestCase):
self.main_window._discover_cpp_interfaces.assert_called_with(interfaces)
def test_that_populate_interfaces_menu_ignores_hidden_interfaces(self):
interface_dir = './interfaces/'
self.main_window._discover_python_interfaces = Mock(return_value=({
'category1': ['interface1.py'],
'category2': ['interface2.py']
}, {}))
self.main_window._discover_cpp_interfaces = Mock()
self.main_window.interfaces_menu = Mock()
ConfigService_dict = {'interfaces.categories.hidden': 'category1;category2', 'mantidqt.python_interfaces_directory': interface_dir}
ConfigService_dict = {'interfaces.categories.hidden': 'category1;category2'}
with patch.object(self.main_window, 'interfaces_menu') as mock_interfaces_menu:
with patch('workbench.app.mainwindow.ConfigService', new=ConfigService_dict):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment