refactor: 重构运行提示传递逻辑

This commit is contained in:
Quan
2025-12-16 12:55:52 +08:00
parent 8039c6a5db
commit 855113c94d
11 changed files with 117 additions and 181 deletions

View File

@@ -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,
)
):

View File

@@ -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):

View File

@@ -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)

View File

@@ -34,7 +34,6 @@ class Update(ModalScreen):
url = await self.xhs.html.request_url(
RELEASES,
False,
None,
timeout=5,
)
version = url.split("/")[-1]