mirror of
https://github.com/JoeanAmier/XHS-Downloader.git
synced 2026-03-22 06:57:16 +08:00
refactor: 重构运行提示传递逻辑
This commit is contained in:
@@ -77,13 +77,12 @@ class Index(Screen):
|
||||
self.title = PROJECT
|
||||
self.url = self.query_one(Input)
|
||||
self.tip = self.query_one(RichLog)
|
||||
self.xhs.print.func = self.tip
|
||||
self.tip.write(
|
||||
Text(_("免责声明\n") + f"\n{'>' * 50}", style=MASTER),
|
||||
scroll_end=True,
|
||||
)
|
||||
self.xhs.manager.print_proxy_tip(
|
||||
log=self.tip,
|
||||
)
|
||||
self.xhs.manager.print_proxy_tip()
|
||||
|
||||
@on(Button.Pressed, "#deal")
|
||||
async def deal_button(self):
|
||||
@@ -114,7 +113,6 @@ class Index(Screen):
|
||||
await self.xhs.extract(
|
||||
self.url.value,
|
||||
True,
|
||||
log=self.tip,
|
||||
data=False,
|
||||
)
|
||||
):
|
||||
|
||||
@@ -8,7 +8,6 @@ from textual.widgets import Button, Footer, Header, Label, RichLog
|
||||
from ..application import XHS
|
||||
from ..module import (
|
||||
INFO,
|
||||
MASTER,
|
||||
PROJECT,
|
||||
)
|
||||
from ..translation import _
|
||||
@@ -42,24 +41,12 @@ class Monitor(Screen):
|
||||
|
||||
@work(exclusive=True)
|
||||
async def run_monitor(self):
|
||||
await self.xhs.monitor(
|
||||
download=True,
|
||||
log=self.query_one(RichLog),
|
||||
data=False,
|
||||
)
|
||||
await self.xhs.monitor()
|
||||
await self.action_close()
|
||||
|
||||
def on_mount(self) -> None:
|
||||
self.title = PROJECT
|
||||
self.query_one(RichLog).write(
|
||||
Text(
|
||||
_(
|
||||
"程序会自动读取并提取剪贴板中的小红书作品链接,并自动下载链接对应的作品文件,如需关闭,请点击关闭按钮,或者向剪贴板写入 “close” 文本!"
|
||||
),
|
||||
style=MASTER,
|
||||
),
|
||||
scroll_end=True,
|
||||
)
|
||||
self.xhs.print.func = self.query_one(RichLog)
|
||||
self.run_monitor()
|
||||
|
||||
async def action_close(self):
|
||||
|
||||
@@ -40,7 +40,6 @@ class Record(ModalScreen):
|
||||
async def delete(self, text: str):
|
||||
text = await self.xhs.extract_links(
|
||||
text,
|
||||
None,
|
||||
)
|
||||
text = self.xhs.extract_id(text)
|
||||
await self.xhs.id_recorder.delete(text)
|
||||
|
||||
@@ -34,7 +34,6 @@ class Update(ModalScreen):
|
||||
url = await self.xhs.html.request_url(
|
||||
RELEASES,
|
||||
False,
|
||||
None,
|
||||
timeout=5,
|
||||
)
|
||||
version = url.split("/")[-1]
|
||||
|
||||
Reference in New Issue
Block a user