mirror of
https://gitee.com/xmz7891/ykxmz.git
synced 2026-10-18 16:00:43 +00:00
被控端 - 修复 MTU 问题:夹 MSS + 路径 MTU 探测(公网可用率 48% -> 100%) - 复用 HTTP 连接(免掉每次新建 TLS 的 30% 握手失败) - 每分钟回头找局域网,自动切回快 400 倍的路径 - 画面心跳帧:静止时省流量,客户端仍知道流是活的 - 锁屏时给出可操作的提示 手表端 - 内置 GTS Root R4 / GlobalSign Root CA,修 SSLHandshakeException - 连接错误翻译成人话(证书/时间/解析/超时分别提示) - 经中转连上后用服务器报的地址刷新已配对记录 - 新增局域网连接页面、服务器延迟检测 服务器端 - 支持 chunked 请求体(修每 16 秒一次的连接错乱与大面积 502) - 网络调优脚本 net-tune.sh(开机自动应用) - 管理页:批量删除、网络体检、下载区 - 隧道改 HTTP/2 + 双连接 文档 - 许可协议 / 安装前必读 / 安装后须知(作者:小麦子)
98 lines
3.5 KiB
Python
98 lines
3.5 KiB
Python
# -*- coding: utf-8 -*-
|
||
"""修界面:卡片根本没显示出来。
|
||
|
||
我写的 _card() 是这样的:
|
||
def _card(self, parent):
|
||
outer = tk.Frame(parent, bg=BORDER) # 外层:边框色
|
||
inner = tk.Frame(outer, bg=CARD) # 内层:白底
|
||
inner.pack(fill="both", expand=True, padx=1, pady=1) # 挂到 outer
|
||
return inner # ← 返回内层
|
||
|
||
调用处:card = self._card(page); card.pack(...)
|
||
card.pack() 是 inner.pack(),而 inner 的父控件是 **outer** ——
|
||
所以它被挂回 outer,而 **outer 从来没有被 pack 进 page**。
|
||
结果:两张卡片完全看不见,窗口高度只有 199px,
|
||
但控件都"存在"(walk 能列出来),测试也就查不出来。
|
||
|
||
修法:_card 返回 outer,调用处 pack outer。
|
||
"""
|
||
from __future__ import annotations
|
||
|
||
import ast
|
||
import sys
|
||
from pathlib import Path
|
||
|
||
UI = Path(r"C:\Users\shu\Desktop\deepseekagent\LanRemote\windows\lanremote"
|
||
r"\ui.py")
|
||
|
||
OLD = ''' def _card(self, parent) -> tk.Frame:
|
||
"""一个白底圆角感的卡片(tkinter 没有圆角,用边框色模拟)。"""
|
||
outer = tk.Frame(parent, bg=BORDER)
|
||
inner = tk.Frame(outer, bg=CARD)
|
||
inner.pack(fill="both", expand=True, padx=1, pady=1)
|
||
return inner'''
|
||
|
||
NEW = ''' def _card(self, parent) -> tk.Frame:
|
||
"""一个白底圆角感的卡片(tkinter 没有圆角,用边框色模拟)。
|
||
|
||
返回的是**外层** frame —— 调用处要 pack 它。
|
||
踩过的坑:一开始返回 inner,而 inner 的父控件是 outer,
|
||
于是 inner.pack() 挂回 outer,outer 自己从没被 pack,
|
||
结果卡片完全不显示(窗口高度只剩 199px)。
|
||
"""
|
||
outer = tk.Frame(parent, bg=BORDER)
|
||
inner = tk.Frame(outer, bg=CARD)
|
||
inner.pack(fill="both", expand=True, padx=1, pady=1)
|
||
return outer'''
|
||
|
||
# 卡片内容要挂在 inner 上,所以取 inner
|
||
CARD_USE_OLD = ''' card = self._card(page)
|
||
card.pack(fill="x", pady=(16, 0))
|
||
|
||
inner = tk.Frame(card, bg=CARD)
|
||
inner.pack(fill="x", padx=16, pady=14)
|
||
'''
|
||
CARD_USE_NEW = ''' card = self._card(page)
|
||
card.pack(fill="x", pady=(16, 0))
|
||
|
||
inner = tk.Frame(card.winfo_children()[0], bg=CARD)
|
||
inner.pack(fill="x", padx=16, pady=14)
|
||
'''
|
||
|
||
OPTIONS_OLD = ''' options = self._card(page)
|
||
options.pack(fill="x", pady=(12, 0))
|
||
opt_inner = tk.Frame(options, bg=CARD)
|
||
opt_inner.pack(fill="x", padx=16, pady=12)'''
|
||
OPTIONS_NEW = ''' options = self._card(page)
|
||
options.pack(fill="x", pady=(12, 0))
|
||
opt_inner = tk.Frame(options.winfo_children()[0], bg=CARD)
|
||
opt_inner.pack(fill="x", padx=16, pady=12)'''
|
||
|
||
|
||
def main() -> int:
|
||
text = UI.read_text(encoding="utf-8")
|
||
ok = True
|
||
|
||
if "返回的是**外层** frame" in text:
|
||
print(" 已经修过")
|
||
return 0
|
||
|
||
for old, new, label in ((OLD, NEW, "_card 返回外层"),
|
||
(CARD_USE_OLD, CARD_USE_NEW, "配对码卡片内容挂 inner"),
|
||
(OPTIONS_OLD, OPTIONS_NEW, "选项卡片内容挂 inner")):
|
||
if old in text:
|
||
text = text.replace(old, new, 1)
|
||
print(f" {label}")
|
||
else:
|
||
print(f" [失败] {label} —— 锚点没找到")
|
||
ok = False
|
||
|
||
UI.write_text(text, encoding="utf-8", newline="\n")
|
||
ast.parse(text)
|
||
print(" ui.py 语法 OK")
|
||
return 0 if ok else 1
|
||
|
||
|
||
if __name__ == "__main__":
|
||
sys.exit(main())
|