修改导入路径,方便打包成exe

This commit is contained in:
shuaikangzhou 2023-11-08 00:13:12 +08:00
parent bb692bbec1
commit 576981e7b2
16 changed files with 82 additions and 90 deletions

View File

@ -4,10 +4,23 @@
<option name="autoReloadType" value="SELECTIVE" /> <option name="autoReloadType" value="SELECTIVE" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="84e65474-7da9-466d-baf3-cc88dde3ffdd" name="变更" comment="修改部分UI"> <list default="true" id="84e65474-7da9-466d-baf3-cc88dde3ffdd" name="变更" comment="加快打开速度">
<change afterPath="$PROJECT_DIR$/app/DataBase/database.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/DataBase/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/DataBase/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/DataBase/data.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/DataBase/data.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/DataBase/output.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/DataBase/output.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Ui/ICON.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/Icon.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Ui/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Ui/chat/chat.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/chat/chat.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Ui/contact/contact.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/contact/contact.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/app/Ui/contact/contact.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/contact/contact.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Ui/contact/contactInfo.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/contact/contactInfo.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Ui/contact/userinfo/userinfo.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/contact/userinfo/userinfo.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Ui/mainview.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/mainview.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/person.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/person.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.spec" beforeDir="false" afterPath="$PROJECT_DIR$/main.spec" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -509,7 +522,14 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1699275644642</updated> <updated>1699275644642</updated>
</task> </task>
<option name="localTasksCounter" value="45" /> <task id="LOCAL-00045" summary="加快打开速度">
<created>1699367814847</created>
<option name="number" value="00045" />
<option name="presentableId" value="LOCAL-00045" />
<option name="project" value="LOCAL" />
<updated>1699367814847</updated>
</task>
<option name="localTasksCounter" value="46" />
<servers /> <servers />
</component> </component>
<component name="UnknownFeatures"> <component name="UnknownFeatures">
@ -545,7 +565,6 @@
</option> </option>
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value="update" />
<MESSAGE value="update1" /> <MESSAGE value="update1" />
<MESSAGE value="导出word文档" /> <MESSAGE value="导出word文档" />
<MESSAGE value="聊天统计" /> <MESSAGE value="聊天统计" />
@ -570,7 +589,8 @@
<MESSAGE value="用stackWidget重写contactUI" /> <MESSAGE value="用stackWidget重写contactUI" />
<MESSAGE value="修改联系人视图架构" /> <MESSAGE value="修改联系人视图架构" />
<MESSAGE value="修改部分UI" /> <MESSAGE value="修改部分UI" />
<option name="LAST_COMMIT_MESSAGE" value="修改部分UI" /> <MESSAGE value="加快打开速度" />
<option name="LAST_COMMIT_MESSAGE" value="加快打开速度" />
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="true" /> <option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="true" />
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="true" /> <option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="true" />
</component> </component>
@ -584,7 +604,7 @@
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line"> <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/main.py</url> <url>file://$PROJECT_DIR$/main.py</url>
<line>19</line> <line>23</line>
<option name="timeStamp" value="8" /> <option name="timeStamp" value="8" />
</line-breakpoint> </line-breakpoint>
</breakpoints> </breakpoints>

View File

@ -7,3 +7,7 @@
@Version : Python3.10 @Version : Python3.10
@comment : ··· @comment : ···
""" """
from . import data
from . import output
__all__ = ["data", 'output']

View File

@ -15,8 +15,6 @@ import time
import requests import requests
from app import person
DB = None DB = None
cursor = None cursor = None
lock = threading.Lock() lock = threading.Lock()
@ -82,16 +80,6 @@ if os.path.exists('./Msg.db'):
cursor = DB.cursor() 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: def is_db_exist() -> bool:
""" """
判断数据库是否正常使用 判断数据库是否正常使用
@ -103,8 +91,10 @@ def is_db_exist() -> bool:
sql = 'select * from userinfo where id=2' sql = 'select * from userinfo where id=2'
cursor.execute(sql) cursor.execute(sql)
result = cursor.fetchone() result = cursor.fetchone()
me = Me(result[2]) if result[2]:
return True return True
else:
return False
except Exception as e: except Exception as e:
return False return False
return False return False
@ -155,8 +145,7 @@ def get_myinfo():
sql = 'select * from userinfo where id=2' sql = 'select * from userinfo where id=2'
cursor.execute(sql) cursor.execute(sql)
result = cursor.fetchone() result = cursor.fetchone()
me = person.Me(result[2]) return result[2]
return me
def get_contacts(): def get_contacts():

