chore: adopt remaining local development state
Catch-all for the intermixed residue of the unpushed otko-development work ported into this tree: combinations/console-dock/quick-guide wiring across commands, core, services, views and tests; repo-wide ruff-format normalization; README/CONTRIBUTING updates; and the toolbar default (both toolbars now open in the top area, quick guide text updated). Splitting this further would require hunk-level surgery with low confidence; the preceding commits in this branch isolate the self-contained features.
This commit is contained in:
parent
cb4bf8fccd
commit
ba783718d4
152 changed files with 3394 additions and 1651 deletions
|
|
@ -23,16 +23,31 @@ from otko.viewmodels import ProjectViewModel # noqa: E402
|
|||
def _vm_with_truss() -> ProjectViewModel:
|
||||
vm = ProjectViewModel()
|
||||
vm.new_project()
|
||||
vm.apply_command(AddNodesCommand(vm, [
|
||||
Node(id=1, coords=(0, 0, 0)),
|
||||
Node(id=2, coords=(3, 0, 0)),
|
||||
]))
|
||||
vm.apply_command(AddMaterialsCommand(vm, [
|
||||
ElasticUniaxial(id=1, name="Steel", E=200e9),
|
||||
]))
|
||||
vm.apply_command(AddElementsCommand(vm, [
|
||||
TrussElement(id=1, nodes=(1, 2), area=0.001, material_id=1),
|
||||
]))
|
||||
vm.apply_command(
|
||||
AddNodesCommand(
|
||||
vm,
|
||||
[
|
||||
Node(id=1, coords=(0, 0, 0)),
|
||||
Node(id=2, coords=(3, 0, 0)),
|
||||
],
|
||||
)
|
||||
)
|
||||
vm.apply_command(
|
||||
AddMaterialsCommand(
|
||||
vm,
|
||||
[
|
||||
ElasticUniaxial(id=1, name="Steel", E=200e9),
|
||||
],
|
||||
)
|
||||
)
|
||||
vm.apply_command(
|
||||
AddElementsCommand(
|
||||
vm,
|
||||
[
|
||||
TrussElement(id=1, nodes=(1, 2), area=0.001, material_id=1),
|
||||
],
|
||||
)
|
||||
)
|
||||
return vm
|
||||
|
||||
|
||||
|
|
@ -57,9 +72,13 @@ def test_update_area_is_undoable(qtbot) -> None: # type: ignore[no-untyped-def]
|
|||
def test_unknown_field_is_silently_ignored(qtbot) -> None: # type: ignore[no-untyped-def]
|
||||
"""Fields not in the element's model are filtered out — no exception."""
|
||||
vm = _vm_with_truss()
|
||||
vm.apply_command(UpdateElementFieldsCommand(
|
||||
vm, 1, {"section_id": 42}, # TrussElement has no section_id
|
||||
))
|
||||
vm.apply_command(
|
||||
UpdateElementFieldsCommand(
|
||||
vm,
|
||||
1,
|
||||
{"section_id": 42}, # TrussElement has no section_id
|
||||
)
|
||||
)
|
||||
# The element is unchanged.
|
||||
assert vm.project.element(1).area == pytest.approx(0.001)
|
||||
assert vm.project.element(1).material_id == 1
|
||||
|
|
@ -68,9 +87,13 @@ def test_unknown_field_is_silently_ignored(qtbot) -> None: # type: ignore[no-un
|
|||
@pytest.mark.gui
|
||||
def test_update_multiple_fields_at_once(qtbot) -> None: # type: ignore[no-untyped-def]
|
||||
vm = _vm_with_truss()
|
||||
vm.apply_command(UpdateElementFieldsCommand(
|
||||
vm, 1, {"area": 0.003, "rho": 7850.0},
|
||||
))
|
||||
vm.apply_command(
|
||||
UpdateElementFieldsCommand(
|
||||
vm,
|
||||
1,
|
||||
{"area": 0.003, "rho": 7850.0},
|
||||
)
|
||||
)
|
||||
el = vm.project.element(1)
|
||||
assert el.area == pytest.approx(0.003)
|
||||
assert el.rho == pytest.approx(7850.0)
|
||||
|
|
|
|||
Loading…
Reference in a new issue