feat: consolidate units to Metric/Imperial with unit-aware dialogs
Some checks failed
CI / lint (push) Has been cancelled
CI / test (macos-latest, 3.10) (push) Has been cancelled
CI / test (macos-latest, 3.11) (push) Has been cancelled
CI / test (macos-latest, 3.12) (push) Has been cancelled
CI / test (ubuntu-latest, 3.10) (push) Has been cancelled
CI / test (ubuntu-latest, 3.11) (push) Has been cancelled
CI / test (ubuntu-latest, 3.12) (push) Has been cancelled
CI / test (windows-latest, 3.10) (push) Has been cancelled
CI / test (windows-latest, 3.11) (push) Has been cancelled
CI / test (windows-latest, 3.12) (push) Has been cancelled

- core/units: two dominant systems (Metric m/kN, Imperial ft/kip) with
  display conversion helpers, legacy 4-system migration in ProjectMeta
- dialogs/docks: unit-aware material, section, case, load, grid and
  results labels; diagram renderer unit labels; render controls update
- docs: add consistent_units.md; regen examples/*.osmodel artifacts
- tests: update persistence/phase8/project/unit-labels for new systems
This commit is contained in:
smillmorel 2026-09-08 16:33:30 -04:00
commit d01a5957b7
99 changed files with 3143 additions and 976 deletions

View file

@ -42,7 +42,7 @@ def test_is_rotation_dof_ndf6() -> None:
@pytest.mark.gui
def test_si_translation_labels(qtbot) -> None: # type: ignore[no-untyped-def]
v = PushoverCurveView(units=UnitSystem.SI_M_N, ndf=6)
v = PushoverCurveView(units=UnitSystem.METRIC, ndf=6)
qtbot.addWidget(v)
v.set_results(_pushover(control_dof=1))
assert "m" in v._plot.getAxis("bottom").labelText
@ -53,7 +53,7 @@ def test_si_translation_labels(qtbot) -> None: # type: ignore[no-untyped-def]
@pytest.mark.gui
def test_si_rotation_labels_show_curvature_and_moment(qtbot) -> None: # type: ignore[no-untyped-def]
v = PushoverCurveView(units=UnitSystem.SI_M_N, ndf=3)
v = PushoverCurveView(units=UnitSystem.METRIC, ndf=3)
qtbot.addWidget(v)
v.set_results(_pushover(control_dof=3))
assert "1/m" in v._plot.getAxis("bottom").labelText
@ -65,7 +65,7 @@ def test_si_rotation_labels_show_curvature_and_moment(qtbot) -> None: # type: i
@pytest.mark.gui
def test_us_in_kip_rotation_labels(qtbot) -> None: # type: ignore[no-untyped-def]
"""kip-in Moment-Curvature project must NOT show cm / kN anywhere."""
v = PushoverCurveView(units=UnitSystem.US_IN_KIP, ndf=3)
v = PushoverCurveView(units=UnitSystem.IMPERIAL, ndf=3)
qtbot.addWidget(v)
v.set_results(_pushover(control_dof=3))
x_label = v._plot.getAxis("bottom").labelText
@ -78,7 +78,7 @@ def test_us_in_kip_rotation_labels(qtbot) -> None: # type: ignore[no-untyped-de
@pytest.mark.gui
def test_us_in_kip_translation_labels(qtbot) -> None: # type: ignore[no-untyped-def]
v = PushoverCurveView(units=UnitSystem.US_IN_KIP, ndf=3)
v = PushoverCurveView(units=UnitSystem.IMPERIAL, ndf=3)
qtbot.addWidget(v)
v.set_results(_pushover(control_dof=1))
assert "in" in v._plot.getAxis("bottom").labelText
@ -90,7 +90,7 @@ def test_no_auto_scaling_applied_to_values(qtbot) -> None: # type: ignore[no-un
"""Regression: earlier versions divided base_shear by 1000 to
display kN. The values must now be drawn exactly as stored so
kip-in users don't see nonsense scaling."""
v = PushoverCurveView(units=UnitSystem.US_IN_KIP, ndf=3)
v = PushoverCurveView(units=UnitSystem.IMPERIAL, ndf=3)
qtbot.addWidget(v)
r = _pushover(control_dof=3)
v.set_results(r)