1
app/DataBase/database.py Normal file
View File

@ -0,0 +1 @@

View File

@ -12,8 +12,8 @@ from docx.enum.table import WD_ALIGN_VERTICAL
from docx.enum.text import WD_COLOR_INDEX, WD_PARAGRAPH_ALIGNMENT from docx.enum.text import WD_COLOR_INDEX, WD_PARAGRAPH_ALIGNMENT
from docxcompose.composer import Composer from docxcompose.composer import Composer
from app.person import Me from app import person
from . import data from app.DataBase import data
# import data # import data
@ -53,7 +53,7 @@ class Output(QThread):
DOCX = 1 DOCX = 1
HTML = 2 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) super().__init__(parent)
self.Me = Me self.Me = Me
self.sec = 2 # 默认1000秒 self.sec = 2 # 默认1000秒
@ -151,7 +151,7 @@ class ChildThread(QThread):
DOCX = 1 DOCX = 1
HTML = 2 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) super().__init__(parent)
self.Me = Me self.Me = Me
self.sec = 2 # 默认1000秒 self.sec = 2 # 默认1000秒
@ -444,6 +444,6 @@ class ChildThread(QThread):
if __name__ == '__main__': if __name__ == '__main__':
# wxid_0o18ef858vnu22 # wxid_0o18ef858vnu22
# wxid_fdkbu92el15h22 # 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 = Output(Me=me, ta_u='wxid_0o18ef858vnu22', type_=Output.CSV)
t.run() t.run()

View File

@ -3,7 +3,7 @@ from PyQt5.QtGui import QIcon
class Icon: class Icon:
Default_avatar_path = './app/data/icons/default_avatar.svg' 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) Default_avatar = QIcon(Default_avatar_path)
Output = QIcon('./app/data/icons/output.svg') Output = QIcon('./app/data/icons/output.svg')
Back = QIcon('./app/data/icons/back.svg') Back = QIcon('./app/data/icons/back.svg')

View File

@ -7,11 +7,11 @@
@Version : Python3.10 @Version : Python3.10
@comment : ··· @comment : ···
""" """
# from .ICON import Icon
# from .chat import chat
from app.Ui import mainview
# 文件__init__.py # 文件__init__.py
# from login import login # from login import login
from . import mainwindow from app.Ui.decrypt import decrypt
from .ICON import Icon
from .MyComponents import *
from .decrypt import decrypt
__all__ = ["decrypt", 'mainview', 'contact', 'ICON'] __all__ = ["decrypt", 'mainview', 'chat']

View File

@ -17,7 +17,6 @@ from PyQt5.QtGui import *
from PyQt5.QtWidgets import * from PyQt5.QtWidgets import *
from app.Ui.MyComponents.Button_Contact import ContactUi from app.Ui.MyComponents.Button_Contact import ContactUi
from app.person import Me
from .chatUi import * from .chatUi import *
from ...DataBase import data from ...DataBase import data
from ...ImageBox.ui import MainDemo from ...ImageBox.ui import MainDemo
@ -29,7 +28,7 @@ class ChatController(QWidget, Ui_Form):
# username = '' # username = ''
def __init__(self, me: Me, parent=None): def __init__(self, me, parent=None):
super(ChatController, self).__init__(parent) super(ChatController, self).__init__(parent)
self.chatroomFlag = None self.chatroomFlag = None
self.ta_avatar = None self.ta_avatar = None

View File

@ -9,14 +9,15 @@
""" """
from typing import Dict from typing import Dict
from PyQt5 import QtCore
from PyQt5.QtCore import * from PyQt5.QtCore import *
from PyQt5.QtWidgets import * from PyQt5.QtWidgets import *
import app.Ui.MyComponents.Button_Contact as MyLabel import app.Ui.MyComponents.Button_Contact as MyLabel
from .contactInfo import ContactInfo from app import person
from .contactUi import * from app.DataBase import data
from ... import person from app.Ui.contact.contactInfo import ContactInfo
from ...DataBase import data from app.Ui.contact.contactUi import Ui_Dialog
EMOTION = 1 EMOTION = 1
ANALYSIS = 2 ANALYSIS = 2

