diff --git a/buildconfig/Jenkins/buildscript b/buildconfig/Jenkins/buildscript index d4fb2f75f0be02f48d78c4bf10f9bb513df44266..72e46bbb6498589a1f368afae6e66658f0a25fb1 100755 --- a/buildconfig/Jenkins/buildscript +++ b/buildconfig/Jenkins/buildscript @@ -107,12 +107,14 @@ fi # For a clean build the entire thing is removed to guarantee it is clean. All # other build types are assumed to be incremental and the following items # are removed to ensure stale build objects don't interfere with each other: +# - those removed by git clean -fdx --exclude=`basename $BUILD_DIR` # - build/bin/**: if libraries are removed from cmake they are not deleted # from bin and can cause random failures # - build/ExternalData/**: data files will change over time and removing # the links helps keep it fresh ############################################################################### -BUILD_DIR=$WORKSPACE/build +BUILD_DIR_REL=build +BUILD_DIR=$WORKSPACE/$BUILD_DIR_REL if [ -z "$BUILD_DIR" ]; then echo "Build directory not set. Cannot continue" exit 1 @@ -122,6 +124,7 @@ if [[ "$CLEANBUILD" == true ]]; then rm -rf $BUILD_DIR fi if [ -d $BUILD_DIR ]; then + git clean -fdx --exclude=${BUILD_DIR_REL} rm -rf ${BUILD_DIR:?}/bin ${BUILD_DIR:?}/ExternalData find ${BUILD_DIR:?} -name 'TEST-*.xml' -delete if [[ -n ${CLEAN_EXTERNAL_PROJECTS} && "${CLEAN_EXTERNAL_PROJECTS}" == true ]]; then diff --git a/buildconfig/Jenkins/buildscript.bat b/buildconfig/Jenkins/buildscript.bat index 76f486247cfdc1842e0056bb7928d5830fece519..7244fd4fd2b4f31da34e7a21d058263ef7b2cbdb 100755 --- a/buildconfig/Jenkins/buildscript.bat +++ b/buildconfig/Jenkins/buildscript.bat @@ -84,12 +84,14 @@ if not "%JOB_NAME%" == "%JOB_NAME:debug=%" ( :: For a clean build the entire thing is removed to guarantee it is clean. All :: other build types are assumed to be incremental and the following items :: are removed to ensure stale build objects don't interfere with each other: +:: - those removed by git clean -fdx --exclude=build :: - build/bin: if libraries are removed from cmake they are not deleted :: from bin and can cause random failures :: - build/ExternalData/**: data files will change over time and removing :: the links helps keep it fresh ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -set BUILD_DIR=%WORKSPACE%\build +set BUILD_DIR_REL=build +set BUILD_DIR=%WORKSPACE%\%BUILD_DIR_REL% call %~dp0setupcompiler.bat %BUILD_DIR% if "!CLEANBUILD!" == "yes" ( @@ -98,6 +100,7 @@ if "!CLEANBUILD!" == "yes" ( ) if EXIST %BUILD_DIR% ( + git clean -fdx --exclude=external --exclude=%BUILD_DIR_REL% rmdir /S /Q %BUILD_DIR%\bin %BUILD_DIR%\ExternalData for /f %%F in ('dir /b /a-d /S "TEST-*.xml"') do del /Q %%F >/nul if "!CLEAN_EXTERNAL_PROJECTS!" == "true" ( diff --git a/qt/applications/workbench/workbench/plugins/workspacewidget.py b/qt/applications/workbench/workbench/plugins/workspacewidget.py index ecd179237ccc76da060a68017c8516027c648cad..2ffcc1c21be7aec370d6cf2f516fe73c82553943 100644 --- a/qt/applications/workbench/workbench/plugins/workspacewidget.py +++ b/qt/applications/workbench/workbench/plugins/workspacewidget.py @@ -22,7 +22,7 @@ import functools # third-party library imports from mantid.api import AnalysisDataService, MatrixWorkspace, WorkspaceGroup from mantid.kernel import Logger -from mantidqt.widgets.workspacewidget.plotselectiondialog import get_plot_selection +from mantidqt.dialogs.spectraselectordialog import get_spectra_selection from mantidqt.widgets.workspacewidget.workspacetreewidget import WorkspaceTreeWidget from qtpy.QtWidgets import QMessageBox, QVBoxLayout @@ -116,7 +116,7 @@ class WorkspaceWidget(PluginWidget): return try: - selection = get_plot_selection(_workspaces_from_names(names), self) + selection = get_spectra_selection(_workspaces_from_names(names), self) if selection is not None: plot(selection.workspaces, spectrum_nums=selection.spectra, wksp_indices=selection.wksp_indices, diff --git a/qt/python/CMakeLists.txt b/qt/python/CMakeLists.txt index af366df4d652b413dd4c972b64372d2c947f11ff..508b70e03026ca2f7cf23c5f7150a0e5a3366cea 100644 --- a/qt/python/CMakeLists.txt +++ b/qt/python/CMakeLists.txt @@ -36,12 +36,12 @@ if ( ENABLE_WORKBENCH ) add_custom_target ( mantidqt_resources ALL DEPENDS ${_output_res_py} ) # Now add any compiled sip targets - add_subdirectory ( mantidqt/widgets ) + add_subdirectory ( mantidqt ) # Setup dependency chain add_dependencies ( mantidqt - mantidqt_widgetscoreqt5 - mantidqt_widgetscoreqt4 + mantidqt_commonqt4 + mantidqt_commonqt5 mantidqt_resources ) @@ -66,22 +66,22 @@ endif () mantidqt/test/test_algorithm_observer.py mantidqt/test/test_import.py + mantidqt/dialogs/test/test_algorithm_dialog.py + mantidqt/dialogs/test/test_spectraselectiondialog.py + mantidqt/utils/test/test_async.py mantidqt/utils/test/test_modal_tester.py mantidqt/utils/test/test_qt_utils.py mantidqt/utils/test/test_writetosignal.py - mantidqt/widgets/test/test_algorithm_dialog.py - + mantidqt/widgets/algorithmselector/test/test_algorithmselector.py mantidqt/widgets/codeeditor/test/test_codeeditor.py mantidqt/widgets/codeeditor/test/test_errorformatter.py mantidqt/widgets/codeeditor/test/test_execution.py mantidqt/widgets/codeeditor/test/test_interpreter.py mantidqt/widgets/codeeditor/test/test_multifileinterpreter.py + mantidqt/widgets/workspacewidget/test/test_workspacetreewidget.py - mantidqt/widgets/workspacewidget/test/test_plotselectiondialog.py - - mantidqt/widgets/test/test_algorithmselector.py mantidqt/widgets/test/test_jupyterconsole.py mantidqt/widgets/test/test_messagedisplay.py ) diff --git a/qt/python/mantidqt/widgets/CMakeLists.txt b/qt/python/mantidqt/CMakeLists.txt similarity index 86% rename from qt/python/mantidqt/widgets/CMakeLists.txt rename to qt/python/mantidqt/CMakeLists.txt index a69ab12eac2bad3197bc53a026ad474b53bb7363..1ec7b21fc9d2478fea791db55318cfe486266792 100644 --- a/qt/python/mantidqt/widgets/CMakeLists.txt +++ b/qt/python/mantidqt/CMakeLists.txt @@ -20,9 +20,9 @@ list ( APPEND common_link_libs # Wrapper module linked against Qt4 mtd_add_sip_module ( - MODULE_NAME _widgetscoreqt4 - TARGET_NAME mantidqt_widgetscoreqt4 - SIP_SRCS src/_widgetscore.sip + MODULE_NAME _commonqt4 + TARGET_NAME mantidqt_commonqt4 + SIP_SRCS _common.sip HEADER_DEPS ${HEADER_DEPENDS} PYQT_VERSION 4 LINK_LIBS @@ -43,9 +43,9 @@ endif() # Wrapper module linked against Qt5 mtd_add_sip_module ( - MODULE_NAME _widgetscoreqt5 - TARGET_NAME mantidqt_widgetscoreqt5 - SIP_SRCS src/_widgetscore.sip + MODULE_NAME _commonqt5 + TARGET_NAME mantidqt_commonqt5 + SIP_SRCS _common.sip HEADER_DEPS ${HEADER_DEPENDS} PYQT_VERSION 5 LINK_LIBS diff --git a/qt/python/mantidqt/widgets/src/_widgetscore.sip b/qt/python/mantidqt/_common.sip similarity index 100% rename from qt/python/mantidqt/widgets/src/_widgetscore.sip rename to qt/python/mantidqt/_common.sip diff --git a/qt/python/mantidqt/dialogs/__init__.py b/qt/python/mantidqt/dialogs/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/qt/python/mantidqt/widgets/algorithmdialog.py b/qt/python/mantidqt/dialogs/algorithmdialog.py similarity index 85% rename from qt/python/mantidqt/widgets/algorithmdialog.py rename to qt/python/mantidqt/dialogs/algorithmdialog.py index d5fe952227c6d301e4f0bf1940f5cc08b7913be1..3f028b7f13a688a87f4818c6e399175767e6fb4f 100644 --- a/qt/python/mantidqt/widgets/algorithmdialog.py +++ b/qt/python/mantidqt/dialogs/algorithmdialog.py @@ -16,7 +16,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. from __future__ import (absolute_import) -from mantidqt.utils.qt import import_qtlib +from mantidqt.utils.qt import import_qt -AlgorithmDialog = import_qtlib('_widgetscore', 'mantidqt.widgets', 'AlgorithmDialog') +AlgorithmDialog = import_qt('.._common', package='mantidqt.dialogs', attr='AlgorithmDialog') diff --git a/qt/python/mantidqt/widgets/genericdialog.py b/qt/python/mantidqt/dialogs/genericdialog.py similarity index 85% rename from qt/python/mantidqt/widgets/genericdialog.py rename to qt/python/mantidqt/dialogs/genericdialog.py index 0d26bc1b949aac1125c8b56538af61de71404777..4ed0e745e3416621282025dbe1c66de693c18438 100644 --- a/qt/python/mantidqt/widgets/genericdialog.py +++ b/qt/python/mantidqt/dialogs/genericdialog.py @@ -16,7 +16,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. from __future__ import (absolute_import) -from mantidqt.utils.qt import import_qtlib +from mantidqt.utils.qt import import_qt -GenericDialog = import_qtlib('_widgetscore', 'mantidqt.widgets', 'GenericDialog') +GenericDialog = import_qt('.._common', package='mantidqt.dialogs', attr='GenericDialog') diff --git a/qt/python/mantidqt/widgets/workspacewidget/plotselectiondialog.py b/qt/python/mantidqt/dialogs/spectraselectordialog.py similarity index 90% rename from qt/python/mantidqt/widgets/workspacewidget/plotselectiondialog.py rename to qt/python/mantidqt/dialogs/spectraselectordialog.py index 7fe74f05edc7b7be90db5decb2304be81b3afa61..0bde6df74688864fa3641688a2c72d390d7902a1 100644 --- a/qt/python/mantidqt/widgets/workspacewidget/plotselectiondialog.py +++ b/qt/python/mantidqt/dialogs/spectraselectordialog.py @@ -38,10 +38,10 @@ def red_asterisk(): return RED_ASTERISK -PlotSelectionDialogUI, PlotSelectionDialogUIBase = load_ui(__file__, 'plotselectiondialog.ui') +SpectraSelectionDialogUI, SpectraSelectionDialogUIBase = load_ui(__file__, 'spectraselectordialog.ui') -class PlotSelection(object): +class SpectraSelection(object): Individual = 0 @@ -49,14 +49,14 @@ class PlotSelection(object): self.workspaces = workspaces self.wksp_indices = None self.spectra = None - self.plot_type = PlotSelection.Individual + self.plot_type = SpectraSelection.Individual -class PlotSelectionDialog(PlotSelectionDialogUIBase): +class SpectraSelectionDialog(SpectraSelectionDialogUIBase): def __init__(self, workspaces, parent=None): - super(PlotSelectionDialog, self).__init__(parent) + super(SpectraSelectionDialog, self).__init__(parent) # attributes self._workspaces = workspaces self.spec_min, self.spec_max = None, None @@ -72,14 +72,14 @@ class PlotSelectionDialog(PlotSelectionDialogUIBase): self.accept() def on_plot_all_clicked(self): - selection = PlotSelection(self._workspaces) + selection = SpectraSelection(self._workspaces) selection.wksp_indices = range(self.wi_min, self.wi_max + 1) self.selection = selection self.accept() # ------------------- Private ------------------------- def _init_ui(self): - ui = PlotSelectionDialogUI() + ui = SpectraSelectionDialogUI() ui.setupUi(self) self._ui = ui # overwrite the "Yes to All" button text @@ -142,7 +142,7 @@ class PlotSelectionDialog(PlotSelectionDialogUIBase): def _parse_wksp_indices(self): wksp_indices = parse_selection_str(self._ui.wkspIndices.text(), self.wi_min, self.wi_max) if wksp_indices: - selection = PlotSelection(self._workspaces) + selection = SpectraSelection(self._workspaces) selection.wksp_indices = wksp_indices else: selection = None @@ -151,7 +151,7 @@ class PlotSelectionDialog(PlotSelectionDialogUIBase): def _parse_spec_nums(self): spec_nums = parse_selection_str(self._ui.specNums.text(), self.spec_min, self.spec_max) if spec_nums: - selection = PlotSelection(self._workspaces) + selection = SpectraSelection(self._workspaces) selection.spectra = spec_nums else: selection = None @@ -161,7 +161,7 @@ class PlotSelectionDialog(PlotSelectionDialogUIBase): return self.selection is not None -def get_plot_selection(workspaces, parent_widget): +def get_spectra_selection(workspaces, parent_widget): """Decides whether it is necessary to request user input when asked to plot a list of workspaces. The input dialog will only be shown in the case where all workspaces @@ -169,20 +169,20 @@ def get_plot_selection(workspaces, parent_widget): :param workspaces: A list of MatrixWorkspaces that will be plotted :param parent_widget: A parent_widget to use for the input selection dialog - :returns: Either a PlotSelection object containing the details of workspaces to plot or None indicating + :returns: Either a SpectraSelection object containing the details of workspaces to plot or None indicating the request was cancelled """ single_spectra_ws = [wksp.getNumberHistograms() for wksp in workspaces if wksp.getNumberHistograms() == 1] if len(single_spectra_ws) > 0: # At least 1 workspace contains only a single spectrum so this is all # that is possible to plot for all of them - selection = PlotSelection(workspaces) + selection = SpectraSelection(workspaces) selection.wksp_indices = [0] return selection else: - selection_dlg = PlotSelectionDialog(workspaces, parent=parent_widget) + selection_dlg = SpectraSelectionDialog(workspaces, parent=parent_widget) res = selection_dlg.exec_() - if res == PlotSelectionDialog.Rejected: + if res == SpectraSelectionDialog.Rejected: # cancelled return None else: diff --git a/qt/python/mantidqt/widgets/workspacewidget/plotselectiondialog.ui b/qt/python/mantidqt/dialogs/spectraselectordialog.ui similarity index 100% rename from qt/python/mantidqt/widgets/workspacewidget/plotselectiondialog.ui rename to qt/python/mantidqt/dialogs/spectraselectordialog.ui diff --git a/qt/python/mantidqt/widgets/test/test_algorithm_dialog.py b/qt/python/mantidqt/dialogs/test/test_algorithm_dialog.py similarity index 93% rename from qt/python/mantidqt/widgets/test/test_algorithm_dialog.py rename to qt/python/mantidqt/dialogs/test/test_algorithm_dialog.py index 52121d0bd7096351c28f23c82f3467c81ae20b9a..d5ac28bfd304a7da8221cd7fd6f590e8570d5319 100644 --- a/qt/python/mantidqt/widgets/test/test_algorithm_dialog.py +++ b/qt/python/mantidqt/dialogs/test/test_algorithm_dialog.py @@ -21,9 +21,9 @@ from qtpy.QtWidgets import QWidget, QLineEdit from mantid.api import AlgorithmManager, AlgorithmFactory, PythonAlgorithm from mantid.kernel import Direction, FloatArrayProperty from mantidqt.utils.qt.testing import requires_qapp -from mantidqt.widgets.algorithmdialog import AlgorithmDialog -from mantidqt.widgets.genericdialog import GenericDialog -from mantidqt.widgets.interfacemanager import InterfaceManager +from mantidqt.dialogs.algorithmdialog import AlgorithmDialog +from mantidqt.dialogs.genericdialog import GenericDialog +from mantidqt.interfacemanager import InterfaceManager class AlgorithmDialogMockAlgorithm(PythonAlgorithm): diff --git a/qt/python/mantidqt/widgets/workspacewidget/test/test_plotselectiondialog.py b/qt/python/mantidqt/dialogs/test/test_spectraselectiondialog.py similarity index 91% rename from qt/python/mantidqt/widgets/workspacewidget/test/test_plotselectiondialog.py rename to qt/python/mantidqt/dialogs/test/test_spectraselectiondialog.py index 36ed6f5bd39dca4ee0763001fc3711609ed8c3af..135614b46a41c1f39fb20cbac9d6062c3098a72d 100644 --- a/qt/python/mantidqt/widgets/workspacewidget/test/test_plotselectiondialog.py +++ b/qt/python/mantidqt/dialogs/test/test_spectraselectiondialog.py @@ -25,27 +25,27 @@ from qtpy.QtWidgets import QDialogButtonBox # local imports from mantidqt.utils.qt.testing import requires_qapp -from mantidqt.widgets.workspacewidget.plotselectiondialog import parse_selection_str, PlotSelectionDialog +from mantidqt.dialogs.spectraselectordialog import parse_selection_str, SpectraSelectionDialog @requires_qapp -class PlotSelectionDialogTest(unittest.TestCase): +class SpectraSelectionDialogTest(unittest.TestCase): def test_initial_dialog_setup(self): workspaces = [CreateSampleWorkspace(OutputWorkspace='ws', StoreInADS=False)] - dlg = PlotSelectionDialog(workspaces) + dlg = SpectraSelectionDialog(workspaces) self.assertFalse(dlg._ui.buttonBox.button(QDialogButtonBox.Ok).isEnabled()) def test_filling_workspace_details_single_workspace(self): workspaces = [CreateSampleWorkspace(OutputWorkspace='ws', StoreInADS=False)] - dlg = PlotSelectionDialog(workspaces) + dlg = SpectraSelectionDialog(workspaces) self.assertEqual("valid range: 1-200", dlg._ui.specNums.placeholderText()) self.assertEqual("valid range: 0-199", dlg._ui.wkspIndices.placeholderText()) def test_filling_workspace_details_multiple_workspaces_of_same_size(self): workspaces = [CreateSampleWorkspace(OutputWorkspace='ws', StoreInADS=False), CreateSampleWorkspace(OutputWorkspace='ws2', StoreInADS=False)] - dlg = PlotSelectionDialog(workspaces) + dlg = SpectraSelectionDialog(workspaces) self.assertEqual("valid range: 1-200", dlg._ui.specNums.placeholderText()) self.assertEqual("valid range: 0-199", dlg._ui.wkspIndices.placeholderText()) @@ -54,13 +54,13 @@ class PlotSelectionDialogTest(unittest.TestCase): ws1 = CropWorkspace(ws1, StartWorkspaceIndex=50) ws2 = CreateSampleWorkspace(OutputWorkspace='ws', StoreInADS=False) - dlg = PlotSelectionDialog([ws1, ws2]) + dlg = SpectraSelectionDialog([ws1, ws2]) self.assertEqual("valid range: 51-100", dlg._ui.specNums.placeholderText()) self.assertEqual("valid range: 0-49", dlg._ui.wkspIndices.placeholderText()) def test_valid_text_in_boxes_activates_ok(self): workspaces = [CreateSampleWorkspace(OutputWorkspace='ws', StoreInADS=False)] - dlg = PlotSelectionDialog(workspaces) + dlg = SpectraSelectionDialog(workspaces) def do_test(input_box): input_box.setText("1") @@ -73,7 +73,7 @@ class PlotSelectionDialogTest(unittest.TestCase): def test_plot_all_gives_only_workspaces_indices(self): ws = CreateSampleWorkspace(OutputWorkspace='ws', StoreInADS=False) - dlg = PlotSelectionDialog([ws]) + dlg = SpectraSelectionDialog([ws]) dlg._ui.buttonBox.button(QDialogButtonBox.YesToAll).click() self.assertTrue(dlg.selection is not None) self.assertTrue(dlg.selection.spectra is None) diff --git a/qt/python/mantidqt/widgets/interfacemanager.py b/qt/python/mantidqt/interfacemanager.py similarity index 85% rename from qt/python/mantidqt/widgets/interfacemanager.py rename to qt/python/mantidqt/interfacemanager.py index c036ceb23c03e8c1e08418d72f90f34aed30b110..46f621f9b23d4f58d88ac47ecfeb4aa7dcfa0fdb 100644 --- a/qt/python/mantidqt/widgets/interfacemanager.py +++ b/qt/python/mantidqt/interfacemanager.py @@ -16,7 +16,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. from __future__ import (absolute_import) -from mantidqt.utils.qt import import_qtlib +from mantidqt.utils.qt import import_qt -InterfaceManager = import_qtlib('_widgetscore', 'mantidqt.widgets', 'InterfaceManager') +InterfaceManager = import_qt('._common', 'mantidqt', 'InterfaceManager') diff --git a/qt/python/mantidqt/utils/qt/__init__.py b/qt/python/mantidqt/utils/qt/__init__.py index 64a792113f4644e6134ad221d314c96579eec73b..96de996a4d2ad935a36850961aed8479ea0aa714 100644 --- a/qt/python/mantidqt/utils/qt/__init__.py +++ b/qt/python/mantidqt/utils/qt/__init__.py @@ -32,25 +32,34 @@ from qtpy.QtWidgets import QAction, QMenu LIB_SUFFIX = 'qt' + QT_VERSION[0] -def import_qtlib(modulename, package, attr=None): - """Import a module built against a specified major version of Qt. +def import_qt(modulename, package, attr=None): + """Import a module built against the version of Qt we are running. The provided name is suffixed with the string 'qtX' where X is the major version of Qt that the library was built against. The version is determined by inspecting the loaded Python Qt bindings. If none can be found then Qt5 is assumed. - It is assumed that the module is a build product and therefore may not be in a fixed - location relative to the python source files. First a relative import from the calling - package is requested followed by a simple search for the binary by name on sys.path - :param modulename: The name of the dynamic module to find - :param package: The calling package trying to import the module using dotted syntax + If modulename looks like a relative name then the import is first tried as specified + and if this fails it is attempted as a top-level import without a package name and the relative prefixes removed. + This allows the built module to live outside of the package in a binary directory of the build. For example, a + developer build would put the built dynamic library in the bin directory but a package installation + would have the library in the proper location as indicated by the relative import path. This avoids any build + products being placed in the source tree. + + :param modulename: The name of the dynamic module to find, possibly a relative name + :param package: If the name looks like a relative import then the package argument is required to specify the + parent package :param attr: Optional attribute to retrieve from the module :return: Either the module object if no attribute is specified of the requested attribute """ - try: - lib = import_module('.' + modulename + LIB_SUFFIX, package) - except ImportError: + if modulename.startswith('.'): + try: + lib = import_module(modulename + LIB_SUFFIX, package) + except ImportError: + lib = import_module(modulename.lstrip('.') + LIB_SUFFIX) + else: lib = import_module(modulename + LIB_SUFFIX) + if attr is not None: return getattr(lib, attr) else: diff --git a/qt/python/mantidqt/widgets/algorithmselector/test/__init__.py b/qt/python/mantidqt/widgets/algorithmselector/test/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/qt/python/mantidqt/widgets/test/test_algorithmselector.py b/qt/python/mantidqt/widgets/algorithmselector/test/test_algorithmselector.py similarity index 97% rename from qt/python/mantidqt/widgets/test/test_algorithmselector.py rename to qt/python/mantidqt/widgets/algorithmselector/test/test_algorithmselector.py index 9932eca44eb7ae8cda780ff467785c83250ebb3f..ae0da9bbb0a345b6e979513582c72ddab9d321f8 100644 --- a/qt/python/mantidqt/widgets/test/test_algorithmselector.py +++ b/qt/python/mantidqt/widgets/algorithmselector/test/test_algorithmselector.py @@ -145,14 +145,14 @@ class WidgetTest(unittest.TestCase): self.assertEqual(widget.search_box.currentText(), 'abc') def test_execute_on_click(self): - with patch('mantidqt.widgets.interfacemanager.InterfaceManager.createDialogFromName') as createDialog: + with patch('mantidqt.interfacemanager.InterfaceManager.createDialogFromName') as createDialog: widget = AlgorithmSelectorWidget() self._select_in_tree(widget, 'DoStuff v.2') widget.execute_button.click() createDialog.assert_called_once_with('DoStuff', 2) def test_execute_on_return_press(self): - with patch('mantidqt.widgets.interfacemanager.InterfaceManager.createDialogFromName') as createDialog: + with patch('mantidqt.interfacemanager.InterfaceManager.createDialogFromName') as createDialog: widget = AlgorithmSelectorWidget() self._select_in_tree(widget, 'DoStuff v.2') QTest.keyClick(widget.search_box, Qt.Key_Return) diff --git a/qt/python/mantidqt/widgets/algorithmselector/widget.py b/qt/python/mantidqt/widgets/algorithmselector/widget.py index d79c00fee253b87d214ae3c4dd761d2f53e2eaa3..150c3100dd8361928e8b569c7417b8458eac2b76 100644 --- a/qt/python/mantidqt/widgets/algorithmselector/widget.py +++ b/qt/python/mantidqt/widgets/algorithmselector/widget.py @@ -6,9 +6,10 @@ from qtpy.QtCore import QModelIndex from qtpy.QtWidgets import (QWidget, QPushButton, QComboBox, QTreeWidget, QVBoxLayout, QHBoxLayout, QCompleter, QTreeWidgetItem) +from mantidqt.interfacemanager import InterfaceManager from mantidqt.utils.qt import block_signals -from mantidqt.widgets.interfacemanager import InterfaceManager from mantidqt.widgets.algorithmprogress import AlgorithmProgressWidget + from .presenter import IAlgorithmSelectorView, SelectedAlgorithm diff --git a/qt/python/mantidqt/widgets/codeeditor/editor.py b/qt/python/mantidqt/widgets/codeeditor/editor.py index 35802bcec6c4ed728544dc19a8c5859e11d4dace..00c9c75ee472310fbd0263def7fc171b415aa42c 100644 --- a/qt/python/mantidqt/widgets/codeeditor/editor.py +++ b/qt/python/mantidqt/widgets/codeeditor/editor.py @@ -19,7 +19,7 @@ from __future__ import (absolute_import, unicode_literals) # 3rd party imports # local imports -from mantidqt.utils.qt import import_qtlib +from mantidqt.utils.qt import import_qt # Import single-file editor from C++ wrapping -CodeEditor = import_qtlib('_widgetscore', 'mantidqt.widgets', 'ScriptEditor') +CodeEditor = import_qt('.._common', 'mantidqt.widgets', 'ScriptEditor') diff --git a/qt/python/mantidqt/widgets/manageuserdirectories.py b/qt/python/mantidqt/widgets/manageuserdirectories.py index 34363fc98855341ad5025a9ca29cf382ff33fd72..aefb7ec89f3e47a2731d72621e2590af41fc2f12 100644 --- a/qt/python/mantidqt/widgets/manageuserdirectories.py +++ b/qt/python/mantidqt/widgets/manageuserdirectories.py @@ -16,7 +16,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. from __future__ import (absolute_import, unicode_literals) -from mantidqt.utils.qt import import_qtlib +from mantidqt.utils.qt import import_qt -ManageUserDirectories = import_qtlib('_widgetscore', 'mantidqt.widgets', 'ManageUserDirectories') +ManageUserDirectories = import_qt('.._common', 'mantidqt.widgets', 'ManageUserDirectories') diff --git a/qt/python/mantidqt/widgets/messagedisplay.py b/qt/python/mantidqt/widgets/messagedisplay.py index 2fe0e1652309dc01d72beab2fa8d5751466490d6..7c7e5429bc7e8b284c8cc0b7915c11cfae402242 100644 --- a/qt/python/mantidqt/widgets/messagedisplay.py +++ b/qt/python/mantidqt/widgets/messagedisplay.py @@ -16,7 +16,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. from __future__ import (absolute_import, unicode_literals) -from mantidqt.utils.qt import import_qtlib +from mantidqt.utils.qt import import_qt -MessageDisplay = import_qtlib('_widgetscore', 'mantidqt.widgets', 'MessageDisplay') +MessageDisplay = import_qt('.._common', 'mantidqt.widgets', 'MessageDisplay') diff --git a/qt/python/mantidqt/widgets/workspacewidget/mantidtreemodel.py b/qt/python/mantidqt/widgets/workspacewidget/mantidtreemodel.py index 568c9646d13962abdf26f1cb231d8a6d735eeca0..28b9925abd9a90e541b9a9eb6c88d5505388ef43 100644 --- a/qt/python/mantidqt/widgets/workspacewidget/mantidtreemodel.py +++ b/qt/python/mantidqt/widgets/workspacewidget/mantidtreemodel.py @@ -16,7 +16,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. from __future__ import (absolute_import) -from mantidqt.utils.qt import import_qtlib +from mantidqt.utils.qt import import_qt -MantidTreeModel = import_qtlib('_widgetscore', 'mantidqt.widgets.workspacewidgets', 'MantidTreeModel') +MantidTreeModel = import_qt('.._common', 'mantidqt.widgets.workspacewidget', 'MantidTreeModel') diff --git a/qt/python/mantidqt/widgets/test/test_workspacetreewidget.py b/qt/python/mantidqt/widgets/workspacewidget/test/test_workspacetreewidget.py similarity index 88% rename from qt/python/mantidqt/widgets/test/test_workspacetreewidget.py rename to qt/python/mantidqt/widgets/workspacewidget/test/test_workspacetreewidget.py index 59e527b63841a935666f132abb526cc7d5e5de51..c58f0c263fc8320d25b9cd3ba5303a9e8f2b3158 100644 --- a/qt/python/mantidqt/widgets/test/test_workspacetreewidget.py +++ b/qt/python/mantidqt/widgets/workspacewidget/test/test_workspacetreewidget.py @@ -18,7 +18,6 @@ from __future__ import absolute_import, print_function import unittest -from mantidqt.widgets.workspacewidget.mantidtreemodel import MantidTreeModel from mantidqt.widgets.workspacewidget.workspacetreewidget import WorkspaceTreeWidget from mantidqt.utils.qt.testing import requires_qapp @@ -28,8 +27,7 @@ class WorkspaceWidgetTest(unittest.TestCase): """Minimal testing as it is exported from C++""" def test_widget_creation(self): - param = MantidTreeModel() - widget = WorkspaceTreeWidget(param) + widget = WorkspaceTreeWidget() self.assertTrue(widget is not None) diff --git a/qt/python/mantidqt/widgets/workspacewidget/workspacetreewidget.py b/qt/python/mantidqt/widgets/workspacewidget/workspacetreewidget.py index 0563a03872a06e1a0705fdac4e18bc55b03a69e3..f8fee5faa670f553f8595f478f3c8bcfede1c4c5 100644 --- a/qt/python/mantidqt/widgets/workspacewidget/workspacetreewidget.py +++ b/qt/python/mantidqt/widgets/workspacewidget/workspacetreewidget.py @@ -21,11 +21,8 @@ from __future__ import (absolute_import, unicode_literals) # 3rd party imports # local imports -from mantidqt.utils.qt import import_qtlib +from mantidqt.utils.qt import import_qt -# Constants -PLACEHOLDER_FORMAT = 'valid range: {}-{}' - -WorkspaceTreeWidget = import_qtlib('_widgetscore', 'mantidqt.widgets.workspacewidget', - 'WorkspaceTreeWidgetSimple') +WorkspaceTreeWidget = import_qt('.._common', 'mantidqt.widgets.workspacewidget', + 'WorkspaceTreeWidgetSimple')