feat: 完善 Face 参数化编辑和隔离执行
This commit is contained in:
+30
-16
@@ -3,6 +3,7 @@ from __future__ import annotations
|
||||
from datetime import datetime
|
||||
import faulthandler
|
||||
import math
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
@@ -78,6 +79,12 @@ def _enable_crash_log() -> None:
|
||||
faulthandler.enable(all_threads=True)
|
||||
|
||||
|
||||
def _crash_log_requested(argv: list[str]) -> bool:
|
||||
if "--crash-log" in argv:
|
||||
return True
|
||||
return os.environ.get("STEP_EDITOR_CRASH_LOG", "").strip().lower() in {"1", "true", "yes", "on"}
|
||||
|
||||
|
||||
class StepEditorWindow(WindowCoreMixin, WindowStateMixin, WindowActionMixin, InfoPanelMixin, QMainWindow):
|
||||
ui_task_requested = Signal(object)
|
||||
|
||||
@@ -334,9 +341,9 @@ class StepEditorWindow(WindowCoreMixin, WindowStateMixin, WindowActionMixin, Inf
|
||||
background: #fff8ef;
|
||||
border: 1px solid #edc98e;
|
||||
border-left: 5px solid #d97706;
|
||||
padding-left: 5px;
|
||||
padding-right: 3px;
|
||||
padding-bottom: 7px;
|
||||
padding-left: 2px;
|
||||
padding-right: 1px;
|
||||
padding-bottom: 6px;
|
||||
}
|
||||
QGroupBox#editSection::title {
|
||||
background: #fff0d8;
|
||||
@@ -423,7 +430,7 @@ class StepEditorWindow(WindowCoreMixin, WindowStateMixin, WindowActionMixin, Inf
|
||||
color: #ffffff;
|
||||
font-weight: 700;
|
||||
min-height: 18px;
|
||||
padding: 1px 6px;
|
||||
padding: 1px 3px;
|
||||
}
|
||||
QPushButton#propertyRowEditButton:hover {
|
||||
background: #f97316;
|
||||
@@ -434,7 +441,7 @@ class StepEditorWindow(WindowCoreMixin, WindowStateMixin, WindowActionMixin, Inf
|
||||
border-color: #7c2d12;
|
||||
color: #ffffff;
|
||||
padding-top: 2px;
|
||||
padding-left: 7px;
|
||||
padding-left: 4px;
|
||||
}
|
||||
QPushButton#propertyRowEditButton[changed="true"] {
|
||||
background: #dcfce7;
|
||||
@@ -450,13 +457,19 @@ class StepEditorWindow(WindowCoreMixin, WindowStateMixin, WindowActionMixin, Inf
|
||||
border: 1px dashed #bcc7d4;
|
||||
color: #8f99a8;
|
||||
}
|
||||
QPushButton#propertyRowEditButton[invalid="true"],
|
||||
QPushButton#propertyRowEditButton[invalid="true"]:disabled {
|
||||
background: #fee2e2;
|
||||
border: 1px solid #ef4444;
|
||||
color: #991b1b;
|
||||
}
|
||||
QComboBox#propertyScopeCombo {
|
||||
background: #ffffff;
|
||||
border: 1px solid #f59e0b;
|
||||
border-radius: 5px;
|
||||
color: #7c2d12;
|
||||
min-height: 18px;
|
||||
padding: 0px 4px;
|
||||
padding: 0px 2px;
|
||||
font-weight: 600;
|
||||
}
|
||||
QComboBox#propertyScopeCombo:hover {
|
||||
@@ -478,7 +491,7 @@ class StepEditorWindow(WindowCoreMixin, WindowStateMixin, WindowActionMixin, Inf
|
||||
border-radius: 5px;
|
||||
color: #111827;
|
||||
min-height: 18px;
|
||||
padding: 0px 5px;
|
||||
padding: 0px 2px;
|
||||
selection-background-color: #bfdbfe;
|
||||
}
|
||||
QLineEdit#propertyTargetEditor:hover {
|
||||
@@ -488,7 +501,7 @@ class StepEditorWindow(WindowCoreMixin, WindowStateMixin, WindowActionMixin, Inf
|
||||
QLineEdit#propertyTargetEditor:focus {
|
||||
background: #ffffff;
|
||||
border: 2px solid #2563eb;
|
||||
padding: 0px 4px;
|
||||
padding: 0px 1px;
|
||||
}
|
||||
QPushButton#propertyExpandBar {
|
||||
background: #f8fafc;
|
||||
@@ -568,12 +581,12 @@ class StepEditorWindow(WindowCoreMixin, WindowStateMixin, WindowActionMixin, Inf
|
||||
padding: 0;
|
||||
}
|
||||
QTableWidget#propertyTable::item {
|
||||
padding-left: 2px;
|
||||
padding-right: 2px;
|
||||
padding-left: 1px;
|
||||
padding-right: 1px;
|
||||
}
|
||||
QTableWidget#propertyTable QHeaderView::section {
|
||||
padding-left: 3px;
|
||||
padding-right: 3px;
|
||||
padding-left: 1px;
|
||||
padding-right: 1px;
|
||||
}
|
||||
QTabWidget::pane {
|
||||
border: 1px solid #d8e0eb;
|
||||
@@ -822,7 +835,7 @@ class StepEditorWindow(WindowCoreMixin, WindowStateMixin, WindowActionMixin, Inf
|
||||
"选择模型对象后,这里会列出当前对象的属性和值;能改的行可以输入目标值,不能改的行只读。",
|
||||
)
|
||||
object_edit_layout = QVBoxLayout(self.object_edit_box)
|
||||
object_edit_layout.setContentsMargins(2, 8, 2, 4)
|
||||
object_edit_layout.setContentsMargins(0, 8, 0, 4)
|
||||
object_edit_layout.setSpacing(4)
|
||||
self.property_table = QTableWidget(0, 5)
|
||||
self.property_table.setObjectName("propertyTable")
|
||||
@@ -984,10 +997,10 @@ class StepEditorWindow(WindowCoreMixin, WindowStateMixin, WindowActionMixin, Inf
|
||||
help_tip(self.face_area_input, "目标面面积。当前选中对象表会使用这个隐藏输入执行所属特征或 Solid 的均匀缩放。")
|
||||
self.face_width_input = QLineEdit("", edit_box)
|
||||
self.face_width_input.setVisible(False)
|
||||
help_tip(self.face_width_input, "目标面宽。当前选中对象表会使用这个隐藏输入只修改当前 Face 的平面内宽度。")
|
||||
help_tip(self.face_width_input, "目标面宽。当前选中对象表会使用这个隐藏输入修改 Face 平面内第一个方向的尺寸。")
|
||||
self.face_height_input = QLineEdit("", edit_box)
|
||||
self.face_height_input.setVisible(False)
|
||||
help_tip(self.face_height_input, "目标面高。当前选中对象表会使用这个隐藏输入只修改当前 Face 的平面内高度。")
|
||||
help_tip(self.face_height_input, "目标面高。当前选中对象表会使用这个隐藏输入修改 Face 平面内第二个方向的尺寸。")
|
||||
self.resize_boss_button = QPushButton("调整圆柱凸台直径")
|
||||
help_tip(self.resize_boss_button, "修改完整圆柱凸台直径。变大会加料,变小会重建凸台区域。")
|
||||
self.resize_boss_button.clicked.connect(self.resize_boss)
|
||||
@@ -1375,7 +1388,8 @@ def _parse_args(argv: list[str]) -> tuple[Path, bool]:
|
||||
|
||||
|
||||
def main() -> int:
|
||||
_enable_crash_log()
|
||||
if _crash_log_requested(sys.argv):
|
||||
_enable_crash_log()
|
||||
path, smoke_test = _parse_args(sys.argv)
|
||||
app = QApplication(sys.argv)
|
||||
window = StepEditorWindow(path, background_load=not smoke_test)
|
||||
|
||||
Reference in New Issue
Block a user