autocal: 新增单位与换算页(默认锁定)及轴页报警与事件日志
- 设备设置新增“单位与换算”页:显示各轴 UNITS、读回值、脉冲/mm 换算与核对状态; 默认锁定,点击“修改”后才可编辑,应用前弹窗确认,旋转轴偏离标定值时额外警告 - 轴调试页:脉冲当量改为只读并提供入口;新增报警与事件日志(报警、使能、 回零、读取失败、单位不符等)及单位核对摘要 - 新增 motion/unit_report.py、motion/events.py 及对应测试
This commit is contained in:
@@ -53,7 +53,7 @@ def test_the_page_is_locked_until_the_operator_presses_modify(make_window):
|
||||
page = window.device_setup.units_page
|
||||
page.set_rows(_rows(connected=False), False)
|
||||
assert page.locked
|
||||
assert all(edit.isReadOnly() for edit in page._edits.values()) # noqa: SLF001
|
||||
assert all(edit.isReadOnly() for edit in page._edits.values())
|
||||
# Nothing to change on a machine that is not connected.
|
||||
assert not page.modify_button.isEnabled()
|
||||
|
||||
@@ -61,7 +61,7 @@ def test_the_page_is_locked_until_the_operator_presses_modify(make_window):
|
||||
assert page.modify_button.isEnabled()
|
||||
page.modify_button.click()
|
||||
assert not page.locked
|
||||
assert not any(edit.isReadOnly() for edit in page._edits.values()) # noqa: SLF001
|
||||
assert not any(edit.isReadOnly() for edit in page._edits.values())
|
||||
assert page.apply_button.isEnabled()
|
||||
window.close()
|
||||
|
||||
@@ -75,7 +75,7 @@ def test_a_confirmed_change_is_emitted_and_the_page_locks_again(make_window, mon
|
||||
asked = _answer(monkeypatch, QMessageBox.StandardButton.Yes)
|
||||
|
||||
page.modify_button.click()
|
||||
page._edits["x"].setText("5") # noqa: SLF001
|
||||
page._edits["x"].setText("5")
|
||||
page.apply_button.click()
|
||||
|
||||
assert emitted == [{0: 5.0}]
|
||||
@@ -93,14 +93,14 @@ def test_declining_the_confirmation_changes_nothing(make_window, monkeypatch):
|
||||
_answer(monkeypatch, QMessageBox.StandardButton.No)
|
||||
|
||||
page.modify_button.click()
|
||||
page._edits["y"].setText("20") # noqa: SLF001
|
||||
page._edits["y"].setText("20")
|
||||
page.apply_button.click()
|
||||
|
||||
assert emitted == []
|
||||
assert not page.locked # still the operator's to finish or cancel
|
||||
page.cancel_button.click()
|
||||
assert page.locked
|
||||
assert page._edits["y"].text() == "10" # noqa: SLF001
|
||||
assert page._edits["y"].text() == "10"
|
||||
window.close()
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ def test_a_rotary_value_off_the_calibration_is_warned_about(make_window, monkeyp
|
||||
asked = _answer(monkeypatch, QMessageBox.StandardButton.No)
|
||||
|
||||
page.modify_button.click()
|
||||
page._edits["yaw"].setText("5") # noqa: SLF001
|
||||
page._edits["yaw"].setText("5")
|
||||
page.apply_button.click()
|
||||
|
||||
assert t("units.confirm_rotary", roles=t("setup.role_yaw"), cal="10") in asked[0]
|
||||
@@ -128,7 +128,7 @@ def test_an_unusable_value_is_refused_before_any_question(make_window, monkeypat
|
||||
asked = _answer(monkeypatch, QMessageBox.StandardButton.Yes)
|
||||
|
||||
page.modify_button.click()
|
||||
page._edits["z"].setText(bad) # noqa: SLF001
|
||||
page._edits["z"].setText(bad)
|
||||
page.apply_button.click()
|
||||
|
||||
assert emitted == [] and asked == []
|
||||
@@ -157,13 +157,13 @@ def test_a_changed_axis_mapping_drops_an_open_edit(make_window):
|
||||
page = window.device_setup.units_page
|
||||
page.set_rows(_rows(), True)
|
||||
page.modify_button.click()
|
||||
page._edits["x"].setText("5") # noqa: SLF001
|
||||
page._edits["x"].setText("5")
|
||||
|
||||
swapped = dict(ROLES, x=1, y=0)
|
||||
page.set_rows(build_unit_rows(swapped, lambda axis: 10.0, _snapshot()), True)
|
||||
|
||||
assert page.locked
|
||||
assert page._edits["x"].text() == "10" # noqa: SLF001
|
||||
assert page._edits["x"].text() == "10"
|
||||
window.close()
|
||||
|
||||
|
||||
@@ -205,9 +205,9 @@ def test_the_axis_page_logs_alarms_and_can_clear_the_log(make_window):
|
||||
def test_a_unit_mismatch_reaches_the_axis_page_summary(make_window):
|
||||
window = make_window()
|
||||
window.axis_panel.update_snapshot(_snapshot(units=5.0))
|
||||
window._refresh_unit_report() # noqa: SLF001 - the window does this on every poll
|
||||
window._refresh_unit_report()
|
||||
assert t("units.summary_bad", bad=5, total=5) == window.axis_panel.units_chip.text()
|
||||
window.axis_panel.update_snapshot(_snapshot(units=10.0))
|
||||
window._refresh_unit_report() # noqa: SLF001
|
||||
window._refresh_unit_report()
|
||||
assert t("units.summary_ok", total=5) == window.axis_panel.units_chip.text()
|
||||
window.close()
|
||||
|
||||
Reference in New Issue
Block a user