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
|
|
@ -30,18 +30,34 @@ from otko.viewmodels import ProjectViewModel # noqa: E402
|
|||
def _vm_with_steel() -> ProjectViewModel:
|
||||
vm = ProjectViewModel()
|
||||
vm.new_project()
|
||||
vm.apply_command(AddNodesCommand(vm, [
|
||||
Node(id=1, coords=(0, 0, 0)),
|
||||
Node(id=2, coords=(1, 0, 0)),
|
||||
Node(id=3, coords=(2, 0, 0)),
|
||||
]))
|
||||
vm.apply_command(AddMaterialsCommand(vm, [
|
||||
Steel01(id=1, name="S420", Fy=420e6, E0=200e9, b=0.01),
|
||||
]))
|
||||
vm.apply_command(AddSectionsCommand(vm, [
|
||||
ElasticSection(id=1, name="Default", E=200e9, A=0.01,
|
||||
Iz=8.33e-6, Iy=8.33e-6, G=80e9, J=1e-6),
|
||||
]))
|
||||
vm.apply_command(
|
||||
AddNodesCommand(
|
||||
vm,
|
||||
[
|
||||
Node(id=1, coords=(0, 0, 0)),
|
||||
Node(id=2, coords=(1, 0, 0)),
|
||||
Node(id=3, coords=(2, 0, 0)),
|
||||
],
|
||||
)
|
||||
)
|
||||
vm.apply_command(
|
||||
AddMaterialsCommand(
|
||||
vm,
|
||||
[
|
||||
Steel01(id=1, name="S420", Fy=420e6, E0=200e9, b=0.01),
|
||||
],
|
||||
)
|
||||
)
|
||||
vm.apply_command(
|
||||
AddSectionsCommand(
|
||||
vm,
|
||||
[
|
||||
ElasticSection(
|
||||
id=1, name="Default", E=200e9, A=0.01, Iz=8.33e-6, Iy=8.33e-6, G=80e9, J=1e-6
|
||||
),
|
||||
],
|
||||
)
|
||||
)
|
||||
return vm
|
||||
|
||||
|
||||
|
|
@ -91,8 +107,7 @@ def test_update_unknown_id_raises(qtbot) -> None: # type: ignore[no-untyped-def
|
|||
@pytest.mark.gui
|
||||
def test_update_section_changes_inertia(qtbot) -> None: # type: ignore[no-untyped-def]
|
||||
vm = _vm_with_steel()
|
||||
new = ElasticSection(id=1, name="Updated", E=200e9, A=0.02,
|
||||
Iz=2e-5, Iy=2e-5, G=80e9, J=2e-6)
|
||||
new = ElasticSection(id=1, name="Updated", E=200e9, A=0.02, Iz=2e-5, Iy=2e-5, G=80e9, J=2e-6)
|
||||
vm.apply_command(UpdateSectionCommand(vm, new))
|
||||
s = vm.project.section(1)
|
||||
assert s.A == 0.02
|
||||
|
|
@ -106,14 +121,23 @@ def test_update_section_changes_inertia(qtbot) -> None: # type: ignore[no-untyp
|
|||
def test_assign_section_to_frames(qtbot) -> None: # type: ignore[no-untyped-def]
|
||||
vm = _vm_with_steel()
|
||||
# Add a second section and two frames.
|
||||
vm.apply_command(AddSectionsCommand(vm, [
|
||||
ElasticSection(id=2, name="Big", E=200e9, A=0.05,
|
||||
Iz=4e-5, Iy=4e-5, G=80e9, J=2e-6),
|
||||
]))
|
||||
vm.apply_command(AddElementsCommand(vm, [
|
||||
ElasticBeamColumn(id=1, nodes=(1, 2), section_id=1),
|
||||
ElasticBeamColumn(id=2, nodes=(2, 3), section_id=1),
|
||||
]))
|
||||
vm.apply_command(
|
||||
AddSectionsCommand(
|
||||
vm,
|
||||
[
|
||||
ElasticSection(id=2, name="Big", E=200e9, A=0.05, Iz=4e-5, Iy=4e-5, G=80e9, J=2e-6),
|
||||
],
|
||||
)
|
||||
)
|
||||
vm.apply_command(
|
||||
AddElementsCommand(
|
||||
vm,
|
||||
[
|
||||
ElasticBeamColumn(id=1, nodes=(1, 2), section_id=1),
|
||||
ElasticBeamColumn(id=2, nodes=(2, 3), section_id=1),
|
||||
],
|
||||
)
|
||||
)
|
||||
vm.apply_command(AssignSectionCommand(vm, {1, 2}, section_id=2))
|
||||
assert vm.project.element(1).section_id == 2
|
||||
assert vm.project.element(2).section_id == 2
|
||||
|
|
@ -126,10 +150,15 @@ def test_assign_section_to_frames(qtbot) -> None: # type: ignore[no-untyped-def
|
|||
def test_assign_section_skips_truss_elements(qtbot) -> None: # type: ignore[no-untyped-def]
|
||||
"""Truss has no section_id — command should silently skip it."""
|
||||
vm = _vm_with_steel()
|
||||
vm.apply_command(AddElementsCommand(vm, [
|
||||
TrussElement(id=1, nodes=(1, 2), area=1e-3, material_id=1),
|
||||
ElasticBeamColumn(id=2, nodes=(2, 3), section_id=1),
|
||||
]))
|
||||
vm.apply_command(
|
||||
AddElementsCommand(
|
||||
vm,
|
||||
[
|
||||
TrussElement(id=1, nodes=(1, 2), area=1e-3, material_id=1),
|
||||
ElasticBeamColumn(id=2, nodes=(2, 3), section_id=1),
|
||||
],
|
||||
)
|
||||
)
|
||||
vm.apply_command(AssignSectionCommand(vm, {1, 2}, section_id=1))
|
||||
# Frame ok, truss unchanged (still material-based).
|
||||
assert vm.project.element(2).section_id == 1
|
||||
|
|
@ -140,13 +169,23 @@ def test_assign_section_skips_truss_elements(qtbot) -> None: # type: ignore[no-
|
|||
@pytest.mark.gui
|
||||
def test_assign_material_to_truss(qtbot) -> None: # type: ignore[no-untyped-def]
|
||||
vm = _vm_with_steel()
|
||||
vm.apply_command(AddMaterialsCommand(vm, [
|
||||
Steel02(id=2, name="S355", Fy=355e6, E0=210e9, b=0.005),
|
||||
]))
|
||||
vm.apply_command(AddElementsCommand(vm, [
|
||||
TrussElement(id=1, nodes=(1, 2), area=1e-3, material_id=1),
|
||||
TrussElement(id=2, nodes=(2, 3), area=1e-3, material_id=1),
|
||||
]))
|
||||
vm.apply_command(
|
||||
AddMaterialsCommand(
|
||||
vm,
|
||||
[
|
||||
Steel02(id=2, name="S355", Fy=355e6, E0=210e9, b=0.005),
|
||||
],
|
||||
)
|
||||
)
|
||||
vm.apply_command(
|
||||
AddElementsCommand(
|
||||
vm,
|
||||
[
|
||||
TrussElement(id=1, nodes=(1, 2), area=1e-3, material_id=1),
|
||||
TrussElement(id=2, nodes=(2, 3), area=1e-3, material_id=1),
|
||||
],
|
||||
)
|
||||
)
|
||||
vm.apply_command(AssignMaterialCommand(vm, {1, 2}, material_id=2))
|
||||
assert vm.project.element(1).material_id == 2
|
||||
assert vm.project.element(2).material_id == 2
|
||||
|
|
@ -157,10 +196,15 @@ def test_assign_material_to_truss(qtbot) -> None: # type: ignore[no-untyped-def
|
|||
@pytest.mark.gui
|
||||
def test_assign_material_skips_frame_elements(qtbot) -> None: # type: ignore[no-untyped-def]
|
||||
vm = _vm_with_steel()
|
||||
vm.apply_command(AddElementsCommand(vm, [
|
||||
ElasticBeamColumn(id=1, nodes=(1, 2), section_id=1),
|
||||
TrussElement(id=2, nodes=(2, 3), area=1e-3, material_id=1),
|
||||
]))
|
||||
vm.apply_command(
|
||||
AddElementsCommand(
|
||||
vm,
|
||||
[
|
||||
ElasticBeamColumn(id=1, nodes=(1, 2), section_id=1),
|
||||
TrussElement(id=2, nodes=(2, 3), area=1e-3, material_id=1),
|
||||
],
|
||||
)
|
||||
)
|
||||
vm.apply_command(AssignMaterialCommand(vm, {1, 2}, material_id=1))
|
||||
# Frame doesn't have material_id; only the truss is affected.
|
||||
assert vm.project.element(2).material_id == 1
|
||||
|
|
|
|||
Loading…
Reference in a new issue