View File

@ -2,14 +2,13 @@ from PyQt5.QtCore import *
from PyQt5.QtGui import * from PyQt5.QtGui import *
from PyQt5.QtWidgets import * from PyQt5.QtWidgets import *
from app import person
from app.DataBase import output from app.DataBase import output
from app.person import Contact from app.Ui.Icon import Icon
from .analysis import analysis from .analysis import analysis
from .contactInfoUi import Ui_Form from .contactInfoUi import Ui_Form
from .emotion import emotion from .emotion import emotion
from .userinfo import userinfo from .userinfo import userinfo
from .. import Icon
from ... import person
class ContactInfo(QWidget, Ui_Form): class ContactInfo(QWidget, Ui_Form):
@ -20,7 +19,7 @@ class ContactInfo(QWidget, Ui_Form):
def __init__(self, wxid, me: person.Me, parent=None): def __init__(self, wxid, me: person.Me, parent=None):
super(ContactInfo, self).__init__(parent) super(ContactInfo, self).__init__(parent)
self.setupUi(self) self.setupUi(self)
self.contact = Contact(wxid) self.contact = person.Contact(wxid)
self.view_userinfo = userinfo.UserinfoController(self.contact) self.view_userinfo = userinfo.UserinfoController(self.contact)
self.view_analysis = analysis.AnalysisController(wxid) self.view_analysis = analysis.AnalysisController(wxid)
self.view_emotion = emotion.EmotionController(wxid) self.view_emotion = emotion.EmotionController(wxid)

View File

@ -1,11 +1,10 @@
from PyQt5.QtWidgets import * from PyQt5.QtWidgets import *
from app.person import Contact
from .userinfoUi import Ui_Frame from .userinfoUi import Ui_Frame
class UserinfoController(QWidget, Ui_Frame): class UserinfoController(QWidget, Ui_Frame):
def __init__(self, contact: Contact, parent=None): def __init__(self, contact, parent=None):
super().__init__(parent) super().__init__(parent)
self.setupUi(self) self.setupUi(self)
self.l_remark.setText(contact.conRemark) self.l_remark.setText(contact.conRemark)

View File

@ -12,11 +12,12 @@ from PyQt5.QtCore import *
from PyQt5.QtGui import * from PyQt5.QtGui import *
from PyQt5.QtWidgets import * from PyQt5.QtWidgets import *
from app.DataBase import data from app import person
from . import mainwindow from app.DataBase import *
from .ICON import Icon from app.Ui import mainwindow
from .chat import chat from app.Ui.Icon import Icon
from .contact import contact from app.Ui.chat import chat
from app.Ui.contact import contact
class MainWinController(QMainWindow, mainwindow.Ui_MainWindow): class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
@ -26,8 +27,8 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
def __init__(self, username, parent=None): def __init__(self, username, parent=None):
super(MainWinController, self).__init__(parent) super(MainWinController, self).__init__(parent)
self.setupUi(self) self.setupUi(self)
self.setWindowIcon(Icon.MainWindow) self.setWindowIcon(Icon.MainWindow_Icon)
self.Me = data.get_myinfo() self.Me = person.Me(data.get_myinfo())
self.setAttribute(Qt.WA_AttributeCount) self.setAttribute(Qt.WA_AttributeCount)
self.chatView = chat.ChatController(self.Me, parent=None) self.chatView = chat.ChatController(self.Me, parent=None)

View File

