更新 TUI 界面

This commit is contained in:
JoeamAmier 2023-09-25 21:43:50 +08:00
parent b43b2ef195
commit ae3da1e61e
2 changed files with 9 additions and 6 deletions

View File

@ -8,7 +8,6 @@ from textual.widgets import Header
from textual.widgets import Input
from textual.widgets import Label
from textual.widgets import Log
from textual.widgets import Pretty
from source import Batch
from source import Settings
@ -76,8 +75,6 @@ class XHSDownloader(App):
Button("读取文件并开始批量下载作品", id="batch", variant="success"),
Button("清空输入框", id="reset", variant="error"), )
yield Log(auto_scroll=True)
yield Pretty(
{"运行结果": "输入小红书图文/视频作品链接,点击“下载无水印图片/视频”按钮即可获取作品数据并下载作品文件!"})
yield Footer()
def on_mount(self) -> None:
@ -93,9 +90,8 @@ class XHSDownloader(App):
def solo(self):
url = self.query_one(Input).value
result = self.APP.extract(url, download=True)
self.APP.extract(url, download=True)
# self.query_one(Log).write_line()
self.query_one(Pretty).update(result)
def batch(self):
urls = self.Batch.read_txt()

View File

@ -1,4 +1,11 @@
Button {
width: auto;
width: 1fr;
margin: 1 2;
}
Label {
width: 100%;
padding: 1;
color: white;
content-align-horizontal: center;
content-align-vertical: middle;
}