diff --git a/qt/python/mantidqt/widgets/codeeditor/editor.py b/qt/python/mantidqt/widgets/codeeditor/editor.py index 28152ad5f9a07a35f008cc0bd61dda430179f1e7..2ce2ae4fbd425c2979d57e8a95b69f0c11d0e34a 100644 --- a/qt/python/mantidqt/widgets/codeeditor/editor.py +++ b/qt/python/mantidqt/widgets/codeeditor/editor.py @@ -19,7 +19,9 @@ from __future__ import (absolute_import) # 3rd party imports from qtpy.QtWidgets import QTabWidget, QVBoxLayout, QWidget +# local imports from mantidqt.utils.qt import import_qtlib +from .execution import PythonCodeExecution EDITOR_LANGUAGE = "Python" @@ -43,10 +45,10 @@ class MultiFileCodeEditor(QWidget): # add a single editor by default self.append_new_editor(EDITOR_LANGUAGE) - def append_new_editor(self, language): - title = "New" - self.editors.addTab(CodeEditor(language, self.editors), title) - @property def editor_count(self): return self.editors.count() + + def append_new_editor(self, language): + title = "New" + self.editors.addTab(CodeEditor(language, self.editors), title) diff --git a/qt/python/mantidqt/widgets/codeeditor/test/test_multifileeditor.py b/qt/python/mantidqt/widgets/codeeditor/test/test_multifileeditor.py index b0834dbb536b92bd08cc340585aaa545522c8f79..d14387c10feb80e173b6683be31d6141ba2cb393 100644 --- a/qt/python/mantidqt/widgets/codeeditor/test/test_multifileeditor.py +++ b/qt/python/mantidqt/widgets/codeeditor/test/test_multifileeditor.py @@ -35,6 +35,11 @@ class MultiFileCodeEditorTest(unittest.TestCase): widget = MultiFileCodeEditor() self.assertEqual(1, widget.editor_count) + def test_execute_current_file_executes_correct_tab(self): + # set up code in current tab + widget = MultiFileCodeEditor() + editor = self.current_editor() + if __name__ == '__main__': unittest.main()