Files
ykxmz/_build/patch_layout_tabs.py
xmz7891 b62ac865ea ykxmz 1.5.0:修复手表端 TLS 证书校验 + MTU 修复网络稳定性
被控端
- 修复 MTU 问题:夹 MSS + 路径 MTU 探测(公网可用率 48% -> 100%)
- 复用 HTTP 连接(免掉每次新建 TLS 的 30% 握手失败)
- 每分钟回头找局域网,自动切回快 400 倍的路径
- 画面心跳帧:静止时省流量,客户端仍知道流是活的
- 锁屏时给出可操作的提示

手表端
- 内置 GTS Root R4 / GlobalSign Root CA,修 SSLHandshakeException
- 连接错误翻译成人话(证书/时间/解析/超时分别提示)
- 经中转连上后用服务器报的地址刷新已配对记录
- 新增局域网连接页面、服务器延迟检测

服务器端
- 支持 chunked 请求体(修每 16 秒一次的连接错乱与大面积 502)
- 网络调优脚本 net-tune.sh(开机自动应用)
- 管理页:批量删除、网络体检、下载区
- 隧道改 HTTP/2 + 双连接

文档
- 许可协议 / 安装前必读 / 安装后须知(作者:小麦子)
2026-10-06 19:01:05 +08:00

80 lines
3.1 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
"""布局核算改成按「分页」算。
改成 Tab 之后,每页最多 7 个按钮,一屏就放得下 —— 这才是关键指标:
**每一页都不需要滚动**。
"""
from __future__ import annotations
import sys
from pathlib import Path
TARGET = Path(r"C:\Users\shu\Desktop\deepseekagent\LanRemote\_tests\check_layout.py")
OLD_LABELS_START = 'LABELS = ['
NEW_TABS = '''# 现在手表端分 6 页,每页按钮数不一样。
# 关键指标变成「每一页都能一屏放下、不用滚动」。
TABS = {
"媒体": ["播放/暂停", "停止", "上一曲", "下一曲", "音量 +", "音量 -", "静音"],
"屏幕": ["屏幕镜像", "截屏", "投图到电脑", "放音到电脑", "关显示器", "设为壁纸"],
"文件": ["发送文件", "接收文件", "剪贴板→电脑", "取电脑剪贴板", "剪贴板历史", "打开文件夹"],
"语音": ["语音播报", "音色", "朗读剪贴板", "电脑音乐", "弹通知"],
"电脑": ["快捷命令", "打开网址", "进程管理", "性能", "磁盘", "电量"],
"系统": ["锁屏", "睡眠", "关机", "重启", "取消定时关机", "定时关机", "设备诊断"],
}
# 全部按钮(用于最坏情况估算)
LABELS = [label for group in TABS.values() for label in group]
'''
def main() -> int:
text = TARGET.read_text(encoding="utf-8")
start = text.find(OLD_LABELS_START)
if start < 0:
print(" [失败] 找不到 LABELS")
return 1
end = text.find("]\n", start)
if end < 0:
print(" [失败] 找不到 LABELS 结尾")
return 1
end += 2
text = text[:start] + NEW_TABS + text[end:]
# 在真机那段后面补上「分页不滚动」的断言
anchor = ''' real_cols = adapt(dev["width_px"] / dev["density"], dev["height_px"] / dev["density"])[0]'''
addition = ''' # ---- 分页:每页都要能一屏放下 ----
print()
print("=" * 74)
print("三、分页布局(每页不超过 7 个按钮)")
print("=" * 74)
width_dp = dev["width_px"] / dev["density"]
height_dp = dev["height_px"] / dev["density"]
columns, cell_h, text_sp = adapt(width_dp, height_dp)
# 顶栏 42dp + 标签栏 42dp + 日志约 60dp + 边距
chrome_dp = 42 + 42 + 62 + 20
available = height_dp - chrome_dp
for name, labels in TABS.items():
rows = (len(labels) + columns - 1) // columns
need = rows * (cell_h + 6)
fits = need <= available
check(f"「{name}」{len(labels)} 个按钮 / {rows} 行,一屏放得下",
fits, f"需要 {need:.0f}dp,可用 {available:.0f}dp")
print(f" {name}: {len(labels)} 个 / {rows} 行 / {need:.0f}dp"
f"(可用 {available:.0f}dp)")
real_cols = adapt(dev["width_px"] / dev["density"], dev["height_px"] / dev["density"])[0]'''
if anchor in text:
text = text.replace(anchor, addition, 1)
print(" 已加分页断言")
else:
print(" [警告] 分页断言锚点未匹配")
TARGET.write_text(text, encoding="utf-8")
return 0
if __name__ == "__main__":
sys.exit(main())