Skip to content

Commit

Permalink
支持导出docx文档
Browse files Browse the repository at this point in the history
  • Loading branch information
LC044 committed Dec 27, 2023
1 parent 3974438 commit b3f4fed
Show file tree
Hide file tree
Showing 7 changed files with 246 additions and 31 deletions.
239 changes: 220 additions & 19 deletions app/DataBase/output_pc.py

Large diffs are not rendered by default.

9 changes: 2 additions & 7 deletions app/ui/contact/contactInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,8 @@ def output(self):
"""
self.stackedWidget.setCurrentWidget(self.view_userinfo)
if self.sender() == self.toDocxAct:
print('功能暂未实现')
QMessageBox.warning(self,
"别急别急",
"马上就实现该功能"
)
return
self.outputThread = Output(self.Me, self.contact.wxid)
dialog = ExportDialog(self.contact, title='选择导出的消息类型', file_type='docx', parent=self)
result = dialog.exec_() # 使用exec_()获取用户的操作结果
elif self.sender() == self.toCSVAct:
# self.outputThread = Output(self.contact, type_=Output.CSV)
dialog = ExportDialog(self.contact,title='选择导出的消息类型', file_type='csv', parent=self)
Expand Down
4 changes: 4 additions & 0 deletions app/ui/contact/export_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ def __init__(self, contact=None, title="选择导出的类型", file_type="csv",
self.export_type = Output.TXT
self.export_choices = {"文本": True, "图片": True, "语音": True, "视频": True,
"表情包": True} # 定义导出的数据类型,默认全部选择
elif file_type == 'docx':
self.export_type = Output.DOCX
self.export_choices = {"文本": True, "图片": False, "语音": False, "视频": False,
"表情包": False,'拍一拍等系统消息': True} # 定义导出的数据类型,默认全部选择
else:
self.export_choices = {"文本": True, "图片": True, "视频": True, "表情包": True} # 定义导出的数据类型,默认全部选择
self.setWindowTitle(title)
Expand Down
12 changes: 9 additions & 3 deletions app/ui/tool/pc_decrypt/pc_decrypt.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def decrypt(self):
self.thread2.signal.connect(self.progressBar_view)
self.thread2.okSignal.connect(self.btnExitClicked)
self.thread2.errorSignal.connect(
lambda x: QMessageBox.critical(self, "错误", "密钥错误\n请检查微信版本是否为最新和微信路径是否正确")
lambda x: QMessageBox.critical(self, "错误", "错误\n请检查微信版本是否为最新和微信路径是否正确\n或者关闭微信多开")
)
self.thread2.start()

Expand Down Expand Up @@ -232,7 +232,10 @@ def run(self):
import shutil
if os.path.exists(target_database):
os.remove(target_database)
shutil.copy2("app/DataBase/Msg/MSG0.db", target_database) # 使用一个数据库文件作为模板
try:
shutil.copy2("app/DataBase/Msg/MSG0.db", target_database) # 使用一个数据库文件作为模板
except FileNotFoundError:
self.errorSignal.emit(True)
# 合并数据库
try:
merge_databases(source_databases, target_database)
Expand All @@ -245,7 +248,10 @@ def run(self):
if os.path.exists(target_database):
os.remove(target_database)
source_databases = [f"app/DataBase/Msg/MediaMSG{i}.db" for i in range(1, 50)]
shutil.copy2("app/DataBase/Msg/MediaMSG0.db", target_database) # 使用一个数据库文件作为模板
try:
shutil.copy2("app/DataBase/Msg/MediaMSG0.db", target_database) # 使用一个数据库文件作为模板
except FileNotFoundError:
self.errorSignal.emit(True)
# 合并数据库
try:
merge_MediaMSG_databases(source_databases, target_database)
Expand Down
9 changes: 9 additions & 0 deletions app/util/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,15 @@ def get_image(path, base_path) -> str:
return ':/icons/icons/404.png'


def get_image_abs_path(path, base_path) -> str:
if path:
base_path = os.getcwd() + base_path
output_path = decode_dat(os.path.join(MePC().wx_dir, path), base_path)
return output_path
else:
return ':/icons/icons/404.png'


def get_image_path(path, base_path) -> str:
if path:
base_path = os.getcwd() + base_path
Expand Down
3 changes: 1 addition & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,14 @@
- HTML(文本、图片、视频、表情包、语音)✅
- CSV文档✅
- TXT文档✅
- Word文档
- Word文档
- 分析聊天数据,做成可视化年报(急需前端大佬提供优质模板)
- 🔥**项目持续更新中**
- 开发计划
- 一键导出全部表情包、文件、图片、视频、语音
- 合并多个备份数据
- 批量导出数据
- 文件
- 导出word文档
- 个人年度报告
- 群组年度报告
- 小伙伴们想要其他功能可以留言哦📬
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ protobuf==4.25.1
soupsieve==2.5
lz4==4.3.2
pilk==0.2.4
python-docx==1.1.0
eyed3==0.9.7

0 comments on commit b3f4fed

Please sign in to comment.