mirror of
https://github.com/LC044/WeChatMsg
synced 2024-11-14 22:01:54 +08:00
commit
2f22d03ebd
@ -4,9 +4,10 @@
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="84e65474-7da9-466d-baf3-cc88dde3ffdd" name="变更" comment="新版本更新">
|
||||
<list default="true" id="84e65474-7da9-466d-baf3-cc88dde3ffdd" name="变更" comment="修复时间插入位置">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/DataBase/micro_msg.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/DataBase/micro_msg.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/DataBase/misc.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/DataBase/misc.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/ui_pc/mainview.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/ui_pc/mainview.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/readme.md" beforeDir="false" afterPath="$PROJECT_DIR$/readme.md" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
@ -273,34 +274,6 @@
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1672848140146</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00027" summary="mainwindows文件修正">
|
||||
<created>1684726034556</created>
|
||||
<option name="number" value="00027" />
|
||||
<option name="presentableId" value="LOCAL-00027" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1684726034556</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00028" summary="mainwindows文件修正">
|
||||
<created>1684726338618</created>
|
||||
<option name="number" value="00028" />
|
||||
<option name="presentableId" value="LOCAL-00028" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1684726338618</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00029" summary="match语法说明">
|
||||
<created>1692427491271</created>
|
||||
<option name="number" value="00029" />
|
||||
<option name="presentableId" value="LOCAL-00029" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1692427491271</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00030" summary="update readme">
|
||||
<created>1698248435600</created>
|
||||
<option name="number" value="00030" />
|
||||
<option name="presentableId" value="LOCAL-00030" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1698248435600</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00031" summary="增加群二维码">
|
||||
<created>1698248457797</created>
|
||||
<option name="number" value="00031" />
|
||||
@ -616,7 +589,35 @@
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1700289701718</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="76" />
|
||||
<task id="LOCAL-00076" summary="update readme">
|
||||
<created>1700290543397</created>
|
||||
<option name="number" value="00076" />
|
||||
<option name="presentableId" value="LOCAL-00076" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1700290543397</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00077" summary="update readme">
|
||||
<created>1700290549743</created>
|
||||
<option name="number" value="00077" />
|
||||
<option name="presentableId" value="LOCAL-00077" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1700290549743</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00078" summary="update readme">
|
||||
<created>1700290555508</created>
|
||||
<option name="number" value="00078" />
|
||||
<option name="presentableId" value="LOCAL-00078" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1700290555508</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00079" summary="修复时间插入位置">
|
||||
<created>1700309638496</created>
|
||||
<option name="number" value="00079" />
|
||||
<option name="presentableId" value="LOCAL-00079" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1700309638496</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="80" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="UnknownFeatures">
|
||||
@ -652,7 +653,6 @@
|
||||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="增加几个图标" />
|
||||
<MESSAGE value="增加导航按钮效果" />
|
||||
<MESSAGE value="新增PC数据库解密" />
|
||||
<MESSAGE value="main首次加载解密界面" />
|
||||
@ -668,7 +668,6 @@
|
||||
<MESSAGE value="修复情感分析数值显示过长的bug" />
|
||||
<MESSAGE value="新增聊天记录导出csv格式" />
|
||||
<MESSAGE value="导出所有数据库的聊天记录" />
|
||||
<MESSAGE value="update readme" />
|
||||
<MESSAGE value="数据库加锁避免多线程访问报错" />
|
||||
<MESSAGE value="修复聊天气泡不能更改大小的bug" />
|
||||
<MESSAGE value="更改头像显示" />
|
||||
@ -677,7 +676,9 @@
|
||||
<MESSAGE value="聊天记录从后往前显示" />
|
||||
<MESSAGE value="聊天消息自适应" />
|
||||
<MESSAGE value="新版本更新" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="新版本更新" />
|
||||
<MESSAGE value="update readme" />
|
||||
<MESSAGE value="修复时间插入位置" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="修复时间插入位置" />
|
||||
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="true" />
|
||||
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="true" />
|
||||
</component>
|
||||
|
@ -13,6 +13,16 @@ if os.path.exists(misc_path):
|
||||
cursor = DB.cursor()
|
||||
|
||||
|
||||
def init_database():
|
||||
global DB
|
||||
global cursor
|
||||
if not DB:
|
||||
if os.path.exists(misc_path):
|
||||
DB = sqlite3.connect(misc_path, check_same_thread=False)
|
||||
# '''创建游标'''
|
||||
cursor = DB.cursor()
|
||||
|
||||
|
||||
def get_avatar_buffer(userName):
|
||||
sql = '''
|
||||
select smallHeadBuf
|
||||
@ -21,7 +31,12 @@ def get_avatar_buffer(userName):
|
||||
'''
|
||||
try:
|
||||
lock.acquire(True)
|
||||
cursor.execute(sql, [userName])
|
||||
try:
|
||||
cursor.execute(sql, [userName])
|
||||
except AttributeError:
|
||||
init_database()
|
||||
finally:
|
||||
cursor.execute(sql, [userName])
|
||||
result = cursor.fetchall()
|
||||
# print(result[0][0])
|
||||
if result:
|
||||
|
@ -10,9 +10,9 @@ class ChatInfo(QWidget):
|
||||
def __init__(self, contact, parent=None):
|
||||
super().__init__(parent)
|
||||
self.last_timestamp = 0
|
||||
self.last_str_time = ''
|
||||
self.last_pos = 0
|
||||
self.contact = contact
|
||||
|
||||
self.init_ui()
|
||||
self.show_chats()
|
||||
|
||||
@ -71,6 +71,7 @@ class ChatInfo(QWidget):
|
||||
def is_5_min(self, timestamp):
|
||||
if abs(timestamp - self.last_timestamp) > 300:
|
||||
self.last_timestamp = timestamp
|
||||
|
||||
return True
|
||||
return False
|
||||
|
||||
@ -85,7 +86,8 @@ class ChatInfo(QWidget):
|
||||
timestamp = message[5]
|
||||
if type_ == 1:
|
||||
if self.is_5_min(timestamp):
|
||||
time_message = Notice(str_time)
|
||||
time_message = Notice(self.last_str_time)
|
||||
self.last_str_time = str_time
|
||||
self.chat_window.add_message_item(time_message, 0)
|
||||
bubble_message = BubbleMessage(
|
||||
str_content,
|
||||
@ -96,6 +98,7 @@ class ChatInfo(QWidget):
|
||||
# print(str_content)
|
||||
# self.scroolAreaLayout.addWidget(bubble_message)
|
||||
self.chat_window.add_message_item(bubble_message, 0)
|
||||
|
||||
except:
|
||||
print(message)
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
@comment : 主窗口
|
||||
"""
|
||||
import json
|
||||
import os.path
|
||||
from random import randint
|
||||
|
||||
from PyQt5.QtCore import *
|
||||
@ -72,24 +73,31 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
|
||||
self.setStyleSheet(Stylesheet)
|
||||
self.listWidget.clear()
|
||||
self.resize(QSize(800, 600))
|
||||
# self.stackedWidget = QtWidgets.QStackedWidget(self.centralwidget)
|
||||
self.action_desc.triggered.connect(self.about)
|
||||
self.load_data()
|
||||
self.init_ui()
|
||||
self.load_num = 0
|
||||
|
||||
def load_data(self):
|
||||
with open('./app/data/info.json', 'r', encoding='utf-8') as f:
|
||||
dic = json.loads(f.read())
|
||||
wxid = dic.get('wxid')
|
||||
if wxid:
|
||||
me = MePC()
|
||||
self.set_my_info(wxid)
|
||||
if os.path.exists('./app/data/info.json'):
|
||||
with open('./app/data/info.json', 'r', encoding='utf-8') as f:
|
||||
dic = json.loads(f.read())
|
||||
wxid = dic.get('wxid')
|
||||
if wxid:
|
||||
me = MePC()
|
||||
self.set_my_info(wxid)
|
||||
else:
|
||||
QMessageBox.information(
|
||||
self,
|
||||
'温馨提示',
|
||||
'点击 工具->获取信息 重启后可以显示本人头像哦'
|
||||
)
|
||||
|
||||
def init_ui(self):
|
||||
# self.movie = QMovie("./app/data/loading.gif")
|
||||
self.label = QLabel(self)
|
||||
self.label.setGeometry(0, 0, self.width(), self.height())
|
||||
self.label.setVisible(False)
|
||||
# self.label.setMovie(self.movie)
|
||||
# self.movie.start()
|
||||
self.listWidget.currentRowChanged.connect(self.setCurrentIndex)
|
||||
@ -105,6 +113,7 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
|
||||
self.listWidget.setCurrentRow(0)
|
||||
self.stackedWidget.setCurrentIndex(0)
|
||||
chat_window = ChatWindow()
|
||||
# chat_window = QWidget()
|
||||
self.stackedWidget.addWidget(chat_window)
|
||||
contact_window = ContactWindow()
|
||||
self.stackedWidget.addWidget(contact_window)
|
||||
@ -117,7 +126,7 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
|
||||
self.stackedWidget.addWidget(label)
|
||||
tool_window.load_finish_signal.connect(self.loading)
|
||||
contact_window.load_finish_signal.connect(self.loading)
|
||||
chat_window.load_finish_signal.connect(self.loading)
|
||||
# chat_window.load_finish_signal.connect(self.loading)
|
||||
# self.load_window_thread = LoadWindowThread(self.stackedWidget)
|
||||
# self.load_window_thread.okSignal.connect(self.stop_loading)
|
||||
# self.load_window_thread.start()
|
||||
@ -126,6 +135,8 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
|
||||
self.stackedWidget.setCurrentIndex(row)
|
||||
if row == 2:
|
||||
self.stackedWidget.currentWidget().show_contacts()
|
||||
if row == 1:
|
||||
self.stackedWidget.currentWidget().show_chats()
|
||||
|
||||
def setWindow(self, window):
|
||||
try:
|
||||
@ -136,7 +147,10 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
|
||||
|
||||
def set_my_info(self, wxid):
|
||||
self.avatar = QPixmap()
|
||||
img_bytes = misc.get_avatar_buffer(wxid)
|
||||
try:
|
||||
img_bytes = misc.get_avatar_buffer(wxid)
|
||||
except AttributeError:
|
||||
return
|
||||
if img_bytes[:4] == b'\x89PNG':
|
||||
self.avatar.loadFromData(img_bytes, format='PNG')
|
||||
else:
|
||||
@ -157,6 +171,7 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
|
||||
|
||||
def loading(self, a0):
|
||||
self.load_num += 1
|
||||
self.label.setVisible(False)
|
||||
# print('加载一个了')
|
||||
if self.load_num == 2:
|
||||
# print('ok了')
|
||||
|
@ -16,30 +16,31 @@ class Ui_MainWindow(object):
|
||||
MainWindow.setObjectName("MainWindow")
|
||||
MainWindow.resize(1280, 779)
|
||||
MainWindow.setStyleSheet("\n"
|
||||
"/*去掉item虚线边框*/\n"
|
||||
"QListWidget, QListView, QTreeWidget, QTreeView {\n"
|
||||
" outline: 0px;\n"
|
||||
"}\n"
|
||||
"/*设置左侧选项的最小最大宽度,文字颜色和背景颜色*/\n"
|
||||
"QListWidget {\n"
|
||||
" min-width: 120px;\n"
|
||||
" max-width: 120px;\n"
|
||||
" color: black;\n"
|
||||
" background: white;\n"
|
||||
" border:none;\n"
|
||||
"}\n"
|
||||
"QListWidget::item{\n"
|
||||
" height:80;\n"
|
||||
"}\n"
|
||||
"/*被选中时的背景颜色和左边框颜色*/\n"
|
||||
"QListWidget::item:selected {\n"
|
||||
" background: rgb(204, 204, 204);\n"
|
||||
" border-left: 4px solid rgb(9, 187, 7);\n"
|
||||
"}\n"
|
||||
"/*鼠标悬停颜色*/\n"
|
||||
"HistoryPanel::item:hover {\n"
|
||||
" background: rgb(52, 52, 52);\n"
|
||||
"}")
|
||||
" /*去掉item虚线边框*/\n"
|
||||
" QListWidget, QListView, QTreeWidget, QTreeView {\n"
|
||||
" outline: 0px;\n"
|
||||
" }\n"
|
||||
" /*设置左侧选项的最小最大宽度,文字颜色和背景颜色*/\n"
|
||||
" QListWidget {\n"
|
||||
" min-width: 120px;\n"
|
||||
" max-width: 120px;\n"
|
||||
" color: black;\n"
|
||||
" background: white;\n"
|
||||
" border:none;\n"
|
||||
" }\n"
|
||||
" QListWidget::item{\n"
|
||||
" height:80;\n"
|
||||
" }\n"
|
||||
" /*被选中时的背景颜色和左边框颜色*/\n"
|
||||
" QListWidget::item:selected {\n"
|
||||
" background: rgb(204, 204, 204);\n"
|
||||
" border-left: 4px solid rgb(9, 187, 7);\n"
|
||||
" }\n"
|
||||
" /*鼠标悬停颜色*/\n"
|
||||
" HistoryPanel::item:hover {\n"
|
||||
" background: rgb(52, 52, 52);\n"
|
||||
" }\n"
|
||||
" ")
|
||||
self.centralwidget = QtWidgets.QWidget(MainWindow)
|
||||
self.centralwidget.setObjectName("centralwidget")
|
||||
self.horizontalLayout = QtWidgets.QHBoxLayout(self.centralwidget)
|
||||
@ -58,6 +59,11 @@ class Ui_MainWindow(object):
|
||||
self.myavatar.setObjectName("myavatar")
|
||||
self.listWidget = QtWidgets.QListWidget(self.frame_info)
|
||||
self.listWidget.setGeometry(QtCore.QRect(0, 230, 120, 331))
|
||||
self.listWidget.setMinimumSize(QtCore.QSize(120, 0))
|
||||
self.listWidget.setMaximumSize(QtCore.QSize(120, 16777215))
|
||||
self.listWidget.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
|
||||
self.listWidget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
|
||||
self.listWidget.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustIgnored)
|
||||
self.listWidget.setObjectName("listWidget")
|
||||
item = QtWidgets.QListWidgetItem()
|
||||
self.listWidget.addItem(item)
|
||||
@ -93,6 +99,8 @@ class Ui_MainWindow(object):
|
||||
self.menu_2.setObjectName("menu_2")
|
||||
self.menu_about = QtWidgets.QMenu(self.menubar)
|
||||
self.menu_about.setObjectName("menu_about")
|
||||
self.menu_3 = QtWidgets.QMenu(self.menubar)
|
||||
self.menu_3.setObjectName("menu_3")
|
||||
MainWindow.setMenuBar(self.menubar)
|
||||
self.statusbar = QtWidgets.QStatusBar(MainWindow)
|
||||
self.statusbar.setObjectName("statusbar")
|
||||
@ -118,6 +126,7 @@ class Ui_MainWindow(object):
|
||||
self.menubar.addAction(self.menu.menuAction())
|
||||
self.menubar.addAction(self.menu_2.menuAction())
|
||||
self.menubar.addAction(self.menu_about.menuAction())
|
||||
self.menubar.addAction(self.menu_3.menuAction())
|
||||
|
||||
self.retranslateUi(MainWindow)
|
||||
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||
@ -143,6 +152,7 @@ class Ui_MainWindow(object):
|
||||
self.menu.setTitle(_translate("MainWindow", "编辑"))
|
||||
self.menu_2.setTitle(_translate("MainWindow", "帮助"))
|
||||
self.menu_about.setTitle(_translate("MainWindow", "关于"))
|
||||
self.menu_3.setTitle(_translate("MainWindow", "不显示或者显示异常请重启应用"))
|
||||
self.action_3.setText(_translate("MainWindow", "保存"))
|
||||
self.action_4.setText(_translate("MainWindow", "退出"))
|
||||
self.action.setText(_translate("MainWindow", "关于"))
|
||||
|
@ -99,19 +99,19 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>230</y>
|
||||
<width>80</width>
|
||||
<width>120</width>
|
||||
<height>331</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<width>120</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<width>120</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -205,10 +205,16 @@
|
||||
</property>
|
||||
<addaction name="action_desc"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_3">
|
||||
<property name="title">
|
||||
<string>不显示或者显示异常请重启应用</string>
|
||||
</property>
|
||||
</widget>
|
||||
<addaction name="menu_F"/>
|
||||
<addaction name="menu"/>
|
||||
<addaction name="menu_2"/>
|
||||
<addaction name="menu_about"/>
|
||||
<addaction name="menu_3"/>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
<action name="action_3">
|
||||
|
Loading…
Reference in New Issue
Block a user