From abad231d38202472ce5dd921bc168e878b075901 Mon Sep 17 00:00:00 2001 From: Martyn Gigg <martyn.gigg@gmail.com> Date: Sun, 7 Jan 2018 21:11:18 +0000 Subject: [PATCH] Check point work so far. Refs #21251 --- qt/python/mantidqt/widgets/codeeditor/editor.py | 10 ++++++---- .../widgets/codeeditor/test/test_multifileeditor.py | 5 +++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/qt/python/mantidqt/widgets/codeeditor/editor.py b/qt/python/mantidqt/widgets/codeeditor/editor.py index 28152ad5f9a..2ce2ae4fbd4 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 b0834dbb536..d14387c10fe 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() -- GitLab