From 3d98670b748824e6e671049c43d48412c4a77aa2 Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Thu, 3 Sep 2026 11:28:46 +0800 Subject: [PATCH] =?UTF-8?q?revert(ViperQtProject):=20=E5=A4=8D=E9=80=89?= =?UTF-8?q?=E6=A1=86=E6=8C=87=E7=A4=BA=E5=99=A8=E6=81=A2=E5=A4=8D=E5=8E=9F?= =?UTF-8?q?=E7=94=9F=E5=AF=B9=E5=8B=BE=E6=B8=B2=E6=9F=93=EF=BC=8C=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=E8=87=AA=E5=AE=9A=E4=B9=89=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViperQtProject/App/assets/check_off.png | Bin 242 -> 0 bytes .../ViperQtProject/App/assets/check_on.png | Bin 404 -> 0 bytes .../App/assets/make_check_icons.py | 102 ------------------ ViperBTests/ViperQtProject/App/main.vp | 18 ---- 4 files changed, 120 deletions(-) delete mode 100644 ViperBTests/ViperQtProject/App/assets/check_off.png delete mode 100644 ViperBTests/ViperQtProject/App/assets/check_on.png delete mode 100644 ViperBTests/ViperQtProject/App/assets/make_check_icons.py diff --git a/ViperBTests/ViperQtProject/App/assets/check_off.png b/ViperBTests/ViperQtProject/App/assets/check_off.png deleted file mode 100644 index 09e5ec151a931b17af95387e311e728ed63f8cc3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 242 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJot`d^Ar-fh6C_w881^?T*wei{ zzP>2!;m=je=KY_NFhNpbvqPFt>dtkIo;87~pR2ue-Ht05JEjS5k%^q_pYWq5+I@SK zm%$016yriGCJ`5d`OQtfK2BcqqXM~%xW(owSZ{D+*O-^EZppHzC;A#@@^9jHW<1ln zKw)v{qc&Ie6M8(JGhRD|AGMxM2kX_K(?FRG&gQu&X%Q~loCIA7`Sycc4 diff --git a/ViperBTests/ViperQtProject/App/assets/check_on.png b/ViperBTests/ViperQtProject/App/assets/check_on.png deleted file mode 100644 index 94b6affc57ad45f7c4e5ef0141c00d7c7c792705..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 404 zcmV;F0c-w=P)9 zjE-?S0u)5F@Hw`Sz#1K(c%p@cfgL-*7+DNt7ls3JoRzW(^#e;5Fw9sS%>jj{_*Qi zl-xj+1F&TwT x1 or y < y0 or y > y1: - return False - cx = min(max(x, x0 + rad), x1 - rad) - cy = min(max(y, y0 + rad), y1 - rad) - return (x - cx) ** 2 + (y - cy) ** 2 <= rad * rad - - -def stroke_inside(x, y, pad, rad, th): - if rounded_inside(x, y, pad, rad): - if not rounded_inside(x, y, pad + th, max(0.0, rad - th)): - return True - return False - - -def seg_dist(px, py, ax, ay, bx, by): - vx, vy = bx - ax, by - ay - wx, wy = px - ax, py - ay - c1 = vx * wx + vy * wy - if c1 <= 0: - return (wx * wx + wy * wy) ** 0.5 - c2 = vx * vx + vy * vy - if c2 <= c1: - return ((px - bx) ** 2 + (py - by) ** 2) ** 0.5 - t = c1 / c2 - dx, dy = px - (ax + t * vx), py - (ay + t * vy) - return (dx * dx + dy * dy) ** 0.5 - - -CHECK_SEGS = (((8.0, 17.0), (14.0, 23.0)), ((14.0, 23.0), (25.0, 10.0))) -CHECK_W = 3.2 - - -def render(checked): - rows = [] - step = 1.0 / SS - for py in range(W): - row = bytearray() - for px in range(W): - r = g = b = a = 0 - for sy in range(SS): - for sx in range(SS): - x = px + (sx + 0.5) * step - y = py + (sy + 0.5) * step - col = None - if checked: - if rounded_inside(x, y, 2.0, 7.0): - col = (42, 109, 168) # #2a6da8 蓝底 - for (p1, p2) in CHECK_SEGS: - if seg_dist(x, y, p1[0], p1[1], p2[0], p2[1]) <= CHECK_W: - col = (255, 255, 255) # 白对勾 - break - else: - if stroke_inside(x, y, 2.0, 7.0, 2.4): - col = (122, 130, 140) # 灰框 - if col is not None: - r += col[0] - g += col[1] - b += col[2] - a += 255 - n = SS * SS - row += bytes((r // n, g // n, b // n, a // n)) - rows.append(bytes(row)) - return rows - - -def write_png(path, w, h, rgba_rows): - def chunk(tag, data): - out = struct.pack(">I", len(data)) + tag + data - out += struct.pack(">I", zlib.crc32(tag + data) & 0xFFFFFFFF) - return out - - raw = b"".join(b"\x00" + r for r in rgba_rows) - sig = b"\x89PNG\r\n\x1a\n" - ihdr = struct.pack(">IIBBBBB", w, h, 8, 6, 0, 0, 0) - idat = zlib.compress(raw, 9) - with open(path, "wb") as f: - f.write(sig + chunk(b"IHDR", ihdr) + chunk(b"IDAT", idat) + chunk(b"IEND", b"")) - - -def main(): - here = os.path.dirname(os.path.abspath(__file__)) - write_png(os.path.join(here, "check_off.png"), W, W, render(False)) - write_png(os.path.join(here, "check_on.png"), W, W, render(True)) - print("icons written:", os.path.join(here, "check_off.png"), os.path.join(here, "check_on.png")) - - -if __name__ == "__main__": - main() diff --git a/ViperBTests/ViperQtProject/App/main.vp b/ViperBTests/ViperQtProject/App/main.vp index 702026d..535eb58 100644 --- a/ViperBTests/ViperQtProject/App/main.vp +++ b/ViperBTests/ViperQtProject/App/main.vp @@ -466,19 +466,6 @@ def OnThemeChanged(slot_id: int, data: t.CPtr): ApplyTheme(idx) -def ApplyIndicatorIcons(ptr: t.CPtr, is_tree: int): - """复选框/树叶子指示器用带对勾的 PNG 图标(未勾=灰框,勾选=蓝框+白勾) - 图标放 exe 目录 assets/ 下,路径用 vqt6_app_dir_utf8 运行时拼接""" - sel: str = "QTreeWidget" if is_tree != 0 else "QCheckBox" - dbuf: bytes = stdlib.malloc(640) - vqt6.vqt6_app_dir_utf8(dbuf, 640) - buf: bytes = stdlib.malloc(1100) - viperlib.snprintf(buf, 1100, "%s::indicator { width: 16px; height: 16px; } %s::indicator:unchecked { image: url(file:///%s/assets/check_off.png); } %s::indicator:checked { image: url(file:///%s/assets/check_on.png); }", sel, sel, dbuf, sel, dbuf) - vqt6.vqt6_qwidget_set_stylesheet_utf8(ptr, buf) - stdlib.free(dbuf) - stdlib.free(buf) - - def main() -> int: global app_ptr, stack_ptr global nav0_ptr, nav1_ptr, nav2_ptr, nav3_ptr, nav4_ptr, nav5_ptr @@ -630,7 +617,6 @@ def main() -> int: agree_cb = vqt6.QCheckBox("我接受上述协议条款") p1.addWidget(agree_cb._ptr) agree_cb_ptr = t.CPtr(agree_cb._ptr) - ApplyIndicatorIcons(agree_cb_ptr, 0) agree_cb.toggled(OnLicenseToggled, 0) lbrow = vqt6.QHBoxLayout() @@ -665,7 +651,6 @@ def main() -> int: tree.setHeaderHidden(1) p2.addWidget(tree._ptr) tree_ptr = t.CPtr(tree._ptr) - ApplyIndicatorIcons(tree_ptr, 1) # 叶子磁盘占用经 setSize 存入节点 UserRole,统计时自动读取 g0 = vqt6.QTreeWidgetItem("开发工具链") @@ -763,19 +748,16 @@ def main() -> int: opt0.setChecked(1) p3.addWidget(opt0._ptr) opt0_ptr = t.CPtr(opt0._ptr) - ApplyIndicatorIcons(opt0_ptr, 0) opt1 = vqt6.QCheckBox("将 viper 命令添加到系统 PATH") opt1.setChecked(0) p3.addWidget(opt1._ptr) opt1_ptr = t.CPtr(opt1._ptr) - ApplyIndicatorIcons(opt1_ptr, 0) opt2 = vqt6.QCheckBox("创建桌面图标") opt2.setChecked(0) p3.addWidget(opt2._ptr) opt2_ptr = t.CPtr(opt2._ptr) - ApplyIndicatorIcons(opt2_ptr, 0) # 安装位置行 path_row = vqt6.QHBoxLayout()