feat: 完善参数化关系式与SCDM模型修改验证

This commit is contained in:
2026-08-17 18:53:03 +08:00
parent a633b5a338
commit 722256a41f
7 changed files with 1798 additions and 83 deletions
+43 -1
View File
@@ -179,12 +179,48 @@ class WindowCoreMixin:
elif watched is getattr(self, "property_table", None):
if event.type() == QEvent.Type.Resize and hasattr(self, "_resize_property_table_columns"):
QTimer.singleShot(0, self._resize_property_table_columns)
elif watched is self._relation_formula_popup_widget():
if event.type() == QEvent.Type.KeyPress and event.key() == Qt.Key.Key_Backspace:
editor = getattr(self, "relation_formula_input", None)
popup = self._relation_formula_popup_widget()
if editor is not None and hasattr(editor, "backspace"):
if popup is not None and hasattr(popup, "hide"):
popup.hide()
if hasattr(editor, "setFocus"):
editor.setFocus(Qt.FocusReason.OtherFocusReason)
editor.backspace()
if hasattr(self, "_update_relation_formula_completions"):
QTimer.singleShot(0, self._update_relation_formula_completions)
event.accept()
return True
elif watched is getattr(self, "relation_formula_input", None):
if event.type() == QEvent.Type.KeyPress and event.key() == Qt.Key.Key_Tab:
if event.type() == QEvent.Type.MouseButtonPress:
if hasattr(self, "_hide_relation_formula_completion_popup"):
self._hide_relation_formula_completion_popup()
if hasattr(watched, "setFocus"):
watched.setFocus(Qt.FocusReason.MouseFocusReason)
if event.type() in {QEvent.Type.ShortcutOverride, QEvent.Type.KeyPress} and event.key() == Qt.Key.Key_Tab:
if bool(getattr(self, "_relation_formula_tab_completion_accepted", False)):
self._relation_formula_tab_completion_accepted = False
event.accept()
return True
if hasattr(self, "_accept_relation_formula_completion") and self._accept_relation_formula_completion():
self._relation_formula_tab_completion_accepted = event.type() == QEvent.Type.ShortcutOverride
if self._relation_formula_tab_completion_accepted:
QTimer.singleShot(0, lambda: setattr(self, "_relation_formula_tab_completion_accepted", False))
event.accept()
return True
return super().eventFilter(watched, event)
def _relation_formula_popup_widget(self):
completer = getattr(self, "relation_formula_completer", None)
if completer is None or not hasattr(completer, "popup"):
return None
try:
return completer.popup()
except RuntimeError:
return None
def _should_suppress_transient_tooltip(self, watched) -> bool:
if not isinstance(watched, QWidget):
return False
@@ -1274,6 +1310,8 @@ class WindowCoreMixin:
self.load_in_progress = False
self.pending_load_path = None
self._update_action_states()
if hasattr(self, "_update_relation_formula_buttons"):
self._update_relation_formula_buttons()
if float(getattr(self, "preview_load_deflection", 0.0) or 0.0) > float(
getattr(self, "initial_load_deflection", 0.0) or 0.0
):
@@ -1337,6 +1375,8 @@ class WindowCoreMixin:
self.load_in_progress = False
self.pending_load_path = None
self._update_action_states()
if hasattr(self, "_update_relation_formula_buttons"):
self._update_relation_formula_buttons()
self._request_thread_quit(self.load_thread)
self._request_thread_quit(self.load_refine_thread)
@@ -1387,6 +1427,8 @@ class WindowCoreMixin:
self.redo_stack.clear()
self.operation_history.clear()
self.redo_history.clear()
if hasattr(self, "_clear_relation_formula_runtime_state"):
self._clear_relation_formula_runtime_state(clear_items=True)
self.clear_diff_preview(render=False)
if hasattr(self, "history_list"):
self.history_list.clear()