diff --git a/rascal2/core/commands.py b/rascal2/core/commands.py index 11386f0..3b53c13 100644 --- a/rascal2/core/commands.py +++ b/rascal2/core/commands.py @@ -3,7 +3,7 @@ from PyQt6 import QtGui -class editControls(QtGui.QUndoCommand): +class edit_controls(QtGui.QUndoCommand): """Command for editing the Controls object.""" def __init__(self, controls, attr, value): diff --git a/rascal2/ui/presenter.py b/rascal2/ui/presenter.py index bbe5f41..d3755a5 100644 --- a/rascal2/ui/presenter.py +++ b/rascal2/ui/presenter.py @@ -64,7 +64,7 @@ def edit_controls(self, setting: str, value: Any): with warnings.catch_warnings(): warnings.simplefilter("ignore") self.model.controls.model_validate({setting: value}) - self.view.undo_stack.push(commands.editControls(self.model.controls, setting, value)) + self.view.undo_stack.push(commands.edit_controls(self.model.controls, setting, value)) return True def interrupt_terminal(self): diff --git a/rascal2/widgets/controls.py b/rascal2/widgets/controls.py index 94a7ab8..b1e12e4 100644 --- a/rascal2/widgets/controls.py +++ b/rascal2/widgets/controls.py @@ -165,7 +165,7 @@ def set_procedure(self, index: int): """ self.fit_settings_layout.setCurrentIndex(index) procedure = [p.value for p in Procedures][index] - self.presenter.editControls("procedure", procedure) + self.presenter.edit_controls("procedure", procedure) # synchronise common fields between procedures for field in common_fields: if field not in ["procedure", "resampleParams"]: # FIXME remove resampleparams when merged @@ -258,7 +258,7 @@ def create_model_data_setter(self, setting: str) -> Callable: def set_model_data(): value = self.rows[setting].get_data() try: - self.presenter.editControls(setting, value) + self.presenter.edit_controls(setting, value) except ValidationError as err: self.set_validation_text(setting, err.errors()[0]["msg"]) else: diff --git a/tests/test_controls.py b/tests/test_controls.py index c6e9030..e78e4b0 100644 --- a/tests/test_controls.py +++ b/tests/test_controls.py @@ -49,7 +49,7 @@ def __init__(self): self.model.controls = MockControls() self.terminal_interrupted = False - def editControls(self, setting, value): + def edit_controls(self, setting, value): setattr(self.model.controls, setting, value) def interrupt_terminal(self): diff --git a/tests/test_presenter.py b/tests/test_presenter.py index 9309447..30a8c30 100644 --- a/tests/test_presenter.py +++ b/tests/test_presenter.py @@ -40,7 +40,7 @@ def presenter(): @pytest.mark.parametrize(["param", "value"], [("nSamples", 50), ("calcSldDuringFit", True), ("parallel", "contrasts")]) def test_set_controls_data(presenter, param, value): """Check that setting values are correctly propagated to the Controls object.""" - assert presenter.editControls(param, value) + assert presenter.edit_controls(param, value) assert getattr(presenter.model.controls, param) == value @@ -50,7 +50,7 @@ def test_set_controls_data(presenter, param, value): def test_controls_validation_error(presenter, param, value): """Test that data is not changed if invalid data is passed to set.""" try: - presenter.editControls(param, value) + presenter.edit_controls(param, value) except ValidationError as err: with pytest.raises(ValidationError, match=f"{param}"): raise err