From 61ca6b46d97be96a73576df17a6a701901c35c14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=82=A5=E5=AE=85=E6=B0=B4=E6=B0=B4=E5=91=80?= <91878264+happycola233@users.noreply.github.com> Date: Tue, 13 Jan 2026 00:12:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E4=B8=B2=E6=A0=BC=E5=BC=8F=E5=8C=96=E4=B8=AD=E7=9A=84=E5=BC=95?= =?UTF-8?q?=E5=8F=B7=E4=BD=BF=E7=94=A8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/tchMaterial-parser.pyw | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/tchMaterial-parser.pyw b/src/tchMaterial-parser.pyw index 0b545a3..4e15153 100644 --- a/src/tchMaterial-parser.pyw +++ b/src/tchMaterial-parser.pyw @@ -161,8 +161,8 @@ def parse(url: str, bookmarks: bool) -> tuple[str, str, list] | tuple[None, None mappings.sort(key=lambda x: x["page_number"]) for i, m in enumerate(mappings): temp_chapters.append({ - "title": f"第 {i+1} 节 (P{m["page_number"]})", - "page_index": m["page_number"] + "title": f"第 {i+1} 节 (P{m['page_number']})", + "page_index": m['page_number'] }) chapters = temp_chapters @@ -650,9 +650,9 @@ class resource_helper: # 获取网站上资源的数据 if not temp_hier["children"]: temp_hier["children"] = {} - book["display_name"] = book["title"] if "title" in book else book["name"] if "name" in book else f"(未知电子课本 {book["id"]})" + book["display_name"] = book["title"] if "title" in book else book["name"] if "name" in book else f"(未知电子课本 {book['id']})" - temp_hier["children"][book["id"]] = book + temp_hier["children"][book['id']] = book return parsed_hier @@ -683,9 +683,9 @@ class resource_helper: # 获取网站上资源的数据 if not temp_hier["children"]: temp_hier["children"] = {} - lesson["display_name"] = lesson["title"] if "title" in lesson else lesson["name"] if "name" in lesson else f"(未知课件 {lesson["id"]})" + lesson["display_name"] = lesson["title"] if "title" in lesson else lesson["name"] if "name" in lesson else f"(未知课件 {lesson['id']})" - temp_hier["children"][lesson["id"]] = lesson + temp_hier["children"][lesson['id']] = lesson return parsed_hier @@ -739,7 +739,7 @@ root = tk.Tk() ui_font_family = pick_ui_font_family() # 高 DPI 适配 -if os_name == "Windows" and win32print and win32gui and win32con and win32api: +if os_name == "Windows" and win32print and win32gui and win32con and win32api and ctypes: scale: float = round(win32print.GetDeviceCaps(win32gui.GetDC(0), win32con.DESKTOPHORZRES) / win32api.GetSystemMetrics(0), 2) # 获取当前的缩放因子 # 调用 API 设置成由应用程序缩放