From 2352d55a7fdb1f3526e204d00e88dcd378639f99 Mon Sep 17 00:00:00 2001 From: JoeamAmier Date: Sun, 24 Sep 2023 11:01:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/main.py b/main.py index 93a448e..757a7a3 100644 --- a/main.py +++ b/main.py @@ -58,22 +58,32 @@ def program(): class RunMenu(Static): + def on_button_pressed(self, event: Button.Pressed) -> None: + if event.button.id in ("run", "batch"): + self.add_class("running") + elif event.button.id == "stop": + self.remove_class("running") def compose(self) -> ComposeResult: yield Button("下载无水印图片/视频", id="run", variant="success") yield Button("读取文件并开始批量下载作品", id="batch", variant="success") yield Button("清空输入", id="reset", variant="error") + def run(self): + pass + + def batch(self): + pass + + def reset(self) -> None: + pass + class XHSDownloader(App): CSS_PATH = "static/XHS_Downloader.tcss" BINDINGS = [ - Binding(key="q", action="quit", description="结束运行"), - Binding( - key="w", - action="repository", - description="获取源码", - ), + Binding(key="q", action="quit", description="退出程序"), + ("d", "toggle_dark", "切换主题"), ] def compose(self) -> ComposeResult: