fix: close only completed integration panels during native save
This commit is contained in:
1 parent
d40fa3a750
commit
87e10740f7
4 files changed
+71
-5
No files matched your search
@@ -238,11 +238,16 @@ class WindowProbe:
|
||||
process_name = ""
|
||||
controls = tuple(self._win32_control(child) for child in self._children(hwnd))
|
||||
diagnostics = []
|
||||
try:
|
||||
uia_records = _bounded_call(lambda: self.uia.controls(hwnd), self.uia_timeout_seconds)
|
||||
controls = self._merge_controls(controls, uia_records)
|
||||
except Exception as error:
|
||||
diagnostics.append(f"UIA_ERROR: {error}")
|
||||
native_panel = (process_name.casefold() == 'expeditionpcb.exe'
|
||||
and phase in (DialogPhase.SAVE, DialogPhase.CLOSE)
|
||||
and gui.GetClassName(hwnd) == '#32770' and gui.GetWindowText(hwnd) == 'Project Integration')
|
||||
# This native panel's exact control IDs/text are sufficient; its UIA tree can stall Save.
|
||||
if not native_panel:
|
||||
try:
|
||||
uia_records = _bounded_call(lambda: self.uia.controls(hwnd), self.uia_timeout_seconds)
|
||||
controls = self._merge_controls(controls, uia_records)
|
||||
except Exception as error:
|
||||
diagnostics.append(f"UIA_ERROR: {error}")
|
||||
owner = 0
|
||||
try:
|
||||
owner = int(gui.GetWindow(hwnd, 4) or 0) # GW_OWNER
|
||||
|
||||
@@ -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'
|
||||
|
||||
Reference in new issue
Block a user