mirror of
https://github.com/JoeanAmier/XHS-Downloader.git
synced 2025-12-26 04:48:05 +08:00
fix: 修复特定情况下报错的问题
This commit is contained in:
parent
102e7adbd4
commit
1d2731b93a
@ -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")
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -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")
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -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()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user