fix: close only completed integration panels during native save

This commit is contained in:
阿白叔 committed 2026-11-17 01:22:58 +08:00
1 parent d40fa3a750
commit 87e10740f7
4 files changed
+71 -5

No files matched your search

+15
View File
@@ -220,6 +220,21 @@ def archive_version_choice(snapshot, root):
def decide(snapshot: WindowSnapshot, rules: Sequence[DialogRule]) -> RuleDecision:
if (snapshot.title == 'Project Integration' and snapshot.phase in (DialogPhase.SAVE, DialogPhase.CLOSE)
and snapshot.process_name.casefold() == 'expeditionpcb.exe' and snapshot.process_role == 'pcb'
and snapshot.window_class == '#32770' and snapshot.owner_hwnd and not snapshot.diagnostics):
idle = {1033: 'No connectivity changes to be forward annotated',
1032: 'No pending schematic CES changes to load into PCB',
1035: 'No pending PCB changes to be back annotated',
1034: 'No pending CES changes to load into PCB'}
complete = all(len(matches := [c for c in snapshot.controls if c.control_id == identifier]) == 1
and matches[0].class_name == 'Static' and matches[0].name == text for identifier, text in idle.items())
close = [c for c in snapshot.controls if c.control_id == 2]
if (complete and len(close) == 1 and close[0].class_name == 'Button'
and close[0].name.replace('&', '') == 'Close' and close[0].enabled):
return RuleDecision(rule_id='completed-integration-panel', category='SAFE_CONFIRM',
action='close_completed_integration', channels=('win32_button_click',),
target=(('control_id', 2),), postcondition='window_gone')
# Windows Text Services Framework language-bar window exposed by Mentor's
# process is not a Mentor modal: it has no controls and must not abort a run.
if (snapshot.window_class.casefold() == 'cicerouiwndframe'