Files
TransPyC/_toast_gen.py
T
TermiNexus 3fe985648e chore: 更新 TODO/toast 脚本/测试源
TODO 补编译器实验方向;toast 通知改 list 泛型方法修复完成;DecoratorTest 补 global _call_count 声明;LLvmLiteTest ConstFloat 断言改十六进制位模式。
2026-08-15 06:24:22 +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 = 'list 泛型方法调用修复完成'\n"
"$b = 'obj.method 检测将 list[AST|CPtr] 特化 struct 误当普通结构体走 _translate_method_call 查 append 返回类型失败;新增 _is_list_builtin_method 跳过,落到 list 内置分支' \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)