修复MacOs用户无法正常导出的bug

This commit is contained in:
LibraHp_0928 2024-09-29 13:49:05 +08:00
parent c4f3615715
commit aa4db232e3

View File

@ -851,7 +851,7 @@ def main(page: ft.Page):
if system == "Darwin": # 如果是 macOS 系统
# 将文件保存到用户的 ~/Documents/app_data 目录
base_path = os.path.join(str(Path.home()), "Documents", "qzone_export")
base_path = os.path.join(str(Path.home()), "Documents", "QzoneExport")
elif system == "Windows": # 如果是 Windows 系统
# 将文件保存到程序的当前运行目录
base_path = os.getcwd()
@ -1090,7 +1090,7 @@ def main(page: ft.Page):
friend_element = element.find('a', class_='f-name q_namecard')
if friend_element:
friend_name = friend_element.get_text()
friend_qq = friend_element.get('link', '')[9:] # 使用默认空值
friend_qq = friend_element.get('link', '')[9:] if friend_element.get('link', '') else '123456' # 使用默认空值
friend = User(uin=friend_qq, username=friend_name)
comment.user = friend
res_message.user = friend
@ -1186,7 +1186,7 @@ def main(page: ft.Page):
ft.Text(f"你发布了", size=20, spans=[ft.TextSpan(f" {user_says.__len__() } ", ft.TextStyle(weight=ft.FontWeight.BOLD,color=ft.colors.BLUE_300)),ft.TextSpan("条说说", ft.TextStyle(size=20))]),
ft.Text(f"", size=20, spans=[ft.TextSpan(f" {leaves.__len__() } ", ft.TextStyle(weight=ft.FontWeight.BOLD,color=ft.colors.BLUE_300)),ft.TextSpan("条留言", ft.TextStyle(size=20))]),
ft.Text(f"", size=20,spans=[ft.TextSpan(f" {friends.__len__() } ", ft.TextStyle(weight=ft.FontWeight.BOLD,color=ft.colors.BLUE_300)),ft.TextSpan("个人与你空间有过交互", ft.TextStyle(size=20))]),
ft.Text(f"最早的说说发布在", size=20, spans=[ft.TextSpan(f" {user_says[user_says.__len__() - 1].time} ", ft.TextStyle(weight=ft.FontWeight.BOLD,color=ft.colors.BLUE_300)),ft.TextSpan(",那个时候的你有这么多烦恼嘛", ft.TextStyle(size=20))]),
ft.Text(f"最早的说说发布在", size=20, spans=[ft.TextSpan(f" {user_says[user_says.__len__() - 1].time if user_says.__len__() > 0 else ''} ", ft.TextStyle(weight=ft.FontWeight.BOLD,color=ft.colors.BLUE_300)),ft.TextSpan(",那个时候的你有这么多烦恼嘛", ft.TextStyle(size=20))]),
ft.Text(f"和你交互最多的人是", size=20, spans=[ft.TextSpan(f" @{most_interactive_user[0][0][0]} ", ft.TextStyle(weight=ft.FontWeight.BOLD,color=ft.colors.BLUE_300)),ft.TextSpan("现在的她/他怎么样了呢", ft.TextStyle(size=20))]),
],
spacing=10,