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

RE #27189 Yapf Format GUI

parent 1c7d134a
No related merge requests found
...@@ -61,7 +61,8 @@ class EngineeringDiffractionGui(QtWidgets.QMainWindow, Ui_main_window): ...@@ -61,7 +61,8 @@ class EngineeringDiffractionGui(QtWidgets.QMainWindow, Ui_main_window):
self.tabs.addTab(focus_view, "Focus") self.tabs.addTab(focus_view, "Focus")
def setup_calibration_notifier(self): def setup_calibration_notifier(self):
self.calibration_presenter.calibration_notifier.add_subscriber(self.focus_presenter.calibration_observer) self.calibration_presenter.calibration_notifier.add_subscriber(
self.focus_presenter.calibration_observer)
def set_on_help_clicked(self, slot): def set_on_help_clicked(self, slot):
self.pushButton_help.clicked.connect(slot) self.pushButton_help.clicked.connect(slot)
......
...@@ -121,10 +121,16 @@ class CalibrationPresenterTest(unittest.TestCase): ...@@ -121,10 +121,16 @@ class CalibrationPresenterTest(unittest.TestCase):
@patch(tab_path + ".presenter.CalibrationPresenter.emit_update_fields_signal") @patch(tab_path + ".presenter.CalibrationPresenter.emit_update_fields_signal")
def test_set_current_calibration(self, update_sig): def test_set_current_calibration(self, update_sig):
self.presenter.calibration_notifier = MagicMock() self.presenter.calibration_notifier = MagicMock()
pending = CalibrationInfo(vanadium_path="/test/set/path", sample_path="test/set/path/2", instrument="TEST_INS") pending = CalibrationInfo(vanadium_path="/test/set/path",
pendcpy = CalibrationInfo(vanadium_path="/test/set/path", sample_path="test/set/path/2", instrument="TEST_INS") sample_path="test/set/path/2",
instrument="TEST_INS")
pendcpy = CalibrationInfo(vanadium_path="/test/set/path",
sample_path="test/set/path/2",
instrument="TEST_INS")
self.presenter.pending_calibration = pending self.presenter.pending_calibration = pending
current = CalibrationInfo(vanadium_path="old/value", sample_path="old/cera", instrument="ENGINX") current = CalibrationInfo(vanadium_path="old/value",
sample_path="old/cera",
instrument="ENGINX")
blank = CalibrationInfo() blank = CalibrationInfo()
self.presenter.current_calibration = current self.presenter.current_calibration = current
...@@ -145,7 +151,9 @@ class CalibrationPresenterTest(unittest.TestCase): ...@@ -145,7 +151,9 @@ class CalibrationPresenterTest(unittest.TestCase):
path.return_value = True path.return_value = True
instrument, van, cer = ("test_ins", "test_van", "test_cer") instrument, van, cer = ("test_ins", "test_van", "test_cer")
self.model.load_existing_gsas_parameters.return_value = instrument, van, cer self.model.load_existing_gsas_parameters.return_value = instrument, van, cer
current = CalibrationInfo(vanadium_path="old/value", sample_path="old/cera", instrument="ENGINX") current = CalibrationInfo(vanadium_path="old/value",
sample_path="old/cera",
instrument="ENGINX")
new = CalibrationInfo(vanadium_path=van, sample_path=cer, instrument=instrument) new = CalibrationInfo(vanadium_path=van, sample_path=cer, instrument=instrument)
self.presenter.current_calibration = current self.presenter.current_calibration = current
...@@ -163,7 +171,9 @@ class CalibrationPresenterTest(unittest.TestCase): ...@@ -163,7 +171,9 @@ class CalibrationPresenterTest(unittest.TestCase):
self.view.get_new_checked.return_value = False self.view.get_new_checked.return_value = False
self.view.get_load_checked.return_value = True self.view.get_load_checked.return_value = True
path.return_value = False path.return_value = False
current = CalibrationInfo(vanadium_path="old/value", sample_path="old/cera", instrument="ENGINX") current = CalibrationInfo(vanadium_path="old/value",
sample_path="old/cera",
instrument="ENGINX")
self.presenter.current_calibration = current self.presenter.current_calibration = current
self.presenter.on_calibrate_clicked() self.presenter.on_calibrate_clicked()
...@@ -214,7 +224,9 @@ class CalibrationPresenterTest(unittest.TestCase): ...@@ -214,7 +224,9 @@ class CalibrationPresenterTest(unittest.TestCase):
instrument, van, cer = ("test_ins", "test_van", "test_cer") instrument, van, cer = ("test_ins", "test_van", "test_cer")
old_pending = CalibrationInfo(vanadium_path=None, sample_path=None, instrument=None) old_pending = CalibrationInfo(vanadium_path=None, sample_path=None, instrument=None)
self.presenter.pending_calibration = old_pending self.presenter.pending_calibration = old_pending
expected_pending = CalibrationInfo(vanadium_path=van, sample_path=cer, instrument=instrument) expected_pending = CalibrationInfo(vanadium_path=van,
sample_path=cer,
instrument=instrument)
self.presenter.instrument = instrument self.presenter.instrument = instrument
self.presenter.start_calibration_worker(van, cer, False, None) self.presenter.start_calibration_worker(van, cer, False, None)
......
...@@ -75,7 +75,9 @@ class FocusModel(object): ...@@ -75,7 +75,9 @@ class FocusModel(object):
def _plot_focused_workspaces(focused_workspaces): def _plot_focused_workspaces(focused_workspaces):
fig = plt.figure() fig = plt.figure()
gs = gridspec.GridSpec(1, len(focused_workspaces)) gs = gridspec.GridSpec(1, len(focused_workspaces))
plots = [fig.add_subplot(gs[i], projection="mantid") for i in range(len(focused_workspaces))] plots = [
fig.add_subplot(gs[i], projection="mantid") for i in range(len(focused_workspaces))
]
for ax, ws_name in zip(plots, focused_workspaces): for ax, ws_name in zip(plots, focused_workspaces):
ax.plot(Ads.retrieve(ws_name), wkspIndex=0) ax.plot(Ads.retrieve(ws_name), wkspIndex=0)
......
...@@ -44,8 +44,8 @@ class FocusModelTest(unittest.TestCase): ...@@ -44,8 +44,8 @@ class FocusModelTest(unittest.TestCase):
self.model.focus_run("305761", banks, False, "ENGINX", "0") self.model.focus_run("305761", banks, False, "ENGINX", "0")
self.assertEqual(len(banks), run_focus.call_count) self.assertEqual(len(banks), run_focus.call_count)
run_focus.assert_called_with("mocked_sample", run_focus.assert_called_with("mocked_sample",
model.FOCUSED_OUTPUT_WORKSPACE_NAME + banks[-1], model.FOCUSED_OUTPUT_WORKSPACE_NAME + banks[-1], "test_wsp",
"test_wsp", "test_wsp", banks[-1]) "test_wsp", banks[-1])
@patch(file_path + ".Ads") @patch(file_path + ".Ads")
@patch(file_path + ".FocusModel._save_output") @patch(file_path + ".FocusModel._save_output")
...@@ -53,7 +53,8 @@ class FocusModelTest(unittest.TestCase): ...@@ -53,7 +53,8 @@ class FocusModelTest(unittest.TestCase):
@patch(file_path + ".FocusModel._run_focus") @patch(file_path + ".FocusModel._run_focus")
@patch(file_path + ".FocusModel._load_focus_sample_run") @patch(file_path + ".FocusModel._load_focus_sample_run")
@patch(file_path + ".vanadium_corrections.fetch_correction_workspaces") @patch(file_path + ".vanadium_corrections.fetch_correction_workspaces")
def test_focus_plotted_when_checked(self, fetch_van, load_focus, run_focus, plot_focus, output, ads): def test_focus_plotted_when_checked(self, fetch_van, load_focus, run_focus, plot_focus, output,
ads):
ads.doesExist.return_value = True ads.doesExist.return_value = True
fetch_van.return_value = ("mocked_integ", "mocked_curves") fetch_van.return_value = ("mocked_integ", "mocked_curves")
banks = ["1", "2"] banks = ["1", "2"]
......
...@@ -111,7 +111,8 @@ class FocusPresenterTest(unittest.TestCase): ...@@ -111,7 +111,8 @@ class FocusPresenterTest(unittest.TestCase):
self.presenter._validate(banks) self.presenter._validate(banks)
create_error.assert_called_with( create_error.assert_called_with(
self.presenter.view, "Create or Load a calibration via the Calibration tab before focusing.") self.presenter.view,
"Create or Load a calibration via the Calibration tab before focusing.")
@patch(tab_path + ".presenter.check_workspaces_exist") @patch(tab_path + ".presenter.check_workspaces_exist")
@patch(tab_path + ".presenter.create_error_message") @patch(tab_path + ".presenter.create_error_message")
......
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