Files
kefu/deploy/single-instance-tray-20260917/fix_deferred_portal.py
T
2026-09-21 10:34:06 +08:00

9 lines
776 B
Python

from pathlib import Path
import os
for root in (Path('C:/wechat_rpa'), Path('C:/kefu/wechat_rpa')):
p=root/'wechat_gui_qt.py'
s=p.read_text(encoding='utf-8')
s=s.replace(' def restore_portal() -> None:\n if self.portal_page.view is not None:', ' def restore_portal() -> None:\n if (getattr(self, "_exit_requested", False)\n or getattr(self, "_tray_hidden", False) or not self.isVisible()):\n return\n if self.portal_page.view is not None:',1)
s=s.replace(' QTimer.singleShot(80, restore_portal)', ' QTimer.singleShot(80, self, restore_portal)',1)
t=p.with_suffix('.tray.tmp');t.write_text(s,encoding='utf-8');os.replace(t,p)