Files
TransPyC/_toast_gen.py
T
TermiNexus 921820b26a chore: 纳入 toast 脚本、Sequential 回归测试与诊断产物文件
_toast_gen.py(完成通知 toast 脚本)、Test/SequentialRegressionTest.py
(TPV bootstrap 回归测试脚本)、handles_expr_HEAD.vp 与 output.s
(历史诊断/反汇编产物)入库保存。
2026-08-13 07:51:33 +08:00

20 lines
1.2 KiB
Python

# -*- coding: utf-8 -*-
"""生成并发送 toast 通知"""
import base64, subprocess
ps = (
"Add-Type -AssemblyName System.Runtime.WindowsRuntime\n"
"[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null\n"
"[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] | Out-Null\n"
"$t = 'TransPyC 治本修复:联合转换属性访问'\n"
"$b = 'TPC _handle_attr_call_result 现从 (X|t.CPtr)(arg) 提取真实类并 bitcast,修复属性访问被丢弃;已提交 6a67203(TPV 侧 9f7333b 双保险)'\n"
"$xml = [Windows.Data.Xml.Dom.XmlDocument]::new()\n"
"$xml.LoadXml('<toast><visual><binding template=\"ToastText02\"><text id=\"1\">' + $t + '</text><text id=\"2\">' + $b + '</text></binding></visual></toast>')\n"
"$toast = [Windows.UI.Notifications.ToastNotification]::new($xml)\n"
"[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier('TraeCode').Show($toast)\n"
)
b64 = base64.b64encode(ps.encode('utf-16-le')).decode()
r = subprocess.run(['powershell', '-NoProfile', '-EncodedCommand', b64],
capture_output=True, text=True)
print('rc=', r.returncode)