def setUp(self):
        self.load = mock.create_autospec(load_utils.LoadUtils, spec_set=True)
        self.load.getCurrentWS = mock.Mock(
            return_value=["TEST00000001", ["fwd", "bkwd"]])
        self.load.getRunName = mock.MagicMock(return_value="MUSR00023456")
        self.load.hasDataChanged = mock.MagicMock(return_value=False)
        self.view = mock.create_autospec(fft_view.FFTView, spec_set=True)
        # signals
        self.view.tableClickSignal = mock.Mock(return_value=[3, 1])
        self.view.phaseCheckSignal = mock.Mock(return_value=True)
        # needed for connect in presenter
        self.view.buttonSignal = mock.Mock()
        self.view.changed = mock.MagicMock()
        self.view.changedHideUnTick = mock.MagicMock()
        self.view.initFFTInput = mock.Mock(return_value={
            "InputWorkspace": "testWS",
            "OutputWorkspace": "muon"
        })
        self.view.addFFTComplex = mock.Mock(
            return_value={"InputImWorkspace": "MuonFFT"})
        self.view.addFFTShift = mock.Mock()
        self.view.addRaw = mock.Mock()
        self.view.RePhaseAdvanced = mock.Mock()
        self.view.getFFTRePhase = mock.Mock()
        self.view.getFFTImPhase = mock.Mock()
        self.view.getWS = mock.Mock(return_value="MUSR00023456")
        self.view.getFirstGoodData = mock.Mock(return_value=0.1)
        self.view.getLastGoodData = mock.Mock(return_value=15.)
        self.view.getImBoxRow = mock.Mock(return_value=3)
        self.view.getShiftBoxRow = mock.Mock(return_value=5)
        self.view.isRaw = mock.Mock(return_value=True)
        self.view.isComplex = mock.Mock(return_value=True)
        self.view.isAutoShift = mock.Mock(return_value=True)
        self.view.setPhaseBox = mock.Mock()
        self.view.isNewPhaseTable = mock.Mock(return_value=True)
        self.view.activateButton = mock.Mock()
        self.view.deactivateButton = mock.Mock()
        # setup model
        self.model1 = mock.create_autospec(fft_model.FFTModel, spec_set=False)
        self.model = mock.create_autospec(fft_model.FFTWrapper, spec_set=False)

        # set presenter
        self.presenter = fft_presenter.FFTPresenter(self.view, self.model,
                                                    self.load)

        # mock thread
        self.thread = mock.create_autospec(thread_model.ThreadModel)
        self.thread.start = mock.Mock()
        self.thread.started = mock.Mock()
        self.thread.finished = mock.Mock()
        self.thread.setInputs = mock.Mock()
        self.thread.loadData = mock.Mock()
        self.presenter.createThread = mock.Mock(return_value=self.thread)
Beispiel #2
0
    def __init__(self, view, model):
        self.view = view
        self.load = load_utils.LoadUtils()
        if not self.load.MuonAnalysisExists():
            return

        # create presenters for the views
        self.FFTPresenter = fft_presenter.FFTPresenter(
            self.view.getView("FFT"), model.getModel("FFT"), self.load)
        self.MaxEntPresenter = maxent_presenter.MaxEntPresenter(
            self.view.getView("MaxEnt"), model.getModel("MaxEnt"), self.load)
        # get the transform selection view
        self.selectionPresenter = transform_selection_presenter.TransformSelectionPresenter(
            self.view.selection)
        # gets a list of the views/methods
        self.methodsList = self.view.getMethods()
        # sets the transform selection view to have the correct options
        self.selectionPresenter.setMethodsCombo(self.methodsList)
        # connect
        self.view.selection.changeMethodSignal.connect(self.updateDisplay)