From 8390520fd1ac9db2f5d51df8ab42bf0d7471eb03 Mon Sep 17 00:00:00 2001 From: Dimitar Tasev <dimtasev@gmail.com> Date: Fri, 25 Jan 2019 11:55:56 +0000 Subject: [PATCH] Address comments from review, re #24475 Remove whitespace in multiple files. Make ObserverView and ObserverPresenter inherit object Add superclass call in instrument view presenter Remove unnecessary overload in table worspace python export --- .../api/src/Exports/ITableWorkspace.cpp | 26 +++---------------- .../widgets/common/observing_presenter.py | 2 +- .../mantidqt/widgets/common/observing_view.py | 11 +------- .../test_workspacedisplay_ads_observer.py | 2 -- .../widgets/common/test_mocks/mock_mantid.py | 2 -- .../test_mocks/mock_matrixworkspacedisplay.py | 1 - .../common/test_mocks/mock_observing.py | 9 +++++++ .../widgets/common/test_mocks/mock_qt.py | 2 -- .../widgets/instrumentview/presenter.py | 1 + 9 files changed, 16 insertions(+), 40 deletions(-) diff --git a/Framework/PythonInterface/mantid/api/src/Exports/ITableWorkspace.cpp b/Framework/PythonInterface/mantid/api/src/Exports/ITableWorkspace.cpp index da19e7144f8..34f7a9673a0 100644 --- a/Framework/PythonInterface/mantid/api/src/Exports/ITableWorkspace.cpp +++ b/Framework/PythonInterface/mantid/api/src/Exports/ITableWorkspace.cpp @@ -472,9 +472,9 @@ PyObject *cell(ITableWorkspace &self, const object &value, int row_or_col) { * @param row_or_col An integer giving the row if value is a string or the * column if value is an index */ -void setCellImpl(ITableWorkspace &self, const object &col_or_row, - const int row_or_col, const object &value, - const bool ¬ify_replace) { +void setCell(ITableWorkspace &self, const object &col_or_row, + const int row_or_col, const object &value, + const bool ¬ify_replace) { Mantid::API::Column_sptr column; int row(-1); getCellLoc(self, col_or_row, row_or_col, column, row); @@ -484,17 +484,6 @@ void setCellImpl(ITableWorkspace &self, const object &col_or_row, self.modified(); } } - -void setCell(ITableWorkspace &self, const object &col_or_row, - const int row_or_col, const object &value) { - setCellImpl(self, col_or_row, row_or_col, value, true); -} -void setCellNoNotify(ITableWorkspace &self, const object &col_or_row, - const int row_or_col, const object &value, - const object ¬ify_replace) { - bool notify = extract<bool>(notify_replace)(); - setCellImpl(self, col_or_row, row_or_col, value, notify); -} } // namespace /** @@ -687,14 +676,7 @@ void export_ITableWorkspace() { .def("setCell", &setCell, (arg("self"), arg("row_or_column"), arg("column_or_row"), - arg("value")), - "Sets the value of a given cell. If the row_or_column argument is a " - "number then it is interpreted as a row otherwise it " - "is interpreted as a column name.") - - .def("setCell", &setCellNoNotify, - (arg("self"), arg("row_or_column"), arg("column_or_row"), - arg("value"), arg("notify_replace")), + arg("value"), arg("notify_replace") = true), "Sets the value of a given cell. If the row_or_column argument is a " "number then it is interpreted as a row otherwise it " "is interpreted as a column name. If notify replace is false, then " diff --git a/qt/python/mantidqt/widgets/common/observing_presenter.py b/qt/python/mantidqt/widgets/common/observing_presenter.py index 15a9f6566e9..b71c0e8a389 100644 --- a/qt/python/mantidqt/widgets/common/observing_presenter.py +++ b/qt/python/mantidqt/widgets/common/observing_presenter.py @@ -9,7 +9,7 @@ from __future__ import (absolute_import, division, print_function) -class ObservingPresenter: +class ObservingPresenter(object): """ This class provides some common functions for classes that need to be observable. It is not a GUI class, and if used, should be inherited by the presenter. diff --git a/qt/python/mantidqt/widgets/common/observing_view.py b/qt/python/mantidqt/widgets/common/observing_view.py index 20f09a744b7..9b549c6a8b4 100644 --- a/qt/python/mantidqt/widgets/common/observing_view.py +++ b/qt/python/mantidqt/widgets/common/observing_view.py @@ -9,7 +9,7 @@ from __future__ import (absolute_import, division, print_function) -class ObservingView: +class ObservingView(object): """ This class provides some common functions needed across views observing the ADS. It runs the close_signal so that the view is closed from the GUI thread, @@ -30,15 +30,6 @@ class ObservingView: TITLE_STRING = "{} - Mantid" - def __init__(self, _): - """ - This __init__ is added to conform with the Qt super-class constructor, and is - called when the super(..., self).__init__ is executed in the view inheriting this. - - It is not strictly required, but it prevents an inspection warning in PyCharm. - """ - pass - def emit_close(self): """ Emits a close signal to the main GUI thread that triggers the built-in close method. diff --git a/qt/python/mantidqt/widgets/common/test/test_workspacedisplay_ads_observer.py b/qt/python/mantidqt/widgets/common/test/test_workspacedisplay_ads_observer.py index d2a8cb24434..989537a345c 100644 --- a/qt/python/mantidqt/widgets/common/test/test_workspacedisplay_ads_observer.py +++ b/qt/python/mantidqt/widgets/common/test/test_workspacedisplay_ads_observer.py @@ -5,8 +5,6 @@ # & Institut Laue - Langevin # SPDX - License - Identifier: GPL - 3.0 + # This file is part of the mantid workbench. - - from __future__ import (absolute_import, division, print_function) import unittest diff --git a/qt/python/mantidqt/widgets/common/test_mocks/mock_mantid.py b/qt/python/mantidqt/widgets/common/test_mocks/mock_mantid.py index 7d5466c38ae..d7ece59a130 100644 --- a/qt/python/mantidqt/widgets/common/test_mocks/mock_mantid.py +++ b/qt/python/mantidqt/widgets/common/test_mocks/mock_mantid.py @@ -5,8 +5,6 @@ # & Institut Laue - Langevin # SPDX - License - Identifier: GPL - 3.0 + # This file is part of the mantid workbench. - - from __future__ import (absolute_import, division, print_function) from mock import Mock diff --git a/qt/python/mantidqt/widgets/common/test_mocks/mock_matrixworkspacedisplay.py b/qt/python/mantidqt/widgets/common/test_mocks/mock_matrixworkspacedisplay.py index 108b1d0f750..229b29adb6d 100644 --- a/qt/python/mantidqt/widgets/common/test_mocks/mock_matrixworkspacedisplay.py +++ b/qt/python/mantidqt/widgets/common/test_mocks/mock_matrixworkspacedisplay.py @@ -5,7 +5,6 @@ # & Institut Laue - Langevin # SPDX - License - Identifier: GPL - 3.0 + # This file is part of the mantid workbench. - from __future__ import (absolute_import, division, print_function) from mock import Mock diff --git a/qt/python/mantidqt/widgets/common/test_mocks/mock_observing.py b/qt/python/mantidqt/widgets/common/test_mocks/mock_observing.py index 50d2f40ea40..c65bee478ef 100644 --- a/qt/python/mantidqt/widgets/common/test_mocks/mock_observing.py +++ b/qt/python/mantidqt/widgets/common/test_mocks/mock_observing.py @@ -1,3 +1,12 @@ +# Mantid Repository : https://github.com/mantidproject/mantid +# +# Copyright © 2019 ISIS Rutherford Appleton Laboratory UKRI, +# NScD Oak Ridge National Laboratory, European Spallation Source +# & Institut Laue - Langevin +# SPDX - License - Identifier: GPL - 3.0 + +# This file is part of the mantid workbench. +from __future__ import (absolute_import, division, print_function) + from mock import Mock from mantidqt.widgets.common.observing_presenter import ObservingPresenter diff --git a/qt/python/mantidqt/widgets/common/test_mocks/mock_qt.py b/qt/python/mantidqt/widgets/common/test_mocks/mock_qt.py index 0723ebb9e1f..a678044aafd 100644 --- a/qt/python/mantidqt/widgets/common/test_mocks/mock_qt.py +++ b/qt/python/mantidqt/widgets/common/test_mocks/mock_qt.py @@ -5,8 +5,6 @@ # & Institut Laue - Langevin # SPDX - License - Identifier: GPL - 3.0 + # This file is part of the mantid workbench. - - from __future__ import (absolute_import, division, print_function) from mock import Mock diff --git a/qt/python/mantidqt/widgets/instrumentview/presenter.py b/qt/python/mantidqt/widgets/instrumentview/presenter.py index 2d045e6014a..fb96adb88f1 100644 --- a/qt/python/mantidqt/widgets/instrumentview/presenter.py +++ b/qt/python/mantidqt/widgets/instrumentview/presenter.py @@ -27,6 +27,7 @@ class InstrumentViewPresenter(ObservingPresenter): view = None def __init__(self, ws, parent=None, ads_observer=None): + super(InstrumentViewPresenter, self).__init__() self.ws_name = ws.name() self.view = InstrumentView(self, self.ws_name, parent) -- GitLab