@ -7,35 +7,3 @@
@Version : Python3.10 @Version : Python3.10
@comment : ··· @comment : ···
""" """
Type = {
'1': '文字',
'3': '图片',
'43': '视频',
'-1879048185': '微信运动排行榜',
'5': '',
'47': '表情包',
'268445456': '撤回的消息',
'34': '语音',
'419430449': '转账',
'50': '语音电话',
'100001': '领取红包',
'10000': '消息已发出,但被对方拒收了。',
'822083633': '回复消息',
'922746929': '拍一拍',
'1090519089': '发送文件',
'318767153': '付款成功',
'436207665': '发红包',
}
'''
wxid_ewi8gfgpp0eu22:
<?xml version="1.0"?>
<msg>
<videomsg aeskey="83df0143b64616922a12ba14635d572b"
cdnvideourl="3057020100044b30490201000204828e296a02034c53d9020425cc6ddf020463a93395042465653734303464352d636431642d346234322d383434632d3938623138316365646263360204010400040201000405004c53d900" cdnthumbaeskey="83df0143b64616922a12ba14635d572b"
cdnthumburl="3057020100044b30490201000204828e296a02034c53d9020425cc6ddf020463a93395042465653734303464352d636431642d346234322d383434632d3938623138316365646263360204010400040201000405004c53d900" length="100104377" playlength="603" cdnthumblength="13085" cdnthumbwidth="306" cdnthumbheight="540" fromusername="wxid_ewi8gfgpp0eu22" md5="f337bdc19fc2ce00a36660487792975d" newmd5="166392b4f9445f4772922a48e4762c6d" isplaceholder="0" rawmd5="" rawlength="0" cdnrawvideourl="" cdnrawvideoaeskey="" overwritenewmsgid="0" isad="0" />
</msg>
'''
'''
<template><![CDATA["${wxid_ip8kl703gar522}${fromusername@textstatusicon}" 拍了拍 "${wxid_i6zgnagsvrsk22}${pattedusername@textstatusicon}" 并请她喝奶茶]]></template>
'''

View File

@ -2,8 +2,10 @@ import os.path
from PyQt5.QtGui import QPixmap from PyQt5.QtGui import QPixmap
import app.DataBase.data as data from app.DataBase import data
from app.Ui.ICON import Icon
# from app.Ui.Icon import Icon
class Person: class Person:
@ -15,7 +17,8 @@ class Person:
if os.path.exists(self.avatar_path): if os.path.exists(self.avatar_path):
self.avatar = QPixmap(self.avatar_path).scaled(60, 60) self.avatar = QPixmap(self.avatar_path).scaled(60, 60)
else: 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) self.avatar = QPixmap(self.avatar_path).scaled(60, 60)

View File

@ -1,10 +1,13 @@
import ctypes
import sys import sys
import time import time
from PyQt5.QtWidgets import * from PyQt5.QtWidgets import *
import app.DataBase.data as DB import app.DataBase.data as DB
from app.Ui import * from app.Ui import decrypt, mainview
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID("WeChatReport")
class ViewController: class ViewController:

View File

@ -4,13 +4,16 @@ add_files = [
("D:\\Project\\Python\\WeChatMsg\\app\\data\\icon.png",'.\\app\\data'), ("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\\stopwords.txt",'.\\app\\data'),
("D:\\Project\\Python\\WeChatMsg\\app\\data\\bg.gif",'.\\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\\ImageBox",'.\\app\\ImageBox'),
("D:\\Project\\Python\\WeChatMsg\\app\\DataBase",'.\\app\\DataBase'), ("D:\\Project\\Python\\WeChatMsg\\app\\DataBase",'.\\app\\DataBase'),
#("D:\\Project\\Python\\WeChatMsg\\app\\Ui",'.\\app\\Ui'), #("D:\\Project\\Python\\WeChatMsg\\app\\Ui",'.\\app\\Ui'),
("D:\\Project\\Python\\WeChatMsg\\sqlcipher-3.0.1",'.\\sqlcipher-3.0.1'), ("D:\\Project\\Python\\WeChatMsg\\sqlcipher-3.0.1",'.\\sqlcipher-3.0.1'),
('.\\resource\\datasets', 'pyecharts\\datasets\\.'), ('.\\resource\\datasets', 'pyecharts\\datasets\\.'),
('.\\resource\\render\\templates', 'pyecharts\\render\\templates\\.'), ('.\\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 block_cipher = None
@ -23,12 +26,14 @@ a = Analysis(
'./app/Ui/__init__.py', './app/Ui/__init__.py',
'./app/Ui/chat/chat.py','./app/Ui/chat/chatUi.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/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/decrypt/decrypt.py','./app/Ui/decrypt/decryptUi.py',
'./app/Ui/userinfo/userinfo.py','./app/Ui/userinfo/userinfoUi.py', './app/Ui/userinfo/userinfo.py','./app/Ui/userinfo/userinfoUi.py',
'./app/person.py', './app/person.py',
'./app/Ui/ICON.py', './app/Ui/ICON.py',
'./app/Ui/MyComponents/Contact.py' './app/Ui/MyComponents/Button_Contact.py'
], ],
pathex=[], pathex=[],
binaries=[], binaries=[],