From 1d2731b93a25c8dc35493fb885dc0d9ceb9cc40e Mon Sep 17 00:00:00 2001 From: JoeanAmier Date: Sun, 29 Dec 2024 10:34:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=89=B9=E5=AE=9A?= =?UTF-8?q?=E6=83=85=E5=86=B5=E4=B8=8B=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/TUI/about.py | 6 +++--- source/TUI/app.py | 8 ++++---- source/TUI/index.py | 4 ++-- source/TUI/monitor.py | 12 ++++++------ source/TUI/setting.py | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/source/TUI/about.py b/source/TUI/about.py index 40a4a23..c88cb48 100644 --- a/source/TUI/about.py +++ b/source/TUI/about.py @@ -30,7 +30,7 @@ class About(Screen): description=_("检查更新")), Binding( key="B", - action="index", + action="back", description=_("返回首页")), ] @@ -73,8 +73,8 @@ class About(Screen): async def action_quit(self) -> None: await self.app.action_quit() - async def action_index(self): - await self.app.push_screen("index") + async def action_back(self) -> None: + await self.app.action_back() async def action_check_update(self): await self.app.run_action("update_and_return") diff --git a/source/TUI/app.py b/source/TUI/app.py index a76645d..2abe949 100644 --- a/source/TUI/app.py +++ b/source/TUI/app.py @@ -74,7 +74,7 @@ class XHSDownloader(App): await self.push_screen("setting", save_settings) async def refresh_screen(self): - await self.pop_screen() + await self.action_back() await self.close_database() await self.APP.close() self.__initialization() @@ -100,12 +100,12 @@ class XHSDownloader(App): log.write(tip) log.write(">" * 50) - async def action_check_update(self): + async def action_update(self): await self.push_screen(Update(self.APP, ), callback=self.update_result) async def action_update_and_return(self): - await self.push_screen("index") - await self.action_check_update() + await self.action_back() + await self.action_update() async def close_database(self): await self.APP.id_recorder.cursor.close() diff --git a/source/TUI/index.py b/source/TUI/index.py index f962fc4..2af3833 100644 --- a/source/TUI/index.py +++ b/source/TUI/index.py @@ -130,13 +130,13 @@ class Index(Screen): Text(">" * 50, style=GENERAL), animate=True, ) - await self.app.pop_screen() + await self.app.action_back() async def action_quit(self) -> None: await self.app.action_quit() async def action_update(self) -> None: - await self.app.run_action("check_update") + await self.app.run_action("update") async def action_settings(self): await self.app.run_action("settings") diff --git a/source/TUI/monitor.py b/source/TUI/monitor.py index f15f6c1..40d0c3e 100644 --- a/source/TUI/monitor.py +++ b/source/TUI/monitor.py @@ -39,13 +39,13 @@ class Monitor(Screen): yield Footer() @on(Button.Pressed, "#close") - def close_button(self): - self.action_close() + async def close_button(self): + await self.action_close() @work(exclusive=True) async def run_monitor(self): await self.xhs.monitor(download=True, log=self.query_one(RichLog), data=False, ) - self.action_close() + await self.action_close() def on_mount(self) -> None: self.title = PROJECT @@ -55,10 +55,10 @@ class Monitor(Screen): style=MASTER)) self.run_monitor() - def action_close(self): + async def action_close(self): self.xhs.stop_monitor() - self.app.pop_screen() + await self.app.action_back() async def action_quit(self) -> None: - self.action_close() + await self.action_close() await self.app.action_quit() diff --git a/source/TUI/setting.py b/source/TUI/setting.py index 1c33038..be2f96f 100644 --- a/source/TUI/setting.py +++ b/source/TUI/setting.py @@ -126,4 +126,4 @@ class Setting(Screen): await self.app.action_quit() async def action_index(self): - await self.app.push_screen("index") + await self.app.action_back()