Skip to content
Snippets Groups Projects
Commit e69e882e authored by Conor Finn's avatar Conor Finn
Browse files

RE #27779 Remove unneeded widget file

parent 449755d0
No related branches found
No related tags found
No related merge requests found
......@@ -5,13 +5,27 @@
# & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
from mantidqt.utils.observer_pattern import GenericObserverWithArgPassing, GenericObserver
from Engineering.gui.engineering_diffraction.tabs.fitting.plotting.plot_model import FittingPlotModel
from Engineering.gui.engineering_diffraction.tabs.fitting.plotting.plot_view import FittingPlotView
PLOT_KWARGS = {"linestyle": "", "marker": "x", "markersize": "3"}
class FittingPlotPresenter(object):
def __init__(self, model, view):
self.model = model
self.view = view
def __init__(self, parent, model=None, view=None):
if view is None:
self.view = FittingPlotView(parent)
else:
self.view = view
if model is None:
self.model = FittingPlotModel()
else:
self.model = model
self.workspace_added_observer = GenericObserverWithArgPassing(self.add_workspace_to_plot)
self.workspace_removed_observer = GenericObserverWithArgPassing(self.remove_workspace_from_plot)
self.all_workspaces_removed_observer = GenericObserver(self.clear_plot)
def add_workspace_to_plot(self, ws):
axes = self.view.get_axes()
......
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2020 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source
# & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
from Engineering.gui.engineering_diffraction.tabs.fitting.plotting.plot_model import FittingPlotModel
from Engineering.gui.engineering_diffraction.tabs.fitting.plotting.plot_view import FittingPlotView
from Engineering.gui.engineering_diffraction.tabs.fitting.plotting.plot_presenter import FittingPlotPresenter
from mantidqt.utils.observer_pattern import GenericObserverWithArgPassing, GenericObserver
class FittingPlotWidget(object):
def __init__(self, parent, view=None):
if view is None:
self.view = FittingPlotView(parent)
else:
self.view = view
self.model = FittingPlotModel()
self.presenter = FittingPlotPresenter(self.model, self.view)
self.workspace_added_observer = GenericObserverWithArgPassing(self.presenter.add_workspace_to_plot)
self.workspace_removed_observer = GenericObserverWithArgPassing(self.presenter.remove_workspace_from_plot)
self.all_workspaces_removed_observer = GenericObserver(self.presenter.clear_plot)
......@@ -18,7 +18,7 @@ class FittingPlotPresenterTest(unittest.TestCase):
def setUp(self):
self.model = mock.create_autospec(plot_model.FittingPlotModel)
self.view = mock.create_autospec(plot_view.FittingPlotView)
self.presenter = plot_presenter.FittingPlotPresenter(self.model, self.view)
self.presenter = plot_presenter.FittingPlotPresenter(None, self.model, self.view)
def test_add_workspace_to_plot(self):
self.view.get_axes.return_value = ["axis1", "axis2"]
......
......@@ -6,7 +6,7 @@
# SPDX - License - Identifier: GPL - 3.0 +
from Engineering.gui.engineering_diffraction.tabs.fitting.data_handling.data_widget import FittingDataWidget
from Engineering.gui.engineering_diffraction.tabs.fitting.plotting.plot_widget import FittingPlotWidget
from Engineering.gui.engineering_diffraction.tabs.fitting.plotting.plot_presenter import FittingPlotPresenter
class FittingPresenter(object):
......@@ -14,7 +14,7 @@ class FittingPresenter(object):
self.view = view
self.data_widget = FittingDataWidget(self.view, view=self.view.get_data_widget())
self.plot_widget = FittingPlotWidget(self.view, view=self.view.get_plot_widget())
self.plot_widget = FittingPlotPresenter(self.view, view=self.view.get_plot_widget())
self.data_widget.presenter.plot_removed_notifier.add_subscriber(
self.plot_widget.workspace_removed_observer)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment