Skip to content

Commit

Permalink
more consistent name changing...
Browse files Browse the repository at this point in the history
  • Loading branch information
alexhroom committed Sep 4, 2024
1 parent 6777c8d commit aecdb61
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion rascal2/core/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion rascal2/ui/presenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions rascal2/widgets/controls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_controls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_presenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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
Expand Down

0 comments on commit aecdb61

Please sign in to comment.