migrate pyqt5 to pyside6

This commit is contained in:
ykcheungab
2026-09-21 09:34:56 +08:00
parent e276b5de0f
commit ccedb9ddd9
66 changed files with 2184 additions and 395 deletions
+39 -26
View File
@@ -77,8 +77,8 @@ STRINGS = {
"stop_all": "全部停止",
"run_title": "运行",
"run_phase": "空闲",
"run_step": "第 0/0 点",
"run_time": "已用 0:00 · 预计剩余 —",
"run_idle_hint": "尚未生成标定点",
"run_run": "运行",
"run_pause": "暂停",
"run_abort": "中止",
@@ -129,6 +129,9 @@ STRINGS = {
"seq_preview": "预览",
"seq_validation": "校验",
"seq_points": "标定点列表",
"seq_name": "序列名称",
"seq_note": "备注",
"seq_summary": "6 点(6 启用) · X 0.000–10.000 (10.000) · Y 0.000 · Z 12.400–13.400 (1.000) · 预计 2:24(估计值)",
"seq_fields": [
("曲面模式", "平面"), ("点距 (mm)", "2.000"), ("边界余量 (mm)", "1.000"),
("曲面半径 (mm)", "—"), ("安全高度 (mm)", "5.000"), ("进给速度 (mm/s)", "2.000"),
@@ -140,12 +143,12 @@ STRINGS = {
"seq_preview_hint": "生成后可在此检查点是否落在曲面上、是否在行程内、接触能否被确认。",
"seq_checks": ["在曲面范围内", "在行程内", "接触可确认"],
"seq_checks_pending": "尚未生成标定点。",
"seq_buttons": [("生成标定点", True), ("仿真", True), ("干跑(不接触)", True), ("保存序列…", True), ("载入序列…", True)],
"point_cols": ["#", "X (mm)", "Y (mm)", "Z (mm)", "状态", "灵敏度(上次)", "样本", "操作"],
"seq_buttons": [("生成标定点", True), ("仿真", True), ("干跑(不接触)", True), ("导出序列…", False), ("导入序列…", False)],
"point_cols": ["#", "X (mm)", "Y (mm)", "Z (mm)", "状态", "灵敏度(上次)", "样本"],
"point_rows": [
["1", "0.000", "0.000", "12.400", "待测", "—", "—", ""],
["2", "2.000", "0.000", "12.400", "待测", "—", "—", ""],
["3", "4.000", "0.000", "12.400", "待测", "—", "—", ""],
["1", "0.000", "0.000", "12.400", "待测", "—", "—"],
["2", "2.000", "0.000", "12.400", "待测", "—", "—"],
["3", "4.000", "0.000", "12.400", "待测", "—", "—"],
],
"points_hint": "坐标由网格生成并逐点校验,不接受手工输入:手工输入的坐标没有任何检查,一个错数字会毁掉整条序列。",
"sensor_note": "设备与信号源、实时图像、力曲线",
@@ -169,8 +172,8 @@ STRINGS = {
"stop_all": "Stop all",
"run_title": "Run",
"run_phase": "Idle",
"run_step": "Point 0/0",
"run_time": "Elapsed 0:00 · about — left",
"run_idle_hint": "No points generated",
"run_run": "Run",
"run_pause": "Pause",
"run_abort": "Abort",
@@ -221,6 +224,9 @@ STRINGS = {
"seq_preview": "Preview",
"seq_validation": "Checks",
"seq_points": "Calibration points",
"seq_name": "Sequence name",
"seq_note": "Note",
"seq_summary": "6 points (6 enabled) · X 0.000-10.000 (10.000) · Y 0.000 · Z 12.400-13.400 (1.000) · about 2:24 (estimate)",
"seq_fields": [
("Surface mode", "Flat"), ("Pitch (mm)", "2.000"), ("Margin (mm)", "1.000"),
("Radius (mm)", "—"), ("Clear height (mm)", "5.000"), ("Approach (mm/s)", "2.000"),
@@ -232,12 +238,12 @@ STRINGS = {
"seq_preview_hint": "After generation, check each point is on the surface, inside travel and confirmable by contact.",
"seq_checks": ["On the surface", "Within travel", "Contact confirmable"],
"seq_checks_pending": "No points generated yet.",
"seq_buttons": [("Generate points", True), ("Simulate", True), ("Dry run (no contact)", True), ("Save sequence…", True), ("Load sequence…", True)],
"point_cols": ["#", "X (mm)", "Y (mm)", "Z (mm)", "Status", "Sensitivity (last)", "Samples", "Actions"],
"seq_buttons": [("Generate points", True), ("Simulate", True), ("Dry run (no contact)", True), ("Export sequence…", False), ("Import sequence…", False)],
"point_cols": ["#", "X (mm)", "Y (mm)", "Z (mm)", "Status", "Sensitivity (last)", "Samples"],
"point_rows": [
["1", "0.000", "0.000", "12.400", "Pending", "—", "—", ""],
["2", "2.000", "0.000", "12.400", "Pending", "—", "—", ""],
["3", "4.000", "0.000", "12.400", "Pending", "—", "—", ""],
["1", "0.000", "0.000", "12.400", "Pending", "—", "—"],
["2", "2.000", "0.000", "12.400", "Pending", "—", "—"],
["3", "4.000", "0.000", "12.400", "Pending", "—", "—"],
],
"points_hint": "Coordinates are generated and checked per point; they are not typed. A typed coordinate is one nothing has checked.",
"sensor_note": "Device and source, live image, force curves",
@@ -644,13 +650,22 @@ def draw_sequence_tab(painter: QPainter, palette: Palette, s: dict, rect: QRect)
profile = QRect(inner.x(), inner.y(), profile_w, top_h)
p_inner = _panel(painter, profile, palette)
_box_title(painter, profile, s["seq_profile"], palette)
# the name and note the document carries
y = p_inner.y() + 4
_text(painter, QRect(p_inner.x(), y, 70, 22), s["seq_name"], palette, size=9, muted=True)
_field(painter, QRect(p_inner.x() + 72, y, p_inner.width() - 78, 22), "5 点灵敏度扫描", palette)
y += 26
_text(painter, QRect(p_inner.x(), y, 70, 22), s["seq_note"], palette, size=9, muted=True)
_field(painter, QRect(p_inner.x() + 72, y, p_inner.width() - 78, 22), "", palette)
y += 28
column_w = p_inner.width() // 2
for index, (label, value) in enumerate(s["seq_fields"]):
row, side = divmod(index, 2)
x = p_inner.x() + side * column_w
y = p_inner.y() + 20 + row * 26
_text(painter, QRect(x, y, 130, 22), label, palette, size=9, muted=True)
_field(painter, QRect(x + 128, y, column_w - 140, 22), value, palette)
row_y = y + row * 26
_text(painter, QRect(x, row_y, 130, 22), label, palette, size=9, muted=True)
_field(painter, QRect(x + 128, row_y, column_w - 140, 22), value, palette)
# --- preview
preview = QRect(inner.x() + profile_w + gap, inner.y(), preview_w, top_h)
@@ -699,7 +714,9 @@ def draw_sequence_tab(painter: QPainter, palette: Palette, s: dict, rect: QRect)
points = QRect(inner.x(), inner.y() + top_h + gap, inner.width(), inner.height() - top_h - gap)
t_inner = _panel(painter, points, palette)
_box_title(painter, points, s["seq_points"], palette)
widths = (50, 150, 150, 150, 130, 190, 100)
# Seven columns: no empty actions column, and the summary line carries the
# count and span the operator reasons with.
widths = (60, 150, 150, 150, 140, 190, 110)
widths = widths + (t_inner.width() - sum(widths),)
header_h = 28
header = QRect(t_inner.x(), t_inner.y() + 4, t_inner.width(), header_h)
@@ -719,7 +736,9 @@ def draw_sequence_tab(painter: QPainter, palette: Palette, s: dict, rect: QRect)
for value, width in zip(row, widths):
_text(painter, QRect(x, row_y, width, row_h), value, palette, size=10, align=Qt.AlignmentFlag.AlignCenter)
x += width
y = header.bottom() + 1 + len(s["point_rows"]) * row_h + 10
y = header.bottom() + 1 + len(s["point_rows"]) * row_h + 8
_text(painter, QRect(t_inner.x(), y, t_inner.width(), 22), s["seq_summary"], palette, size=10)
y += 24
_text(painter, QRect(t_inner.x(), y, t_inner.width(), 34), s["points_hint"], palette, size=9, muted=True)
@@ -917,13 +936,7 @@ def draw_run_bar(painter: QPainter, palette: Palette, s: dict, top: int) -> None
x += painter.fontMetrics().horizontalAdvance(s["run_title"]) + 20
_text(painter, QRect(x, top, 90, RUNBAR_H), s["run_phase"], palette, size=10, muted=True)
x += 96
_text(painter, QRect(x, top, 150, RUNBAR_H), s["run_step"], palette, size=10)
x += 158
bar = QRect(x, top + 14, 300, 12)
painter.fillRect(bar, palette.border)
painter.fillRect(QRect(bar.x(), bar.y(), 3 * bar.width() // 4, bar.height()), palette.accent)
_text(painter, QRect(bar.right() + 12, top, 260, RUNBAR_H), s["run_time"], palette, size=10, muted=True)
_text(painter, QRect(x, top, 420, RUNBAR_H), s["run_idle_hint"], palette, size=9, muted=True)
_button(painter, QRect(PAGE_W - 330, top + 7, 96, 26), s["run_run"], palette, disabled=True)
_button(painter, QRect(PAGE_W - 228, top + 7, 96, 26), s["run_pause"], palette, disabled=True)