From 576981e7b25afab7e40c8cab5e672e9ce4d61500 Mon Sep 17 00:00:00 2001
From: shuaikangzhou <863909694@qq.com>
Date: Wed, 8 Nov 2023 00:13:12 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AF=BC=E5=85=A5=E8=B7=AF?=
=?UTF-8?q?=E5=BE=84=EF=BC=8C=E6=96=B9=E4=BE=BF=E6=89=93=E5=8C=85=E6=88=90?=
=?UTF-8?q?exe?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/workspace.xml | 30 ++++++++++++++++++++++-----
app/DataBase/__init__.py | 4 ++++
app/DataBase/data.py | 21 +++++--------------
app/DataBase/database.py | 1 +
app/DataBase/output.py | 10 ++++-----
app/Ui/{ICON.py => Icon.py} | 2 +-
app/Ui/__init__.py | 10 ++++-----
app/Ui/chat/chat.py | 3 +--
app/Ui/contact/contact.py | 9 ++++----
app/Ui/contact/contactInfo.py | 7 +++----
app/Ui/contact/userinfo/userinfo.py | 3 +--
app/Ui/mainview.py | 15 +++++++-------
app/__init__.py | 32 -----------------------------
app/person.py | 9 +++++---
main.py | 5 ++++-
main.spec | 11 +++++++---
16 files changed, 82 insertions(+), 90 deletions(-)
create mode 100644 app/DataBase/database.py
rename app/Ui/{ICON.py => Icon.py} (81%)
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 9cca919..717ba9a 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,10 +4,23 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -509,7 +522,14 @@
1699275644642
-
+
+ 1699367814847
+
+
+
+ 1699367814847
+
+
@@ -545,7 +565,6 @@
-
@@ -570,7 +589,8 @@
-
+
+
@@ -584,7 +604,7 @@
file://$PROJECT_DIR$/main.py
- 19
+ 23
diff --git a/app/DataBase/__init__.py b/app/DataBase/__init__.py
index c5d89be..171ff5a 100644
--- a/app/DataBase/__init__.py
+++ b/app/DataBase/__init__.py
@@ -7,3 +7,7 @@
@Version : Python3.10
@comment : ···
"""
+from . import data
+from . import output
+
+__all__ = ["data", 'output']
diff --git a/app/DataBase/data.py b/app/DataBase/data.py
index c0d356d..ef72cde 100644
--- a/app/DataBase/data.py
+++ b/app/DataBase/data.py
@@ -15,8 +15,6 @@ import time
import requests
-from app import person
-
DB = None
cursor = None
lock = threading.Lock()
@@ -82,16 +80,6 @@ if os.path.exists('./Msg.db'):
cursor = DB.cursor()
-class Me:
- """个人信息"""
-
- def __init__(self, username):
- self.username = username # 自己的用户名
- self.my_avatar = get_avator(self.username) # 自己的头像地址
- self.city = None
- self.province = None
-
-
def is_db_exist() -> bool:
"""
判断数据库是否正常使用
@@ -103,8 +91,10 @@ def is_db_exist() -> bool:
sql = 'select * from userinfo where id=2'
cursor.execute(sql)
result = cursor.fetchone()
- me = Me(result[2])
- return True
+ if result[2]:
+ return True
+ else:
+ return False
except Exception as e:
return False
return False
@@ -155,8 +145,7 @@ def get_myinfo():
sql = 'select * from userinfo where id=2'
cursor.execute(sql)
result = cursor.fetchone()
- me = person.Me(result[2])
- return me
+ return result[2]
def get_contacts():
diff --git a/app/DataBase/database.py b/app/DataBase/database.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/app/DataBase/database.py
@@ -0,0 +1 @@
+
diff --git a/app/DataBase/output.py b/app/DataBase/output.py
index e060379..259d91c 100644
--- a/app/DataBase/output.py
+++ b/app/DataBase/output.py
@@ -12,8 +12,8 @@ from docx.enum.table import WD_ALIGN_VERTICAL
from docx.enum.text import WD_COLOR_INDEX, WD_PARAGRAPH_ALIGNMENT
from docxcompose.composer import Composer
-from app.person import Me
-from . import data
+from app import person
+from app.DataBase import data
# import data
@@ -53,7 +53,7 @@ class Output(QThread):
DOCX = 1
HTML = 2
- def __init__(self, Me: Me, ta_u, parent=None, type_=DOCX):
+ def __init__(self, Me: person.Me, ta_u, parent=None, type_=DOCX):
super().__init__(parent)
self.Me = Me
self.sec = 2 # 默认1000秒
@@ -151,7 +151,7 @@ class ChildThread(QThread):
DOCX = 1
HTML = 2
- def __init__(self, Me: Me, ta_u, message, conRemark, num, parent=None, type_=DOCX):
+ def __init__(self, Me: person.Me, ta_u, message, conRemark, num, parent=None, type_=DOCX):
super().__init__(parent)
self.Me = Me
self.sec = 2 # 默认1000秒
@@ -444,6 +444,6 @@ class ChildThread(QThread):
if __name__ == '__main__':
# wxid_0o18ef858vnu22
# wxid_fdkbu92el15h22
- me = data.Me('wxid_fdkbu92el15h22')
+ me = data.Me_Person('wxid_fdkbu92el15h22')
t = Output(Me=me, ta_u='wxid_0o18ef858vnu22', type_=Output.CSV)
t.run()
diff --git a/app/Ui/ICON.py b/app/Ui/Icon.py
similarity index 81%
rename from app/Ui/ICON.py
rename to app/Ui/Icon.py
index 45b3dbc..2bda4c8 100644
--- a/app/Ui/ICON.py
+++ b/app/Ui/Icon.py
@@ -3,7 +3,7 @@ from PyQt5.QtGui import QIcon
class Icon:
Default_avatar_path = './app/data/icons/default_avatar.svg'
- MainWindow = QIcon('./app/data/icons/logo.svg')
+ MainWindow_Icon = QIcon('./app/data/icons/logo.svg')
Default_avatar = QIcon(Default_avatar_path)
Output = QIcon('./app/data/icons/output.svg')
Back = QIcon('./app/data/icons/back.svg')
diff --git a/app/Ui/__init__.py b/app/Ui/__init__.py
index ebbb627..730bbfa 100644
--- a/app/Ui/__init__.py
+++ b/app/Ui/__init__.py
@@ -7,11 +7,11 @@
@Version : Python3.10
@comment : ···
"""
+# from .ICON import Icon
+# from .chat import chat
+from app.Ui import mainview
# 文件__init__.py
# from login import login
-from . import mainwindow
-from .ICON import Icon
-from .MyComponents import *
-from .decrypt import decrypt
+from app.Ui.decrypt import decrypt
-__all__ = ["decrypt", 'mainview', 'contact', 'ICON']
+__all__ = ["decrypt", 'mainview', 'chat']
diff --git a/app/Ui/chat/chat.py b/app/Ui/chat/chat.py
index 7b1f2f8..6bb6a01 100644
--- a/app/Ui/chat/chat.py
+++ b/app/Ui/chat/chat.py
@@ -17,7 +17,6 @@ from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from app.Ui.MyComponents.Button_Contact import ContactUi
-from app.person import Me
from .chatUi import *
from ...DataBase import data
from ...ImageBox.ui import MainDemo
@@ -29,7 +28,7 @@ class ChatController(QWidget, Ui_Form):
# username = ''
- def __init__(self, me: Me, parent=None):
+ def __init__(self, me, parent=None):
super(ChatController, self).__init__(parent)
self.chatroomFlag = None
self.ta_avatar = None
diff --git a/app/Ui/contact/contact.py b/app/Ui/contact/contact.py
index df62d7e..99556b7 100644
--- a/app/Ui/contact/contact.py
+++ b/app/Ui/contact/contact.py
@@ -9,14 +9,15 @@
"""
from typing import Dict
+from PyQt5 import QtCore
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
import app.Ui.MyComponents.Button_Contact as MyLabel
-from .contactInfo import ContactInfo
-from .contactUi import *
-from ... import person
-from ...DataBase import data
+from app import person
+from app.DataBase import data
+from app.Ui.contact.contactInfo import ContactInfo
+from app.Ui.contact.contactUi import Ui_Dialog
EMOTION = 1
ANALYSIS = 2
diff --git a/app/Ui/contact/contactInfo.py b/app/Ui/contact/contactInfo.py
index 340d621..b921c40 100644
--- a/app/Ui/contact/contactInfo.py
+++ b/app/Ui/contact/contactInfo.py
@@ -2,14 +2,13 @@ from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
+from app import person
from app.DataBase import output
-from app.person import Contact
+from app.Ui.Icon import Icon
from .analysis import analysis
from .contactInfoUi import Ui_Form
from .emotion import emotion
from .userinfo import userinfo
-from .. import Icon
-from ... import person
class ContactInfo(QWidget, Ui_Form):
@@ -20,7 +19,7 @@ class ContactInfo(QWidget, Ui_Form):
def __init__(self, wxid, me: person.Me, parent=None):
super(ContactInfo, self).__init__(parent)
self.setupUi(self)
- self.contact = Contact(wxid)
+ self.contact = person.Contact(wxid)
self.view_userinfo = userinfo.UserinfoController(self.contact)
self.view_analysis = analysis.AnalysisController(wxid)
self.view_emotion = emotion.EmotionController(wxid)
diff --git a/app/Ui/contact/userinfo/userinfo.py b/app/Ui/contact/userinfo/userinfo.py
index 10c6237..5bc3656 100644
--- a/app/Ui/contact/userinfo/userinfo.py
+++ b/app/Ui/contact/userinfo/userinfo.py
@@ -1,11 +1,10 @@
from PyQt5.QtWidgets import *
-from app.person import Contact
from .userinfoUi import Ui_Frame
class UserinfoController(QWidget, Ui_Frame):
- def __init__(self, contact: Contact, parent=None):
+ def __init__(self, contact, parent=None):
super().__init__(parent)
self.setupUi(self)
self.l_remark.setText(contact.conRemark)
diff --git a/app/Ui/mainview.py b/app/Ui/mainview.py
index 5aa9ce9..2987bd2 100644
--- a/app/Ui/mainview.py
+++ b/app/Ui/mainview.py
@@ -12,11 +12,12 @@ from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
-from app.DataBase import data
-from . import mainwindow
-from .ICON import Icon
-from .chat import chat
-from .contact import contact
+from app import person
+from app.DataBase import *
+from app.Ui import mainwindow
+from app.Ui.Icon import Icon
+from app.Ui.chat import chat
+from app.Ui.contact import contact
class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
@@ -26,8 +27,8 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
def __init__(self, username, parent=None):
super(MainWinController, self).__init__(parent)
self.setupUi(self)
- self.setWindowIcon(Icon.MainWindow)
- self.Me = data.get_myinfo()
+ self.setWindowIcon(Icon.MainWindow_Icon)
+ self.Me = person.Me(data.get_myinfo())
self.setAttribute(Qt.WA_AttributeCount)
self.chatView = chat.ChatController(self.Me, parent=None)
diff --git a/app/__init__.py b/app/__init__.py
index 06b23c9..2def13e 100644
--- a/app/__init__.py
+++ b/app/__init__.py
@@ -7,35 +7,3 @@
@Version : Python3.10
@comment : ···
"""
-Type = {
- '1': '文字',
- '3': '图片',
- '43': '视频',
- '-1879048185': '微信运动排行榜',
- '5': '',
- '47': '表情包',
- '268445456': '撤回的消息',
- '34': '语音',
- '419430449': '转账',
- '50': '语音电话',
- '100001': '领取红包',
- '10000': '消息已发出,但被对方拒收了。',
- '822083633': '回复消息',
- '922746929': '拍一拍',
- '1090519089': '发送文件',
- '318767153': '付款成功',
- '436207665': '发红包',
-}
-'''
-wxid_ewi8gfgpp0eu22:
-
-
-
-
-
-'''
-'''
-
-'''
diff --git a/app/person.py b/app/person.py
index caa951e..68f8e5c 100644
--- a/app/person.py
+++ b/app/person.py
@@ -2,8 +2,10 @@ import os.path
from PyQt5.QtGui import QPixmap
-import app.DataBase.data as data
-from app.Ui.ICON import Icon
+from app.DataBase import data
+
+
+# from app.Ui.Icon import Icon
class Person:
@@ -15,7 +17,8 @@ class Person:
if os.path.exists(self.avatar_path):
self.avatar = QPixmap(self.avatar_path).scaled(60, 60)
else:
- self.avatar_path = Icon.Default_avatar_path
+ self.avatar_path = './app/data/icons/default_avatar.svg'
+ # self.avatar_path = Icon.Default_avatar_path
self.avatar = QPixmap(self.avatar_path).scaled(60, 60)
diff --git a/main.py b/main.py
index 3b48bdd..126e4e0 100644
--- a/main.py
+++ b/main.py
@@ -1,10 +1,13 @@
+import ctypes
import sys
import time
from PyQt5.QtWidgets import *
import app.DataBase.data as DB
-from app.Ui import *
+from app.Ui import decrypt, mainview
+
+ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID("WeChatReport")
class ViewController:
diff --git a/main.spec b/main.spec
index 4dd8cd8..af2513a 100644
--- a/main.spec
+++ b/main.spec
@@ -4,13 +4,16 @@ add_files = [
("D:\\Project\\Python\\WeChatMsg\\app\\data\\icon.png",'.\\app\\data'),
("D:\\Project\\Python\\WeChatMsg\\app\\data\\stopwords.txt",'.\\app\\data'),
("D:\\Project\\Python\\WeChatMsg\\app\\data\\bg.gif",'.\\app\\data'),
+ ("D:\\Project\\Python\\WeChatMsg\\app\\data\\icons",'.\\app\\data\\icons'),
("D:\\Project\\Python\\WeChatMsg\\app\\ImageBox",'.\\app\\ImageBox'),
("D:\\Project\\Python\\WeChatMsg\\app\\DataBase",'.\\app\\DataBase'),
#("D:\\Project\\Python\\WeChatMsg\\app\\Ui",'.\\app\\Ui'),
("D:\\Project\\Python\\WeChatMsg\\sqlcipher-3.0.1",'.\\sqlcipher-3.0.1'),
('.\\resource\\datasets', 'pyecharts\\datasets\\.'),
('.\\resource\\render\\templates', 'pyecharts\\render\\templates\\.'),
- ('.\\data\\AnnualReport', 'data\\AnnualReport')
+ ('.\\data\\AnnualReport', 'data\\AnnualReport'),
+ ("D:\\Program Files\\Python310\\Lib\\site-packages\\snownlp",'snownlp')
+
]
block_cipher = None
@@ -23,12 +26,14 @@ a = Analysis(
'./app/Ui/__init__.py',
'./app/Ui/chat/chat.py','./app/Ui/chat/chatUi.py',
'./app/Ui/contact/contact.py','./app/Ui/contact/contactUi.py','./app/Ui/contact/analysis/analysis.py','./app/Ui/contact/analysis/charts.py','./app/Ui/contact/report/report.py',
- './app/Ui/contact/userinfo/userinfoUi.py',
+ './app/Ui/contact/emotion/emotion.py','./app/Ui/contact/emotion/emotionUi.py',
+ './app/Ui/contact/contactInfo.py','./app/Ui/contact/contactInfoUi.py',
+ './app/Ui/contact/userinfo/userinfoUi.py','./app/Ui/contact/userinfo/userinfo.py',
'./app/Ui/decrypt/decrypt.py','./app/Ui/decrypt/decryptUi.py',
'./app/Ui/userinfo/userinfo.py','./app/Ui/userinfo/userinfoUi.py',
'./app/person.py',
'./app/Ui/ICON.py',
- './app/Ui/MyComponents/Contact.py'
+ './app/Ui/MyComponents/Button_Contact.py'
],
pathex=[],
binaries=[],