新增修改昵称、手机号信息

This commit is contained in:
SiYuan 2024-03-01 01:17:47 +08:00
parent 1b901535ab
commit d78b808050
12 changed files with 238 additions and 105 deletions

View File

@ -1,11 +1,13 @@
"""
定义各种联系人
"""
import json
import os.path
import re
from typing import Dict
from PyQt5.QtGui import QPixmap
from app.config import INFO_FILE_PATH
from app.ui.Icon import Icon
@ -66,7 +68,16 @@ class Me(Person):
self.smallHeadImgUrl = ''
self.nickName = self.name
self.remark = self.nickName
self.token = ''
def save_info(self):
if os.path.exists(INFO_FILE_PATH):
with open(INFO_FILE_PATH, 'r', encoding='utf-8') as f:
info_data = json.loads(f.read())
info_data['name'] = self.name
info_data['mobile'] = self.mobile
with open(INFO_FILE_PATH, 'w', encoding='utf-8') as f:
json.dump(info_data, f, ensure_ascii=False, indent=4)
class Contact(Person):
def __init__(self, contact_info: Dict):
@ -84,7 +95,7 @@ class Contact(Person):
self.avatar = QPixmap()
self.avatar_path = Icon.Default_avatar_path
self.is_chatroom = self.wxid.__contains__('@chatroom')
self.detail:Dict = contact_info.get('detail')
self.detail: Dict = contact_info.get('detail')
self.label_name = contact_info.get('label_name') # 联系人的标签分类
"""

View File

@ -15,7 +15,7 @@ try:
except:
from chatInfoUi import Ui_Form
from app.components.bubble_message import BubbleMessage
from app.person import Me,ContactDefault
from app.person import Me, ContactDefault
class Message(QWidget):
@ -114,7 +114,7 @@ class AIChat(QWidget, Ui_Form):
def eventFilter(self, obj, event):
if obj == self.textEdit and event.type() == event.KeyPress:
key = event.key()
key = event.token()
if key == 16777220: # 回车键的键值
self.send_msg()
self.textEdit.setText('')
@ -137,6 +137,7 @@ class AIChatThread(QThread):
url = 'http://api.lc044.love/chat'
data = {
'username': Me().wxid,
'token': Me().token,
'messages': [
{
'role': 'user',
@ -160,12 +161,13 @@ class AIChatThread(QThread):
print(trunk)
self.msgSignal.emit(trunk)
else:
print(resp.text)
error = resp.json().get('error')
logger.error(f'ai请求错误:{error}')
self.msgSignal.emit(error)
except Exception as e:
error = str(e)
logger.error(f'ai请求错误:{error}')
logger.error(f'ai请求错误:{error}{traceback.format_exc()}')
self.msgSignal.emit(error)

View File

@ -1,14 +1,26 @@
import time
from PyQt5.QtCore import Qt, pyqtSignal, QThread, QUrl
from PyQt5.QtGui import QFont, QDesktopServices
from PyQt5.QtWidgets import QWidget, QListWidgetItem, QLabel
from PyQt5.QtWidgets import QWidget, QMessageBox
from app.ui.Icon import Icon
from .home_windowUi import Ui_Dialog
from ...person import Me
Stylesheet = """
QPushButton{
border-radius: 5px;
padding: 8px;
border-right: 2px solid #888888; /* 按钮边框2px宽白色 */
border-bottom: 2px solid #888888; /* 按钮边框2px宽白色 */
border-left: 1px solid #ffffff; /* 按钮边框2px宽白色 */
border-top: 1px solid #ffffff; /* 按钮边框2px宽白色 */
}
QPushButton:hover {
background-color: lightgray;
}
"""
class HomeWindow(QWidget, Ui_Dialog):
load_finish_signal = pyqtSignal(bool)
@ -17,11 +29,32 @@ class HomeWindow(QWidget, Ui_Dialog):
super().__init__(parent)
self.setupUi(self)
self.init_ui()
self.setStyleSheet(Stylesheet)
self.load_finish_signal.emit(True)
self.btn_report.clicked.connect(self.report)
self.btn_save.clicked.connect(self.save_info)
def init_ui(self):
pass
self.label_wxid.setText(Me().wxid)
self.lineEdit_name.setText(Me().name)
self.lineEdit_phone.setText(Me().mobile)
def save_info(self):
if self.lineEdit_name.text():
Me().name = self.lineEdit_name.text()
else:
QMessageBox.critical(self, "错误",
"昵称不能为空")
return
if self.lineEdit_phone.text():
Me().mobile = self.lineEdit_phone.text()
else:
QMessageBox.critical(self, "错误",
"手机号不能为空")
return
Me().save_info()
QMessageBox.information(self, "修改成功",
"个人信息修改成功")
def report(self):
time_range = ['2023-01-01 00:00:00', '2024-02-10 00:00:00']

View File

@ -18,7 +18,15 @@ class Ui_Dialog(object):
font = QtGui.QFont()
font.setFamily("微软雅黑")
Dialog.setFont(font)
self.verticalLayout = QtWidgets.QVBoxLayout(Dialog)
self.verticalLayout_2 = QtWidgets.QVBoxLayout(Dialog)
self.verticalLayout_2.setObjectName("verticalLayout_2")
spacerItem = QtWidgets.QSpacerItem(20, 157, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.verticalLayout_2.addItem(spacerItem)
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem1)
self.verticalLayout = QtWidgets.QVBoxLayout()
self.verticalLayout.setObjectName("verticalLayout")
self.btn_report = QtWidgets.QPushButton(Dialog)
font = QtGui.QFont()
@ -27,6 +35,65 @@ class Ui_Dialog(object):
self.btn_report.setFont(font)
self.btn_report.setObjectName("btn_report")
self.verticalLayout.addWidget(self.btn_report)
self.label = QtWidgets.QLabel(Dialog)
self.label.setAlignment(QtCore.Qt.AlignCenter)
self.label.setObjectName("label")
self.verticalLayout.addWidget(self.label)
self.gridLayout = QtWidgets.QGridLayout()
self.gridLayout.setObjectName("gridLayout")
self.label_4 = QtWidgets.QLabel(Dialog)
self.label_4.setObjectName("label_4")
self.gridLayout.addWidget(self.label_4, 0, 0, 1, 1)
self.lineEdit_phone = QtWidgets.QLineEdit(Dialog)
self.lineEdit_phone.setStyleSheet("background:transparent;\n"
"\n"
" border-radius:5px;\n"
" border-top: 0px solid #b2e281;\n"
" border-bottom: 2px solid black;\n"
" border-right: 0px solid #b2e281;\n"
" border-left: 0px solid #b2e281;\n"
"\n"
"\n"
" border-style:outset\n"
" ")
self.lineEdit_phone.setFrame(False)
self.lineEdit_phone.setObjectName("lineEdit_phone")
self.gridLayout.addWidget(self.lineEdit_phone, 0, 1, 1, 1)
self.lineEdit_name = QtWidgets.QLineEdit(Dialog)
self.lineEdit_name.setStyleSheet("background:transparent;\n"
"\n"
" border-radius:5px;\n"
" border-top: 0px solid #b2e281;\n"
" border-bottom: 2px solid black;\n"
" border-right: 0px solid #b2e281;\n"
" border-left: 0px solid #b2e281;\n"
"\n"
"\n"
" border-style:outset\n"
" ")
self.lineEdit_name.setFrame(False)
self.lineEdit_name.setObjectName("lineEdit_name")
self.gridLayout.addWidget(self.lineEdit_name, 1, 1, 1, 1)
self.label_wxid = QtWidgets.QLabel(Dialog)
self.label_wxid.setText("")
self.label_wxid.setObjectName("label_wxid")
self.gridLayout.addWidget(self.label_wxid, 2, 1, 1, 1)
self.label_5 = QtWidgets.QLabel(Dialog)
self.label_5.setObjectName("label_5")
self.gridLayout.addWidget(self.label_5, 1, 0, 1, 1)
self.label_6 = QtWidgets.QLabel(Dialog)
self.label_6.setObjectName("label_6")
self.gridLayout.addWidget(self.label_6, 2, 0, 1, 1)
self.verticalLayout.addLayout(self.gridLayout)
self.btn_save = QtWidgets.QPushButton(Dialog)
self.btn_save.setObjectName("btn_save")
self.verticalLayout.addWidget(self.btn_save)
self.horizontalLayout.addLayout(self.verticalLayout)
spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem2)
self.verticalLayout_2.addLayout(self.horizontalLayout)
spacerItem3 = QtWidgets.QSpacerItem(20, 157, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.verticalLayout_2.addItem(spacerItem3)
self.retranslateUi(Dialog)
QtCore.QMetaObject.connectSlotsByName(Dialog)
@ -35,3 +102,8 @@ class Ui_Dialog(object):
_translate = QtCore.QCoreApplication.translate
Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
self.btn_report.setText(_translate("Dialog", "我的年度聊天报告"))
self.label.setText(_translate("Dialog", "修改个人信息"))
self.label_4.setText(_translate("Dialog", "手机号"))
self.label_5.setText(_translate("Dialog", "微信昵称"))
self.label_6.setText(_translate("Dialog", "wxid"))
self.btn_save.setText(_translate("Dialog", "保存"))

View File

@ -317,6 +317,7 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow, QCursorGif):
me.remark = dic.get('name')
me.mobile = dic.get('mobile')
me.wx_dir = dic.get('wx_dir')
me.token = dic.get('token')
self.set_my_info(wxid)
self.load_flag = True
else:

View File

@ -26,31 +26,29 @@ class Ui_Dialog(object):
"QPushButton:hover{\n"
" background: rgb(230, 235, 240);\n"
"}")
self.verticalLayout_3 = QtWidgets.QVBoxLayout(Dialog)
self.verticalLayout_3.setObjectName("verticalLayout_3")
self.verticalLayout_2 = QtWidgets.QVBoxLayout()
self.verticalLayout_2 = QtWidgets.QVBoxLayout(Dialog)
self.verticalLayout_2.setObjectName("verticalLayout_2")
spacerItem = QtWidgets.QSpacerItem(20, 79, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.verticalLayout_2.addItem(spacerItem)
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
spacerItem1 = QtWidgets.QSpacerItem(78, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_3.addItem(spacerItem1)
self.verticalLayout = QtWidgets.QVBoxLayout()
self.verticalLayout.setObjectName("verticalLayout")
self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_4.addItem(spacerItem)
spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_4.addItem(spacerItem2)
self.btn_help = QtWidgets.QPushButton(Dialog)
self.btn_help.setMinimumSize(QtCore.QSize(0, 40))
self.btn_help.setMaximumSize(QtCore.QSize(200, 16777215))
self.btn_help.setStyleSheet("")
self.btn_help.setObjectName("btn_help")
self.horizontalLayout_4.addWidget(self.btn_help)
spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_4.addItem(spacerItem1)
self.verticalLayout_2.addLayout(self.horizontalLayout_4)
spacerItem2 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.verticalLayout_2.addItem(spacerItem2)
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_3.addItem(spacerItem3)
self.verticalLayout = QtWidgets.QVBoxLayout()
self.verticalLayout.setObjectName("verticalLayout")
self.horizontalLayout_4.addItem(spacerItem3)
self.verticalLayout.addLayout(self.horizontalLayout_4)
self.label_3 = QtWidgets.QLabel(Dialog)
font = QtGui.QFont()
font.setFamily("一纸情书")
@ -63,19 +61,36 @@ class Ui_Dialog(object):
self.label_9.setAlignment(QtCore.Qt.AlignCenter)
self.label_9.setObjectName("label_9")
self.verticalLayout.addWidget(self.label_9)
self.gridLayout_2 = QtWidgets.QGridLayout()
self.gridLayout_2.setObjectName("gridLayout_2")
self.gridLayout = QtWidgets.QGridLayout()
self.gridLayout.setObjectName("gridLayout")
self.label_phone = QtWidgets.QLabel(Dialog)
self.label_phone.setText("")
self.label_phone.setObjectName("label_phone")
self.gridLayout.addWidget(self.label_phone, 2, 1, 1, 1)
self.label = QtWidgets.QLabel(Dialog)
self.label.setObjectName("label")
self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
self.label_pid = QtWidgets.QLabel(Dialog)
self.label_pid.setText("")
self.label_pid.setObjectName("label_pid")
self.gridLayout.addWidget(self.label_pid, 0, 1, 1, 1)
self.label_7 = QtWidgets.QLabel(Dialog)
self.label_7.setObjectName("label_7")
self.gridLayout.addWidget(self.label_7, 1, 0, 1, 1)
self.lineEdit = QtWidgets.QLineEdit(Dialog)
self.lineEdit.setStyleSheet("background:transparent;\n"
self.label_version = QtWidgets.QLabel(Dialog)
self.label_version.setText("")
self.label_version.setObjectName("label_version")
self.gridLayout.addWidget(self.label_version, 1, 1, 1, 1)
self.btn_getinfo = QtWidgets.QPushButton(Dialog)
self.btn_getinfo.setMinimumSize(QtCore.QSize(0, 40))
self.btn_getinfo.setObjectName("btn_getinfo")
self.gridLayout.addWidget(self.btn_getinfo, 1, 2, 2, 1)
self.checkBox = QtWidgets.QCheckBox(Dialog)
self.checkBox.setText("")
self.checkBox.setCheckable(False)
self.checkBox.setObjectName("checkBox")
self.gridLayout.addWidget(self.checkBox, 1, 3, 2, 1)
self.label_2 = QtWidgets.QLabel(Dialog)
self.label_2.setObjectName("label_2")
self.gridLayout.addWidget(self.label_2, 2, 0, 1, 1)
self.lineEdit_phone = QtWidgets.QLineEdit(Dialog)
self.lineEdit_phone.setStyleSheet("background:transparent;\n"
"\n"
" border-radius:5px;\n"
" border-top: 0px solid #b2e281;\n"
@ -86,12 +101,38 @@ class Ui_Dialog(object):
"\n"
" border-style:outset\n"
" ")
self.lineEdit.setFrame(False)
self.lineEdit.setObjectName("lineEdit")
self.gridLayout.addWidget(self.lineEdit, 4, 1, 1, 1)
self.lineEdit_phone.setFrame(False)
self.lineEdit_phone.setObjectName("lineEdit_phone")
self.gridLayout.addWidget(self.lineEdit_phone, 2, 1, 1, 1)
self.label_5 = QtWidgets.QLabel(Dialog)
self.label_5.setObjectName("label_5")
self.gridLayout.addWidget(self.label_5, 3, 0, 1, 1)
self.lineEdit_name = QtWidgets.QLineEdit(Dialog)
self.lineEdit_name.setStyleSheet("background:transparent;\n"
"\n"
" border-radius:5px;\n"
" border-top: 0px solid #b2e281;\n"
" border-bottom: 2px solid black;\n"
" border-right: 0px solid #b2e281;\n"
" border-left: 0px solid #b2e281;\n"
"\n"
"\n"
" border-style:outset\n"
" ")
self.lineEdit_name.setFrame(False)
self.lineEdit_name.setObjectName("lineEdit_name")
self.gridLayout.addWidget(self.lineEdit_name, 3, 1, 1, 1)
self.label_4 = QtWidgets.QLabel(Dialog)
self.label_4.setObjectName("label_4")
self.gridLayout.addWidget(self.label_4, 4, 0, 1, 1)
self.label_wxid = QtWidgets.QLabel(Dialog)
self.label_wxid.setText("")
self.label_wxid.setObjectName("label_wxid")
self.gridLayout.addWidget(self.label_wxid, 4, 1, 1, 1)
self.btn_db_dir = QtWidgets.QPushButton(Dialog)
self.btn_db_dir.setMinimumSize(QtCore.QSize(0, 40))
self.btn_db_dir.setObjectName("btn_db_dir")
self.gridLayout.addWidget(self.btn_db_dir, 4, 2, 3, 1)
self.label_6 = QtWidgets.QLabel(Dialog)
self.label_6.setObjectName("label_6")
self.gridLayout.addWidget(self.label_6, 5, 0, 1, 1)
@ -100,27 +141,11 @@ class Ui_Dialog(object):
self.label_key.setText("")
self.label_key.setObjectName("label_key")
self.gridLayout.addWidget(self.label_key, 5, 1, 1, 1)
self.label = QtWidgets.QLabel(Dialog)
self.label.setObjectName("label")
self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
self.label_2 = QtWidgets.QLabel(Dialog)
self.label_2.setObjectName("label_2")
self.gridLayout.addWidget(self.label_2, 2, 0, 1, 1)
self.label_pid = QtWidgets.QLabel(Dialog)
self.label_pid.setText("")
self.label_pid.setObjectName("label_pid")
self.gridLayout.addWidget(self.label_pid, 0, 1, 1, 1)
self.label_name = QtWidgets.QLabel(Dialog)
self.label_name.setText("")
self.label_name.setObjectName("label_name")
self.gridLayout.addWidget(self.label_name, 3, 1, 1, 1)
self.label_4 = QtWidgets.QLabel(Dialog)
self.label_4.setObjectName("label_4")
self.gridLayout.addWidget(self.label_4, 4, 0, 1, 1)
self.label_version = QtWidgets.QLabel(Dialog)
self.label_version.setText("")
self.label_version.setObjectName("label_version")
self.gridLayout.addWidget(self.label_version, 1, 1, 1, 1)
self.checkBox_2 = QtWidgets.QCheckBox(Dialog)
self.checkBox_2.setText("")
self.checkBox_2.setCheckable(False)
self.checkBox_2.setObjectName("checkBox_2")
self.gridLayout.addWidget(self.checkBox_2, 5, 3, 1, 1)
self.label_8 = QtWidgets.QLabel(Dialog)
self.label_8.setObjectName("label_8")
self.gridLayout.addWidget(self.label_8, 6, 0, 1, 1)
@ -129,29 +154,7 @@ class Ui_Dialog(object):
self.label_db_dir.setText("")
self.label_db_dir.setObjectName("label_db_dir")
self.gridLayout.addWidget(self.label_db_dir, 6, 1, 1, 1)
self.gridLayout.setColumnMinimumWidth(0, 1)
self.gridLayout.setColumnStretch(0, 1)
self.gridLayout.setColumnStretch(1, 10)
self.gridLayout_2.addLayout(self.gridLayout, 0, 0, 2, 1)
self.btn_getinfo = QtWidgets.QPushButton(Dialog)
self.btn_getinfo.setMinimumSize(QtCore.QSize(0, 40))
self.btn_getinfo.setObjectName("btn_getinfo")
self.gridLayout_2.addWidget(self.btn_getinfo, 0, 1, 1, 1)
self.checkBox = QtWidgets.QCheckBox(Dialog)
self.checkBox.setText("")
self.checkBox.setCheckable(False)
self.checkBox.setObjectName("checkBox")
self.gridLayout_2.addWidget(self.checkBox, 0, 2, 1, 1)
self.btn_db_dir = QtWidgets.QPushButton(Dialog)
self.btn_db_dir.setMinimumSize(QtCore.QSize(0, 40))
self.btn_db_dir.setObjectName("btn_db_dir")
self.gridLayout_2.addWidget(self.btn_db_dir, 1, 1, 1, 1)
self.checkBox_2 = QtWidgets.QCheckBox(Dialog)
self.checkBox_2.setText("")
self.checkBox_2.setCheckable(False)
self.checkBox_2.setObjectName("checkBox_2")
self.gridLayout_2.addWidget(self.checkBox_2, 1, 2, 1, 1)
self.verticalLayout.addLayout(self.gridLayout_2)
self.verticalLayout.addLayout(self.gridLayout)
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
spacerItem4 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
@ -175,12 +178,11 @@ class Ui_Dialog(object):
self.horizontalLayout.addWidget(self.progressBar)
self.verticalLayout.addLayout(self.horizontalLayout)
self.horizontalLayout_3.addLayout(self.verticalLayout)
spacerItem6 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
spacerItem6 = QtWidgets.QSpacerItem(128, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_3.addItem(spacerItem6)
self.verticalLayout_2.addLayout(self.horizontalLayout_3)
spacerItem7 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
spacerItem7 = QtWidgets.QSpacerItem(20, 79, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.verticalLayout_2.addItem(spacerItem7)
self.verticalLayout_3.addLayout(self.verticalLayout_2)
self.retranslateUi(Dialog)
QtCore.QMetaObject.connectSlotsByName(Dialog)
@ -191,14 +193,14 @@ class Ui_Dialog(object):
self.btn_help.setText(_translate("Dialog", "使用说明"))
self.label_3.setText(_translate("Dialog", "解密数据库"))
self.label_9.setText(_translate("Dialog", "以下内容为自动获取,如获取失败请手动填写"))
self.label_7.setText(_translate("Dialog", "版本"))
self.label_5.setText(_translate("Dialog", "微信昵称"))
self.label_6.setText(_translate("Dialog", "密钥"))
self.label.setText(_translate("Dialog", "PID"))
self.label_2.setText(_translate("Dialog", "手机号"))
self.label_4.setText(_translate("Dialog", "wxid"))
self.label_8.setText(_translate("Dialog", "微信路径"))
self.label_7.setText(_translate("Dialog", "版本"))
self.btn_getinfo.setText(_translate("Dialog", "获取信息"))
self.label_2.setText(_translate("Dialog", "手机号"))
self.label_5.setText(_translate("Dialog", "微信昵称"))
self.label_4.setText(_translate("Dialog", "wxid"))
self.btn_db_dir.setText(_translate("Dialog", "设置微信路径"))
self.label_6.setText(_translate("Dialog", "密钥"))
self.label_8.setText(_translate("Dialog", "微信路径"))
self.btn_start.setText(_translate("Dialog", "开始启动"))
self.label_ready.setText(_translate("Dialog", "未就绪"))

View File

@ -18,6 +18,7 @@ from app.log import logger
from app.util import path
from . import decryptUi
from ...Icon import Icon
from ...menu.about_dialog import Decrypt
class DecryptControl(QWidget, decryptUi.Ui_Dialog, QCursorGif):
@ -37,15 +38,19 @@ class DecryptControl(QWidget, decryptUi.Ui_Dialog, QCursorGif):
self.btn_start.clicked.connect(self.decrypt)
self.btn_getinfo.clicked.connect(self.get_info)
self.btn_db_dir.clicked.connect(self.select_db_dir)
self.lineEdit.returnPressed.connect(self.set_wxid)
self.lineEdit.textChanged.connect(self.set_wxid_)
# self.lineEdit.returnPressed.connect(self.set_wxid)
# self.lineEdit.textChanged.connect(self.set_wxid_)
self.lineEdit_name.returnPressed.connect(self.set_wxid)
self.lineEdit_name.textChanged.connect(self.set_wxid_)
self.lineEdit_phone.returnPressed.connect(self.set_wxid)
self.lineEdit_phone.textChanged.connect(self.set_wxid_)
self.btn_help.clicked.connect(self.show_help)
self.btn_getinfo.setIcon(Icon.Get_info_Icon)
self.btn_db_dir.setIcon(Icon.Folder_Icon)
self.btn_start.setIcon(Icon.Start_Icon)
self.btn_help.setIcon(Icon.Help_Icon)
self.info = {}
self.lineEdit.setFocus()
self.lineEdit_name.setFocus()
self.ready = False
self.wx_dir = None
@ -79,12 +84,12 @@ class DecryptControl(QWidget, decryptUi.Ui_Dialog, QCursorGif):
self.ready = True
self.info = result[0]
self.label_key.setText(self.info['key'])
self.lineEdit.setText(self.info['wxid'])
self.label_name.setText(self.info['name'])
self.label_phone.setText(self.info['mobile'])
self.label_wxid.setText(self.info['wxid'])
self.lineEdit_name.setText(self.info['name'])
self.lineEdit_phone.setText(self.info['mobile'])
self.label_pid.setText(str(self.info['pid']))
self.label_version.setText(self.info['version'])
self.lineEdit.setFocus()
self.lineEdit_name.setFocus()
self.checkBox.setCheckable(True)
self.checkBox.setChecked(True)
self.get_wxidSignal.emit(self.info['wxid'])
@ -102,11 +107,18 @@ class DecryptControl(QWidget, decryptUi.Ui_Dialog, QCursorGif):
self.stopBusy()
def set_wxid_(self):
self.info['wxid'] = self.lineEdit.text()
if self.sender() == self.lineEdit_name:
self.info['name'] = self.lineEdit_name.text()
elif self.sender() == self.lineEdit_phone:
self.info['mobel'] = self.lineEdit_phone.text()
def set_wxid(self):
self.info['wxid'] = self.lineEdit.text()
QMessageBox.information(self, "ok", f"wxid修改成功{self.info['wxid']}")
if self.sender() == self.lineEdit_name:
self.info['name'] = self.lineEdit_name.text()
QMessageBox.information(self, "ok", f"昵称修改成功{self.info['name']}")
elif self.sender() == self.lineEdit_phone:
self.info['mobile'] = self.lineEdit_phone.text()
QMessageBox.information(self, "ok", f"手机号修改成功{self.info['mobile']}")
def select_db_dir(self):
directory = QFileDialog.getExistingDirectory(
@ -132,7 +144,7 @@ class DecryptControl(QWidget, decryptUi.Ui_Dialog, QCursorGif):
if not self.wx_dir:
QMessageBox.critical(self, "错误", "请先选择微信安装路径")
return
if self.lineEdit.text() == 'None':
if self.label_wxid.text() == 'None':
QMessageBox.critical(self, "错误", "请填入wxid")
return
db_dir = os.path.join(self.wx_dir, 'Msg')
@ -182,11 +194,10 @@ class DecryptControl(QWidget, decryptUi.Ui_Dialog, QCursorGif):
'wxid': self.info['wxid'],
'wx_dir': self.wx_dir,
'name': self.info['name'],
'mobile': self.info['mobile']
'mobile': self.info['mobile'],
'token': Decrypt.decrypt(self.info['wxid'])
}
try:
with open(INFO_FILE_PATH, "w", encoding="utf-8") as f:
json.dump(dic, f, ensure_ascii=False, indent=4)
except:

View File

@ -266,8 +266,8 @@ p {
display: flex;
}
#word_cloud{
width: 800px;
height: 800px;
width: 700px;
height: 600px;
}
@media screen and (max-width:480px){
.chart{

View File

@ -163,6 +163,7 @@ def upload():
'html_content': html,
'wxid': contact.wxid,
'username': Me().wxid,
'token':Me().token,
'type': 'contact'
}
response = requests.post(api_url, data=data)