mirror of
https://github.com/LC044/WeChatMsg
synced 2024-11-09 09:31:18 +08:00
Initial commit
This commit is contained in:
commit
06fca04187
6
.idea/inspectionProfiles/profiles_settings.xml
Normal file
6
.idea/inspectionProfiles/profiles_settings.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
4
.idea/misc.xml
Normal file
4
.idea/misc.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10" project-jdk-type="Python SDK" />
|
||||
</project>
|
6
.idea/vcs.xml
Normal file
6
.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
94
TEST.py
Normal file
94
TEST.py
Normal file
@ -0,0 +1,94 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Created on Sat May 9 17:14:37 2020
|
||||
|
||||
@author: Giyn
|
||||
"""
|
||||
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QTextBrowser, QVBoxLayout, QHBoxLayout, QMessageBox
|
||||
from PyQt5.QtGui import QIcon
|
||||
|
||||
|
||||
class Simple_Window(QWidget):
|
||||
def __init__(self):
|
||||
super(Simple_Window, self).__init__() # 使用super函数可以实现子类使用父类的方法
|
||||
self.setWindowTitle("记事本")
|
||||
self.setWindowIcon(QIcon('NoteBook.png')) # 设置窗口图标
|
||||
self.resize(412, 412)
|
||||
self.text_browser = QTextBrowser(self) # 实例化一个QTextBrowser对象
|
||||
# self.text_browser.setText("<h1>Hello World!</h1>") # 设置编辑框初始化时显示的文本
|
||||
# self.text_browser.setReadOnly(False) # 调用setReadOnly方法并传入False参数即可编辑文本浏览框(编辑框也可以变成只读)
|
||||
|
||||
self.save_button = QPushButton("Save", self)
|
||||
self.clear_button = QPushButton("Clear", self)
|
||||
self.add_button = QPushButton("Add", self)
|
||||
|
||||
self.save_button.clicked.connect(lambda: self.button_slot(self.save_button))
|
||||
self.clear_button.clicked.connect(lambda: self.button_slot(self.clear_button))
|
||||
self.add_button.clicked.connect(self.add_text)
|
||||
|
||||
self.h_layout = QHBoxLayout()
|
||||
self.v_layout = QVBoxLayout()
|
||||
|
||||
self.h_layout.addWidget(self.save_button)
|
||||
self.h_layout.addWidget(self.clear_button)
|
||||
self.h_layout.addWidget(self.add_button)
|
||||
self.v_layout.addWidget(self.text_browser)
|
||||
self.v_layout.addLayout(self.h_layout)
|
||||
|
||||
self.setLayout(self.v_layout)
|
||||
|
||||
def button_slot(self, button):
|
||||
if button == self.save_button:
|
||||
choice = QMessageBox.question(self, "Question", "Do you want to save it?", QMessageBox.Yes | QMessageBox.No)
|
||||
if choice == QMessageBox.Yes:
|
||||
with open('Second text.txt', 'w') as f:
|
||||
f.write(self.text_browser.toPlainText())
|
||||
self.close()
|
||||
elif choice == QMessageBox.No:
|
||||
self.close()
|
||||
elif button == self.clear_button:
|
||||
self.text_browser.clear()
|
||||
|
||||
def add_text(self):
|
||||
# self.text_browser.append("<h1>Hello World!</h1>") # 调用append方法可以向文本浏览框中添加文本
|
||||
html = """
|
||||
<div class="user-group" style="padding: 6px;
|
||||
display: flex;
|
||||
display: -webkit-flex;
|
||||
justify-content: flex-end;
|
||||
-webkit-justify-content: flex-end;
|
||||
">
|
||||
<div class="user-msg" style="text-align: right;
|
||||
width: 75%;
|
||||
position: relative;">
|
||||
<span class="user-reply" style="display: inline-block;
|
||||
padding: 8px;
|
||||
border-radius: 4px;
|
||||
margin:0 15px 12px;
|
||||
text-align: left;
|
||||
background-color: #9EEA6A;
|
||||
box-shadow: 0px 0px 2px #bbb;
|
||||
">我要抢楼</span>
|
||||
<i style="width: 0;
|
||||
height: 0;
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
display: inline-block;
|
||||
border-top: 10px solid transparent;
|
||||
border-bottom: 10px solid transparent;
|
||||
right: 4px;
|
||||
border-left: 12px solid #9EEA6A;"></i>
|
||||
</div>
|
||||
<img class="user-img" src="./app/data/avatar/2a/42/user_2a427a26f96058921da245444ab542f5.png" width="45px" height="45px";/>
|
||||
</div>
|
||||
"""
|
||||
self.text_browser.insertHtml(html)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = QApplication(sys.argv)
|
||||
window = Simple_Window()
|
||||
window.show()
|
||||
sys.exit(app.exec())
|
9
app/DB/__init__.py
Normal file
9
app/DB/__init__.py
Normal file
@ -0,0 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@File : __init__.py
|
||||
@Author : Shuaikang Zhou
|
||||
@Time : 2022/12/25 19:53
|
||||
@IDE : Pycharm
|
||||
@Version : Python3.10
|
||||
@comment : ···
|
||||
"""
|
404
app/DB/data.py
Normal file
404
app/DB/data.py
Normal file
@ -0,0 +1,404 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@File : data.py
|
||||
@Author : Shuaikang Zhou
|
||||
@Time : 2022/12/13 20:59
|
||||
@IDE : Pycharm
|
||||
@Version : Python3.10
|
||||
@comment : ···
|
||||
"""
|
||||
import json
|
||||
import pymysql
|
||||
import random
|
||||
import time
|
||||
import hashlib
|
||||
import datetime
|
||||
import os
|
||||
import shutil
|
||||
f = open('./app/data/config.json','r')
|
||||
config = json.loads(f.read())
|
||||
username = config['username']
|
||||
password = config['password']
|
||||
database = config['database']
|
||||
# 打开数据库连接t
|
||||
db = pymysql.connect(
|
||||
host='localhost',
|
||||
user=username,
|
||||
password=password,
|
||||
database=database,
|
||||
autocommit=True
|
||||
)
|
||||
cursor = db.cursor()
|
||||
|
||||
|
||||
def register(username, password, nickname):
|
||||
"""
|
||||
注册账号
|
||||
:param username: 用户名
|
||||
:param password: 密码
|
||||
:param nickname: 昵称
|
||||
:return:
|
||||
"""
|
||||
try:
|
||||
create = 'insert into users (username,password,createTime) values (%s,%s,%s)'
|
||||
timestamp = float(time.time())
|
||||
dt = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||
cursor.execute(create, [username, password, dt])
|
||||
create = 'insert into userinfo (username,nickname) values (%s,%s)'
|
||||
cursor.execute(create, [username, nickname])
|
||||
db.commit()
|
||||
try:
|
||||
sql = f'''
|
||||
create view msg_view_{username}
|
||||
as
|
||||
select msgId,type,IsSend,createTime,content,talkerId from message
|
||||
where username = %s
|
||||
order by msgId;
|
||||
'''
|
||||
cursor.execute(sql, [username])
|
||||
sql = f'''
|
||||
create view contact_view_{username}
|
||||
as
|
||||
select contactId,conRemark,type,addTime from contact
|
||||
where username = %s;
|
||||
'''
|
||||
cursor.execute(sql, [username])
|
||||
sql = f'''
|
||||
create view group_view_{username}
|
||||
as
|
||||
select g_id,g_name,gu_nickname,gu_type,gu_time from group_users,`group`
|
||||
where gu_uid=%s and group_users.gu_gid=`group`.g_id;
|
||||
'''
|
||||
cursor.execute(sql, [username])
|
||||
db.commit()
|
||||
except pymysql.err.OperationalError:
|
||||
print('视图已经存在')
|
||||
except pymysql.err.IntegrityError:
|
||||
print('用户已存在')
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def login(username, password):
|
||||
select = 'select * from users where username = %s and password = %s'
|
||||
cursor.execute(select, [username, password])
|
||||
result = cursor.fetchall()
|
||||
if result:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def del_user(username):
|
||||
sql = 'delete from users where username = %s'
|
||||
cursor.execute(sql, [username])
|
||||
db.commit()
|
||||
return True
|
||||
|
||||
|
||||
def searchUser(username):
|
||||
select = 'select * from users where username = %s'
|
||||
cursor.execute(select, [username])
|
||||
result = cursor.fetchall()
|
||||
if result:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def add_contact(username, contactId, conRemark, _type=3):
|
||||
send = 'insert into contact (username,conRemark,type,addTime,contactId) values(%s,%s,%s,%s,%s)'
|
||||
dt = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||
select = 'select * from userinfo where username = %s '
|
||||
cursor.execute(select, [username])
|
||||
result = cursor.fetchall()
|
||||
if not result:
|
||||
return False
|
||||
if not conRemark:
|
||||
conRemark = None
|
||||
try:
|
||||
if _type == 3:
|
||||
cursor.execute(send, [username, conRemark, 3, dt, contactId])
|
||||
db.commit()
|
||||
return (contactId, conRemark, 3, dt)
|
||||
except:
|
||||
return False
|
||||
|
||||
|
||||
def get_userinfo(username):
|
||||
sql = 'select * from userinfo where username = %s'
|
||||
cursor.execute(sql, [username])
|
||||
result = cursor.fetchone()
|
||||
return result[0]
|
||||
|
||||
|
||||
def online(username, socket=None):
|
||||
status = random.randint(32010, 52090)
|
||||
sql = 'update userinfo set status = %s where username=%s'
|
||||
cursor.execute(sql, [status, username])
|
||||
db.commit()
|
||||
|
||||
return status
|
||||
|
||||
|
||||
def tell_online(username, socket):
|
||||
if socket:
|
||||
contacts = get_contacts(username)
|
||||
for contact in contacts:
|
||||
contactID = contact[0]
|
||||
status = check_online(contactID)
|
||||
if status != -1:
|
||||
ta_addr = ('localhost', status)
|
||||
send_data = {
|
||||
'type': 'T',
|
||||
'username': username,
|
||||
'content': '在线0000_1'
|
||||
}
|
||||
socket.sendto(json.dumps(send_data).encode('utf-8'), ta_addr)
|
||||
|
||||
|
||||
def offline(username):
|
||||
status = -1
|
||||
sql = 'update userinfo set status = %s where username=%s'
|
||||
cursor.execute(sql, [status, username])
|
||||
db.commit()
|
||||
return status
|
||||
|
||||
|
||||
def check_online(username):
|
||||
db.commit()
|
||||
sql = 'select status from userinfo where username=%s'
|
||||
cursor.execute(sql, [username])
|
||||
db.commit()
|
||||
result = cursor.fetchone()
|
||||
# print(username, '端口号:', result)
|
||||
if result:
|
||||
return result[0]
|
||||
else:
|
||||
return -1
|
||||
|
||||
|
||||
def send_msg(IsSend, msg, ta, me, status=-1, _type=3):
|
||||
if status == -1:
|
||||
return False
|
||||
send = 'insert into message (type,isSend,createTime,content,talkerId,username) values(%s,%s,%s,%s,%s,%s)'
|
||||
dt = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||
if _type == 3:
|
||||
cursor.execute(send, [_type, IsSend, dt, msg, ta, me])
|
||||
db.commit()
|
||||
return 1, _type, IsSend, datetime.datetime.now(), msg, ta
|
||||
|
||||
|
||||
def send_group_msg(gid, msg, talker, IsSend=0, _type=3):
|
||||
send = 'insert into group_message (g_id,gm_type,gm_content,gm_time,gm_talker,gm_isSend) values(%s,%s,%s,%s,%s,%s)'
|
||||
dt = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||
if _type == 3:
|
||||
cursor.execute(send, [gid, _type, msg, dt, talker, IsSend])
|
||||
db.commit()
|
||||
return 1, gid, _type, msg, datetime.datetime.now(), talker, IsSend
|
||||
|
||||
|
||||
def get_group_message(g_id):
|
||||
sql = f'select * from group_message where g_id = %s order by gm_id'
|
||||
cursor.execute(sql, [g_id])
|
||||
result = cursor.fetchall()
|
||||
return result
|
||||
|
||||
|
||||
def avatar_md5(wxid):
|
||||
m = hashlib.md5()
|
||||
# 参数必须是byte类型,否则报Unicode-objects must be encoded before hashing错误
|
||||
m.update(bytes(wxid.encode('utf-8')))
|
||||
return m.hexdigest()
|
||||
|
||||
|
||||
def get_avator(wxid):
|
||||
if wxid == None:
|
||||
return
|
||||
wxid = str(wxid)
|
||||
avatar = avatar_md5(wxid)
|
||||
avatar_path = r"./data/avatar/"
|
||||
path = avatar_path + avatar[:2] + '/' + avatar[2:4]
|
||||
for root, dirs, files in os.walk(path):
|
||||
for file in files:
|
||||
if avatar in file:
|
||||
avatar = file
|
||||
break
|
||||
return path + '/' + avatar
|
||||
|
||||
|
||||
def get_contacts(username):
|
||||
sql = f'select * from contact_view_{username} '
|
||||
cursor.execute(sql)
|
||||
result = cursor.fetchall()
|
||||
return result
|
||||
|
||||
|
||||
def get_myinfo(username):
|
||||
sql = 'select * from userinfo where username = %s'
|
||||
cursor.execute(sql, [username])
|
||||
result = cursor.fetchone()
|
||||
return result
|
||||
|
||||
|
||||
def update_userinfo(userinfo):
|
||||
sql = '''
|
||||
update userinfo
|
||||
set
|
||||
nickname=%s,
|
||||
gender=%s,
|
||||
city=%s,
|
||||
province=%s,
|
||||
tel=%s,
|
||||
email=%s,
|
||||
signsture=%s
|
||||
where username=%s
|
||||
'''
|
||||
cursor.execute(sql, userinfo)
|
||||
|
||||
|
||||
def get_nickname(username):
|
||||
sql = 'select nickname from userinfo where username=%s'
|
||||
cursor.execute(sql, [username])
|
||||
result = cursor.fetchone()
|
||||
return result[0]
|
||||
|
||||
|
||||
def update_conRemark(username, contactId, new_conRemark):
|
||||
sql = 'update contact set conRemark=%s where username=%s and contactId=%s'
|
||||
cursor.execute(sql, [new_conRemark, username, contactId])
|
||||
db.commit()
|
||||
return True
|
||||
|
||||
|
||||
def delete_contact(username, contactId):
|
||||
sql = 'delete from contact where username=%s and contactId=%s'
|
||||
cursor.execute(sql, [username, contactId])
|
||||
db.commit()
|
||||
return True
|
||||
|
||||
|
||||
def delete_group(uid, gid):
|
||||
sql = 'delete from group_users where gu_uid=%s and gu_gid=%s'
|
||||
cursor.execute(sql, [uid, gid])
|
||||
db.commit()
|
||||
return True
|
||||
|
||||
|
||||
def get_remark(username, talkerId):
|
||||
sql = f'select conRemark from contact_view_{username} where contactId = %s'
|
||||
cursor.execute(sql, [talkerId])
|
||||
result = cursor.fetchone()
|
||||
return result[0]
|
||||
|
||||
|
||||
def mycopyfile(srcfile, dstpath):
|
||||
# 复制函数
|
||||
"""
|
||||
复制文件
|
||||
:param srcfile: 原路径
|
||||
:param dstpath: 新路径
|
||||
:return:
|
||||
"""
|
||||
# if 1:
|
||||
try:
|
||||
if not os.path.isfile(srcfile):
|
||||
print("%s not exist!" % (srcfile))
|
||||
return
|
||||
else:
|
||||
print(dstpath)
|
||||
if os.path.isfile(dstpath):
|
||||
os.remove(dstpath)
|
||||
fpath, fname = os.path.split(srcfile) # 分离文件名和路径
|
||||
dpath, dname = os.path.split(dstpath)
|
||||
if not os.path.exists(dpath):
|
||||
os.makedirs(dpath) # 创建路径
|
||||
# dstpath = '/'.join(dstpath.split('/')[:-1])+'/'
|
||||
|
||||
# print(dpath,dname)
|
||||
shutil.copy(srcfile, dpath) # 复制文件
|
||||
os.rename(dpath + '/' + fname, dstpath)
|
||||
# print ("copy %s -> %s"%(srcfile, dstpath + fname))
|
||||
except:
|
||||
print('文件已存在')
|
||||
|
||||
|
||||
def get_message(username, talkerId):
|
||||
sql = f'select * from msg_view_{username} where talkerId = %s order by msgId'
|
||||
cursor.execute(sql, [talkerId])
|
||||
result = cursor.fetchall()
|
||||
return result
|
||||
|
||||
|
||||
def create_group(g_name, g_admin, g_notice=None, g_intro=None):
|
||||
g_id = random.randint(10000, 99999)
|
||||
sql = '''insert into `group` (g_id,g_name,g_admin,g_notice,g_intro,g_time) values (%s, %s, %s, %s, %s, %s);'''
|
||||
dt = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||
param = [g_id, g_name, g_admin, g_notice, g_intro, dt]
|
||||
print(param)
|
||||
cursor.execute(sql, param)
|
||||
sql = '''insert into `group_users` (gu_uid,gu_gid,gu_time,gu_nickname,gu_type) values (%s, %s, %s, %s, %s);'''
|
||||
param = [g_admin, g_id, dt, None, 1]
|
||||
cursor.execute(sql, param)
|
||||
db.commit()
|
||||
return g_id
|
||||
|
||||
|
||||
def add_group(username, g_id, nickname):
|
||||
group = search_group(g_id)
|
||||
if not group:
|
||||
return False
|
||||
if not nickname:
|
||||
nickname = None
|
||||
sql = 'insert into group_users (gu_uid,gu_gid,gu_time,gu_nickname,gu_type) values (%s,%s,%s,%s,%s)'
|
||||
dt = dt = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||
cursor.execute(sql, [username, g_id, dt, nickname, 2])
|
||||
db.commit()
|
||||
return [g_id, dt, nickname, 2]
|
||||
|
||||
|
||||
def search_group(gid):
|
||||
sql = 'select * from `group` where g_id=%s'
|
||||
cursor.execute(sql, [gid])
|
||||
result = cursor.fetchone()
|
||||
return result
|
||||
|
||||
|
||||
def get_groups(username):
|
||||
sql = f'select * from group_view_{username}'
|
||||
cursor.execute(sql)
|
||||
result = cursor.fetchall()
|
||||
return result
|
||||
|
||||
|
||||
def get_group_users(g_id):
|
||||
db.commit()
|
||||
sql = '''
|
||||
select gu_uid,gu_gid,gu_time,gu_nickname,status
|
||||
from group_users,userinfo
|
||||
where gu_gid=%s and
|
||||
gu_uid=userinfo.username
|
||||
'''
|
||||
cursor.execute(sql, [g_id])
|
||||
db.commit()
|
||||
result = cursor.fetchall()
|
||||
return result
|
||||
|
||||
|
||||
# send_msg(3, '你好', '123456')
|
||||
if __name__ == '__main__':
|
||||
# add_contact('2020303457', '周帅康')
|
||||
# contacts = get_contacts('')
|
||||
# print(contacts)
|
||||
# messages = get_message('2020303457', '')
|
||||
# print(messages)
|
||||
# online('2020303457')
|
||||
# status = check_online('2020303457')
|
||||
# print('status:', status)
|
||||
# offline('2020303457')
|
||||
# status = check_online('2020303457')
|
||||
# print('status:', status)
|
||||
# print(get_remark('', 2020303457))
|
||||
# print(get_groups('2020303457'))
|
||||
# # print(create_group("DB实验", '2020303457', g_notice=str(12), g_intro="test"))
|
||||
# print(get_groups(''))
|
||||
# print(get_group_users(61067))
|
||||
print(get_myinfo(''))
|
9
app/DataBase/__init__.py
Normal file
9
app/DataBase/__init__.py
Normal file
@ -0,0 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@File : __init__.py.py
|
||||
@Author : Shuaikang Zhou
|
||||
@Time : 2023/1/5 0:10
|
||||
@IDE : Pycharm
|
||||
@Version : Python3.10
|
||||
@comment : ···
|
||||
"""
|
7
app/DataBase/config.txt
Normal file
7
app/DataBase/config.txt
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
PRAGMA key = '10f35f1';
|
||||
PRAGMA cipher_migrate;
|
||||
ATTACH DATABASE './app/DataBase/Msg.db' AS Msg KEY '';
|
||||
SELECT sqlcipher_export('Msg');
|
||||
DETACH DATABASE Msg;
|
||||
|
197
app/DataBase/data.py
Normal file
197
app/DataBase/data.py
Normal file
@ -0,0 +1,197 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@File : data.py
|
||||
@Author : Shuaikang Zhou
|
||||
@Time : 2023/1/5 0:11
|
||||
@IDE : Pycharm
|
||||
@Version : Python3.10
|
||||
@comment : ···
|
||||
"""
|
||||
import hashlib
|
||||
import os
|
||||
import sqlite3
|
||||
import time
|
||||
|
||||
import requests
|
||||
|
||||
DB = None
|
||||
cursor = None
|
||||
|
||||
|
||||
def mkdir(path):
|
||||
path = path.strip()
|
||||
path = path.rstrip("\\")
|
||||
if os.path.exists(path):
|
||||
return False
|
||||
os.makedirs(path)
|
||||
return True
|
||||
|
||||
|
||||
mkdir(os.path.abspath('.') + '/app/data/emoji')
|
||||
if os.path.exists('./app/DataBase/Msg.db'):
|
||||
DB = sqlite3.connect("./app/DataBase/Msg.db", check_same_thread=False)
|
||||
# '''创建游标'''
|
||||
cursor = DB.cursor()
|
||||
if os.path.exists('./Msg.db'):
|
||||
DB = sqlite3.connect("./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 decrypt(db, key):
|
||||
if not key:
|
||||
print('缺少数据库密钥')
|
||||
return False
|
||||
if not db:
|
||||
print('没有数据库文件')
|
||||
if os.path.exists('./app/DataBase/Msg.db'):
|
||||
print('/app/DataBase/Msg.db 已经存在')
|
||||
return True
|
||||
cmd = '/sqlcipher-3.0.1/bin/sqlcipher-shell32.exe'
|
||||
print(os.path.abspath('.'))
|
||||
param = f"""
|
||||
PRAGMA key = '{key}';
|
||||
PRAGMA cipher_migrate;
|
||||
ATTACH DATABASE './app/DataBase/Msg.db' AS Msg KEY '';
|
||||
SELECT sqlcipher_export('Msg');
|
||||
DETACH DATABASE Msg;
|
||||
"""
|
||||
with open('./app/DataBase/config.txt', 'w') as f:
|
||||
f.write(param)
|
||||
p = os.system(f"{os.path.abspath('.')}{cmd} {db} < ./app/DataBase/config.txt")
|
||||
global DB
|
||||
global cursor
|
||||
DB = sqlite3.connect("./app/DataBase/Msg.db")
|
||||
# '''创建游标'''
|
||||
cursor = DB.cursor()
|
||||
|
||||
|
||||
def get_myinfo():
|
||||
sql = 'select * from userinfo where id=2'
|
||||
cursor.execute(sql)
|
||||
result = cursor.fetchone()
|
||||
me = Me(result[2])
|
||||
return me
|
||||
|
||||
|
||||
def get_contacts():
|
||||
sql = 'select * from rcontact'
|
||||
cursor.execute(sql)
|
||||
result = cursor.fetchall()
|
||||
return result
|
||||
|
||||
|
||||
def get_rconversation():
|
||||
sql = '''
|
||||
select msgCount,username,unReadCount,chatmode,status,isSend,conversationTime,msgType,digest,digestUser,hasTrunc,attrflag
|
||||
from rconversation
|
||||
where chatmode=1 or chatmode=0 and (msgType='1' or msgType='3' or msgType='47')
|
||||
order by msgCount desc
|
||||
'''
|
||||
'''order by conversationTime desc'''
|
||||
cursor.execute(sql)
|
||||
result = cursor.fetchall()
|
||||
return result
|
||||
|
||||
|
||||
def timestamp2str(timestamp):
|
||||
# t2 = 1586102400
|
||||
s_l = time.localtime(timestamp / 1000)
|
||||
ts = time.strftime("%Y/%m/%d", s_l)
|
||||
# print(ts)
|
||||
return ts
|
||||
|
||||
|
||||
def get_conRemark(username):
|
||||
sql = 'select conRemark,nickname from rcontact where username=?'
|
||||
cursor.execute(sql, [username])
|
||||
result = cursor.fetchone()
|
||||
if result[0]:
|
||||
return result[0]
|
||||
else:
|
||||
return result[1]
|
||||
|
||||
|
||||
def avatar_md5(wxid):
|
||||
m = hashlib.md5()
|
||||
# 参数必须是byte类型,否则报Unicode-objects must be encoded before hashing错误
|
||||
m.update(bytes(wxid.encode('utf-8')))
|
||||
return m.hexdigest()
|
||||
|
||||
|
||||
def get_avator(wxid):
|
||||
if wxid == None:
|
||||
return
|
||||
wxid = str(wxid)
|
||||
avatar = avatar_md5(wxid)
|
||||
avatar_path = r"./app/data/avatar/"
|
||||
path = avatar_path + avatar[:2] + '/' + avatar[2:4]
|
||||
for root, dirs, files in os.walk(path):
|
||||
for file in files:
|
||||
if avatar in file:
|
||||
avatar = file
|
||||
break
|
||||
return f'''{path}/{avatar}'''
|
||||
# return f'''{path}/user_{avatar}.png'''
|
||||
|
||||
|
||||
def get_message(wxid, num):
|
||||
sql = '''
|
||||
select * from message
|
||||
where talker = ?
|
||||
order by msgId desc
|
||||
limit ?,100
|
||||
'''
|
||||
cursor.execute(sql, [wxid, num * 100])
|
||||
return cursor.fetchall()
|
||||
|
||||
|
||||
def get_emoji(imgPath):
|
||||
newPath = f"{os.path.abspath('.')}/app/data/emoji/{imgPath}"
|
||||
if os.path.exists(newPath):
|
||||
return newPath
|
||||
else:
|
||||
sql = '''
|
||||
select cdnUrl
|
||||
from EmojiInfo
|
||||
where md5=?
|
||||
'''
|
||||
cursor.execute(sql, [imgPath])
|
||||
result = cursor.fetchone()
|
||||
download_emoji(newPath,result[0])
|
||||
return newPath
|
||||
|
||||
|
||||
def download_emoji(imgPath, url):
|
||||
resp = requests.get(url)
|
||||
with open(imgPath, 'wb') as f:
|
||||
f.write(resp.content)
|
||||
return imgPath
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# rconversation = get_rconversation()
|
||||
# for i in rconversation:
|
||||
# print(i)
|
||||
timestamp2str(1632219794000)
|
||||
conremark = get_conRemark('wxid_q3ozn70pweud22')
|
||||
print(conremark)
|
||||
print(get_avator('wxid_q3ozn70pweud22'))
|
||||
me = get_myinfo()
|
||||
print(me.__dict__)
|
||||
# r = get_message('wxid_78ka0n92rzzj22', 0)
|
||||
# r.reverse()
|
||||
# for i in r:
|
||||
# print(i)
|
||||
# print(len(r), type(r))
|
||||
print(get_emoji('f5f8a6116e177937ca9795c47f10113d'))
|
564
app/DataBase/to_docx.py
Normal file
564
app/DataBase/to_docx.py
Normal file
@ -0,0 +1,564 @@
|
||||
import hashlib
|
||||
import os
|
||||
import re
|
||||
import threading
|
||||
import time
|
||||
import docx
|
||||
import pandas as pd
|
||||
import requests
|
||||
from docx import shared
|
||||
from docx.enum.table import WD_ALIGN_VERTICAL
|
||||
from docx.enum.text import WD_COLOR_INDEX, WD_PARAGRAPH_ALIGNMENT
|
||||
from docxcompose.composer import Composer
|
||||
import rcontact
|
||||
|
||||
import sys
|
||||
from PyQt5.QtGui import QIcon
|
||||
from PyQt5.QtWidgets import *
|
||||
from PyQt5.QtCore import *
|
||||
from PyQt5.QtGui import QPixmap
|
||||
|
||||
path = 'D:\Project\PythonProject\WeChat'
|
||||
# conRemark = '曹雨萱'
|
||||
# self_wxid = rcontact.get_self_wxid()
|
||||
# ta_wxid = rcontact.get_one_wxid(conRemark)
|
||||
|
||||
'''
|
||||
#! 创建emoji目录,存放emoji文件
|
||||
'''
|
||||
|
||||
|
||||
def mkdir(path):
|
||||
path = path.strip()
|
||||
path = path.rstrip("\\")
|
||||
if os.path.exists(path):
|
||||
return False
|
||||
os.makedirs(path)
|
||||
return True
|
||||
|
||||
|
||||
mkdir(path+'/emoji')
|
||||
# mkdir('..//db_tables')
|
||||
'''
|
||||
#! 将wxid使用MD5编码加密
|
||||
#! 加密结果是用户头像路径
|
||||
'''
|
||||
|
||||
|
||||
def avatar_md5(wxid):
|
||||
m = hashlib.md5()
|
||||
# 参数必须是byte类型,否则报Unicode-objects must be encoded before hashing错误
|
||||
m.update(bytes(wxid.encode('utf-8')))
|
||||
return m.hexdigest()
|
||||
|
||||
|
||||
'''
|
||||
#! 获取头像文件完整路径
|
||||
'''
|
||||
|
||||
|
||||
def get_avator(wxid):
|
||||
avatar = avatar_md5(wxid)
|
||||
avatar_path = path + "/avatar/"
|
||||
Path = avatar_path + avatar[:2] + '/' + avatar[2:4]
|
||||
for root, dirs, files in os.walk(path):
|
||||
for file in files:
|
||||
if avatar in file:
|
||||
avatar = file
|
||||
break
|
||||
return Path + '/' + avatar
|
||||
|
||||
def read_csv(conRemark):
|
||||
'''
|
||||
:param conRemark: (str) 要导出的联系人备注名
|
||||
:return: pandas数据
|
||||
'''
|
||||
user_data = pd.read_csv(f'{path}/db_tables/{conRemark}.csv')
|
||||
'''将浮点数转化成字符串类型,否则会舍入影响时间结果'''
|
||||
user_data['createTime'] = user_data['createTime'].astype(str)
|
||||
# print(user_data)
|
||||
return user_data
|
||||
|
||||
|
||||
def download_emoji(content, img_path):
|
||||
'''
|
||||
#! 下载emoji文件
|
||||
#!
|
||||
#!
|
||||
'''
|
||||
# if 1:
|
||||
try:
|
||||
# print(img_path)
|
||||
url = content.split('cdnurl = "')[1].split('"')[0]
|
||||
print(url)
|
||||
url = ':'.join(url.split('*#*'))
|
||||
if 'amp;' in url:
|
||||
url = ''.join(url.split('amp;'))
|
||||
print('emoji downloading!!!')
|
||||
resp = requests.get(url)
|
||||
with open(f'{path}/emoji/{img_path}', 'wb') as f:
|
||||
f.write(resp.content)
|
||||
except Exception:
|
||||
print("emoji download error")
|
||||
|
||||
|
||||
def time_format(timestamp):
|
||||
'''
|
||||
#! 将字符串类型的时间戳转换成日期
|
||||
#! 返回格式化的时间字符串
|
||||
#! %Y-%m-%d %H:%M:%S
|
||||
'''
|
||||
# print(timestamp)
|
||||
# timestamp = timestamp[:-5]
|
||||
timestamp = float(timestamp[:-3] + '.' + timestamp[-3:])
|
||||
# print(timestamp)
|
||||
time_tuple = time.localtime(timestamp)
|
||||
# print(time.strftime("%Y-%m-%d %H:%M:%S", time_tuple))
|
||||
# quit()
|
||||
return time.strftime("%Y-%m-%d %H:%M:%S", time_tuple)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def IS_5_min(last_m, now_m):
|
||||
'''
|
||||
#! 判断两次聊天时间是不是大于五分钟
|
||||
#! 若大于五分钟则显示时间
|
||||
#! 否则不显示
|
||||
'''
|
||||
last_m = last_m[:-5]
|
||||
last_m = float(last_m + '.' + last_m[-5:2])
|
||||
now_m = now_m[:-5]
|
||||
now_m = float(now_m + '.' + now_m[-5:2])
|
||||
'''两次聊天记录时间差,单位是秒'''
|
||||
time_sub = now_m - last_m
|
||||
return time_sub >= 300
|
||||
|
||||
|
||||
def judge_type(Type):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
'''合并word文档到一个文件里'''
|
||||
|
||||
|
||||
def merge_docx(conRemark, n):
|
||||
origin_docx_path = f"{path}/{conRemark}"
|
||||
all_word = os.listdir(origin_docx_path)
|
||||
all_file_path = []
|
||||
for i in range(n):
|
||||
file_name = f"{conRemark}{i}.docx"
|
||||
all_file_path.append(origin_docx_path + '/' + file_name)
|
||||
filename = f"{conRemark}.docx"
|
||||
# print(all_file_path)
|
||||
doc = docx.Document()
|
||||
doc.save(origin_docx_path + '/' + filename)
|
||||
master = docx.Document(origin_docx_path + '/' + filename)
|
||||
middle_new_docx = Composer(master)
|
||||
num = 0
|
||||
for word in all_file_path:
|
||||
word_document = docx.Document(word)
|
||||
word_document.add_page_break()
|
||||
if num != 0:
|
||||
middle_new_docx.append(word_document)
|
||||
num = num + 1
|
||||
middle_new_docx.save(origin_docx_path + '/' + filename)
|
||||
|
||||
|
||||
class MyThread(QThread):
|
||||
signal = pyqtSignal(str)
|
||||
self_text = pyqtSignal(str)
|
||||
ta_text = pyqtSignal(str)
|
||||
bar = pyqtSignal(int)
|
||||
def __init__(self):
|
||||
super(MyThread, self).__init__()
|
||||
self.ta_info = {}
|
||||
self.self_info = {}
|
||||
self.textBrowser = None
|
||||
self.num = 0
|
||||
self.total_num = 1
|
||||
|
||||
def get_avator(self):
|
||||
self.wxid = self.self_info['wxid']
|
||||
self.ta_wxid = self.ta_info['wxid']
|
||||
self.avator = get_avator(self.wxid)
|
||||
print(self.avator)
|
||||
self.ta_avator = get_avator(self.ta_wxid)
|
||||
print(self.ta_avator)
|
||||
# quit()
|
||||
self.img_self = open(self.avator, 'rb')
|
||||
self.img_ta = open(self.ta_avator, 'rb')
|
||||
|
||||
def read_csv(self, conRemark):
|
||||
'''
|
||||
:param conRemark: (str) 要导出的联系人备注名
|
||||
:return: pandas数据
|
||||
'''
|
||||
user_data = pd.read_csv(f'{path}/db_tables/{conRemark}.csv')
|
||||
'''将浮点数转化成字符串类型,否则会舍入影响时间结果'''
|
||||
user_data['createTime'] = user_data['createTime'].astype(str)
|
||||
# print(user_data)
|
||||
self.total_num = len(user_data)
|
||||
return user_data
|
||||
def create_table(self,doc, isSend):
|
||||
'''
|
||||
#! 创建一个1*2表格
|
||||
#! isSend = 1 (0,0)存聊天内容,(0,1)存头像
|
||||
#! isSend = 0 (0,0)存头像,(0,1)存聊天内容
|
||||
#! 返回聊天内容的坐标
|
||||
'''
|
||||
table = doc.add_table(rows=1, cols=2, style='Normal Table')
|
||||
table.cell(0, 1).height = shared.Inches(0.5)
|
||||
table.cell(0, 0).height = shared.Inches(0.5)
|
||||
text_size = 1
|
||||
if isSend:
|
||||
'''表格右对齐'''
|
||||
table.alignment = WD_PARAGRAPH_ALIGNMENT.RIGHT
|
||||
avatar = table.cell(0, 1).paragraphs[0].add_run()
|
||||
'''插入头像,设置头像宽度'''
|
||||
avatar.add_picture(self.img_self, width=shared.Inches(0.5))
|
||||
'''设置单元格宽度跟头像一致'''
|
||||
table.cell(0, 1).width = shared.Inches(0.5)
|
||||
content_cell = table.cell(0, 0)
|
||||
'''聊天内容右对齐'''
|
||||
content_cell.paragraphs[0].paragraph_format.alignment = WD_PARAGRAPH_ALIGNMENT.RIGHT
|
||||
else:
|
||||
avatar = table.cell(0, 0).paragraphs[0].add_run()
|
||||
avatar.add_picture(self.img_ta, width=shared.Inches(0.5))
|
||||
'''设置单元格宽度'''
|
||||
table.cell(0, 0).width = shared.Inches(0.5)
|
||||
content_cell = table.cell(0, 1)
|
||||
'''聊天内容垂直居中对齐'''
|
||||
content_cell.vertical_alignment = WD_ALIGN_VERTICAL.CENTER
|
||||
return content_cell
|
||||
|
||||
def text(self, doc, isSend, message, status):
|
||||
if status == 5:
|
||||
message += '(未发出) '
|
||||
content_cell = self.create_table(doc, isSend)
|
||||
content_cell.paragraphs[0].add_run(message)
|
||||
content_cell.paragraphs[0].font_size = shared.Inches(0.5)
|
||||
self.self_text.emit(message)
|
||||
if isSend:
|
||||
p = content_cell.paragraphs[0]
|
||||
p.paragraph_format.alignment = WD_PARAGRAPH_ALIGNMENT.RIGHT
|
||||
doc.add_paragraph()
|
||||
|
||||
def image(self, doc, isSend, Type, content, imgPath):
|
||||
'''
|
||||
#! 插入聊天图片
|
||||
#! isSend = 1 只有缩略图
|
||||
#! isSend = 0 有原图
|
||||
:param doc:
|
||||
:param isSend:
|
||||
:param Type:
|
||||
:param content:
|
||||
:param imgPath:
|
||||
:return:
|
||||
'''
|
||||
content = self.create_table(doc, isSend)
|
||||
run = content.paragraphs[0].add_run()
|
||||
imgPath = imgPath.split('//th_')[-1]
|
||||
Path = None
|
||||
if Type == 3:
|
||||
Path = f'{path}/image2//{imgPath[:2]}//{imgPath[2:4]}'
|
||||
elif Type == 47:
|
||||
Path = '{path}/emoji'
|
||||
for root, dirs, files in os.walk(Path):
|
||||
for file in files:
|
||||
if isSend:
|
||||
if imgPath + 'hd' in file:
|
||||
imgPath = file
|
||||
try:
|
||||
run.add_picture(f'{Path}/{imgPath}', height=shared.Inches(2))
|
||||
doc.add_paragraph()
|
||||
except Exception:
|
||||
print("Error!image")
|
||||
return
|
||||
elif imgPath in file:
|
||||
imgPath = file
|
||||
break
|
||||
try:
|
||||
run.add_picture(f'{Path}/{imgPath}', height=shared.Inches(2))
|
||||
doc.add_paragraph()
|
||||
except Exception:
|
||||
print("Error!image")
|
||||
|
||||
# run.add_picture(f'{Path}/{imgPath}', height=shared.Inches(2))
|
||||
|
||||
def emoji(self, doc, isSend, content, imgPath):
|
||||
'''
|
||||
#! 添加表情包
|
||||
:param isSend:
|
||||
:param content:
|
||||
:param imgPath:
|
||||
:return:
|
||||
'''
|
||||
if 1:
|
||||
# try:
|
||||
Path = f'{path}/emoji/{imgPath}'
|
||||
is_Exist = os.path.exists(Path)
|
||||
if not is_Exist:
|
||||
'''表情包不存在,则下载表情包到emoji文件夹中'''
|
||||
download_emoji(content, imgPath)
|
||||
self.image(doc, isSend, Type=47, content=content, imgPath=imgPath)
|
||||
# except Exception:
|
||||
# print("can't find emoji!")
|
||||
|
||||
def wx_file(self, doc, isSend, content, status):
|
||||
'''
|
||||
#! 添加微信文件
|
||||
:param isSend:
|
||||
:param content:
|
||||
:param status:
|
||||
:return:
|
||||
'''
|
||||
pattern = re.compile(r"<title>(.*?)<")
|
||||
r = pattern.search(content).group()
|
||||
filename = r.lstrip('<title>').rstrip('<')
|
||||
self.text(doc, isSend, filename, status)
|
||||
|
||||
def retract_message(self,doc, isSend, content, status):
|
||||
'''
|
||||
#! 显示撤回消息
|
||||
:param isSend:
|
||||
:param content:
|
||||
:param status:
|
||||
:return:
|
||||
'''
|
||||
paragraph = doc.add_paragraph(content)
|
||||
paragraph.paragraph_format.alignment = WD_PARAGRAPH_ALIGNMENT.CENTER
|
||||
|
||||
def reply(self, doc, isSend, content, status):
|
||||
'''
|
||||
#! 添加回复信息
|
||||
:param isSend:
|
||||
:param content:
|
||||
:param status:
|
||||
:return:
|
||||
'''
|
||||
pattern1 = re.compile(r"<title>(?P<title>(.*?))</title>")
|
||||
title = pattern1.search(content).groupdict()['title']
|
||||
pattern2 = re.compile(r"<displayname>(?P<displayname>(.*?))</displayname>")
|
||||
displayname = pattern2.search(content).groupdict()['displayname']
|
||||
'''匹配回复的回复'''
|
||||
pattern3 = re.compile(r"\n?title>(?P<content>(.*?))\n?</title>")
|
||||
if not pattern3.search(content):
|
||||
if isSend == 0:
|
||||
'''匹配对方的回复'''
|
||||
pattern3 = re.compile(r"<content>(?P<content>(.*?))</content>")
|
||||
else:
|
||||
'''匹配自己的回复'''
|
||||
pattern3 = re.compile(r"</msgsource>\n?<content>(?P<content>(.*?))\n?</content>")
|
||||
|
||||
'''这部分代码完全可以用if代替'''
|
||||
|
||||
try:
|
||||
'''试错'''
|
||||
text = pattern3.search(content).groupdict()['content']
|
||||
except Exception:
|
||||
try:
|
||||
'''试错'''
|
||||
text = pattern3.search(content).groupdict()['content']
|
||||
except Exception:
|
||||
'''试错'''
|
||||
pattern3 = re.compile(r"\n?<content>(?P<content>(.*?))\n?</content>")
|
||||
'''试错'''
|
||||
if pattern3.search(content):
|
||||
text = pattern3.search(content).groupdict()['content']
|
||||
else:
|
||||
text = '图片'
|
||||
if status == 5:
|
||||
message = '(未发出) ' + ''
|
||||
content_cell = self.create_table(doc, isSend)
|
||||
content_cell.paragraphs[0].add_run(title)
|
||||
content_cell.paragraphs[0].font_size = shared.Inches(0.5)
|
||||
reply_p = content_cell.add_paragraph()
|
||||
run = content_cell.paragraphs[1].add_run(displayname + ':' + text)
|
||||
'''设置被回复内容格式'''
|
||||
run.font.color.rgb = shared.RGBColor(121, 121, 121)
|
||||
run.font_size = shared.Inches(0.3)
|
||||
run.font.highlight_color = WD_COLOR_INDEX.GRAY_25
|
||||
|
||||
if isSend:
|
||||
p = content_cell.paragraphs[0]
|
||||
p.paragraph_format.alignment = WD_PARAGRAPH_ALIGNMENT.RIGHT
|
||||
reply_p.paragraph_format.alignment = WD_PARAGRAPH_ALIGNMENT.RIGHT
|
||||
doc.add_paragraph()
|
||||
|
||||
|
||||
def pat_a_pat(self, doc, isSend, content, status):
|
||||
'''
|
||||
#! 添加拍一拍信息
|
||||
todo 把wxid转化成昵称
|
||||
:param isSend:
|
||||
:param content:
|
||||
:param status:
|
||||
:return:
|
||||
'''
|
||||
'''<template><![CDATA[我${fromusername@textstatusicon}拍了拍自己]]></template>'''
|
||||
pattern = re.compile(r"<template><!\[CDATA\[(?P<it>(.*?))]]></template>")
|
||||
result = pattern.search(content).groupdict()['it']
|
||||
fromusername = '${fromusername@textstatusicon}'
|
||||
pattedusername = '${pattedusername@textstatusicon}'
|
||||
'''我拍别人'''
|
||||
if result[0] == u'我':
|
||||
result = ''.join(result.split(fromusername))
|
||||
result = ''.join(result.split(pattedusername))
|
||||
pat = result
|
||||
else:
|
||||
'''处理多余的引号'''
|
||||
result = result.split('""') if '""' in result else result.split('"')
|
||||
for i in range(len(result)):
|
||||
if fromusername in result[i]:
|
||||
result[i] = result[i].rstrip(fromusername)
|
||||
elif pattedusername in result[i]:
|
||||
result[i] = result[i].rstrip(pattedusername)
|
||||
|
||||
if len(result) >= 4:
|
||||
'''别人拍别人
|
||||
#! ""${s407575157}${fromusername@textstatusicon}"" \
|
||||
#! 拍了拍 \
|
||||
#! ""${wxid_7rs401fwlaje22}${pattedusername@textstatusicon}"" \
|
||||
#! 的豪宅不小心塌了??
|
||||
#! [' ', wxid0, '拍了拍', wxid1, '内容']
|
||||
'''
|
||||
wxid0 = result[1].lstrip('${').rstrip('}') # ! 第一个人的wxid
|
||||
wxid1 = result[3].lstrip('${').rstrip('}') # ! 第二个人的wxid
|
||||
nickname0 = rcontact.wxid_to_conRemark(wxid0) # ! 将wxid转换成昵称
|
||||
nickname1 = rcontact.wxid_to_conRemark(wxid1) # ! 将wxid转换成昵称
|
||||
pat = nickname0 + result[2] + nickname1 # todo 留着把wxid转换成昵称
|
||||
if len(result) == 5:
|
||||
pat += result[4]
|
||||
else:
|
||||
'''#! ""${wxid_8piw6sb4hvfm22}"" 拍了拍我 '''
|
||||
'''
|
||||
#! 别人拍我
|
||||
#! [' ', wxid0, '拍了拍我']
|
||||
'''
|
||||
wxid0 = result[1].lstrip('${').rstrip('}')
|
||||
pat = wxid0 + result[2]
|
||||
print(pat)
|
||||
p = doc.add_paragraph()
|
||||
run = p.add_run(pat)
|
||||
p.paragraph_format.alignment = WD_PARAGRAPH_ALIGNMENT.CENTER
|
||||
'''设置拍一拍文字格式'''
|
||||
run.font.color.rgb = shared.RGBColor(121, 121, 121)
|
||||
run.font_size = shared.Inches(0.3)
|
||||
# run.font.highlight_color=WD_COLOR_INDEX.GRAY_25
|
||||
|
||||
def video(self, doc, isSend, content, status, img_path):
|
||||
print(content, img_path)
|
||||
|
||||
def to_docx(self, user_data, i, conRemark):
|
||||
'''
|
||||
|
||||
:param user_data:
|
||||
:param i:
|
||||
:param conRemark:
|
||||
:return:
|
||||
'''
|
||||
'''创建联系人目录'''
|
||||
mkdir(f"{path}/{conRemark}")
|
||||
filename = f"{path}/{conRemark}/{conRemark}{i}.docx"
|
||||
doc = docx.Document()
|
||||
now_timestamp = '1600008700000.0'
|
||||
for row_index, row in user_data.iterrows():
|
||||
self.num += 1
|
||||
self.bar.emit(int((self.num)/self.total_num*100))
|
||||
Type = row['type']
|
||||
content = row['content']
|
||||
isSend = row['isSend']
|
||||
last_timestamp = now_timestamp
|
||||
now_timestamp = row['createTime']
|
||||
createTime = time_format(now_timestamp)
|
||||
imgPath = row['imgPath']
|
||||
status = row['status']
|
||||
if IS_5_min(last_timestamp, now_timestamp):
|
||||
doc.add_paragraph(createTime).alignment = WD_PARAGRAPH_ALIGNMENT.CENTER
|
||||
if Type == 1:
|
||||
# print('文本信息')
|
||||
# print(createTime, content)
|
||||
# continue
|
||||
self.text(doc, isSend, content, status)
|
||||
elif Type == 3:
|
||||
# print('图片信息')
|
||||
# continue
|
||||
self.image(doc, isSend, 3, content, imgPath)
|
||||
elif Type == 47:
|
||||
# print(content)
|
||||
print(imgPath,content)
|
||||
self.emoji(doc, isSend, content, imgPath)
|
||||
elif Type == 1090519089:
|
||||
self.wx_file(doc, isSend, content, status)
|
||||
elif Type == 268445456:
|
||||
self.retract_message(doc, isSend, content, status)
|
||||
elif Type == 822083633:
|
||||
self.reply(doc, isSend, content, status)
|
||||
elif Type == 922746929:
|
||||
self.pat_a_pat(doc, isSend, content, status)
|
||||
elif Type == 43:
|
||||
# print(createTime)
|
||||
self.video(doc, isSend, content, status, imgPath)
|
||||
# doc.add_paragraph(str(i))
|
||||
# print(filename)
|
||||
doc.save(filename)
|
||||
def run(self):
|
||||
if 1:
|
||||
# try:
|
||||
self.get_avator()
|
||||
conRemark = self.ta_info['conRemark']
|
||||
self.self_text.emit(conRemark)
|
||||
self.self_text.emit(path)
|
||||
user_data = self.read_csv(conRemark)
|
||||
l = len(user_data)
|
||||
n = 50
|
||||
threads = []
|
||||
for i in range(n):
|
||||
q = i * (l // n)
|
||||
p = (i + 1) * (l // n)
|
||||
if i == n - 1:
|
||||
p = l
|
||||
data = user_data[q:p]
|
||||
self.to_docx(data, i, conRemark)
|
||||
# # t = threading.Thread(target=self.to_docx, args=(data, i, conRemark))
|
||||
# # threads.append(t)
|
||||
# # for thr in threads:
|
||||
# # thr.start()
|
||||
# # thr.join()
|
||||
self.self_text.emit('\n\n\n导出进度还差一点点!!!')
|
||||
self.bar.emit(99)
|
||||
merge_docx(conRemark, n)
|
||||
self.self_text.emit(f'{conRemark}聊天记录导出成功!!!')
|
||||
self.bar.emit(100)
|
||||
# except Exception as e:
|
||||
# self.self_text.emit('发生异常')
|
||||
# print(e)
|
||||
#self.self_text.emit(e)
|
||||
if __name__ == '__main__':
|
||||
# # conRemark = '张三' #! 微信备注名
|
||||
# n = 100 # ! 分割的文件个数
|
||||
# main(conRemark, n)
|
||||
# img_self.close()
|
||||
# img_ta.close()
|
||||
t = MyThread()
|
||||
# t.ta_info = {
|
||||
# 'wxid': 'wxid_q3ozn70pweud22',
|
||||
# 'conRemark': '小钱'
|
||||
# }
|
||||
t.ta_info = {
|
||||
'wxid': 'wxid_8piw6sb4hvfm22',
|
||||
'conRemark': '曹雨萱'
|
||||
}
|
||||
#wxid_8piw6sb4hvfm22
|
||||
t.self_info = {
|
||||
'wxid': 'wxid_27hqbq7vx5hf22',
|
||||
'conRemark': 'Shuaikang Zhou'
|
||||
}
|
||||
t.run()
|
15
app/Ui/__init__.py
Normal file
15
app/Ui/__init__.py
Normal file
@ -0,0 +1,15 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@File : __init__.py.py
|
||||
@Author : Shuaikang Zhou
|
||||
@Time : 2022/12/13 14:19
|
||||
@IDE : Pycharm
|
||||
@Version : Python3.10
|
||||
@comment : ···
|
||||
"""
|
||||
#文件__init__.py
|
||||
# from login import login
|
||||
from . import mainview
|
||||
|
||||
from .decrypt import decrypt
|
||||
__all__ = ["decrypt", 'mainview']
|
9
app/Ui/chat/__init__.py
Normal file
9
app/Ui/chat/__init__.py
Normal file
@ -0,0 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@File : __init__.py.py
|
||||
@Author : Shuaikang Zhou
|
||||
@Time : 2022/12/13 20:33
|
||||
@IDE : Pycharm
|
||||
@Version : Python3.10
|
||||
@comment : ···
|
||||
"""
|
9
app/Ui/chat/addContact/__init__.py
Normal file
9
app/Ui/chat/addContact/__init__.py
Normal file
@ -0,0 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@File : __init__.py.py
|
||||
@Author : Shuaikang Zhou
|
||||
@Time : 2022/12/24 10:34
|
||||
@IDE : Pycharm
|
||||
@Version : Python3.10
|
||||
@comment : ···
|
||||
"""
|
89
app/Ui/chat/addContact/addContact.py
Normal file
89
app/Ui/chat/addContact/addContact.py
Normal file
@ -0,0 +1,89 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@File : addContact.py
|
||||
@Author : Shuaikang Zhou
|
||||
@Time : 2022/12/17 14:26
|
||||
@IDE : Pycharm
|
||||
@Version : Python3.10
|
||||
@comment : ···
|
||||
"""
|
||||
from .addContactUi import *
|
||||
from PyQt5.QtGui import *
|
||||
from PyQt5.QtWidgets import *
|
||||
from PyQt5.QtCore import *
|
||||
from ....DB import data
|
||||
import time
|
||||
|
||||
|
||||
class addControl(QWidget, Ui_Dialog):
|
||||
backSignal = pyqtSignal(str)
|
||||
contactSignal = pyqtSignal(tuple)
|
||||
def __init__(self, username,parent=None):
|
||||
super(addControl, self).__init__(parent)
|
||||
self.setupUi(self)
|
||||
self.tips.setVisible(False)
|
||||
self.time.setVisible(False)
|
||||
self.setWindowTitle('添加联系人')
|
||||
self.setWindowIcon(QIcon('./data/icon.png'))
|
||||
self.Username = username
|
||||
# self.register_2.clicked.connect(self.login_)
|
||||
self.back.clicked.connect(self.btnEnterClicked)
|
||||
self.search.clicked.connect(self.search_user)
|
||||
self.add_contact.clicked.connect(self.add_contact_)
|
||||
self.avatar = None
|
||||
|
||||
def search_user(self):
|
||||
username = self.username.text()
|
||||
nickname = self.nickname.text()
|
||||
print(username,nickname)
|
||||
if data.searchUser(username):
|
||||
imgpath = data.get_avator(username)
|
||||
print(imgpath)
|
||||
pixmap = QPixmap(imgpath).scaled(60, 60) # 按指定路径找到图片
|
||||
self.avatar_img.setPixmap(pixmap) # 在label上显示图片
|
||||
else:
|
||||
self.error.setText('用户不存在')
|
||||
|
||||
def add_contact_(self):
|
||||
username = self.username.text()
|
||||
nickname = self.nickname.text()
|
||||
flag = data.add_contact(self.Username,username, nickname)
|
||||
if flag:
|
||||
self.error.setText('添加成功')
|
||||
self.contactSignal.emit(flag)
|
||||
self.thread = MyThread() # 创建一个线程
|
||||
self.thread.sec_changed_signal.connect(self._update) # 线程发过来的信号挂接到槽:update
|
||||
self.thread.start()
|
||||
else:
|
||||
QMessageBox.critical(self, "错误", "用户不存在")
|
||||
|
||||
|
||||
def _update(self, sec):
|
||||
self.time.setProperty("value", float(sec))
|
||||
# self.time.setDigitCount(sec)
|
||||
# self.time.s
|
||||
if sec == 0:
|
||||
self.btnEnterClicked()
|
||||
|
||||
def btnEnterClicked(self):
|
||||
print("退出添加联系人界面")
|
||||
# 中间可以添加处理逻辑
|
||||
self.backSignal.emit("back")
|
||||
self.close()
|
||||
|
||||
def btnExitClicked(self):
|
||||
print("Exit clicked")
|
||||
self.close()
|
||||
|
||||
|
||||
class MyThread(QThread):
|
||||
sec_changed_signal = pyqtSignal(int) # 信号类型:int
|
||||
|
||||
def __init__(self, sec=1000, parent=None):
|
||||
super().__init__(parent)
|
||||
self.sec = 2 # 默认1000秒
|
||||
|
||||
def run(self):
|
||||
for i in range(self.sec, -1, -1):
|
||||
self.sec_changed_signal.emit(i) # 发射信号
|
||||
time.sleep(1)
|
98
app/Ui/chat/addContact/addContactUi.py
Normal file
98
app/Ui/chat/addContact/addContactUi.py
Normal file
@ -0,0 +1,98 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'addContactUi.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.15.7
|
||||
#
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
|
||||
class Ui_Dialog(object):
|
||||
def setupUi(self, Dialog):
|
||||
Dialog.setObjectName("Dialog")
|
||||
Dialog.resize(400, 300)
|
||||
self.label_3 = QtWidgets.QLabel(Dialog)
|
||||
self.label_3.setGeometry(QtCore.QRect(120, 0, 221, 51))
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("一纸情书")
|
||||
font.setPointSize(20)
|
||||
self.label_3.setFont(font)
|
||||
self.label_3.setObjectName("label_3")
|
||||
self.error = QtWidgets.QLabel(Dialog)
|
||||
self.error.setGeometry(QtCore.QRect(300, 70, 101, 16))
|
||||
self.error.setAutoFillBackground(False)
|
||||
self.error.setStyleSheet("color:red")
|
||||
self.error.setText("")
|
||||
self.error.setObjectName("error")
|
||||
self.time = QtWidgets.QLCDNumber(Dialog)
|
||||
self.time.setGeometry(QtCore.QRect(230, 230, 51, 61))
|
||||
self.time.setLineWidth(5)
|
||||
self.time.setDigitCount(1)
|
||||
self.time.setProperty("value", 8.0)
|
||||
self.time.setObjectName("time")
|
||||
self.tips = QtWidgets.QLabel(Dialog)
|
||||
self.tips.setGeometry(QtCore.QRect(140, 250, 61, 16))
|
||||
self.tips.setObjectName("tips")
|
||||
self.toolButton = QtWidgets.QToolButton(Dialog)
|
||||
self.toolButton.setGeometry(QtCore.QRect(360, 0, 47, 21))
|
||||
self.toolButton.setObjectName("toolButton")
|
||||
self.back = QtWidgets.QPushButton(Dialog)
|
||||
self.back.setGeometry(QtCore.QRect(10, 10, 41, 28))
|
||||
self.back.setObjectName("back")
|
||||
self.avatar_img = QtWidgets.QLabel(Dialog)
|
||||
self.avatar_img.setGeometry(QtCore.QRect(310, 130, 80, 80))
|
||||
self.avatar_img.setObjectName("avatar_img")
|
||||
self.layoutWidget = QtWidgets.QWidget(Dialog)
|
||||
self.layoutWidget.setGeometry(QtCore.QRect(71, 63, 227, 155))
|
||||
self.layoutWidget.setObjectName("layoutWidget")
|
||||
self.verticalLayout = QtWidgets.QVBoxLayout(self.layoutWidget)
|
||||
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
|
||||
self.verticalLayout.setObjectName("verticalLayout")
|
||||
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||
self.label_2 = QtWidgets.QLabel(self.layoutWidget)
|
||||
self.label_2.setObjectName("label_2")
|
||||
self.horizontalLayout_2.addWidget(self.label_2)
|
||||
self.username = QtWidgets.QLineEdit(self.layoutWidget)
|
||||
self.username.setObjectName("username")
|
||||
self.horizontalLayout_2.addWidget(self.username)
|
||||
self.verticalLayout.addLayout(self.horizontalLayout_2)
|
||||
self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
|
||||
self.label_4 = QtWidgets.QLabel(self.layoutWidget)
|
||||
self.label_4.setMinimumSize(QtCore.QSize(38, 21))
|
||||
self.label_4.setMaximumSize(QtCore.QSize(38, 21))
|
||||
self.label_4.setObjectName("label_4")
|
||||
self.horizontalLayout_4.addWidget(self.label_4)
|
||||
self.nickname = QtWidgets.QLineEdit(self.layoutWidget)
|
||||
self.nickname.setMinimumSize(QtCore.QSize(0, 0))
|
||||
self.nickname.setMaximumSize(QtCore.QSize(100000, 10000))
|
||||
self.nickname.setObjectName("nickname")
|
||||
self.horizontalLayout_4.addWidget(self.nickname)
|
||||
self.verticalLayout.addLayout(self.horizontalLayout_4)
|
||||
self.search = QtWidgets.QPushButton(self.layoutWidget)
|
||||
self.search.setObjectName("search")
|
||||
self.verticalLayout.addWidget(self.search)
|
||||
self.add_contact = QtWidgets.QPushButton(self.layoutWidget)
|
||||
self.add_contact.setObjectName("add_contact")
|
||||
self.verticalLayout.addWidget(self.add_contact)
|
||||
|
||||
self.retranslateUi(Dialog)
|
||||
QtCore.QMetaObject.connectSlotsByName(Dialog)
|
||||
|
||||
def retranslateUi(self, Dialog):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
|
||||
self.label_3.setText(_translate("Dialog", "添加好友"))
|
||||
self.tips.setText(_translate("Dialog", "即将返回"))
|
||||
self.toolButton.setText(_translate("Dialog", "..."))
|
||||
self.back.setText(_translate("Dialog", "返回"))
|
||||
self.avatar_img.setText(_translate("Dialog", "+"))
|
||||
self.label_2.setText(_translate("Dialog", "账号:"))
|
||||
self.label_4.setText(_translate("Dialog", "备注:"))
|
||||
self.search.setText(_translate("Dialog", "查找"))
|
||||
self.add_contact.setText(_translate("Dialog", "添加联系人"))
|
207
app/Ui/chat/addContact/addContactUi.ui
Normal file
207
app/Ui/chat/addContact/addContactUi.ui
Normal file
@ -0,0 +1,207 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Dialog</class>
|
||||
<widget class="QDialog" name="Dialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>120</x>
|
||||
<y>0</y>
|
||||
<width>221</width>
|
||||
<height>51</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>一纸情书</family>
|
||||
<pointsize>20</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>添加好友</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="error">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>300</x>
|
||||
<y>70</y>
|
||||
<width>101</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">color:red</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLCDNumber" name="time">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>230</x>
|
||||
<y>230</y>
|
||||
<width>51</width>
|
||||
<height>61</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="digitCount">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="value" stdset="0">
|
||||
<double>8.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="tips">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>140</x>
|
||||
<y>250</y>
|
||||
<width>61</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>即将返回</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="toolButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>360</x>
|
||||
<y>0</y>
|
||||
<width>47</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="back">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>41</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>返回</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="avatar_img">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>310</x>
|
||||
<y>130</y>
|
||||
<width>80</width>
|
||||
<height>80</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>+</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>71</x>
|
||||
<y>63</y>
|
||||
<width>227</width>
|
||||
<height>155</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>账号:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="username"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>38</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>38</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>备注:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="nickname">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100000</width>
|
||||
<height>10000</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="search">
|
||||
<property name="text">
|
||||
<string>查找</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="add_contact">
|
||||
<property name="text">
|
||||
<string>添加联系人</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
143
app/Ui/chat/backup/chatUi - 副本.py
Normal file
143
app/Ui/chat/backup/chatUi - 副本.py
Normal file
@ -0,0 +1,143 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'mainviewUi.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.15.7
|
||||
#
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
|
||||
class Ui_Dialog(object):
|
||||
def setupUi(self, Dialog):
|
||||
Dialog.setObjectName("Dialog")
|
||||
Dialog.resize(1280, 720)
|
||||
Dialog.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
|
||||
Dialog.setAutoFillBackground(False)
|
||||
self.sign_up = QtWidgets.QPushButton(Dialog)
|
||||
self.sign_up.setGeometry(QtCore.QRect(680, 10, 93, 28))
|
||||
self.sign_up.setObjectName("sign_up")
|
||||
self.message = QtWidgets.QTextBrowser(Dialog)
|
||||
self.message.setGeometry(QtCore.QRect(480, 50, 780, 520))
|
||||
self.message.setObjectName("message")
|
||||
self.textEdit = QtWidgets.QTextEdit(Dialog)
|
||||
self.textEdit.setGeometry(QtCore.QRect(480, 600, 800, 120))
|
||||
self.textEdit.setObjectName("textEdit")
|
||||
self.toolButton = QtWidgets.QToolButton(Dialog)
|
||||
self.toolButton.setGeometry(QtCore.QRect(1240, 0, 47, 51))
|
||||
self.toolButton.setObjectName("toolButton")
|
||||
self.btn_sendMsg = QtWidgets.QPushButton(Dialog)
|
||||
self.btn_sendMsg.setGeometry(QtCore.QRect(1162, 670, 121, 51))
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("黑体")
|
||||
font.setPointSize(15)
|
||||
font.setBold(False)
|
||||
font.setWeight(50)
|
||||
self.btn_sendMsg.setFont(font)
|
||||
self.btn_sendMsg.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
|
||||
self.btn_sendMsg.setMouseTracking(False)
|
||||
self.btn_sendMsg.setAutoFillBackground(False)
|
||||
self.btn_sendMsg.setStyleSheet("QPushButton {\n"
|
||||
" background-color: #f0f0f0;\n"
|
||||
" \n"
|
||||
" padding: 10px;\n"
|
||||
" color:rgb(5,180,104);\n"
|
||||
"}")
|
||||
self.btn_sendMsg.setIconSize(QtCore.QSize(40, 40))
|
||||
self.btn_sendMsg.setCheckable(False)
|
||||
self.btn_sendMsg.setAutoDefault(True)
|
||||
self.btn_sendMsg.setObjectName("btn_sendMsg")
|
||||
self.line = QtWidgets.QFrame(Dialog)
|
||||
self.line.setGeometry(QtCore.QRect(480, 570, 800, 3))
|
||||
self.line.setFrameShape(QtWidgets.QFrame.HLine)
|
||||
self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||
self.line.setObjectName("line")
|
||||
self.line_2 = QtWidgets.QFrame(Dialog)
|
||||
self.line_2.setGeometry(QtCore.QRect(480, 50, 800, 3))
|
||||
self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
|
||||
self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||
self.line_2.setObjectName("line_2")
|
||||
self.line_3 = QtWidgets.QFrame(Dialog)
|
||||
self.line_3.setGeometry(QtCore.QRect(480, 0, 3, 720))
|
||||
self.line_3.setFrameShape(QtWidgets.QFrame.VLine)
|
||||
self.line_3.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||
self.line_3.setObjectName("line_3")
|
||||
self.verticalScrollBar = QtWidgets.QScrollBar(Dialog)
|
||||
self.verticalScrollBar.setGeometry(QtCore.QRect(460, 50, 16, 671))
|
||||
self.verticalScrollBar.setOrientation(QtCore.Qt.Vertical)
|
||||
self.verticalScrollBar.setObjectName("verticalScrollBar")
|
||||
self.verticalScrollBar_2 = QtWidgets.QScrollBar(Dialog)
|
||||
self.verticalScrollBar_2.setGeometry(QtCore.QRect(1260, 50, 16, 520))
|
||||
self.verticalScrollBar_2.setStyleSheet("background-color: #f0f0f0;")
|
||||
self.verticalScrollBar_2.setOrientation(QtCore.Qt.Vertical)
|
||||
self.verticalScrollBar_2.setObjectName("verticalScrollBar_2")
|
||||
self.pushButton_2 = QtWidgets.QPushButton(Dialog)
|
||||
self.pushButton_2.setGeometry(QtCore.QRect(160, 50, 300, 80))
|
||||
self.pushButton_2.setLayoutDirection(QtCore.Qt.LeftToRight)
|
||||
self.pushButton_2.setAutoFillBackground(False)
|
||||
self.pushButton_2.setText("")
|
||||
self.pushButton_2.setIconSize(QtCore.QSize(80, 80))
|
||||
self.pushButton_2.setObjectName("pushButton_2")
|
||||
self.verticalLayoutWidget = QtWidgets.QWidget(Dialog)
|
||||
self.verticalLayoutWidget.setGeometry(QtCore.QRect(0, 160, 111, 562))
|
||||
self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
|
||||
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.verticalLayoutWidget)
|
||||
self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
|
||||
self.verticalLayout_2.setSpacing(0)
|
||||
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||
self.btn_chat = QtWidgets.QPushButton(self.verticalLayoutWidget)
|
||||
self.btn_chat.setMinimumSize(QtCore.QSize(0, 80))
|
||||
self.btn_chat.setObjectName("btn_chat")
|
||||
self.verticalLayout_2.addWidget(self.btn_chat)
|
||||
self.btn_contact = QtWidgets.QPushButton(self.verticalLayoutWidget)
|
||||
self.btn_contact.setMinimumSize(QtCore.QSize(0, 80))
|
||||
self.btn_contact.setObjectName("btn_contact")
|
||||
self.verticalLayout_2.addWidget(self.btn_contact)
|
||||
self.btn_addC = QtWidgets.QPushButton(self.verticalLayoutWidget)
|
||||
self.btn_addC.setMinimumSize(QtCore.QSize(0, 80))
|
||||
self.btn_addC.setObjectName("btn_addC")
|
||||
self.verticalLayout_2.addWidget(self.btn_addC)
|
||||
self.btn_delC = QtWidgets.QPushButton(self.verticalLayoutWidget)
|
||||
self.btn_delC.setMinimumSize(QtCore.QSize(0, 80))
|
||||
self.btn_delC.setObjectName("btn_delC")
|
||||
self.verticalLayout_2.addWidget(self.btn_delC)
|
||||
self.btn_create_group = QtWidgets.QPushButton(self.verticalLayoutWidget)
|
||||
self.btn_create_group.setMinimumSize(QtCore.QSize(0, 80))
|
||||
self.btn_create_group.setObjectName("btn_create_group")
|
||||
self.verticalLayout_2.addWidget(self.btn_create_group)
|
||||
self.btn_add_group = QtWidgets.QPushButton(self.verticalLayoutWidget)
|
||||
self.btn_add_group.setMinimumSize(QtCore.QSize(0, 80))
|
||||
self.btn_add_group.setObjectName("btn_add_group")
|
||||
self.verticalLayout_2.addWidget(self.btn_add_group)
|
||||
self.pushButton_6 = QtWidgets.QPushButton(self.verticalLayoutWidget)
|
||||
self.pushButton_6.setMinimumSize(QtCore.QSize(100, 80))
|
||||
self.pushButton_6.setObjectName("pushButton_6")
|
||||
self.verticalLayout_2.addWidget(self.pushButton_6)
|
||||
self.verticalLayout_2.setStretch(0, 1)
|
||||
self.verticalLayout_2.setStretch(2, 1)
|
||||
self.verticalLayout_2.setStretch(3, 1)
|
||||
self.verticalLayout_2.setStretch(6, 1)
|
||||
self.myavatar = QtWidgets.QLabel(Dialog)
|
||||
self.myavatar.setGeometry(QtCore.QRect(10, 30, 100, 100))
|
||||
self.myavatar.setObjectName("myavatar")
|
||||
|
||||
self.retranslateUi(Dialog)
|
||||
QtCore.QMetaObject.connectSlotsByName(Dialog)
|
||||
|
||||
def retranslateUi(self, Dialog):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
|
||||
self.sign_up.setText(_translate("Dialog", "退出登录"))
|
||||
self.toolButton.setText(_translate("Dialog", "..."))
|
||||
self.btn_sendMsg.setText(_translate("Dialog", "发送"))
|
||||
self.btn_chat.setText(_translate("Dialog", "聊天"))
|
||||
self.btn_contact.setText(_translate("Dialog", "联系人"))
|
||||
self.btn_addC.setText(_translate("Dialog", "添加联系人"))
|
||||
self.btn_delC.setText(_translate("Dialog", "删除联系人"))
|
||||
self.btn_create_group.setText(_translate("Dialog", "建群"))
|
||||
self.btn_add_group.setText(_translate("Dialog", "加群"))
|
||||
self.pushButton_6.setText(_translate("Dialog", "设置"))
|
||||
self.myavatar.setText(_translate("Dialog", "avatar"))
|
845
app/Ui/chat/backup/chatUi - 副本.ui
Normal file
845
app/Ui/chat/backup/chatUi - 副本.ui
Normal file
@ -0,0 +1,845 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Dialog</class>
|
||||
<widget class="QDialog" name="Dialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1280</width>
|
||||
<height>720</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>ArrowCursor</cursorShape>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>580</x>
|
||||
<y>570</y>
|
||||
<width>93</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTextBrowser" name="textBrowser">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>480</x>
|
||||
<y>50</y>
|
||||
<width>800</width>
|
||||
<height>520</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTextEdit" name="textEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>480</x>
|
||||
<y>600</y>
|
||||
<width>800</width>
|
||||
<height>120</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="toolButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>1240</x>
|
||||
<y>0</y>
|
||||
<width>47</width>
|
||||
<height>51</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="sendMsg">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>1162</x>
|
||||
<y>670</y>
|
||||
<width>121</width>
|
||||
<height>51</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>黑体</family>
|
||||
<pointsize>15</pointsize>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>ArrowCursor</cursorShape>
|
||||
</property>
|
||||
<property name="mouseTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton {
|
||||
background-color: #f0f0f0;
|
||||
border: 1px solid #dcdfe6;
|
||||
padding: 10px;
|
||||
color:rgb(5,180,104);
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>发送</string>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>480</x>
|
||||
<y>570</y>
|
||||
<width>800</width>
|
||||
<height>3</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>480</x>
|
||||
<y>50</y>
|
||||
<width>800</width>
|
||||
<height>3</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>480</x>
|
||||
<y>0</y>
|
||||
<width>3</width>
|
||||
<height>720</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>370</y>
|
||||
<width>411</width>
|
||||
<height>81</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_5" rowstretch="5,3" columnstretch="1,3,1">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="time0_5">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>昨天</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="remark1_5">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>15</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>司小远</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" rowspan="2">
|
||||
<widget class="QLabel" name="image5">
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: #ffffff;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QLabel" name="msg1_5">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>我没去</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>290</y>
|
||||
<width>411</width>
|
||||
<height>81</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_6" rowstretch="5,3" columnstretch="1,3,1">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="time0_4">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>昨天</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="remark1_6">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>15</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>司小远</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" rowspan="2">
|
||||
<widget class="QLabel" name="image4">
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: #ffffff;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QLabel" name="msg1_6">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>我没去</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>210</y>
|
||||
<width>411</width>
|
||||
<height>81</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_9" rowstretch="5,3" columnstretch="1,3,1">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="time0_3">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>昨天</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="remark1_9">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>15</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>司小远</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" rowspan="2">
|
||||
<widget class="QLabel" name="image3">
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: #ffffff;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QLabel" name="msg1_9">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>我没去</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>130</y>
|
||||
<width>411</width>
|
||||
<height>81</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_10" rowstretch="5,3" columnstretch="1,3,1">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="time0_2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>昨天</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="remark2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>15</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>司小远</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" rowspan="2">
|
||||
<widget class="QLabel" name="image2">
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: #ffffff;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QLabel" name="msg2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>我没去</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget_6">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>450</y>
|
||||
<width>411</width>
|
||||
<height>81</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_12" rowstretch="5,3" columnstretch="1,3,1">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="time0_6">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>昨天</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="remark1_12">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>15</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>司小远</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" rowspan="2">
|
||||
<widget class="QLabel" name="image6">
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: #ffffff;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QLabel" name="msg1_12">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>我没去</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>530</y>
|
||||
<width>411</width>
|
||||
<height>81</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_8" rowstretch="5,3" columnstretch="1,3,1">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="time0_7">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>昨天</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="remark1_8">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>15</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>司小远</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" rowspan="2">
|
||||
<widget class="QLabel" name="image7">
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: #ffffff;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QLabel" name="msg1_8">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>我没去</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget_7">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>610</y>
|
||||
<width>411</width>
|
||||
<height>81</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_13" rowstretch="5,3" columnstretch="1,3,1">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="time0_8">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>昨天</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="remark1_13">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>15</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>司小远</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" rowspan="2">
|
||||
<widget class="QLabel" name="image8">
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: #ffffff;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QLabel" name="msg1_13">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>我没去</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QScrollBar" name="verticalScrollBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>460</x>
|
||||
<y>50</y>
|
||||
<width>16</width>
|
||||
<height>671</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QScrollBar" name="verticalScrollBar_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>1260</x>
|
||||
<y>50</y>
|
||||
<width>16</width>
|
||||
<height>520</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: #f0f0f0;</string>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>50</y>
|
||||
<width>411</width>
|
||||
<height>81</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout" rowstretch="5,3" columnstretch="1,3,1">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="time0_1">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>昨天</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="remark1">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>15</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>司小远</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" rowspan="2">
|
||||
<widget class="QLabel" name="image1">
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: #ffffff;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QLabel" name="msg1">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>我没去</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
184
app/Ui/chat/backup/chatUi.py
Normal file
184
app/Ui/chat/backup/chatUi.py
Normal file
@ -0,0 +1,184 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'chatUi.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.15.7
|
||||
#
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
|
||||
class Ui_Dialog(object):
|
||||
def setupUi(self, Dialog):
|
||||
Dialog.setObjectName("Dialog")
|
||||
Dialog.resize(1280, 720)
|
||||
Dialog.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
|
||||
Dialog.setAutoFillBackground(False)
|
||||
self.pushButton = QtWidgets.QPushButton(Dialog)
|
||||
self.pushButton.setGeometry(QtCore.QRect(580, 570, 93, 28))
|
||||
self.pushButton.setObjectName("pushButton")
|
||||
self.textBrowser = QtWidgets.QTextBrowser(Dialog)
|
||||
self.textBrowser.setGeometry(QtCore.QRect(480, 50, 800, 520))
|
||||
self.textBrowser.setObjectName("textBrowser")
|
||||
self.textEdit = QtWidgets.QTextEdit(Dialog)
|
||||
self.textEdit.setGeometry(QtCore.QRect(480, 600, 800, 120))
|
||||
self.textEdit.setObjectName("textEdit")
|
||||
self.toolButton = QtWidgets.QToolButton(Dialog)
|
||||
self.toolButton.setGeometry(QtCore.QRect(1240, 0, 47, 51))
|
||||
self.toolButton.setObjectName("toolButton")
|
||||
self.sendMsg = QtWidgets.QPushButton(Dialog)
|
||||
self.sendMsg.setGeometry(QtCore.QRect(1162, 670, 121, 51))
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("黑体")
|
||||
font.setPointSize(15)
|
||||
font.setBold(False)
|
||||
font.setWeight(50)
|
||||
self.sendMsg.setFont(font)
|
||||
self.sendMsg.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
|
||||
self.sendMsg.setMouseTracking(False)
|
||||
self.sendMsg.setAutoFillBackground(False)
|
||||
self.sendMsg.setStyleSheet("QPushButton {\n"
|
||||
" background-color: #f0f0f0;\n"
|
||||
" \n"
|
||||
" padding: 10px;\n"
|
||||
" color:rgb(5,180,104);\n"
|
||||
"}")
|
||||
self.sendMsg.setIconSize(QtCore.QSize(40, 40))
|
||||
self.sendMsg.setCheckable(False)
|
||||
self.sendMsg.setAutoDefault(True)
|
||||
self.sendMsg.setObjectName("sendMsg")
|
||||
self.line = QtWidgets.QFrame(Dialog)
|
||||
self.line.setGeometry(QtCore.QRect(480, 570, 800, 3))
|
||||
self.line.setFrameShape(QtWidgets.QFrame.HLine)
|
||||
self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||
self.line.setObjectName("line")
|
||||
self.line_2 = QtWidgets.QFrame(Dialog)
|
||||
self.line_2.setGeometry(QtCore.QRect(480, 50, 800, 3))
|
||||
self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
|
||||
self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||
self.line_2.setObjectName("line_2")
|
||||
self.line_3 = QtWidgets.QFrame(Dialog)
|
||||
self.line_3.setGeometry(QtCore.QRect(480, 0, 3, 720))
|
||||
self.line_3.setFrameShape(QtWidgets.QFrame.VLine)
|
||||
self.line_3.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||
self.line_3.setObjectName("line_3")
|
||||
self.verticalScrollBar = QtWidgets.QScrollBar(Dialog)
|
||||
self.verticalScrollBar.setGeometry(QtCore.QRect(460, 50, 16, 671))
|
||||
self.verticalScrollBar.setOrientation(QtCore.Qt.Vertical)
|
||||
self.verticalScrollBar.setObjectName("verticalScrollBar")
|
||||
self.verticalScrollBar_2 = QtWidgets.QScrollBar(Dialog)
|
||||
self.verticalScrollBar_2.setGeometry(QtCore.QRect(1260, 50, 16, 520))
|
||||
self.verticalScrollBar_2.setStyleSheet("background-color: #f0f0f0;")
|
||||
self.verticalScrollBar_2.setOrientation(QtCore.Qt.Vertical)
|
||||
self.verticalScrollBar_2.setObjectName("verticalScrollBar_2")
|
||||
self.pushButton_2 = QtWidgets.QPushButton(Dialog)
|
||||
self.pushButton_2.setGeometry(QtCore.QRect(160, 50, 300, 80))
|
||||
self.pushButton_2.setLayoutDirection(QtCore.Qt.LeftToRight)
|
||||
self.pushButton_2.setAutoFillBackground(False)
|
||||
self.pushButton_2.setText("")
|
||||
self.pushButton_2.setIconSize(QtCore.QSize(80, 80))
|
||||
self.pushButton_2.setObjectName("pushButton_2")
|
||||
self.layoutWidget = QtWidgets.QWidget(Dialog)
|
||||
self.layoutWidget.setGeometry(QtCore.QRect(150, 200, 318, 81))
|
||||
self.layoutWidget.setObjectName("layoutWidget")
|
||||
self.gridLayout1 = QtWidgets.QGridLayout(self.layoutWidget)
|
||||
self.gridLayout1.setSizeConstraint(QtWidgets.QLayout.SetMaximumSize)
|
||||
self.gridLayout1.setContentsMargins(10, 10, 10, 10)
|
||||
self.gridLayout1.setSpacing(10)
|
||||
self.gridLayout1.setObjectName("gridLayout1")
|
||||
self.label_time = QtWidgets.QLabel(self.layoutWidget)
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
self.label_time.setFont(font)
|
||||
self.label_time.setLayoutDirection(QtCore.Qt.RightToLeft)
|
||||
self.label_time.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||
self.label_time.setObjectName("label_time")
|
||||
self.gridLayout1.addWidget(self.label_time, 0, 2, 1, 1)
|
||||
self.label_remark = QtWidgets.QLabel(self.layoutWidget)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Adobe 黑体 Std R")
|
||||
font.setPointSize(10)
|
||||
font.setBold(False)
|
||||
font.setWeight(50)
|
||||
self.label_remark.setFont(font)
|
||||
self.label_remark.setObjectName("label_remark")
|
||||
self.gridLayout1.addWidget(self.label_remark, 0, 1, 1, 1)
|
||||
self.label_msg = QtWidgets.QLabel(self.layoutWidget)
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
self.label_msg.setFont(font)
|
||||
self.label_msg.setObjectName("label_msg")
|
||||
self.gridLayout1.addWidget(self.label_msg, 1, 1, 1, 2)
|
||||
self.label_avatar = QtWidgets.QLabel(self.layoutWidget)
|
||||
self.label_avatar.setMinimumSize(QtCore.QSize(60, 60))
|
||||
self.label_avatar.setMaximumSize(QtCore.QSize(60, 60))
|
||||
self.label_avatar.setLayoutDirection(QtCore.Qt.RightToLeft)
|
||||
self.label_avatar.setAutoFillBackground(False)
|
||||
self.label_avatar.setStyleSheet("background-color: #ffffff;")
|
||||
self.label_avatar.setInputMethodHints(QtCore.Qt.ImhNone)
|
||||
self.label_avatar.setFrameShape(QtWidgets.QFrame.NoFrame)
|
||||
self.label_avatar.setFrameShadow(QtWidgets.QFrame.Plain)
|
||||
self.label_avatar.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
|
||||
self.label_avatar.setObjectName("label_avatar")
|
||||
self.gridLayout1.addWidget(self.label_avatar, 0, 0, 2, 1)
|
||||
self.gridLayout1.setColumnStretch(0, 1)
|
||||
self.gridLayout1.setColumnStretch(1, 6)
|
||||
self.gridLayout1.setRowStretch(0, 5)
|
||||
self.gridLayout1.setRowStretch(1, 3)
|
||||
self.verticalLayoutWidget = QtWidgets.QWidget(Dialog)
|
||||
self.verticalLayoutWidget.setGeometry(QtCore.QRect(0, 160, 111, 402))
|
||||
self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
|
||||
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.verticalLayoutWidget)
|
||||
self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
|
||||
self.verticalLayout_2.setSpacing(0)
|
||||
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||
self.btn_msg = QtWidgets.QPushButton(self.verticalLayoutWidget)
|
||||
self.btn_msg.setMinimumSize(QtCore.QSize(0, 80))
|
||||
self.btn_msg.setObjectName("btn_msg")
|
||||
self.verticalLayout_2.addWidget(self.btn_msg)
|
||||
self.btn_contact = QtWidgets.QPushButton(self.verticalLayoutWidget)
|
||||
self.btn_contact.setMinimumSize(QtCore.QSize(0, 80))
|
||||
self.btn_contact.setObjectName("btn_contact")
|
||||
self.verticalLayout_2.addWidget(self.btn_contact)
|
||||
self.btn_addC = QtWidgets.QPushButton(self.verticalLayoutWidget)
|
||||
self.btn_addC.setMinimumSize(QtCore.QSize(0, 80))
|
||||
self.btn_addC.setObjectName("btn_addC")
|
||||
self.verticalLayout_2.addWidget(self.btn_addC)
|
||||
self.btn_delC = QtWidgets.QPushButton(self.verticalLayoutWidget)
|
||||
self.btn_delC.setMinimumSize(QtCore.QSize(0, 80))
|
||||
self.btn_delC.setObjectName("btn_delC")
|
||||
self.verticalLayout_2.addWidget(self.btn_delC)
|
||||
self.pushButton_6 = QtWidgets.QPushButton(self.verticalLayoutWidget)
|
||||
self.pushButton_6.setMinimumSize(QtCore.QSize(100, 80))
|
||||
self.pushButton_6.setObjectName("pushButton_6")
|
||||
self.verticalLayout_2.addWidget(self.pushButton_6)
|
||||
self.verticalLayout_2.setStretch(0, 1)
|
||||
self.verticalLayout_2.setStretch(2, 1)
|
||||
self.verticalLayout_2.setStretch(3, 1)
|
||||
self.verticalLayout_2.setStretch(4, 1)
|
||||
self.myavatar = QtWidgets.QLabel(Dialog)
|
||||
self.myavatar.setGeometry(QtCore.QRect(10, 30, 100, 100))
|
||||
self.myavatar.setObjectName("myavatar")
|
||||
|
||||
self.retranslateUi(Dialog)
|
||||
QtCore.QMetaObject.connectSlotsByName(Dialog)
|
||||
|
||||
def retranslateUi(self, Dialog):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
|
||||
self.pushButton.setText(_translate("Dialog", "PushButton"))
|
||||
self.toolButton.setText(_translate("Dialog", "..."))
|
||||
self.sendMsg.setText(_translate("Dialog", "发送"))
|
||||
self.label_time.setText(_translate("Dialog", "22/12/17"))
|
||||
self.label_remark.setText(_translate("Dialog", "西北工业大学财务处"))
|
||||
self.label_msg.setText(_translate("Dialog", "我没去"))
|
||||
self.label_avatar.setText(_translate("Dialog", "TextLabel"))
|
||||
self.btn_msg.setText(_translate("Dialog", "聊天"))
|
||||
self.btn_contact.setText(_translate("Dialog", "联系人"))
|
||||
self.btn_addC.setText(_translate("Dialog", "添加联系人"))
|
||||
self.btn_delC.setText(_translate("Dialog", "删除联系人"))
|
||||
self.pushButton_6.setText(_translate("Dialog", "设置"))
|
||||
self.myavatar.setText(_translate("Dialog", "avatar"))
|
422
app/Ui/chat/backup/chatUi.ui
Normal file
422
app/Ui/chat/backup/chatUi.ui
Normal file
@ -0,0 +1,422 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Dialog</class>
|
||||
<widget class="QDialog" name="Dialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1280</width>
|
||||
<height>720</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>ArrowCursor</cursorShape>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>580</x>
|
||||
<y>570</y>
|
||||
<width>93</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PushButton</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTextBrowser" name="textBrowser">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>480</x>
|
||||
<y>50</y>
|
||||
<width>800</width>
|
||||
<height>520</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTextEdit" name="textEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>480</x>
|
||||
<y>600</y>
|
||||
<width>800</width>
|
||||
<height>120</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="toolButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>1240</x>
|
||||
<y>0</y>
|
||||
<width>47</width>
|
||||
<height>51</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="sendMsg">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>1162</x>
|
||||
<y>670</y>
|
||||
<width>121</width>
|
||||
<height>51</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>黑体</family>
|
||||
<pointsize>15</pointsize>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>ArrowCursor</cursorShape>
|
||||
</property>
|
||||
<property name="mouseTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton {
|
||||
background-color: #f0f0f0;
|
||||
|
||||
padding: 10px;
|
||||
color:rgb(5,180,104);
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>发送</string>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>480</x>
|
||||
<y>570</y>
|
||||
<width>800</width>
|
||||
<height>3</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>480</x>
|
||||
<y>50</y>
|
||||
<width>800</width>
|
||||
<height>3</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>480</x>
|
||||
<y>0</y>
|
||||
<width>3</width>
|
||||
<height>720</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QScrollBar" name="verticalScrollBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>460</x>
|
||||
<y>50</y>
|
||||
<width>16</width>
|
||||
<height>671</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QScrollBar" name="verticalScrollBar_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>1260</x>
|
||||
<y>50</y>
|
||||
<width>16</width>
|
||||
<height>520</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: #f0f0f0;</string>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>160</x>
|
||||
<y>50</y>
|
||||
<width>300</width>
|
||||
<height>80</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>150</x>
|
||||
<y>200</y>
|
||||
<width>318</width>
|
||||
<height>81</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout1" rowstretch="5,3" columnstretch="1,6,0" rowminimumheight="0,0" columnminimumwidth="0,0,0">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="label_time">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>22/12/17</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_remark">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Adobe 黑体 Std R</family>
|
||||
<pointsize>10</pointsize>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>西北工业大学财务处</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QLabel" name="label_msg">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>我没去</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" rowspan="2">
|
||||
<widget class="QLabel" name="label_avatar">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: #ffffff;</string>
|
||||
</property>
|
||||
<property name="inputMethodHints">
|
||||
<set>Qt::ImhNone</set>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="verticalLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>160</y>
|
||||
<width>111</width>
|
||||
<height>402</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="1,0,1,1,1">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_msg">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>聊天</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_contact">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>联系人</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_addC">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>添加联系人</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_delC">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>删除联系人</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_6">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>设置</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QLabel" name="myavatar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>30</y>
|
||||
<width>100</width>
|
||||
<height>100</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>avatar</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
428
app/Ui/chat/chat - 副本.py
Normal file
428
app/Ui/chat/chat - 副本.py
Normal file
@ -0,0 +1,428 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@File : mainview.py
|
||||
@Author : Shuaikang Zhou
|
||||
@Time : 2022/12/13 15:07
|
||||
@IDE : Pycharm
|
||||
@Version : Python3.10
|
||||
@comment : ···
|
||||
"""
|
||||
import os.path
|
||||
import socket # 导入socket模块
|
||||
import datetime
|
||||
import json
|
||||
import time
|
||||
|
||||
from PyQt5.QtWidgets import *
|
||||
from PyQt5.QtCore import *
|
||||
from PyQt5.QtGui import *
|
||||
from .chatUi import *
|
||||
from ...DataBase import data
|
||||
|
||||
|
||||
class ChatController(QWidget, Ui_Dialog):
|
||||
exitSignal = pyqtSignal()
|
||||
|
||||
# username = ''
|
||||
|
||||
def __init__(self, Me, parent=None):
|
||||
super(ChatController, self).__init__(parent)
|
||||
self.ta_avatar = None
|
||||
self.setupUi(self)
|
||||
self.setWindowTitle('WeChat')
|
||||
self.setWindowIcon(QIcon('./app/data/icon.png'))
|
||||
self.initui()
|
||||
self.Me = Me
|
||||
self.Thread = ChatMsg(self.Me.username, None)
|
||||
self.Thread.isSend_signal.connect(self.showMsg)
|
||||
self.Thread.okSignal.connect(self.setScrollBarPos)
|
||||
self.contacts = {}
|
||||
self.last_btn = None
|
||||
self.chat_flag = True
|
||||
# self.showChat()
|
||||
self.message.verticalScrollBar().valueChanged.connect(self.textbrower_verticalScrollBar)
|
||||
self.show_flag = False
|
||||
self.ta_username = None
|
||||
self.last_pos = 0
|
||||
self.last_msg_time = 0 # 上次信息的时间
|
||||
self.last_talkerId = None
|
||||
self.now_talkerId = None
|
||||
self.showChat()
|
||||
|
||||
def initui(self):
|
||||
self.textEdit = myTextEdit(self.frame)
|
||||
self.textEdit.setGeometry(QtCore.QRect(9, 580, 821, 141))
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(15)
|
||||
self.textEdit.setFont(font)
|
||||
self.textEdit.setTabStopWidth(80)
|
||||
self.textEdit.setCursorWidth(1)
|
||||
self.textEdit.setObjectName("textEdit")
|
||||
self.textEdit.sendSignal.connect(self.sendMsg)
|
||||
self.btn_sendMsg = QtWidgets.QPushButton(self.frame)
|
||||
self.btn_sendMsg.setGeometry(QtCore.QRect(680, 670, 121, 51))
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("黑体")
|
||||
font.setPointSize(15)
|
||||
font.setBold(False)
|
||||
font.setWeight(50)
|
||||
self.btn_sendMsg.setFont(font)
|
||||
self.btn_sendMsg.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
|
||||
self.btn_sendMsg.setMouseTracking(False)
|
||||
self.btn_sendMsg.setAutoFillBackground(False)
|
||||
self.btn_sendMsg.setStyleSheet("QPushButton {background-color: #f0f0f0;\n"
|
||||
"padding: 10px;\n"
|
||||
"color:rgb(5,180,104);}\n"
|
||||
"QPushButton:hover{background-color: rgb(198,198,198)}\n"
|
||||
)
|
||||
self.btn_sendMsg.setIconSize(QtCore.QSize(40, 40))
|
||||
self.btn_sendMsg.setCheckable(False)
|
||||
self.btn_sendMsg.setAutoDefault(True)
|
||||
self.btn_sendMsg.setObjectName("btn_sendMsg")
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
self.btn_sendMsg.setText(_translate("Dialog", "发送"))
|
||||
self.btn_sendMsg.setToolTip('按Enter键发送,按Ctrl+Enter键换行')
|
||||
|
||||
def showChat(self):
|
||||
"""
|
||||
显示聊天界面
|
||||
:return:
|
||||
"""
|
||||
print('show')
|
||||
if self.show_flag:
|
||||
return
|
||||
self.show_flag = True
|
||||
rconversations = data.get_rconversation()
|
||||
max_hight = max(len(rconversations) * 80, 680)
|
||||
self.scrollAreaWidgetContents.setGeometry(
|
||||
QtCore.QRect(0, 0, 300, max_hight))
|
||||
for i in range(len(rconversations)):
|
||||
rconversation = rconversations[i]
|
||||
username = rconversation[1]
|
||||
# print('联系人:', i, rconversation)
|
||||
pushButton_2 = Contact(self.scrollAreaWidgetContents, i, rconversation)
|
||||
pushButton_2.setGeometry(QtCore.QRect(0, 80 * i, 300, 80))
|
||||
pushButton_2.setLayoutDirection(QtCore.Qt.LeftToRight)
|
||||
pushButton_2.clicked.connect(pushButton_2.show_msg)
|
||||
pushButton_2.usernameSingal.connect(self.Chat)
|
||||
self.contacts[username] = pushButton_2
|
||||
|
||||
def Chat(self, talkerId):
|
||||
"""
|
||||
聊天界面 点击联系人头像时候显示聊天数据
|
||||
:param talkerId:
|
||||
:return:
|
||||
"""
|
||||
self.now_talkerId = talkerId
|
||||
# 把当前按钮设置为灰色
|
||||
if self.last_talkerId and self.last_talkerId != talkerId:
|
||||
print('对方账号:', self.last_talkerId)
|
||||
self.contacts[self.last_talkerId].setStyleSheet(
|
||||
"QPushButton {background-color: rgb(253,253,253);}"
|
||||
"QPushButton:hover{background-color: rgb(209,209,209);}\n"
|
||||
)
|
||||
self.last_talkerId = talkerId
|
||||
self.contacts[talkerId].setStyleSheet(
|
||||
"QPushButton {background-color: rgb(198,198,198);}"
|
||||
"QPushButton:hover{background-color: rgb(209,209,209);}\n"
|
||||
)
|
||||
conRemark = data.get_conRemark(talkerId)
|
||||
self.label_remark.setText(conRemark)
|
||||
self.message.clear()
|
||||
self.message.append(talkerId)
|
||||
self.ta_username = talkerId
|
||||
self.ta_avatar = data.get_avator(talkerId)
|
||||
self.textEdit.setFocus()
|
||||
self.Thread.ta_u = talkerId
|
||||
self.Thread.msg_id = 0
|
||||
self.Thread.start()
|
||||
# 创建新的线程用于显示聊天记录
|
||||
|
||||
def closeEvent(self, a0: QtGui.QCloseEvent) -> None:
|
||||
print("closed")
|
||||
self.exitSignal.emit()
|
||||
self.close()
|
||||
|
||||
def textbrower_verticalScrollBar(self, pos):
|
||||
"""
|
||||
滚动条到0之后自动更新聊天记录
|
||||
:param pos:
|
||||
:return:
|
||||
"""
|
||||
# print(pos)
|
||||
if pos > 0:
|
||||
return
|
||||
self.last_pos = self.message.verticalScrollBar().maximum()
|
||||
self.Thread.start()
|
||||
|
||||
def setScrollBarPos(self, pos):
|
||||
"""
|
||||
将滚动条位置设置为上次看到的地方
|
||||
:param pos:
|
||||
:return:
|
||||
"""
|
||||
pos = self.message.verticalScrollBar().maximum() - self.last_pos
|
||||
|
||||
print(pos)
|
||||
self.message.verticalScrollBar().setValue(pos)
|
||||
|
||||
def sendMsg(self, msg):
|
||||
pass
|
||||
|
||||
def check_time(self, msg_time):
|
||||
"""
|
||||
判断两次聊天时间是否大于五分钟
|
||||
超过五分钟就显示时间
|
||||
:param msg_time:
|
||||
:return:
|
||||
"""
|
||||
dt = msg_time - self.last_msg_time
|
||||
# print(msg_time)
|
||||
if dt // 1000 >= 300:
|
||||
s_l = time.localtime(msg_time / 1000)
|
||||
ts = time.strftime("%Y-%m-%d %H:%M", s_l)
|
||||
html = '''
|
||||
<table align="center" style="vertical-align: middle;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>%s</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>''' % (ts)
|
||||
# print(html)
|
||||
self.last_msg_time = msg_time
|
||||
self.message.insertHtml(html)
|
||||
|
||||
def showMsg(self, message):
|
||||
"""
|
||||
显示聊天消息
|
||||
:param message:
|
||||
:return:
|
||||
"""
|
||||
msgId = message[0]
|
||||
# print(msgId, type(msgId))
|
||||
self.message.moveCursor(self.message.textCursor().Start)
|
||||
ta_username = message[7]
|
||||
msgType = str(message[2])
|
||||
isSend = message[4]
|
||||
content = message[8]
|
||||
imgPath = message[9]
|
||||
msg_time = message[6]
|
||||
self.check_time(msg_time)
|
||||
|
||||
if msgType == '1':
|
||||
self.show_text(isSend, content)
|
||||
elif msgType == '3':
|
||||
self.show_img(isSend,imgPath)
|
||||
# self.message.moveCursor(self.message.textCursor().End)
|
||||
|
||||
def show_img(self, isSend, imgPath):
|
||||
'THUMBNAIL_DIRPATH://th_29cd0f0ca87652943be9ede365aabeaa'
|
||||
imgPath = imgPath.split('th_')[1]
|
||||
imgPath = f'./app/data/image2/{imgPath[0:2]}/{imgPath[2:4]}/th_{imgPath}'
|
||||
html = '''
|
||||
<td style="border: 1px #000000 solid"><img align="right" src="%s"/></td>
|
||||
''' % imgPath
|
||||
style = 'vertical-align: top'
|
||||
if isSend:
|
||||
self.right(html,style=style)
|
||||
else:
|
||||
self.left(html,style=style)
|
||||
|
||||
def show_text(self, isSend, content):
|
||||
|
||||
if isSend:
|
||||
html = '''<td>%s :</td>''' % (content)
|
||||
self.right(html)
|
||||
else:
|
||||
html = '''<td>: %s</td>''' % (content)
|
||||
self.left(html)
|
||||
|
||||
def right(self, content,style='vertical-align: middle'):
|
||||
html = '''
|
||||
<div>
|
||||
<table align="right" style="%s;">
|
||||
<tbody>
|
||||
<tr>
|
||||
%s
|
||||
<td style="border: 1px #000000 solid"><img align="right" src="%s" width="45" height="45"/></td>
|
||||
<td width="15"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
''' % (style,content, self.Me.my_avatar)
|
||||
# print('总的HTML')
|
||||
# print(html)
|
||||
self.message.insertHtml(html)
|
||||
|
||||
def left(self, content,style = 'vertical-align: middle'):
|
||||
html = '''
|
||||
<div>
|
||||
<table align="left" style="%s;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td width="15"></td>
|
||||
<td style="border: 1px #000000 solid"><img align="right" src="%s" width="45" height="45"/></td>
|
||||
%s
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
''' % (style,self.ta_avatar, content)
|
||||
self.message.insertHtml(html)
|
||||
|
||||
def destroy_me(self):
|
||||
"""注销账户"""
|
||||
pass
|
||||
|
||||
|
||||
class Contact(QtWidgets.QPushButton):
|
||||
"""
|
||||
联系人类,继承自pyqt的按钮,里面封装了联系人头像等标签
|
||||
"""
|
||||
usernameSingal = pyqtSignal(str)
|
||||
|
||||
def __init__(self, Ui, id=None, contact=None):
|
||||
super(Contact, self).__init__(Ui)
|
||||
self.layoutWidget = QtWidgets.QWidget(Ui)
|
||||
self.layoutWidget.setObjectName("layoutWidget")
|
||||
self.gridLayout1 = QtWidgets.QGridLayout(self.layoutWidget)
|
||||
self.gridLayout1.setSizeConstraint(QtWidgets.QLayout.SetMaximumSize)
|
||||
self.gridLayout1.setContentsMargins(10, 10, 10, 10)
|
||||
self.gridLayout1.setSpacing(10)
|
||||
self.gridLayout1.setObjectName("gridLayout1")
|
||||
self.label_time = QtWidgets.QLabel(self.layoutWidget)
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
self.label_time.setFont(font)
|
||||
self.label_time.setLayoutDirection(QtCore.Qt.RightToLeft)
|
||||
self.label_time.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
|
||||
self.label_time.setObjectName("label_time")
|
||||
self.gridLayout1.addWidget(self.label_time, 0, 2, 1, 1)
|
||||
self.label_remark = QtWidgets.QLabel(self.layoutWidget)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Adobe 黑体 Std R")
|
||||
font.setPointSize(10)
|
||||
self.label_remark.setFont(font)
|
||||
self.label_remark.setObjectName("label_remark")
|
||||
self.gridLayout1.addWidget(self.label_remark, 0, 1, 1, 1)
|
||||
self.label_msg = QtWidgets.QLabel(self.layoutWidget)
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
self.label_msg.setFont(font)
|
||||
self.label_msg.setObjectName("label_msg")
|
||||
self.gridLayout1.addWidget(self.label_msg, 1, 1, 1, 2)
|
||||
self.label_avatar = QtWidgets.QLabel(self.layoutWidget)
|
||||
self.label_avatar.setMinimumSize(QtCore.QSize(60, 60))
|
||||
self.label_avatar.setMaximumSize(QtCore.QSize(60, 60))
|
||||
self.label_avatar.setLayoutDirection(QtCore.Qt.RightToLeft)
|
||||
self.label_avatar.setAutoFillBackground(False)
|
||||
self.label_avatar.setStyleSheet("background-color: #ffffff;")
|
||||
self.label_avatar.setInputMethodHints(QtCore.Qt.ImhNone)
|
||||
self.label_avatar.setFrameShape(QtWidgets.QFrame.NoFrame)
|
||||
self.label_avatar.setFrameShadow(QtWidgets.QFrame.Plain)
|
||||
self.label_avatar.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
|
||||
self.label_avatar.setObjectName("label_avatar")
|
||||
self.gridLayout1.addWidget(self.label_avatar, 0, 0, 2, 1)
|
||||
self.gridLayout1.setColumnStretch(0, 1)
|
||||
self.gridLayout1.setColumnStretch(1, 6)
|
||||
self.gridLayout1.setRowStretch(0, 5)
|
||||
self.gridLayout1.setRowStretch(1, 3)
|
||||
self.setLayout(self.gridLayout1)
|
||||
self.setStyleSheet(
|
||||
"QPushButton {background-color: rgb(253,253,253);}"
|
||||
"QPushButton:hover{background-color: rgb(209,209,209);}\n"
|
||||
)
|
||||
self.msgCount = contact[0]
|
||||
self.username = contact[1]
|
||||
self.conversationTime = contact[6]
|
||||
self.msgType = contact[7]
|
||||
self.digest = contact[8]
|
||||
hasTrunc = contact[10]
|
||||
attrflag = contact[11]
|
||||
if hasTrunc == 0:
|
||||
if attrflag == 0:
|
||||
self.digest = '[动画表情]'
|
||||
elif attrflag == 67108864:
|
||||
try:
|
||||
remark = data.get_conRemark(contact[9])
|
||||
msg = self.digest.split(':')[1].strip('\n').strip()
|
||||
self.digest = f'{remark}:{msg}'
|
||||
except Exception as e:
|
||||
# print(self.digest)
|
||||
# print(e)
|
||||
pass
|
||||
else:
|
||||
pass
|
||||
self.show_info(id)
|
||||
|
||||
def show_info(self, id):
|
||||
avatar = data.get_avator(self.username)
|
||||
# print(avatar)
|
||||
remark = data.get_conRemark(self.username)
|
||||
time = datetime.datetime.now().strftime("%m-%d %H:%M")
|
||||
msg = '还没说话'
|
||||
pixmap = QPixmap(avatar).scaled(60, 60) # 按指定路径找到图片
|
||||
self.label_avatar.setPixmap(pixmap) # 在label上显示图片
|
||||
self.label_remark.setText(remark)
|
||||
self.label_msg.setText(self.digest)
|
||||
self.label_time.setText(data.timestamp2str(self.conversationTime)[2:])
|
||||
|
||||
def show_msg(self):
|
||||
self.usernameSingal.emit(self.username)
|
||||
|
||||
|
||||
class ChatMsg(QThread):
|
||||
"""
|
||||
发送信息线程
|
||||
"""
|
||||
isSend_signal = pyqtSignal(tuple)
|
||||
okSignal = pyqtSignal(int)
|
||||
|
||||
def __init__(self, my_u, ta_u, parent=None):
|
||||
super().__init__(parent)
|
||||
self.sec = 2 # 默认1000秒
|
||||
self.my_u = my_u
|
||||
self.ta_u = ta_u
|
||||
self.my_avatar = data.get_avator(my_u)
|
||||
self.msg_id = 0
|
||||
|
||||
def run(self):
|
||||
self.ta_avatar = data.get_avator(self.ta_u)
|
||||
messages = data.get_message(self.ta_u, self.msg_id)
|
||||
# messages.reverse()
|
||||
for message in messages:
|
||||
self.isSend_signal.emit(message)
|
||||
self.msg_id += 1
|
||||
self.okSignal.emit(1)
|
||||
|
||||
|
||||
class myTextEdit(QtWidgets.QTextEdit): # 继承 原本组件
|
||||
sendSignal = pyqtSignal(str)
|
||||
|
||||
def __init__(self, parent):
|
||||
QtWidgets.QTextEdit.__init__(self, parent)
|
||||
self.parent = parent
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
self.setHtml(_translate("Dialog",
|
||||
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
||||
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
|
||||
"p, li { white-space: pre-wrap; }\n"
|
||||
"</style></head><body style=\" font-family:\'SimSun\'; font-size:15pt; font-weight:400; font-style:normal;\">\n"
|
||||
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p></body></html>"))
|
||||
|
||||
def keyPressEvent(self, event):
|
||||
QtWidgets.QTextEdit.keyPressEvent(self, event)
|
||||
if event.key() == Qt.Key_Return: # 如果是Enter 按钮
|
||||
modifiers = event.modifiers()
|
||||
if modifiers == Qt.ControlModifier:
|
||||
print('success press ctrl+enter key', self.toPlainText())
|
||||
self.append('\0')
|
||||
return
|
||||
self.sendSignal.emit(self.toPlainText())
|
||||
print('success press enter key', self.toPlainText())
|
||||
|
||||
# if modifiers == (Qt.ControlModifier) and event.key() == Qt.Key_Return:
|
||||
# self.sendSignal.emit(self.toPlainText())
|
||||
# print('success press enter key', self.toPlainText())
|
459
app/Ui/chat/chat.py
Normal file
459
app/Ui/chat/chat.py
Normal file
@ -0,0 +1,459 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@File : mainview.py
|
||||
@Author : Shuaikang Zhou
|
||||
@Time : 2022/12/13 15:07
|
||||
@IDE : Pycharm
|
||||
@Version : Python3.10
|
||||
@comment : ···
|
||||
"""
|
||||
import os.path
|
||||
import socket # 导入socket模块
|
||||
import datetime
|
||||
import json
|
||||
import time
|
||||
from PIL import Image
|
||||
from PyQt5.QtWidgets import *
|
||||
from PyQt5.QtCore import *
|
||||
from PyQt5.QtGui import *
|
||||
from .chatUi import *
|
||||
from ...DataBase import data
|
||||
|
||||
|
||||
class ChatController(QWidget, Ui_Dialog):
|
||||
exitSignal = pyqtSignal()
|
||||
|
||||
# username = ''
|
||||
|
||||
def __init__(self, Me, parent=None):
|
||||
super(ChatController, self).__init__(parent)
|
||||
self.ta_avatar = None
|
||||
self.setupUi(self)
|
||||
self.setWindowTitle('WeChat')
|
||||
self.setWindowIcon(QIcon('./app/data/icon.png'))
|
||||
self.initui()
|
||||
self.Me = Me
|
||||
self.Thread = ChatMsg(self.Me.username, None)
|
||||
self.Thread.isSend_signal.connect(self.showMsg)
|
||||
self.Thread.okSignal.connect(self.setScrollBarPos)
|
||||
self.contacts = {}
|
||||
self.last_btn = None
|
||||
self.chat_flag = True
|
||||
# self.showChat()
|
||||
self.message.verticalScrollBar().valueChanged.connect(self.textbrower_verticalScrollBar)
|
||||
self.show_flag = False
|
||||
self.ta_username = None
|
||||
self.last_pos = 0
|
||||
self.last_msg_time = 0 # 上次信息的时间
|
||||
self.last_talkerId = None
|
||||
self.now_talkerId = None
|
||||
self.showChat()
|
||||
|
||||
def initui(self):
|
||||
with open('./wechat.html', 'r', encoding='utf-8') as f:
|
||||
self.message.setHtml(f.read())
|
||||
self.textEdit = myTextEdit(self.frame)
|
||||
self.textEdit.setGeometry(QtCore.QRect(9, 580, 821, 141))
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(15)
|
||||
self.textEdit.setFont(font)
|
||||
self.textEdit.setTabStopWidth(80)
|
||||
self.textEdit.setCursorWidth(1)
|
||||
self.textEdit.setObjectName("textEdit")
|
||||
self.textEdit.sendSignal.connect(self.sendMsg)
|
||||
self.btn_sendMsg = QtWidgets.QPushButton(self.frame)
|
||||
self.btn_sendMsg.setGeometry(QtCore.QRect(680, 670, 121, 51))
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("黑体")
|
||||
font.setPointSize(15)
|
||||
font.setBold(False)
|
||||
font.setWeight(50)
|
||||
self.btn_sendMsg.setFont(font)
|
||||
self.btn_sendMsg.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
|
||||
self.btn_sendMsg.setMouseTracking(False)
|
||||
self.btn_sendMsg.setAutoFillBackground(False)
|
||||
self.btn_sendMsg.setStyleSheet("QPushButton {background-color: #f0f0f0;\n"
|
||||
"padding: 10px;\n"
|
||||
"color:rgb(5,180,104);}\n"
|
||||
"QPushButton:hover{background-color: rgb(198,198,198)}\n"
|
||||
)
|
||||
self.btn_sendMsg.setIconSize(QtCore.QSize(40, 40))
|
||||
self.btn_sendMsg.setCheckable(False)
|
||||
self.btn_sendMsg.setAutoDefault(True)
|
||||
self.btn_sendMsg.setObjectName("btn_sendMsg")
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
self.btn_sendMsg.setText(_translate("Dialog", "发送"))
|
||||
self.btn_sendMsg.setToolTip('按Enter键发送,按Ctrl+Enter键换行')
|
||||
|
||||
def showChat(self):
|
||||
"""
|
||||
显示聊天界面
|
||||
:return:
|
||||
"""
|
||||
print('show')
|
||||
if self.show_flag:
|
||||
return
|
||||
self.show_flag = True
|
||||
rconversations = data.get_rconversation()
|
||||
max_hight = max(len(rconversations) * 80, 680)
|
||||
self.scrollAreaWidgetContents.setGeometry(
|
||||
QtCore.QRect(0, 0, 300, max_hight))
|
||||
for i in range(len(rconversations)):
|
||||
rconversation = rconversations[i]
|
||||
username = rconversation[1]
|
||||
# print('联系人:', i, rconversation)
|
||||
pushButton_2 = Contact(self.scrollAreaWidgetContents, i, rconversation)
|
||||
pushButton_2.setGeometry(QtCore.QRect(0, 80 * i, 300, 80))
|
||||
pushButton_2.setLayoutDirection(QtCore.Qt.LeftToRight)
|
||||
pushButton_2.clicked.connect(pushButton_2.show_msg)
|
||||
pushButton_2.usernameSingal.connect(self.Chat)
|
||||
self.contacts[username] = pushButton_2
|
||||
|
||||
def Chat(self, talkerId):
|
||||
"""
|
||||
聊天界面 点击联系人头像时候显示聊天数据
|
||||
:param talkerId:
|
||||
:return:
|
||||
"""
|
||||
self.now_talkerId = talkerId
|
||||
# 把当前按钮设置为灰色
|
||||
if self.last_talkerId and self.last_talkerId != talkerId:
|
||||
print('对方账号:', self.last_talkerId)
|
||||
self.contacts[self.last_talkerId].setStyleSheet(
|
||||
"QPushButton {background-color: rgb(253,253,253);}"
|
||||
"QPushButton:hover{background-color: rgb(209,209,209);}\n"
|
||||
)
|
||||
self.last_talkerId = talkerId
|
||||
self.contacts[talkerId].setStyleSheet(
|
||||
"QPushButton {background-color: rgb(198,198,198);}"
|
||||
"QPushButton:hover{background-color: rgb(209,209,209);}\n"
|
||||
)
|
||||
conRemark = data.get_conRemark(talkerId)
|
||||
self.label_remark.setText(conRemark)
|
||||
self.message.clear()
|
||||
self.message.append(talkerId)
|
||||
self.ta_username = talkerId
|
||||
self.ta_avatar = data.get_avator(talkerId)
|
||||
self.textEdit.setFocus()
|
||||
self.Thread.ta_u = talkerId
|
||||
self.Thread.msg_id = 0
|
||||
self.Thread.start()
|
||||
# 创建新的线程用于显示聊天记录
|
||||
|
||||
def closeEvent(self, a0: QtGui.QCloseEvent) -> None:
|
||||
print("closed")
|
||||
self.exitSignal.emit()
|
||||
self.close()
|
||||
|
||||
def textbrower_verticalScrollBar(self, pos):
|
||||
"""
|
||||
滚动条到0之后自动更新聊天记录
|
||||
:param pos:
|
||||
:return:
|
||||
"""
|
||||
# print(pos)
|
||||
if pos > 0:
|
||||
return
|
||||
self.last_pos = self.message.verticalScrollBar().maximum()
|
||||
self.Thread.start()
|
||||
|
||||
def setScrollBarPos(self, pos):
|
||||
"""
|
||||
将滚动条位置设置为上次看到的地方
|
||||
:param pos:
|
||||
:return:
|
||||
"""
|
||||
pos = self.message.verticalScrollBar().maximum() - self.last_pos
|
||||
|
||||
print(pos)
|
||||
self.message.verticalScrollBar().setValue(pos)
|
||||
|
||||
def sendMsg(self, msg):
|
||||
pass
|
||||
|
||||
def check_time(self, msg_time):
|
||||
"""
|
||||
判断两次聊天时间是否大于五分钟
|
||||
超过五分钟就显示时间
|
||||
:param msg_time:
|
||||
:return:
|
||||
"""
|
||||
dt = msg_time - self.last_msg_time
|
||||
# print(msg_time)
|
||||
if abs(dt // 1000) >= 300:
|
||||
s_l = time.localtime(msg_time / 1000)
|
||||
ts = time.strftime("%Y-%m-%d %H:%M", s_l)
|
||||
html = '''
|
||||
<table align="center" style="vertical-align: middle;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>%s</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>''' % (ts)
|
||||
# print(html)
|
||||
self.last_msg_time = msg_time
|
||||
self.message.insertHtml(html)
|
||||
|
||||
def showMsg(self, message):
|
||||
"""
|
||||
显示聊天消息
|
||||
:param message:
|
||||
:return:
|
||||
"""
|
||||
msgId = message[0]
|
||||
# print(msgId, type(msgId))
|
||||
self.message.moveCursor(self.message.textCursor().Start)
|
||||
ta_username = message[7]
|
||||
msgType = str(message[2])
|
||||
isSend = message[4]
|
||||
content = message[8]
|
||||
imgPath = message[9]
|
||||
msg_time = message[6]
|
||||
self.check_time(msg_time)
|
||||
|
||||
if msgType == '1':
|
||||
self.show_text(isSend, content)
|
||||
elif msgType == '3':
|
||||
self.show_img(isSend, imgPath)
|
||||
elif msgType == '47':
|
||||
self.show_emoji(isSend, imgPath)
|
||||
# quit()
|
||||
# self.message.moveCursor(self.message.textCursor().End)
|
||||
|
||||
def show_emoji(self, isSend, imagePath):
|
||||
imgPath = data.get_emoji(imagePath)
|
||||
image = Image.open(imgPath)
|
||||
imagePixmap = image.size # 宽高像素
|
||||
# 设置最大宽度
|
||||
if imagePixmap[0]<150:
|
||||
size = ""
|
||||
else:
|
||||
size = '''height="150" width="150"'''
|
||||
html = '''
|
||||
<td style="border: 1px #000000 solid;" height="150">
|
||||
<img src="{0}" {1} >
|
||||
</td>
|
||||
'''.format(imgPath,size)
|
||||
style = 'vertical-align: top'
|
||||
if isSend:
|
||||
self.right(html, style=style)
|
||||
else:
|
||||
self.left(html, style=style)
|
||||
|
||||
def show_img(self, isSend, imgPath):
|
||||
'THUMBNAIL_DIRPATH://th_29cd0f0ca87652943be9ede365aabeaa'
|
||||
imgPath = imgPath.split('th_')[1]
|
||||
imgPath = f'./app/data/image2/{imgPath[0:2]}/{imgPath[2:4]}/th_{imgPath}'
|
||||
html = '''
|
||||
<td style="border: 1px #000000 solid"><img align="right" src="%s"/></td>
|
||||
''' % imgPath
|
||||
style = 'vertical-align: top'
|
||||
if isSend:
|
||||
self.right(html, style=style)
|
||||
else:
|
||||
self.left(html, style=style)
|
||||
|
||||
def show_text(self, isSend, content):
|
||||
|
||||
if isSend:
|
||||
html = '''
|
||||
<td style="background-color: #9EEA6A;border-radius: 40px;"> %s </td>
|
||||
''' % (content)
|
||||
self.right(html)
|
||||
else:
|
||||
html = '''
|
||||
<td style="background-color: #fff;border-radius: 4px;"> %s </td>
|
||||
''' % (content)
|
||||
self.left(html)
|
||||
|
||||
def right(self, content, style='vertical-align: middle'):
|
||||
html = '''
|
||||
<div>
|
||||
<table align="right" style="%s;">
|
||||
<tbody>
|
||||
<tr>
|
||||
%s
|
||||
<td>:</td>
|
||||
<td style="border: 1px #000000 solid"><img align="right" src="%s" width="45" height="45"/></td>
|
||||
<td width="15"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
''' % (style, content, self.Me.my_avatar)
|
||||
# print('总的HTML')
|
||||
# print(html)
|
||||
self.message.insertHtml(html)
|
||||
|
||||
def left(self, content, style='vertical-align: middle'):
|
||||
html = '''
|
||||
<div>
|
||||
<table align="left" style="%s;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td width="15"></td>
|
||||
<td style="border: 1px #000000 solid"><img align="right" src="%s" width="45" height="45"/></td>
|
||||
<td>:</td>
|
||||
%s
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
''' % (style, self.ta_avatar, content)
|
||||
self.message.insertHtml(html)
|
||||
|
||||
def destroy_me(self):
|
||||
"""注销账户"""
|
||||
pass
|
||||
|
||||
|
||||
class Contact(QtWidgets.QPushButton):
|
||||
"""
|
||||
联系人类,继承自pyqt的按钮,里面封装了联系人头像等标签
|
||||
"""
|
||||
usernameSingal = pyqtSignal(str)
|
||||
|
||||
def __init__(self, Ui, id=None, contact=None):
|
||||
super(Contact, self).__init__(Ui)
|
||||
self.layoutWidget = QtWidgets.QWidget(Ui)
|
||||
self.layoutWidget.setObjectName("layoutWidget")
|
||||
self.gridLayout1 = QtWidgets.QGridLayout(self.layoutWidget)
|
||||
self.gridLayout1.setSizeConstraint(QtWidgets.QLayout.SetMaximumSize)
|
||||
self.gridLayout1.setContentsMargins(10, 10, 10, 10)
|
||||
self.gridLayout1.setSpacing(10)
|
||||
self.gridLayout1.setObjectName("gridLayout1")
|
||||
self.label_time = QtWidgets.QLabel(self.layoutWidget)
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
self.label_time.setFont(font)
|
||||
self.label_time.setLayoutDirection(QtCore.Qt.RightToLeft)
|
||||
self.label_time.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
|
||||
self.label_time.setObjectName("label_time")
|
||||
self.gridLayout1.addWidget(self.label_time, 0, 2, 1, 1)
|
||||
self.label_remark = QtWidgets.QLabel(self.layoutWidget)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("Adobe 黑体 Std R")
|
||||
font.setPointSize(10)
|
||||
self.label_remark.setFont(font)
|
||||
self.label_remark.setObjectName("label_remark")
|
||||
self.gridLayout1.addWidget(self.label_remark, 0, 1, 1, 1)
|
||||
self.label_msg = QtWidgets.QLabel(self.layoutWidget)
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
self.label_msg.setFont(font)
|
||||
self.label_msg.setObjectName("label_msg")
|
||||
self.gridLayout1.addWidget(self.label_msg, 1, 1, 1, 2)
|
||||
self.label_avatar = QtWidgets.QLabel(self.layoutWidget)
|
||||
self.label_avatar.setMinimumSize(QtCore.QSize(60, 60))
|
||||
self.label_avatar.setMaximumSize(QtCore.QSize(60, 60))
|
||||
self.label_avatar.setLayoutDirection(QtCore.Qt.RightToLeft)
|
||||
self.label_avatar.setAutoFillBackground(False)
|
||||
self.label_avatar.setStyleSheet("background-color: #ffffff;")
|
||||
self.label_avatar.setInputMethodHints(QtCore.Qt.ImhNone)
|
||||
self.label_avatar.setFrameShape(QtWidgets.QFrame.NoFrame)
|
||||
self.label_avatar.setFrameShadow(QtWidgets.QFrame.Plain)
|
||||
self.label_avatar.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
|
||||
self.label_avatar.setObjectName("label_avatar")
|
||||
self.gridLayout1.addWidget(self.label_avatar, 0, 0, 2, 1)
|
||||
self.gridLayout1.setColumnStretch(0, 1)
|
||||
self.gridLayout1.setColumnStretch(1, 6)
|
||||
self.gridLayout1.setRowStretch(0, 5)
|
||||
self.gridLayout1.setRowStretch(1, 3)
|
||||
self.setLayout(self.gridLayout1)
|
||||
self.setStyleSheet(
|
||||
"QPushButton {background-color: rgb(253,253,253);}"
|
||||
"QPushButton:hover{background-color: rgb(209,209,209);}\n"
|
||||
)
|
||||
self.msgCount = contact[0]
|
||||
self.username = contact[1]
|
||||
self.conversationTime = contact[6]
|
||||
self.msgType = contact[7]
|
||||
self.digest = contact[8]
|
||||
hasTrunc = contact[10]
|
||||
attrflag = contact[11]
|
||||
if hasTrunc == 0:
|
||||
if attrflag == 0:
|
||||
self.digest = '[动画表情]'
|
||||
elif attrflag == 67108864:
|
||||
try:
|
||||
remark = data.get_conRemark(contact[9])
|
||||
msg = self.digest.split(':')[1].strip('\n').strip()
|
||||
self.digest = f'{remark}:{msg}'
|
||||
except Exception as e:
|
||||
# print(self.digest)
|
||||
# print(e)
|
||||
pass
|
||||
else:
|
||||
pass
|
||||
self.show_info(id)
|
||||
|
||||
def show_info(self, id):
|
||||
avatar = data.get_avator(self.username)
|
||||
# print(avatar)
|
||||
remark = data.get_conRemark(self.username)
|
||||
time = datetime.datetime.now().strftime("%m-%d %H:%M")
|
||||
msg = '还没说话'
|
||||
pixmap = QPixmap(avatar).scaled(60, 60) # 按指定路径找到图片
|
||||
self.label_avatar.setPixmap(pixmap) # 在label上显示图片
|
||||
self.label_remark.setText(remark)
|
||||
self.label_msg.setText(self.digest)
|
||||
self.label_time.setText(data.timestamp2str(self.conversationTime)[2:])
|
||||
|
||||
def show_msg(self):
|
||||
self.usernameSingal.emit(self.username)
|
||||
|
||||
|
||||
class ChatMsg(QThread):
|
||||
"""
|
||||
发送信息线程
|
||||
"""
|
||||
isSend_signal = pyqtSignal(tuple)
|
||||
okSignal = pyqtSignal(int)
|
||||
|
||||
def __init__(self, my_u, ta_u, parent=None):
|
||||
super().__init__(parent)
|
||||
self.sec = 2 # 默认1000秒
|
||||
self.my_u = my_u
|
||||
self.ta_u = ta_u
|
||||
self.my_avatar = data.get_avator(my_u)
|
||||
self.msg_id = 0
|
||||
|
||||
def run(self):
|
||||
self.ta_avatar = data.get_avator(self.ta_u)
|
||||
messages = data.get_message(self.ta_u, self.msg_id)
|
||||
# messages.reverse()
|
||||
for message in messages:
|
||||
self.isSend_signal.emit(message)
|
||||
self.msg_id += 1
|
||||
self.okSignal.emit(1)
|
||||
|
||||
|
||||
class myTextEdit(QtWidgets.QTextEdit): # 继承 原本组件
|
||||
sendSignal = pyqtSignal(str)
|
||||
|
||||
def __init__(self, parent):
|
||||
QtWidgets.QTextEdit.__init__(self, parent)
|
||||
self.parent = parent
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
self.setHtml(_translate("Dialog",
|
||||
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
||||
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
|
||||
"p, li { white-space: pre-wrap; }\n"
|
||||
"</style></head><body style=\" font-family:\'SimSun\'; font-size:15pt; font-weight:400; font-style:normal;\">\n"
|
||||
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p></body></html>"))
|
||||
|
||||
def keyPressEvent(self, event):
|
||||
QtWidgets.QTextEdit.keyPressEvent(self, event)
|
||||
if event.key() == Qt.Key_Return: # 如果是Enter 按钮
|
||||
modifiers = event.modifiers()
|
||||
if modifiers == Qt.ControlModifier:
|
||||
print('success press ctrl+enter key', self.toPlainText())
|
||||
self.append('\0')
|
||||
return
|
||||
self.sendSignal.emit(self.toPlainText())
|
||||
print('success press enter key', self.toPlainText())
|
||||
|
||||
# if modifiers == (Qt.ControlModifier) and event.key() == Qt.Key_Return:
|
||||
# self.sendSignal.emit(self.toPlainText())
|
||||
# print('success press enter key', self.toPlainText())
|
130
app/Ui/chat/chatUi.py
Normal file
130
app/Ui/chat/chatUi.py
Normal file
@ -0,0 +1,130 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'chatUi.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.15.7
|
||||
#
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
|
||||
class Ui_Dialog(object):
|
||||
def setupUi(self, Dialog):
|
||||
Dialog.setObjectName("Dialog")
|
||||
Dialog.resize(1120, 720)
|
||||
Dialog.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
|
||||
Dialog.setAutoFillBackground(False)
|
||||
self.frame_2 = QtWidgets.QFrame(Dialog)
|
||||
self.frame_2.setGeometry(QtCore.QRect(0, 0, 1120, 720))
|
||||
self.frame_2.setFrameShape(QtWidgets.QFrame.StyledPanel)
|
||||
self.frame_2.setFrameShadow(QtWidgets.QFrame.Raised)
|
||||
self.frame_2.setObjectName("frame_2")
|
||||
self.scrollArea = QtWidgets.QScrollArea(self.frame_2)
|
||||
self.scrollArea.setEnabled(True)
|
||||
self.scrollArea.setGeometry(QtCore.QRect(0, 40, 326, 680))
|
||||
self.scrollArea.setMaximumSize(QtCore.QSize(400, 150000))
|
||||
self.scrollArea.setAutoFillBackground(False)
|
||||
self.scrollArea.setFrameShape(QtWidgets.QFrame.WinPanel)
|
||||
self.scrollArea.setFrameShadow(QtWidgets.QFrame.Raised)
|
||||
self.scrollArea.setMidLineWidth(0)
|
||||
self.scrollArea.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
|
||||
self.scrollArea.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
|
||||
self.scrollArea.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContentsOnFirstShow)
|
||||
self.scrollArea.setWidgetResizable(False)
|
||||
self.scrollArea.setObjectName("scrollArea")
|
||||
self.scrollAreaWidgetContents = QtWidgets.QWidget()
|
||||
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 300, 12000))
|
||||
self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
|
||||
self.pushButton_2 = QtWidgets.QPushButton(self.scrollAreaWidgetContents)
|
||||
self.pushButton_2.setGeometry(QtCore.QRect(0, 0, 300, 80))
|
||||
self.pushButton_2.setLayoutDirection(QtCore.Qt.LeftToRight)
|
||||
self.pushButton_2.setAutoFillBackground(False)
|
||||
self.pushButton_2.setText("")
|
||||
self.pushButton_2.setIconSize(QtCore.QSize(80, 80))
|
||||
self.pushButton_2.setObjectName("pushButton_2")
|
||||
self.label = QtWidgets.QLabel(self.scrollAreaWidgetContents)
|
||||
self.label.setGeometry(QtCore.QRect(220, 10, 72, 15))
|
||||
self.label.setObjectName("label")
|
||||
self.scrollArea.setWidget(self.scrollAreaWidgetContents)
|
||||
self.frame = QtWidgets.QFrame(self.frame_2)
|
||||
self.frame.setGeometry(QtCore.QRect(321, 0, 801, 720))
|
||||
self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
|
||||
self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
|
||||
self.frame.setObjectName("frame")
|
||||
self.message = QtWidgets.QTextBrowser(self.frame)
|
||||
self.message.setGeometry(QtCore.QRect(9, 39, 801, 541))
|
||||
self.message.setStyleSheet("background-color: #F5F5F5;")
|
||||
self.message.setObjectName("message")
|
||||
self.textEdit = QtWidgets.QTextEdit(self.frame)
|
||||
self.textEdit.setGeometry(QtCore.QRect(9, 579, 821, 141))
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(15)
|
||||
self.textEdit.setFont(font)
|
||||
self.textEdit.setTabStopWidth(80)
|
||||
self.textEdit.setCursorWidth(1)
|
||||
self.textEdit.setObjectName("textEdit")
|
||||
self.btn_sendMsg = QtWidgets.QPushButton(self.frame)
|
||||
self.btn_sendMsg.setGeometry(QtCore.QRect(680, 670, 121, 51))
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("黑体")
|
||||
font.setPointSize(15)
|
||||
font.setBold(False)
|
||||
font.setWeight(50)
|
||||
self.btn_sendMsg.setFont(font)
|
||||
self.btn_sendMsg.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
|
||||
self.btn_sendMsg.setMouseTracking(False)
|
||||
self.btn_sendMsg.setAutoFillBackground(False)
|
||||
self.btn_sendMsg.setStyleSheet("QPushButton {\n"
|
||||
" background-color: #f0f0f0;\n"
|
||||
" \n"
|
||||
" padding: 10px;\n"
|
||||
" color:rgb(5,180,104);\n"
|
||||
"}")
|
||||
self.btn_sendMsg.setIconSize(QtCore.QSize(40, 40))
|
||||
self.btn_sendMsg.setCheckable(False)
|
||||
self.btn_sendMsg.setAutoDefault(True)
|
||||
self.btn_sendMsg.setObjectName("btn_sendMsg")
|
||||
self.toolButton = QtWidgets.QToolButton(self.frame)
|
||||
self.toolButton.setGeometry(QtCore.QRect(760, 0, 47, 41))
|
||||
self.toolButton.setObjectName("toolButton")
|
||||
self.line_3 = QtWidgets.QFrame(self.frame)
|
||||
self.line_3.setGeometry(QtCore.QRect(2, 0, 3, 720))
|
||||
self.line_3.setLineWidth(6)
|
||||
self.line_3.setFrameShape(QtWidgets.QFrame.VLine)
|
||||
self.line_3.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||
self.line_3.setObjectName("line_3")
|
||||
self.line_2 = QtWidgets.QFrame(self.frame)
|
||||
self.line_2.setGeometry(QtCore.QRect(9, 30, 831, 20))
|
||||
self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
|
||||
self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||
self.line_2.setObjectName("line_2")
|
||||
self.label_remark = QtWidgets.QLabel(self.frame)
|
||||
self.label_remark.setGeometry(QtCore.QRect(30, 0, 351, 41))
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(12)
|
||||
self.label_remark.setFont(font)
|
||||
self.label_remark.setText("")
|
||||
self.label_remark.setObjectName("label_remark")
|
||||
self.line = QtWidgets.QFrame(self.frame)
|
||||
self.line.setGeometry(QtCore.QRect(20, 580, 800, 3))
|
||||
self.line.setFrameShape(QtWidgets.QFrame.HLine)
|
||||
self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||
self.line.setObjectName("line")
|
||||
|
||||
self.retranslateUi(Dialog)
|
||||
QtCore.QMetaObject.connectSlotsByName(Dialog)
|
||||
|
||||
def retranslateUi(self, Dialog):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
|
||||
self.label.setText(_translate("Dialog", "TextLabel"))
|
||||
self.textEdit.setHtml(_translate("Dialog", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
||||
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
|
||||
"p, li { white-space: pre-wrap; }\n"
|
||||
"</style></head><body style=\" font-family:\'SimSun\'; font-size:15pt; font-weight:400; font-style:normal;\">\n"
|
||||
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p></body></html>"))
|
||||
self.btn_sendMsg.setText(_translate("Dialog", "发送"))
|
||||
self.toolButton.setText(_translate("Dialog", "..."))
|
315
app/Ui/chat/chatUi.ui
Normal file
315
app/Ui/chat/chatUi.ui
Normal file
@ -0,0 +1,315 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Dialog</class>
|
||||
<widget class="QDialog" name="Dialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1120</width>
|
||||
<height>720</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>ArrowCursor</cursorShape>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<widget class="QFrame" name="frame_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1120</width>
|
||||
<height>720</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>40</y>
|
||||
<width>326</width>
|
||||
<height>680</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>150000</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::WinPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<property name="midLineWidth">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOn</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QAbstractScrollArea::AdjustToContentsOnFirstShow</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>300</width>
|
||||
<height>12000</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>300</width>
|
||||
<height>80</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>220</x>
|
||||
<y>10</y>
|
||||
<width>72</width>
|
||||
<height>15</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>321</x>
|
||||
<y>0</y>
|
||||
<width>801</width>
|
||||
<height>720</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<widget class="QTextBrowser" name="message">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>9</x>
|
||||
<y>39</y>
|
||||
<width>801</width>
|
||||
<height>541</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::ActionsContextMenu</enum>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: #F5F5F5;</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTextEdit" name="textEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>9</x>
|
||||
<y>579</y>
|
||||
<width>821</width>
|
||||
<height>141</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>15</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="html">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'SimSun'; font-size:15pt; font-weight:400; font-style:normal;">
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html></string>
|
||||
</property>
|
||||
<property name="tabStopWidth">
|
||||
<number>80</number>
|
||||
</property>
|
||||
<property name="cursorWidth">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="btn_sendMsg">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>680</x>
|
||||
<y>670</y>
|
||||
<width>121</width>
|
||||
<height>51</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>黑体</family>
|
||||
<pointsize>15</pointsize>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>ArrowCursor</cursorShape>
|
||||
</property>
|
||||
<property name="mouseTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton {
|
||||
background-color: #f0f0f0;
|
||||
|
||||
padding: 10px;
|
||||
color:rgb(5,180,104);
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>发送</string>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="toolButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>760</x>
|
||||
<y>0</y>
|
||||
<width>47</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>2</x>
|
||||
<y>0</y>
|
||||
<width>3</width>
|
||||
<height>720</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>9</x>
|
||||
<y>30</y>
|
||||
<width>831</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_remark">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>0</y>
|
||||
<width>351</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>580</y>
|
||||
<width>800</width>
|
||||
<height>3</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
107
app/Ui/chat/group/CreateGroup.py
Normal file
107
app/Ui/chat/group/CreateGroup.py
Normal file
@ -0,0 +1,107 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@File : CreateGroup.py
|
||||
@Author : Shuaikang Zhou
|
||||
@Time : 2022/12/20 22:55
|
||||
@IDE : Pycharm
|
||||
@Version : Python3.10
|
||||
@comment : ···
|
||||
"""
|
||||
from .create_groupUi import *
|
||||
from PyQt5.QtGui import *
|
||||
from PyQt5.QtWidgets import *
|
||||
from PyQt5.QtCore import *
|
||||
from ....DB import data
|
||||
import time
|
||||
|
||||
|
||||
class CreateGroupView(QWidget, Ui_Frame):
|
||||
backSignal = pyqtSignal(str)
|
||||
gidSignal = pyqtSignal(int)
|
||||
def __init__(self, username, parent=None):
|
||||
super(CreateGroupView, self).__init__(parent)
|
||||
self.setupUi(self)
|
||||
self.tips.setVisible(False)
|
||||
self.setWindowTitle('创建群聊')
|
||||
self.setWindowIcon(QIcon('./data/icon.png'))
|
||||
self.username = username
|
||||
# self.register_2.clicked.connect(self.login_)
|
||||
self.back.clicked.connect(self.btnEnterClicked)
|
||||
self.back.clicked.connect(self.btnEnterClicked)
|
||||
self.btn_set_gAvatar.clicked.connect(self.up_avatar)
|
||||
self.btn_create.clicked.connect(self.create_group)
|
||||
self.avatar = None
|
||||
|
||||
def up_avatar(self):
|
||||
path, _ = QFileDialog.getOpenFileName(self, 'Open file', r'..', "Image files (*.png;*.jpg)")
|
||||
if path:
|
||||
try:
|
||||
pixmap = QPixmap(path).scaled(80, 80) # 按指定路径找到图片
|
||||
self.avatar_img.setPixmap(pixmap) # 在label上显示图片
|
||||
self.avatar = path
|
||||
except:
|
||||
self.error.setText('头像不存在')
|
||||
|
||||
def create_group(self):
|
||||
# self.close()
|
||||
if not self.avatar:
|
||||
self.error.setText('请上传头像')
|
||||
return False
|
||||
name = self.group_name.text()
|
||||
intro = self.group_intro.toPlainText()
|
||||
# print(intro,self.username)
|
||||
flag = data.create_group(
|
||||
g_name=name,
|
||||
g_admin=self.username,
|
||||
g_intro=intro
|
||||
)
|
||||
# print('123456')
|
||||
# print(flag)
|
||||
if not flag:
|
||||
self.error.setText('创建失败')
|
||||
# print('yonghu已经存在')
|
||||
else:
|
||||
self.error.setText('创建成功')
|
||||
self.error.setStyleSheet("color:black")
|
||||
avatar = data.get_avator(str(flag))
|
||||
# new_path = '/'.join(avatar.split('/')[:-1])+'/'
|
||||
# print(avatar)
|
||||
if '.' in avatar[-10:]:
|
||||
avatar = '.'.join(avatar.split('.')[:-1])
|
||||
# print(avatar)
|
||||
data.mycopyfile(self.avatar, avatar + '.png')
|
||||
self.tips.setVisible(True)
|
||||
self.thread = MyThread() # 创建一个线程
|
||||
self.thread.sec_changed_signal.connect(self._update) # 线程发过来的信号挂接到槽:update
|
||||
self.thread.start()
|
||||
self.gidSignal.emit(int(flag))
|
||||
|
||||
def _update(self, sec):
|
||||
# self.time.setProperty("value", float(sec))
|
||||
# self.time.setDigitCount(sec)
|
||||
# self.time.s
|
||||
if sec == 0:
|
||||
self.btnEnterClicked()
|
||||
|
||||
def btnEnterClicked(self):
|
||||
print("退出创建群聊界面")
|
||||
# 中间可以添加处理逻辑
|
||||
self.backSignal.emit("back")
|
||||
self.close()
|
||||
|
||||
def btnExitClicked(self):
|
||||
print("Exit clicked")
|
||||
self.close()
|
||||
|
||||
|
||||
class MyThread(QThread):
|
||||
sec_changed_signal = pyqtSignal(int) # 信号类型:int
|
||||
|
||||
def __init__(self, sec=1000, parent=None):
|
||||
super().__init__(parent)
|
||||
self.sec = 2 # 默认1000秒
|
||||
|
||||
def run(self):
|
||||
for i in range(self.sec, -1, -1):
|
||||
self.sec_changed_signal.emit(i) # 发射信号
|
||||
time.sleep(1)
|
442
app/Ui/chat/group/Group.py
Normal file
442
app/Ui/chat/group/Group.py
Normal file
@ -0,0 +1,442 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@File : Group.py
|
||||
@Author : Shuaikang Zhou
|
||||
@Time : 2022/12/20 20:26
|
||||
@IDE : Pycharm
|
||||
@Version : Python3.10
|
||||
@comment : ···
|
||||
"""
|
||||
import datetime
|
||||
import json
|
||||
|
||||
from .GroupUi import *
|
||||
from PyQt5.QtGui import *
|
||||
from PyQt5.QtWidgets import *
|
||||
from PyQt5.QtCore import *
|
||||
from ....DB import data
|
||||
import time
|
||||
# from .chat import MainWinController
|
||||
from .create_groupUi import Ui_Frame
|
||||
from .CreateGroup import CreateGroupView
|
||||
from .addGroup import Ui_Frame as Add_GroupUi
|
||||
|
||||
|
||||
class GroupControl(QWidget, Ui_Form):
|
||||
backSignal = pyqtSignal(str)
|
||||
addSignal = pyqtSignal(int)
|
||||
|
||||
# createSignal = pyqtSignal(Group)
|
||||
|
||||
def __init__(self, parent=None, Me=None):
|
||||
super(GroupControl, self).__init__(parent)
|
||||
self.groups = None
|
||||
self.setupUi(self)
|
||||
self.Me = Me
|
||||
self.btn_create_group.clicked.connect(self.create_group_view)
|
||||
self.btn_add_group.clicked.connect(self.addGroupUi)
|
||||
self.btn_sendMsg.clicked.connect(self.sendMsg) # 发送信息按钮
|
||||
self.btn_del_group.clicked.connect(self.delete_group)
|
||||
self.toolButton.clicked.connect(self.about)
|
||||
self.frame_ag = QtWidgets.QFrame(self.frame)
|
||||
self.frame_ag.setGeometry(QtCore.QRect(0, 0, 800, 720))
|
||||
self.frame_ag.setFrameShape(QtWidgets.QFrame.Box)
|
||||
self.frame_ag.setFrameShadow(QtWidgets.QFrame.Raised)
|
||||
self.frame_ag.setObjectName("frame_cg")
|
||||
self.frame_ag.setVisible(False)
|
||||
self.addSignal.connect(self.new_groupUi)
|
||||
# print(self.username)
|
||||
self.groups = {}
|
||||
self.last_gid = None
|
||||
self.now_gid = None
|
||||
self.group_users = None
|
||||
self.last_msg_time = datetime.datetime(2022, 12, 19, 15, 4) # 上次信息的时间
|
||||
self.initUi()
|
||||
|
||||
def initUi(self):
|
||||
|
||||
groups = data.get_groups(self.Me.username)
|
||||
self.groups_num = len(groups)
|
||||
print('群组:', groups)
|
||||
max_hight = max(self.groups_num * 80, 680)
|
||||
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 300, max_hight))
|
||||
for i in range(len(groups)):
|
||||
group = groups[i]
|
||||
# print(contact)
|
||||
g_id = group[0]
|
||||
print('群聊信息:', group)
|
||||
pushButton_2 = OneGroup(self.scrollAreaWidgetContents, group)
|
||||
pushButton_2.setGeometry(QtCore.QRect(0, 80 * i, 300, 80))
|
||||
pushButton_2.setLayoutDirection(QtCore.Qt.LeftToRight)
|
||||
pushButton_2.clicked.connect(pushButton_2.show_msg)
|
||||
pushButton_2.gidSingal.connect(self.chat)
|
||||
self.groups[g_id] = pushButton_2
|
||||
|
||||
def chat(self, g_id):
|
||||
# self.frame_ag.setVisible(False)
|
||||
print('当前聊天群号:', g_id)
|
||||
self.frame_msg.setVisible(True)
|
||||
self.frame_ag.setVisible(False)
|
||||
self.now_gid = g_id
|
||||
self.group_users = data.get_group_users(g_id)
|
||||
# 将当前群的界面设置为灰色
|
||||
# if self.last_gid and self.last_gid != g_id:
|
||||
# self.groups[self.last_gid].setStyleSheet("background-color : rgb(253,253,253)")
|
||||
# self.last_gid = g_id
|
||||
# self.groups[g_id].setStyleSheet("background-color : rgb(198,198,198)")
|
||||
g_name = self.groups[g_id].g_name
|
||||
self.l_g_name.setText(f'{g_name}({g_id})')
|
||||
self.message.clear()
|
||||
self.message.append(str(g_id))
|
||||
# 创建新的线程用于显示聊天记录
|
||||
self.Thread = ChatMsg(self.Me.username, g_id, self.Me.socket)
|
||||
self.Thread.isSend_signal.connect(self.showMsg)
|
||||
self.Thread.recvSignal.connect(self.showMsg)
|
||||
self.Thread.sendSignal.connect(self.showMsg)
|
||||
self.Thread.start()
|
||||
pass
|
||||
|
||||
def sendMsg(self, msg):
|
||||
"""
|
||||
发送信息
|
||||
:param msg:信息内容
|
||||
:return:
|
||||
"""
|
||||
msg = self.textEdit.toPlainText()
|
||||
message = self.Thread.send_msg(msg)
|
||||
if message:
|
||||
print(msg, '发送成功')
|
||||
# self.showMsg(message)
|
||||
else:
|
||||
print(msg, '发送失败')
|
||||
self.textEdit.clear()
|
||||
|
||||
def create_group_view(self):
|
||||
"""建群界面"""
|
||||
self.frame_msg.setVisible(False)
|
||||
self.frame_ag.setVisible(False)
|
||||
# self.frame_ag.setVisible(True)
|
||||
# print(self.Me.__dict__)
|
||||
self.create_view = CreateGroupView(username=self.Me.username)
|
||||
self.create_view.gidSignal.connect(self.new_groupUi)
|
||||
self.create_view.show()
|
||||
|
||||
def addGroupBack(self):
|
||||
"""加群界面"""
|
||||
self.frame_msg.setVisible(True)
|
||||
self.frame_ag.setVisible(False)
|
||||
# self.CG_Ui = None
|
||||
|
||||
def delete_group(self):
|
||||
"""退群"""
|
||||
a = QMessageBox.question(self, '警告', '你确定要退群吗?', QMessageBox.Yes | QMessageBox.No,
|
||||
QMessageBox.No) # "退出"代表的是弹出框的标题,"你确认退出.."表示弹出框的内容
|
||||
if a == QMessageBox.Yes:
|
||||
data.delete_group(self.Me.username, self.now_gid)
|
||||
self.frame_msg.setVisible(False)
|
||||
self.last_gid = None
|
||||
self.groups_num -= 1
|
||||
self.l_g_name.setText('已退群')
|
||||
self.groups[self.now_gid].setVisible(False)
|
||||
self.groups.pop(self.now_gid)
|
||||
else:
|
||||
return
|
||||
|
||||
def show(self):
|
||||
self.message.append('2020303457')
|
||||
|
||||
def addGroupUi(self):
|
||||
"""加群的界面"""
|
||||
self.frame_msg.setVisible(False)
|
||||
self.CG_Ui = Add_GroupUi()
|
||||
self.CG_Ui.setupUi(self.frame_ag)
|
||||
self.CG_Ui.back.clicked.connect(self.addGroupBack)
|
||||
self.CG_Ui.btn_add.clicked.connect(self.addGroup)
|
||||
self.CG_Ui.btn_search.clicked.connect(self.searchGroup)
|
||||
self.frame_ag.setVisible(True)
|
||||
self.CG_Ui.tips.setVisible(False)
|
||||
self.CG_Ui.time.setVisible(False)
|
||||
pass
|
||||
|
||||
def searchGroup(self):
|
||||
"""搜索群聊"""
|
||||
gid = self.CG_Ui.line_g_id.text()
|
||||
if not gid:
|
||||
self.CG_Ui.error.setText('请输入群号')
|
||||
return False
|
||||
nickname = self.CG_Ui.line_nickname.text()
|
||||
group = data.search_group(gid)
|
||||
if not group:
|
||||
self.CG_Ui.error.setText('未找到群聊')
|
||||
return False
|
||||
avatar = data.get_avator(gid)
|
||||
pixmap = QPixmap(avatar).scaled(60, 60) # 按指定路径找到图片
|
||||
self.CG_Ui.avatar_img.setPixmap(pixmap) # 在label上显示图片
|
||||
return group
|
||||
|
||||
def addGroup(self):
|
||||
"""添加群聊"""
|
||||
gid = self.CG_Ui.line_g_id.text()
|
||||
gid = int(gid)
|
||||
nickname = self.CG_Ui.line_nickname.text()
|
||||
flag = data.add_group(self.Me.username, gid, nickname)
|
||||
if not flag:
|
||||
self.CG_Ui.error.setText('群聊不存在')
|
||||
return False
|
||||
avatar = data.get_avator(gid)
|
||||
pixmap = QPixmap(avatar).scaled(60, 60) # 按指定路径找到图片
|
||||
self.CG_Ui.avatar_img.setPixmap(pixmap) # 在label上显示图片
|
||||
self.CG_Ui.error.setText('加群成功')
|
||||
# self.addSignal.emit(gid)
|
||||
self.new_groupUi(gid)
|
||||
|
||||
def new_groupUi(self, gid):
|
||||
nickname = ''
|
||||
group = data.search_group(gid)
|
||||
if not group:
|
||||
return False
|
||||
g_name = group[1]
|
||||
self.groups_num += 1
|
||||
max_hight = max(self.groups_num * 80, 680)
|
||||
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 300, max_hight))
|
||||
group = [
|
||||
gid, g_name, nickname, 3, 1
|
||||
]
|
||||
# g_id = group[0]
|
||||
print('群聊信息:', group)
|
||||
pushButton_2 = OneGroup(self.scrollAreaWidgetContents, group)
|
||||
pushButton_2.setGeometry(QtCore.QRect(0, 80 * self.groups_num - 80, 300, 80))
|
||||
pushButton_2.setLayoutDirection(QtCore.Qt.LeftToRight)
|
||||
pushButton_2.clicked.connect(pushButton_2.show_msg)
|
||||
pushButton_2.gidSingal.connect(self.chat)
|
||||
# pushButton_2.setVisible(True)
|
||||
print('加群成功', gid)
|
||||
print(pushButton_2.g_id)
|
||||
self.groups[gid] = pushButton_2
|
||||
pushButton_2.setVisible(True)
|
||||
print(self.groups)
|
||||
print(self.now_gid, self.last_gid)
|
||||
|
||||
def showMsg(self, message):
|
||||
"""
|
||||
显示聊天消息
|
||||
:param message:
|
||||
:return:
|
||||
"""
|
||||
# print(message)
|
||||
gid = message[1]
|
||||
if self.now_gid is None or gid != self.now_gid:
|
||||
return
|
||||
# self.now_gid = gid
|
||||
talker = message[5]
|
||||
isSend = message[6]
|
||||
content = message[3]
|
||||
msg_time = message[4]
|
||||
# print(message)
|
||||
# print(msg_time, type(msg_time))
|
||||
self.check_time(msg_time)
|
||||
if isSend == 1 and talker == self.Me.username:
|
||||
# 自己发的信息在右边显示
|
||||
self.right(content, talker)
|
||||
else:
|
||||
# 收到的信息在左边显示
|
||||
self.left(content, talker)
|
||||
self.message.moveCursor(self.message.textCursor().End)
|
||||
|
||||
def about(self):
|
||||
group = data.search_group(self.now_gid)
|
||||
QMessageBox.about(
|
||||
self,
|
||||
"关于",
|
||||
f"关于本群\n群名:{group[1]}\n群号:{self.now_gid}"
|
||||
)
|
||||
|
||||
def check_time(self, msg_time):
|
||||
"""
|
||||
判断两次聊天时间是否大于五分钟
|
||||
超过五分钟就显示时间
|
||||
:param msg_time:
|
||||
:return:
|
||||
"""
|
||||
dt = msg_time - self.last_msg_time
|
||||
# print(msg_time)
|
||||
if dt.seconds >= 300:
|
||||
html = '''
|
||||
<table align="center" style="vertical-align: middle;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>%s</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>''' % (msg_time.strftime("%Y-%m-%d %H:%M"))
|
||||
# print(html)
|
||||
self.last_msg_time = msg_time
|
||||
self.message.insertHtml(html)
|
||||
|
||||
def right(self, content, taklekId):
|
||||
html = '''
|
||||
<div>
|
||||
<table align="right" style="vertical-align: middle;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>%s :</td>
|
||||
<td style="border: 1px #000000 solid"><img align="right" src="%s" width="45" height="45"/></td>
|
||||
<td width="15"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
''' % (content, self.Me.my_avatar)
|
||||
self.message.insertHtml(html)
|
||||
|
||||
def left(self, content, taklekId):
|
||||
avatar = data.get_avator(taklekId)
|
||||
html = '''
|
||||
<div>
|
||||
<table align="left" style="vertical-align: middle;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td width="15"></td>
|
||||
<td style="border: 1px #000000 solid"><img align="right" src="%s" width="45" height="45"/></td>
|
||||
<td>: %s</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
''' % (avatar, content)
|
||||
self.message.insertHtml(html)
|
||||
|
||||
|
||||
class OneGroup(QtWidgets.QPushButton):
|
||||
"""
|
||||
联系人类,继承自pyqt的按钮,里面封装了联系人头像等标签
|
||||
"""
|
||||
gidSingal = pyqtSignal(int)
|
||||
|
||||
def __init__(self, Ui, contact=None):
|
||||
super(OneGroup, self).__init__(Ui)
|
||||
self.layoutWidget = QtWidgets.QWidget(Ui)
|
||||
self.layoutWidget.setObjectName("layoutWidget")
|
||||
self.gridLayout1 = QtWidgets.QGridLayout(self.layoutWidget)
|
||||
self.gridLayout1.setSizeConstraint(QtWidgets.QLayout.SetMaximumSize)
|
||||
self.gridLayout1.setContentsMargins(10, 10, 10, 10)
|
||||
self.gridLayout1.setHorizontalSpacing(20)
|
||||
self.gridLayout1.setVerticalSpacing(10)
|
||||
self.gridLayout1.setObjectName("gridLayout1")
|
||||
self.time0_1 = QtWidgets.QLabel(self.layoutWidget)
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
self.time0_1.setFont(font)
|
||||
self.time0_1.setLayoutDirection(QtCore.Qt.RightToLeft)
|
||||
self.time0_1.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
|
||||
self.time0_1.setObjectName("time0_1")
|
||||
self.gridLayout1.addWidget(self.time0_1, 0, 2, 1, 1)
|
||||
self.remark1 = QtWidgets.QLabel(self.layoutWidget)
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(15)
|
||||
self.remark1.setFont(font)
|
||||
self.remark1.setObjectName("remark1")
|
||||
self.gridLayout1.addWidget(self.remark1, 0, 1, 1, 1)
|
||||
self.msg1 = QtWidgets.QLabel(self.layoutWidget)
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
self.msg1.setFont(font)
|
||||
self.msg1.setObjectName("msg1")
|
||||
self.gridLayout1.addWidget(self.msg1, 1, 1, 1, 2)
|
||||
self.image1 = QtWidgets.QLabel(self.layoutWidget)
|
||||
self.image1.setMinimumSize(QtCore.QSize(60, 60))
|
||||
self.image1.setMaximumSize(QtCore.QSize(60, 60))
|
||||
self.image1.setLayoutDirection(QtCore.Qt.RightToLeft)
|
||||
self.image1.setAutoFillBackground(False)
|
||||
self.image1.setStyleSheet("background-color: #ffffff;")
|
||||
self.image1.setInputMethodHints(QtCore.Qt.ImhNone)
|
||||
self.image1.setFrameShape(QtWidgets.QFrame.NoFrame)
|
||||
self.image1.setFrameShadow(QtWidgets.QFrame.Plain)
|
||||
self.image1.setAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignVCenter)
|
||||
self.image1.setObjectName("image1")
|
||||
self.gridLayout1.addWidget(self.image1, 0, 0, 2, 1)
|
||||
self.gridLayout1.setColumnStretch(0, 1)
|
||||
self.gridLayout1.setColumnStretch(1, 6)
|
||||
self.gridLayout1.setRowStretch(0, 5)
|
||||
self.gridLayout1.setRowStretch(1, 3)
|
||||
self.setLayout(self.gridLayout1)
|
||||
if contact:
|
||||
self.g_id = contact[0]
|
||||
self.g_name = contact[1]
|
||||
self.nickname = contact[2]
|
||||
self.type = contact[3]
|
||||
self.addTime = contact[4]
|
||||
self.show_info(id)
|
||||
|
||||
def show_info(self, id):
|
||||
if 1:
|
||||
# try:
|
||||
avatar = data.get_avator(self.g_id)
|
||||
remark = id
|
||||
time = datetime.datetime.now().strftime("%m-%d %H:%M")
|
||||
msg = '还没说话'
|
||||
pixmap = QPixmap(avatar).scaled(60, 60) # 按指定路径找到图片
|
||||
self.image1.setPixmap(pixmap) # 在label上显示图片
|
||||
self.remark1.setText(self.g_name)
|
||||
self.time0_1.setText(time)
|
||||
|
||||
def show_msg(self):
|
||||
print('点击的群号', self.g_id)
|
||||
self.gidSingal.emit(self.g_id)
|
||||
pass
|
||||
|
||||
|
||||
class ChatMsg(QThread):
|
||||
"""
|
||||
发送信息线程
|
||||
"""
|
||||
isSend_signal = pyqtSignal(tuple)
|
||||
recvSignal = pyqtSignal(tuple)
|
||||
sendSignal = pyqtSignal(tuple)
|
||||
|
||||
def __init__(self, my_u, g_id, socket, parent=None):
|
||||
super().__init__(parent)
|
||||
self.sec = 2 # 默认1000秒
|
||||
self.my_u = my_u
|
||||
self.g_id = g_id
|
||||
self.group_users = data.get_group_users(g_id)
|
||||
self.my_avatar = data.get_avator(my_u)
|
||||
self.socket = socket
|
||||
|
||||
def send_msg(self, msg):
|
||||
# 给群里所有在线的用户发送信息
|
||||
for group_user in self.group_users:
|
||||
username = group_user[0]
|
||||
if username == self.my_u:
|
||||
continue
|
||||
ta_port = group_user[4]
|
||||
nickname = group_user[3]
|
||||
self.ta_addr = ('localhost', ta_port)
|
||||
if ta_port == -1:
|
||||
print(f'{nickname}不在线')
|
||||
continue
|
||||
send_data = {
|
||||
'type': 'G',
|
||||
'gid': self.g_id,
|
||||
'username': self.my_u,
|
||||
'content': msg
|
||||
}
|
||||
print(f'{nickname}在线,{msg} 发送成功')
|
||||
self.socket.sendto(json.dumps(send_data).encode('utf-8'), self.ta_addr)
|
||||
message = data.send_group_msg(
|
||||
gid=self.g_id,
|
||||
msg=msg,
|
||||
talker=self.my_u,
|
||||
IsSend=1,
|
||||
_type=3
|
||||
)
|
||||
self.sendSignal.emit(message)
|
||||
return message
|
||||
|
||||
def run(self):
|
||||
# return
|
||||
messages = data.get_group_message(self.g_id)
|
||||
# print(messages)
|
||||
for message in messages:
|
||||
self.isSend_signal.emit(message)
|
||||
# self.recv_msg()
|
100
app/Ui/chat/group/GroupUi.py
Normal file
100
app/Ui/chat/group/GroupUi.py
Normal file
@ -0,0 +1,100 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'GroupUi.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.15.7
|
||||
#
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
|
||||
class Ui_Form(object):
|
||||
def setupUi(self, Form):
|
||||
Form.setObjectName("Form")
|
||||
Form.resize(1120, 720)
|
||||
self.scrollArea = QtWidgets.QScrollArea(Form)
|
||||
self.scrollArea.setGeometry(QtCore.QRect(-1, 70, 322, 651))
|
||||
self.scrollArea.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
|
||||
self.scrollArea.setWidgetResizable(True)
|
||||
self.scrollArea.setObjectName("scrollArea")
|
||||
self.scrollAreaWidgetContents = QtWidgets.QWidget()
|
||||
self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 299, 649))
|
||||
self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
|
||||
self.scrollArea.setWidget(self.scrollAreaWidgetContents)
|
||||
self.horizontalLayoutWidget = QtWidgets.QWidget(Form)
|
||||
self.horizontalLayoutWidget.setGeometry(QtCore.QRect(0, 0, 321, 71))
|
||||
self.horizontalLayoutWidget.setObjectName("horizontalLayoutWidget")
|
||||
self.horizontalLayout = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget)
|
||||
self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
|
||||
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||
self.btn_create_group = QtWidgets.QPushButton(self.horizontalLayoutWidget)
|
||||
self.btn_create_group.setObjectName("btn_create_group")
|
||||
self.horizontalLayout.addWidget(self.btn_create_group)
|
||||
self.btn_add_group = QtWidgets.QPushButton(self.horizontalLayoutWidget)
|
||||
self.btn_add_group.setObjectName("btn_add_group")
|
||||
self.horizontalLayout.addWidget(self.btn_add_group)
|
||||
self.frame = QtWidgets.QFrame(Form)
|
||||
self.frame.setGeometry(QtCore.QRect(320, 0, 800, 720))
|
||||
self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
|
||||
self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
|
||||
self.frame.setObjectName("frame")
|
||||
self.frame_msg = QtWidgets.QFrame(self.frame)
|
||||
self.frame_msg.setGeometry(QtCore.QRect(0, 0, 800, 720))
|
||||
self.frame_msg.setFrameShape(QtWidgets.QFrame.Box)
|
||||
self.frame_msg.setFrameShadow(QtWidgets.QFrame.Raised)
|
||||
self.frame_msg.setObjectName("frame_msg")
|
||||
self.message = QtWidgets.QTextBrowser(self.frame_msg)
|
||||
self.message.setGeometry(QtCore.QRect(0, 40, 800, 540))
|
||||
self.message.setObjectName("message")
|
||||
self.textEdit = QtWidgets.QTextEdit(self.frame_msg)
|
||||
self.textEdit.setGeometry(QtCore.QRect(0, 580, 800, 140))
|
||||
self.textEdit.setObjectName("textEdit")
|
||||
self.l_g_name = QtWidgets.QLabel(self.frame_msg)
|
||||
self.l_g_name.setGeometry(QtCore.QRect(10, 0, 431, 41))
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(15)
|
||||
self.l_g_name.setFont(font)
|
||||
self.l_g_name.setText("")
|
||||
self.l_g_name.setObjectName("l_g_name")
|
||||
self.btn_sendMsg = QtWidgets.QPushButton(self.frame_msg)
|
||||
self.btn_sendMsg.setGeometry(QtCore.QRect(678, 668, 121, 51))
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("黑体")
|
||||
font.setPointSize(15)
|
||||
font.setBold(False)
|
||||
font.setWeight(50)
|
||||
self.btn_sendMsg.setFont(font)
|
||||
self.btn_sendMsg.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
|
||||
self.btn_sendMsg.setMouseTracking(False)
|
||||
self.btn_sendMsg.setAutoFillBackground(False)
|
||||
self.btn_sendMsg.setStyleSheet("QPushButton {\n"
|
||||
" background-color: #f0f0f0;\n"
|
||||
" \n"
|
||||
" padding: 10px;\n"
|
||||
" color:rgb(5,180,104);\n"
|
||||
"}")
|
||||
self.btn_sendMsg.setIconSize(QtCore.QSize(40, 40))
|
||||
self.btn_sendMsg.setCheckable(False)
|
||||
self.btn_sendMsg.setAutoDefault(True)
|
||||
self.btn_sendMsg.setObjectName("btn_sendMsg")
|
||||
self.toolButton = QtWidgets.QToolButton(self.frame_msg)
|
||||
self.toolButton.setGeometry(QtCore.QRect(750, 10, 47, 21))
|
||||
self.toolButton.setObjectName("toolButton")
|
||||
self.btn_del_group = QtWidgets.QPushButton(self.frame_msg)
|
||||
self.btn_del_group.setGeometry(QtCore.QRect(650, 10, 93, 28))
|
||||
self.btn_del_group.setObjectName("btn_del_group")
|
||||
|
||||
self.retranslateUi(Form)
|
||||
QtCore.QMetaObject.connectSlotsByName(Form)
|
||||
|
||||
def retranslateUi(self, Form):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
Form.setWindowTitle(_translate("Form", "Form"))
|
||||
self.btn_create_group.setText(_translate("Form", "创建群聊"))
|
||||
self.btn_add_group.setText(_translate("Form", "添加群聊"))
|
||||
self.btn_sendMsg.setText(_translate("Form", "发送"))
|
||||
self.toolButton.setText(_translate("Form", "..."))
|
||||
self.btn_del_group.setText(_translate("Form", "退群"))
|
217
app/Ui/chat/group/GroupUi.ui
Normal file
217
app/Ui/chat/group/GroupUi.ui
Normal file
@ -0,0 +1,217 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Form</class>
|
||||
<widget class="QWidget" name="Form">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1120</width>
|
||||
<height>720</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>-1</x>
|
||||
<y>70</y>
|
||||
<width>322</width>
|
||||
<height>651</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOn</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>299</width>
|
||||
<height>649</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="horizontalLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>321</width>
|
||||
<height>71</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_create_group">
|
||||
<property name="text">
|
||||
<string>创建群聊</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_add_group">
|
||||
<property name="text">
|
||||
<string>添加群聊</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>320</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>720</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<widget class="QFrame" name="frame_msg">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>720</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<widget class="QTextBrowser" name="message">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>40</y>
|
||||
<width>800</width>
|
||||
<height>540</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTextEdit" name="textEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>580</y>
|
||||
<width>800</width>
|
||||
<height>140</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="l_g_name">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>0</y>
|
||||
<width>431</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>15</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="btn_sendMsg">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>678</x>
|
||||
<y>668</y>
|
||||
<width>121</width>
|
||||
<height>51</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>黑体</family>
|
||||
<pointsize>15</pointsize>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>ArrowCursor</cursorShape>
|
||||
</property>
|
||||
<property name="mouseTracking">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton {
|
||||
background-color: #f0f0f0;
|
||||
|
||||
padding: 10px;
|
||||
color:rgb(5,180,104);
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>发送</string>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="toolButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>750</x>
|
||||
<y>10</y>
|
||||
<width>47</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="btn_del_group">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>650</x>
|
||||
<y>10</y>
|
||||
<width>93</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>退群</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
9
app/Ui/chat/group/__init__.py
Normal file
9
app/Ui/chat/group/__init__.py
Normal file
@ -0,0 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@File : __init__.py.py
|
||||
@Author : Shuaikang Zhou
|
||||
@Time : 2022/12/24 10:33
|
||||
@IDE : Pycharm
|
||||
@Version : Python3.10
|
||||
@comment : ···
|
||||
"""
|
101
app/Ui/chat/group/addGroup.py
Normal file
101
app/Ui/chat/group/addGroup.py
Normal file
@ -0,0 +1,101 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'addGroup.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.15.7
|
||||
#
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
|
||||
class Ui_Frame(object):
|
||||
def setupUi(self, Frame):
|
||||
Frame.setObjectName("Frame")
|
||||
Frame.resize(800, 720)
|
||||
self.back = QtWidgets.QPushButton(Frame)
|
||||
self.back.setGeometry(QtCore.QRect(0, 0, 93, 28))
|
||||
self.back.setObjectName("back")
|
||||
self.avatar_img = QtWidgets.QLabel(Frame)
|
||||
self.avatar_img.setGeometry(QtCore.QRect(530, 130, 80, 80))
|
||||
self.avatar_img.setObjectName("avatar_img")
|
||||
self.label_3 = QtWidgets.QLabel(Frame)
|
||||
self.label_3.setGeometry(QtCore.QRect(230, 50, 221, 51))
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("一纸情书")
|
||||
font.setPointSize(20)
|
||||
self.label_3.setFont(font)
|
||||
self.label_3.setObjectName("label_3")
|
||||
self.layoutWidget = QtWidgets.QWidget(Frame)
|
||||
self.layoutWidget.setGeometry(QtCore.QRect(181, 113, 311, 281))
|
||||
self.layoutWidget.setObjectName("layoutWidget")
|
||||
self.verticalLayout = QtWidgets.QVBoxLayout(self.layoutWidget)
|
||||
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
|
||||
self.verticalLayout.setObjectName("verticalLayout")
|
||||
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||
self.label_2 = QtWidgets.QLabel(self.layoutWidget)
|
||||
self.label_2.setMinimumSize(QtCore.QSize(53, 0))
|
||||
self.label_2.setMaximumSize(QtCore.QSize(58, 16777215))
|
||||
self.label_2.setObjectName("label_2")
|
||||
self.horizontalLayout_2.addWidget(self.label_2)
|
||||
self.line_g_id = QtWidgets.QLineEdit(self.layoutWidget)
|
||||
self.line_g_id.setMinimumSize(QtCore.QSize(0, 50))
|
||||
self.line_g_id.setObjectName("line_g_id")
|
||||
self.horizontalLayout_2.addWidget(self.line_g_id)
|
||||
self.verticalLayout.addLayout(self.horizontalLayout_2)
|
||||
self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
|
||||
self.label_4 = QtWidgets.QLabel(self.layoutWidget)
|
||||
self.label_4.setMinimumSize(QtCore.QSize(38, 21))
|
||||
self.label_4.setMaximumSize(QtCore.QSize(58, 21))
|
||||
self.label_4.setObjectName("label_4")
|
||||
self.horizontalLayout_4.addWidget(self.label_4)
|
||||
self.line_nickname = QtWidgets.QLineEdit(self.layoutWidget)
|
||||
self.line_nickname.setMinimumSize(QtCore.QSize(0, 50))
|
||||
self.line_nickname.setMaximumSize(QtCore.QSize(100000, 50))
|
||||
self.line_nickname.setObjectName("line_nickname")
|
||||
self.horizontalLayout_4.addWidget(self.line_nickname)
|
||||
self.verticalLayout.addLayout(self.horizontalLayout_4)
|
||||
self.btn_search = QtWidgets.QPushButton(self.layoutWidget)
|
||||
self.btn_search.setObjectName("btn_search")
|
||||
self.verticalLayout.addWidget(self.btn_search)
|
||||
self.btn_add = QtWidgets.QPushButton(self.layoutWidget)
|
||||
self.btn_add.setObjectName("btn_add")
|
||||
self.verticalLayout.addWidget(self.btn_add)
|
||||
self.time = QtWidgets.QLCDNumber(Frame)
|
||||
self.time.setGeometry(QtCore.QRect(390, 400, 51, 61))
|
||||
self.time.setLineWidth(5)
|
||||
self.time.setDigitCount(1)
|
||||
self.time.setProperty("value", 8.0)
|
||||
self.time.setObjectName("time")
|
||||
self.error = QtWidgets.QLabel(Frame)
|
||||
self.error.setGeometry(QtCore.QRect(510, 340, 101, 16))
|
||||
self.error.setAutoFillBackground(False)
|
||||
self.error.setStyleSheet("color:red")
|
||||
self.error.setText("")
|
||||
self.error.setObjectName("error")
|
||||
self.toolButton = QtWidgets.QToolButton(Frame)
|
||||
self.toolButton.setGeometry(QtCore.QRect(750, 0, 47, 21))
|
||||
self.toolButton.setObjectName("toolButton")
|
||||
self.tips = QtWidgets.QLabel(Frame)
|
||||
self.tips.setGeometry(QtCore.QRect(230, 430, 61, 16))
|
||||
self.tips.setObjectName("tips")
|
||||
|
||||
self.retranslateUi(Frame)
|
||||
QtCore.QMetaObject.connectSlotsByName(Frame)
|
||||
|
||||
def retranslateUi(self, Frame):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
Frame.setWindowTitle(_translate("Frame", "Frame"))
|
||||
self.back.setText(_translate("Frame", "返回"))
|
||||
self.avatar_img.setText(_translate("Frame", "+"))
|
||||
self.label_3.setText(_translate("Frame", "添加群聊"))
|
||||
self.label_2.setText(_translate("Frame", "群 号:"))
|
||||
self.label_4.setText(_translate("Frame", "群昵称:"))
|
||||
self.btn_search.setText(_translate("Frame", "查找"))
|
||||
self.btn_add.setText(_translate("Frame", "添加"))
|
||||
self.toolButton.setText(_translate("Frame", "..."))
|
||||
self.tips.setText(_translate("Frame", "即将返回"))
|
226
app/Ui/chat/group/addGroup.ui
Normal file
226
app/Ui/chat/group/addGroup.ui
Normal file
@ -0,0 +1,226 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Frame</class>
|
||||
<widget class="QFrame" name="Frame">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>720</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Frame</string>
|
||||
</property>
|
||||
<widget class="QPushButton" name="back">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>93</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>返回</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="avatar_img">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>530</x>
|
||||
<y>130</y>
|
||||
<width>80</width>
|
||||
<height>80</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>+</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>230</x>
|
||||
<y>50</y>
|
||||
<width>221</width>
|
||||
<height>51</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>一纸情书</family>
|
||||
<pointsize>20</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>添加群聊</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>181</x>
|
||||
<y>113</y>
|
||||
<width>311</width>
|
||||
<height>281</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>53</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>58</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>群 号:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="line_g_id">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>38</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>58</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>群昵称:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="line_nickname">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100000</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_search">
|
||||
<property name="text">
|
||||
<string>查找</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_add">
|
||||
<property name="text">
|
||||
<string>添加</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QLCDNumber" name="time">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>390</x>
|
||||
<y>400</y>
|
||||
<width>51</width>
|
||||
<height>61</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="digitCount">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="value" stdset="0">
|
||||
<double>8.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="error">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>510</x>
|
||||
<y>340</y>
|
||||
<width>101</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">color:red</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="toolButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>750</x>
|
||||
<y>0</y>
|
||||
<width>47</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="tips">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>230</x>
|
||||
<y>430</y>
|
||||
<width>61</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>即将返回</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
113
app/Ui/chat/group/create_groupUi.py
Normal file
113
app/Ui/chat/group/create_groupUi.py
Normal file
@ -0,0 +1,113 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'create_groupUi.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.15.7
|
||||
#
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
|
||||
class Ui_Frame(object):
|
||||
def setupUi(self, Frame):
|
||||
Frame.setObjectName("Frame")
|
||||
Frame.resize(800, 720)
|
||||
self.error = QtWidgets.QLabel(Frame)
|
||||
self.error.setGeometry(QtCore.QRect(550, 80, 101, 16))
|
||||
self.error.setAutoFillBackground(False)
|
||||
self.error.setStyleSheet("color:red")
|
||||
self.error.setText("")
|
||||
self.error.setObjectName("error")
|
||||
self.tips = QtWidgets.QLabel(Frame)
|
||||
self.tips.setGeometry(QtCore.QRect(290, 630, 121, 16))
|
||||
self.tips.setObjectName("tips")
|
||||
self.layoutWidget = QtWidgets.QWidget(Frame)
|
||||
self.layoutWidget.setGeometry(QtCore.QRect(140, 70, 401, 511))
|
||||
self.layoutWidget.setObjectName("layoutWidget")
|
||||
self.verticalLayout = QtWidgets.QVBoxLayout(self.layoutWidget)
|
||||
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
|
||||
self.verticalLayout.setObjectName("verticalLayout")
|
||||
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||
self.label_2 = QtWidgets.QLabel(self.layoutWidget)
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(15)
|
||||
self.label_2.setFont(font)
|
||||
self.label_2.setObjectName("label_2")
|
||||
self.horizontalLayout_2.addWidget(self.label_2)
|
||||
self.group_name = QtWidgets.QLineEdit(self.layoutWidget)
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(15)
|
||||
self.group_name.setFont(font)
|
||||
self.group_name.setObjectName("group_name")
|
||||
self.horizontalLayout_2.addWidget(self.group_name)
|
||||
self.verticalLayout.addLayout(self.horizontalLayout_2)
|
||||
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||
self.label = QtWidgets.QLabel(self.layoutWidget)
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(15)
|
||||
self.label.setFont(font)
|
||||
self.label.setObjectName("label")
|
||||
self.horizontalLayout.addWidget(self.label)
|
||||
self.group_intro = QtWidgets.QTextEdit(self.layoutWidget)
|
||||
self.group_intro.setObjectName("group_intro")
|
||||
self.horizontalLayout.addWidget(self.group_intro)
|
||||
self.verticalLayout.addLayout(self.horizontalLayout)
|
||||
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
|
||||
self.btn_set_gAvatar = QtWidgets.QPushButton(self.layoutWidget)
|
||||
self.btn_set_gAvatar.setMinimumSize(QtCore.QSize(100, 50))
|
||||
self.btn_set_gAvatar.setMaximumSize(QtCore.QSize(100, 50))
|
||||
self.btn_set_gAvatar.setObjectName("btn_set_gAvatar")
|
||||
self.horizontalLayout_3.addWidget(self.btn_set_gAvatar)
|
||||
self.avatar_img = QtWidgets.QLabel(self.layoutWidget)
|
||||
self.avatar_img.setMinimumSize(QtCore.QSize(100, 100))
|
||||
self.avatar_img.setMaximumSize(QtCore.QSize(100, 100))
|
||||
self.avatar_img.setText("")
|
||||
self.avatar_img.setObjectName("avatar_img")
|
||||
self.horizontalLayout_3.addWidget(self.avatar_img)
|
||||
self.verticalLayout.addLayout(self.horizontalLayout_3)
|
||||
self.btn_create = QtWidgets.QPushButton(self.layoutWidget)
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(15)
|
||||
self.btn_create.setFont(font)
|
||||
self.btn_create.setObjectName("btn_create")
|
||||
self.verticalLayout.addWidget(self.btn_create)
|
||||
self.label_3 = QtWidgets.QLabel(Frame)
|
||||
self.label_3.setGeometry(QtCore.QRect(260, 0, 221, 51))
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("一纸情书")
|
||||
font.setPointSize(20)
|
||||
self.label_3.setFont(font)
|
||||
self.label_3.setObjectName("label_3")
|
||||
self.back = QtWidgets.QPushButton(Frame)
|
||||
self.back.setGeometry(QtCore.QRect(0, 0, 91, 28))
|
||||
self.back.setObjectName("back")
|
||||
self.toolButton = QtWidgets.QToolButton(Frame)
|
||||
self.toolButton.setGeometry(QtCore.QRect(750, 0, 47, 21))
|
||||
self.toolButton.setObjectName("toolButton")
|
||||
|
||||
self.retranslateUi(Frame)
|
||||
QtCore.QMetaObject.connectSlotsByName(Frame)
|
||||
|
||||
def retranslateUi(self, Frame):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
Frame.setWindowTitle(_translate("Frame", "Frame"))
|
||||
self.tips.setText(_translate("Frame", "创建群聊成功"))
|
||||
self.label_2.setText(_translate("Frame", "群 名:"))
|
||||
self.group_name.setText(_translate("Frame", "请输入群名"))
|
||||
self.label.setText(_translate("Frame", "群简介:"))
|
||||
self.group_intro.setHtml(_translate("Frame", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
||||
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
|
||||
"p, li { white-space: pre-wrap; }\n"
|
||||
"</style></head><body style=\" font-family:\'SimSun\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">在这里介绍你的群聊(不超过150字)</p></body></html>"))
|
||||
self.btn_set_gAvatar.setText(_translate("Frame", "选择群头像"))
|
||||
self.btn_create.setText(_translate("Frame", "创建"))
|
||||
self.label_3.setText(_translate("Frame", "创建群聊"))
|
||||
self.back.setText(_translate("Frame", "返回"))
|
||||
self.toolButton.setText(_translate("Frame", "..."))
|
217
app/Ui/chat/group/create_groupUi.ui
Normal file
217
app/Ui/chat/group/create_groupUi.ui
Normal file
@ -0,0 +1,217 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Frame</class>
|
||||
<widget class="QFrame" name="Frame">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>720</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Frame</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="error">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>550</x>
|
||||
<y>80</y>
|
||||
<width>101</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">color:red</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="tips">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>290</x>
|
||||
<y>630</y>
|
||||
<width>121</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>创建群聊成功</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>140</x>
|
||||
<y>70</y>
|
||||
<width>401</width>
|
||||
<height>511</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>15</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>群 名:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="group_name">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>15</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>请输入群名</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>15</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>群简介:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="group_intro">
|
||||
<property name="html">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'SimSun'; font-size:9pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">在这里介绍你的群聊(不超过150字)</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_set_gAvatar">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>选择群头像</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="avatar_img">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>100</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>100</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_create">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>15</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>创建</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>260</x>
|
||||
<y>0</y>
|
||||
<width>221</width>
|
||||
<height>51</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>一纸情书</family>
|
||||
<pointsize>20</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>创建群聊</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="back">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>91</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>返回</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolButton" name="toolButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>750</x>
|
||||
<y>0</y>
|
||||
<width>47</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
9
app/Ui/chat/myinfo/__init__.py
Normal file
9
app/Ui/chat/myinfo/__init__.py
Normal file
@ -0,0 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@File : __init__.py.py
|
||||
@Author : Shuaikang Zhou
|
||||
@Time : 2022/12/24 10:33
|
||||
@IDE : Pycharm
|
||||
@Version : Python3.10
|
||||
@comment : ···
|
||||
"""
|
67
app/Ui/chat/myinfo/myinfo.py
Normal file
67
app/Ui/chat/myinfo/myinfo.py
Normal file
@ -0,0 +1,67 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@File : myinfo.py
|
||||
@Author : Shuaikang Zhou
|
||||
@Time : 2022/12/23 11:45
|
||||
@IDE : Pycharm
|
||||
@Version : Python3.10
|
||||
@comment : ···
|
||||
"""
|
||||
from PyQt5.QtGui import *
|
||||
from PyQt5.QtWidgets import *
|
||||
from PyQt5.QtCore import *
|
||||
from .myinfoUi import *
|
||||
from ....DB import data
|
||||
|
||||
|
||||
class InfoControl(QWidget, Ui_Frame):
|
||||
backSignal = pyqtSignal(str)
|
||||
|
||||
# createSignal = pyqtSignal(Group)
|
||||
def __init__(self, parent=None, Me=None):
|
||||
super(InfoControl, self).__init__(parent)
|
||||
self.setupUi(self)
|
||||
self.Me = Me
|
||||
self.initUi()
|
||||
self.btn_update.clicked.connect(self.update_)
|
||||
|
||||
def initUi(self):
|
||||
self.ltips.setText('')
|
||||
self.info = data.get_myinfo(self.Me.username)
|
||||
nickname = self.info[1]
|
||||
gender = self.info[2]
|
||||
city = self.info[4]
|
||||
province = self.info[5]
|
||||
tel = self.info[6]
|
||||
email = self.info[7]
|
||||
signsture = self.info[8]
|
||||
pixmap = QPixmap(self.Me.my_avatar).scaled(80, 80) # 按指定路径找到图片
|
||||
self.l_avatar.setPixmap(pixmap) # 在label上显示图片
|
||||
self.l_username.setText(f'账号:{self.Me.username}')
|
||||
if gender=='男':
|
||||
self.radioButton.setChecked(True)
|
||||
elif gender=='女':
|
||||
self.radioButton_2.setChecked(True)
|
||||
self.line_nickname.setText(nickname)
|
||||
self.line_city.setText(city)
|
||||
self.line_tel.setText(tel)
|
||||
self.line_province.setText(province)
|
||||
self.line_email.setText(email)
|
||||
self.line_signsture.setText(signsture)
|
||||
def update_(self):
|
||||
"""更新信息"""
|
||||
nickname = self.line_nickname.text()
|
||||
if self.radioButton.isChecked():
|
||||
gender = self.radioButton.text()
|
||||
else:
|
||||
gender = '女'
|
||||
city = self.line_city.text()
|
||||
province = self.line_province.text()
|
||||
tel = self.line_tel.text()
|
||||
email = self.line_email.text()
|
||||
signsture = self.line_signsture.text()
|
||||
userinfo = [
|
||||
nickname,gender,city,province,tel,email,signsture,self.Me.username
|
||||
]
|
||||
data.update_userinfo(userinfo)
|
||||
self.ltips.setText('修改成功')
|
128
app/Ui/chat/myinfo/myinfoUi.py
Normal file
128
app/Ui/chat/myinfo/myinfoUi.py
Normal file
@ -0,0 +1,128 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'myinfoUi.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.15.7
|
||||
#
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
|
||||
class Ui_Frame(object):
|
||||
def setupUi(self, Frame):
|
||||
Frame.setObjectName("Frame")
|
||||
Frame.resize(1120, 720)
|
||||
self.l_avatar = QtWidgets.QLabel(Frame)
|
||||
self.l_avatar.setGeometry(QtCore.QRect(370, 140, 80, 80))
|
||||
self.l_avatar.setText("")
|
||||
self.l_avatar.setPixmap(QtGui.QPixmap("../../../a_img/微信图片_20221215224740.jpg"))
|
||||
self.l_avatar.setScaledContents(True)
|
||||
self.l_avatar.setObjectName("l_avatar")
|
||||
self.btn_update = QtWidgets.QPushButton(Frame)
|
||||
self.btn_update.setGeometry(QtCore.QRect(370, 610, 93, 28))
|
||||
self.btn_update.setObjectName("btn_update")
|
||||
self.ltips = QtWidgets.QLabel(Frame)
|
||||
self.ltips.setGeometry(QtCore.QRect(490, 620, 72, 15))
|
||||
self.ltips.setText("")
|
||||
self.ltips.setObjectName("ltips")
|
||||
self.widget = QtWidgets.QWidget(Frame)
|
||||
self.widget.setGeometry(QtCore.QRect(270, 260, 281, 311))
|
||||
self.widget.setObjectName("widget")
|
||||
self.verticalLayout = QtWidgets.QVBoxLayout(self.widget)
|
||||
self.verticalLayout.setSizeConstraint(QtWidgets.QLayout.SetMinAndMaxSize)
|
||||
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
|
||||
self.verticalLayout.setObjectName("verticalLayout")
|
||||
self.l_username = QtWidgets.QLabel(self.widget)
|
||||
self.l_username.setObjectName("l_username")
|
||||
self.verticalLayout.addWidget(self.l_username)
|
||||
self.horizontalLayout_6 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_6.setObjectName("horizontalLayout_6")
|
||||
self.l_nickname = QtWidgets.QLabel(self.widget)
|
||||
self.l_nickname.setObjectName("l_nickname")
|
||||
self.horizontalLayout_6.addWidget(self.l_nickname)
|
||||
self.line_nickname = QtWidgets.QLineEdit(self.widget)
|
||||
self.line_nickname.setObjectName("line_nickname")
|
||||
self.horizontalLayout_6.addWidget(self.line_nickname)
|
||||
self.verticalLayout.addLayout(self.horizontalLayout_6)
|
||||
self.horizontalLayout_7 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_7.setObjectName("horizontalLayout_7")
|
||||
self.l_gender = QtWidgets.QLabel(self.widget)
|
||||
self.l_gender.setObjectName("l_gender")
|
||||
self.horizontalLayout_7.addWidget(self.l_gender)
|
||||
self.radioButton = QtWidgets.QRadioButton(self.widget)
|
||||
self.radioButton.setObjectName("radioButton")
|
||||
self.horizontalLayout_7.addWidget(self.radioButton)
|
||||
self.radioButton_2 = QtWidgets.QRadioButton(self.widget)
|
||||
self.radioButton_2.setObjectName("radioButton_2")
|
||||
self.horizontalLayout_7.addWidget(self.radioButton_2)
|
||||
self.verticalLayout.addLayout(self.horizontalLayout_7)
|
||||
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||
self.l_nickname_3 = QtWidgets.QLabel(self.widget)
|
||||
self.l_nickname_3.setObjectName("l_nickname_3")
|
||||
self.horizontalLayout_2.addWidget(self.l_nickname_3)
|
||||
self.line_city = QtWidgets.QLineEdit(self.widget)
|
||||
self.line_city.setText("")
|
||||
self.line_city.setObjectName("line_city")
|
||||
self.horizontalLayout_2.addWidget(self.line_city)
|
||||
self.verticalLayout.addLayout(self.horizontalLayout_2)
|
||||
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||
self.l_nickname_2 = QtWidgets.QLabel(self.widget)
|
||||
self.l_nickname_2.setObjectName("l_nickname_2")
|
||||
self.horizontalLayout.addWidget(self.l_nickname_2)
|
||||
self.line_province = QtWidgets.QLineEdit(self.widget)
|
||||
self.line_province.setObjectName("line_province")
|
||||
self.horizontalLayout.addWidget(self.line_province)
|
||||
self.verticalLayout.addLayout(self.horizontalLayout)
|
||||
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
|
||||
self.l_tel = QtWidgets.QLabel(self.widget)
|
||||
self.l_tel.setObjectName("l_tel")
|
||||
self.horizontalLayout_3.addWidget(self.l_tel)
|
||||
self.line_tel = QtWidgets.QLineEdit(self.widget)
|
||||
self.line_tel.setText("")
|
||||
self.line_tel.setObjectName("line_tel")
|
||||
self.horizontalLayout_3.addWidget(self.line_tel)
|
||||
self.verticalLayout.addLayout(self.horizontalLayout_3)
|
||||
self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
|
||||
self.l_nickname_5 = QtWidgets.QLabel(self.widget)
|
||||
self.l_nickname_5.setObjectName("l_nickname_5")
|
||||
self.horizontalLayout_4.addWidget(self.l_nickname_5)
|
||||
self.line_email = QtWidgets.QLineEdit(self.widget)
|
||||
self.line_email.setText("")
|
||||
self.line_email.setObjectName("line_email")
|
||||
self.horizontalLayout_4.addWidget(self.line_email)
|
||||
self.verticalLayout.addLayout(self.horizontalLayout_4)
|
||||
self.horizontalLayout_5 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_5.setObjectName("horizontalLayout_5")
|
||||
self.l_nickname_6 = QtWidgets.QLabel(self.widget)
|
||||
self.l_nickname_6.setObjectName("l_nickname_6")
|
||||
self.horizontalLayout_5.addWidget(self.l_nickname_6)
|
||||
self.line_signsture = QtWidgets.QLineEdit(self.widget)
|
||||
self.line_signsture.setText("")
|
||||
self.line_signsture.setObjectName("line_signsture")
|
||||
self.horizontalLayout_5.addWidget(self.line_signsture)
|
||||
self.verticalLayout.addLayout(self.horizontalLayout_5)
|
||||
|
||||
self.retranslateUi(Frame)
|
||||
QtCore.QMetaObject.connectSlotsByName(Frame)
|
||||
|
||||
def retranslateUi(self, Frame):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
Frame.setWindowTitle(_translate("Frame", "Frame"))
|
||||
self.btn_update.setText(_translate("Frame", "修改资料"))
|
||||
self.l_username.setText(_translate("Frame", "账号:2020303457"))
|
||||
self.l_nickname.setText(_translate("Frame", "昵称:"))
|
||||
self.l_gender.setText(_translate("Frame", "性别:"))
|
||||
self.radioButton.setText(_translate("Frame", "男"))
|
||||
self.radioButton_2.setText(_translate("Frame", "女"))
|
||||
self.l_nickname_3.setText(_translate("Frame", "城市:"))
|
||||
self.l_nickname_2.setText(_translate("Frame", "省份:"))
|
||||
self.l_tel.setText(_translate("Frame", "电话:"))
|
||||
self.l_nickname_5.setText(_translate("Frame", "邮箱:"))
|
||||
self.l_nickname_6.setText(_translate("Frame", "签名:"))
|
211
app/Ui/chat/myinfo/myinfoUi.ui
Normal file
211
app/Ui/chat/myinfo/myinfoUi.ui
Normal file
@ -0,0 +1,211 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Frame</class>
|
||||
<widget class="QFrame" name="Frame">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1120</width>
|
||||
<height>720</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Frame</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="l_avatar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>370</x>
|
||||
<y>140</y>
|
||||
<width>80</width>
|
||||
<height>80</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap>../../../a_img/微信图片_20221215224740.jpg</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="btn_update">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>370</x>
|
||||
<y>610</y>
|
||||
<width>93</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>修改资料</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="ltips">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>490</x>
|
||||
<y>620</y>
|
||||
<width>72</width>
|
||||
<height>15</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>270</x>
|
||||
<y>260</y>
|
||||
<width>281</width>
|
||||
<height>311</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMinAndMaxSize</enum>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="l_username">
|
||||
<property name="text">
|
||||
<string>账号:2020303457</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="QLabel" name="l_nickname">
|
||||
<property name="text">
|
||||
<string>昵称:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="line_nickname"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QLabel" name="l_gender">
|
||||
<property name="text">
|
||||
<string>性别:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton">
|
||||
<property name="text">
|
||||
<string>男</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton_2">
|
||||
<property name="text">
|
||||
<string>女</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="l_nickname_3">
|
||||
<property name="text">
|
||||
<string>城市:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="line_city">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="l_nickname_2">
|
||||
<property name="text">
|
||||
<string>省份:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="line_province"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="l_tel">
|
||||
<property name="text">
|
||||
<string>电话:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="line_tel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="l_nickname_5">
|
||||
<property name="text">
|
||||
<string>邮箱:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="line_email">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QLabel" name="l_nickname_6">
|
||||
<property name="text">
|
||||
<string>签名:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="line_signsture">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
9
app/Ui/chat/userinfo/__init__.py
Normal file
9
app/Ui/chat/userinfo/__init__.py
Normal file
@ -0,0 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@File : __init__.py.py
|
||||
@Author : Shuaikang Zhou
|
||||
@Time : 2022/12/24 10:34
|
||||
@IDE : Pycharm
|
||||
@Version : Python3.10
|
||||
@comment : ···
|
||||
"""
|
100
app/Ui/chat/userinfo/userinfoUi.py
Normal file
100
app/Ui/chat/userinfo/userinfoUi.py
Normal file
@ -0,0 +1,100 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'userinfoUi.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.15.7
|
||||
#
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
|
||||
class Ui_Frame(object):
|
||||
def setupUi(self, Frame):
|
||||
Frame.setObjectName("Frame")
|
||||
Frame.resize(800, 720)
|
||||
Frame.setCursor(QtGui.QCursor(QtCore.Qt.IBeamCursor))
|
||||
Frame.setMouseTracking(True)
|
||||
Frame.setTabletTracking(True)
|
||||
self.widget = QtWidgets.QWidget(Frame)
|
||||
self.widget.setGeometry(QtCore.QRect(210, 100, 429, 81))
|
||||
self.widget.setObjectName("widget")
|
||||
self.gridLayout = QtWidgets.QGridLayout(self.widget)
|
||||
self.gridLayout.setContentsMargins(0, 0, 0, 0)
|
||||
self.gridLayout.setObjectName("gridLayout")
|
||||
self.l_avatar = QtWidgets.QLabel(self.widget)
|
||||
self.l_avatar.setMinimumSize(QtCore.QSize(80, 80))
|
||||
self.l_avatar.setMaximumSize(QtCore.QSize(80, 80))
|
||||
self.l_avatar.setText("")
|
||||
self.l_avatar.setPixmap(QtGui.QPixmap("../../../a_img/be0fa6c0c4707fb5f7b37b660de826d3.jpg"))
|
||||
self.l_avatar.setScaledContents(True)
|
||||
self.l_avatar.setObjectName("l_avatar")
|
||||
self.gridLayout.addWidget(self.l_avatar, 0, 0, 3, 1)
|
||||
self.l_remark = QtWidgets.QLabel(self.widget)
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(15)
|
||||
self.l_remark.setFont(font)
|
||||
self.l_remark.setObjectName("l_remark")
|
||||
self.gridLayout.addWidget(self.l_remark, 0, 1, 1, 1)
|
||||
self.l_nickname = QtWidgets.QLabel(self.widget)
|
||||
self.l_nickname.setObjectName("l_nickname")
|
||||
self.gridLayout.addWidget(self.l_nickname, 1, 1, 1, 1)
|
||||
self.l_username = QtWidgets.QLabel(self.widget)
|
||||
self.l_username.setObjectName("l_username")
|
||||
self.gridLayout.addWidget(self.l_username, 2, 1, 1, 1)
|
||||
self.horizontalLayoutWidget = QtWidgets.QWidget(Frame)
|
||||
self.horizontalLayoutWidget.setGeometry(QtCore.QRect(210, 210, 429, 71))
|
||||
self.horizontalLayoutWidget.setObjectName("horizontalLayoutWidget")
|
||||
self.horizontalLayout = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget)
|
||||
self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
|
||||
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||
self.label = QtWidgets.QLabel(self.horizontalLayoutWidget)
|
||||
self.label.setMinimumSize(QtCore.QSize(80, 0))
|
||||
self.label.setMaximumSize(QtCore.QSize(80, 16777215))
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(15)
|
||||
self.label.setFont(font)
|
||||
self.label.setObjectName("label")
|
||||
self.horizontalLayout.addWidget(self.label)
|
||||
self.lineEdit = QtWidgets.QLineEdit(self.horizontalLayoutWidget)
|
||||
self.lineEdit.setMinimumSize(QtCore.QSize(0, 25))
|
||||
self.lineEdit.setMaximumSize(QtCore.QSize(16777215, 25))
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(15)
|
||||
self.lineEdit.setFont(font)
|
||||
self.lineEdit.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
|
||||
self.lineEdit.setAutoFillBackground(False)
|
||||
self.lineEdit.setStyleSheet("background:transparent;border-width:0;border-style:outset")
|
||||
self.lineEdit.setObjectName("lineEdit")
|
||||
self.horizontalLayout.addWidget(self.lineEdit)
|
||||
self.btn_update_remark = QtWidgets.QPushButton(self.horizontalLayoutWidget)
|
||||
self.btn_update_remark.setMinimumSize(QtCore.QSize(140, 40))
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(12)
|
||||
self.btn_update_remark.setFont(font)
|
||||
self.btn_update_remark.setObjectName("btn_update_remark")
|
||||
self.horizontalLayout.addWidget(self.btn_update_remark)
|
||||
self.btn_delete_contact = QtWidgets.QPushButton(Frame)
|
||||
self.btn_delete_contact.setGeometry(QtCore.QRect(330, 370, 140, 40))
|
||||
self.btn_delete_contact.setMinimumSize(QtCore.QSize(140, 40))
|
||||
self.btn_delete_contact.setMaximumSize(QtCore.QSize(140, 40))
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(12)
|
||||
self.btn_delete_contact.setFont(font)
|
||||
self.btn_delete_contact.setObjectName("btn_delete_contact")
|
||||
|
||||
self.retranslateUi(Frame)
|
||||
QtCore.QMetaObject.connectSlotsByName(Frame)
|
||||
|
||||
def retranslateUi(self, Frame):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
Frame.setWindowTitle(_translate("Frame", "Frame"))
|
||||
self.l_remark.setText(_translate("Frame", "曹雨萱"))
|
||||
self.l_nickname.setText(_translate("Frame", "昵称:997"))
|
||||
self.l_username.setText(_translate("Frame", "账号:TextLabel"))
|
||||
self.label.setText(_translate("Frame", "备注名"))
|
||||
self.lineEdit.setText(_translate("Frame", "曹雨萱"))
|
||||
self.btn_update_remark.setText(_translate("Frame", "修改备注"))
|
||||
self.btn_delete_contact.setText(_translate("Frame", "删除好友"))
|
208
app/Ui/chat/userinfo/userinfoUi.ui
Normal file
208
app/Ui/chat/userinfo/userinfoUi.ui
Normal file
@ -0,0 +1,208 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Frame</class>
|
||||
<widget class="QFrame" name="Frame">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>720</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="mouseTracking">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="tabletTracking">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Frame</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>210</x>
|
||||
<y>100</y>
|
||||
<width>429</width>
|
||||
<height>81</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" rowspan="3">
|
||||
<widget class="QLabel" name="l_avatar">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap>../../../a_img/be0fa6c0c4707fb5f7b37b660de826d3.jpg</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="l_remark">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>15</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>曹雨萱</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="l_nickname">
|
||||
<property name="text">
|
||||
<string>昵称:997</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="l_username">
|
||||
<property name="text">
|
||||
<string>账号:TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="horizontalLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>210</x>
|
||||
<y>210</y>
|
||||
<width>429</width>
|
||||
<height>71</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>15</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>备注名</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>15</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>ArrowCursor</cursorShape>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background:transparent;border-width:0;border-style:outset</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>曹雨萱</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_update_remark">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>140</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>修改备注</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="btn_delete_contact">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>330</x>
|
||||
<y>370</y>
|
||||
<width>140</width>
|
||||
<height>40</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>140</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>140</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>删除好友</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
153
app/Ui/decrypt/decrypt.py
Normal file
153
app/Ui/decrypt/decrypt.py
Normal file
@ -0,0 +1,153 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@File : decrypt.py
|
||||
@Author : Shuaikang Zhou
|
||||
@Time : 2023/1/5 18:13
|
||||
@IDE : Pycharm
|
||||
@Version : Python3.10
|
||||
@comment : ···
|
||||
"""
|
||||
import hashlib
|
||||
import os
|
||||
import time
|
||||
|
||||
from PyQt5.QtGui import *
|
||||
from PyQt5.QtWidgets import *
|
||||
from PyQt5.QtCore import *
|
||||
from . import decryptUi
|
||||
from ...DataBase import data
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
|
||||
class DecryptControl(QWidget, decryptUi.Ui_Dialog):
|
||||
DecryptSignal = pyqtSignal(str)
|
||||
registerSignal = pyqtSignal(str)
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super(DecryptControl, self).__init__(parent)
|
||||
self.setupUi(self)
|
||||
self.setWindowTitle('解密')
|
||||
self.setWindowIcon(QIcon('./app/data/icon.png'))
|
||||
self.btn_db.clicked.connect(self.get_db)
|
||||
self.btn_xml.clicked.connect(self.get_xml)
|
||||
self.pushButton_3.clicked.connect(self.decrypt)
|
||||
self.xml_path = None
|
||||
self.db_path = None
|
||||
# self.db_exist()
|
||||
|
||||
def db_exist(self):
|
||||
if os.path.exists('./app/DataBase/Msg.db'):
|
||||
self.btnEnterClicked()
|
||||
self.close()
|
||||
|
||||
def get_xml(self):
|
||||
self.xml_path, _ = QFileDialog.getOpenFileName(self, 'Open file', r'..', "Xml files (*.xml)")
|
||||
if self.xml_path:
|
||||
self.label_xml.setText('xml已就绪')
|
||||
key = self.parser_xml()
|
||||
self.label_key.setText(f'数据库密钥:{key}')
|
||||
return self.xml_path
|
||||
return False
|
||||
|
||||
def get_db(self):
|
||||
self.db_path, _ = QFileDialog.getOpenFileName(self, 'Open file', r'..', "Database files (*.db)")
|
||||
if self.db_path:
|
||||
self.label_db.setText('数据库已就绪')
|
||||
return self.db_path
|
||||
return False
|
||||
|
||||
def decrypt(self):
|
||||
if not (self.xml_path and self.db_path):
|
||||
QMessageBox.critical(self, "错误", "请把两个文件加载进来")
|
||||
return
|
||||
key = self.parser_xml()
|
||||
self.label_key.setText(f'数据库密钥:{key}')
|
||||
self.thread1 = MyThread()
|
||||
self.thread1.signal.connect(self.progressBar_view)
|
||||
self.thread1.start()
|
||||
self.thread2 = DecryptThread(self.db_path, key)
|
||||
self.thread2.signal.connect(self.progressBar_view)
|
||||
self.thread2.start()
|
||||
|
||||
def parser_xml(self):
|
||||
if not self.xml_path:
|
||||
return False
|
||||
pid = self.pid(self.xml_path)
|
||||
print(pid)
|
||||
if not pid:
|
||||
return False
|
||||
key = self.key(pid)
|
||||
print(key)
|
||||
return key
|
||||
|
||||
def pid(self, xml_path):
|
||||
tree = ET.parse(xml_path)
|
||||
# 根节点
|
||||
root = tree.getroot()
|
||||
# 标签名
|
||||
print('root_tag:', root.tag)
|
||||
for stu in root:
|
||||
if stu.attrib["name"] == '_auth_uin':
|
||||
return stu.attrib['value']
|
||||
return False
|
||||
|
||||
def key(self, uin, IMEI='1234567890ABCDEF'):
|
||||
print(IMEI, uin)
|
||||
m = hashlib.md5()
|
||||
m.update(bytes((IMEI + uin).encode('utf-8')))
|
||||
psw = m.hexdigest()
|
||||
return psw[:7]
|
||||
|
||||
def btnEnterClicked(self):
|
||||
print("enter clicked")
|
||||
# 中间可以添加处理逻辑
|
||||
self.DecryptSignal.emit('ok')
|
||||
self.close()
|
||||
|
||||
def progressBar_view(self, value):
|
||||
"""
|
||||
进度条显示
|
||||
:param value: 进度0-100
|
||||
:return: None
|
||||
"""
|
||||
self.progressBar.setProperty('value', value)
|
||||
if value == '100':
|
||||
QMessageBox.information(self, "解密成功", "请退出该界面",
|
||||
QMessageBox.Yes)
|
||||
self.btnExitClicked()
|
||||
|
||||
def btnExitClicked(self):
|
||||
print("Exit clicked")
|
||||
self.close()
|
||||
|
||||
|
||||
class DecryptThread(QThread):
|
||||
signal = pyqtSignal(str)
|
||||
|
||||
def __init__(self, db_path, key):
|
||||
super(DecryptThread, self).__init__()
|
||||
self.db_path = db_path
|
||||
self.key = key
|
||||
self.textBrowser = None
|
||||
|
||||
def __del__(self):
|
||||
pass
|
||||
|
||||
def run(self):
|
||||
data.decrypt(self.db_path, self.key)
|
||||
self.signal.emit('100')
|
||||
|
||||
|
||||
class MyThread(QThread):
|
||||
signal = pyqtSignal(str)
|
||||
|
||||
def __init__(self):
|
||||
super(MyThread, self).__init__()
|
||||
|
||||
def __del__(self):
|
||||
pass
|
||||
|
||||
def run(self):
|
||||
for i in range(100):
|
||||
self.signal.emit(str(i))
|
||||
time.sleep(0.1)
|
72
app/Ui/decrypt/decryptUi.py
Normal file
72
app/Ui/decrypt/decryptUi.py
Normal file
@ -0,0 +1,72 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'decryptUi.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.15.7
|
||||
#
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
|
||||
class Ui_Dialog(object):
|
||||
def setupUi(self, Dialog):
|
||||
Dialog.setObjectName("Dialog")
|
||||
Dialog.resize(400, 300)
|
||||
self.label_3 = QtWidgets.QLabel(Dialog)
|
||||
self.label_3.setGeometry(QtCore.QRect(110, 20, 221, 51))
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("一纸情书")
|
||||
font.setPointSize(20)
|
||||
self.label_3.setFont(font)
|
||||
self.label_3.setObjectName("label_3")
|
||||
self.progressBar = QtWidgets.QProgressBar(Dialog)
|
||||
self.progressBar.setGeometry(QtCore.QRect(90, 260, 271, 23))
|
||||
self.progressBar.setProperty("value", 50)
|
||||
self.progressBar.setObjectName("progressBar")
|
||||
self.label_key = QtWidgets.QLabel(Dialog)
|
||||
self.label_key.setGeometry(QtCore.QRect(80, 230, 241, 20))
|
||||
self.label_key.setText("")
|
||||
self.label_key.setObjectName("label_key")
|
||||
self.widget = QtWidgets.QWidget(Dialog)
|
||||
self.widget.setGeometry(QtCore.QRect(80, 80, 245, 134))
|
||||
self.widget.setObjectName("widget")
|
||||
self.verticalLayout = QtWidgets.QVBoxLayout(self.widget)
|
||||
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
|
||||
self.verticalLayout.setObjectName("verticalLayout")
|
||||
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||
self.btn_xml = QtWidgets.QPushButton(self.widget)
|
||||
self.btn_xml.setObjectName("btn_xml")
|
||||
self.horizontalLayout.addWidget(self.btn_xml)
|
||||
self.label_xml = QtWidgets.QLabel(self.widget)
|
||||
self.label_xml.setObjectName("label_xml")
|
||||
self.horizontalLayout.addWidget(self.label_xml)
|
||||
self.verticalLayout.addLayout(self.horizontalLayout)
|
||||
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||
self.btn_db = QtWidgets.QPushButton(self.widget)
|
||||
self.btn_db.setObjectName("btn_db")
|
||||
self.horizontalLayout_2.addWidget(self.btn_db)
|
||||
self.label_db = QtWidgets.QLabel(self.widget)
|
||||
self.label_db.setObjectName("label_db")
|
||||
self.horizontalLayout_2.addWidget(self.label_db)
|
||||
self.verticalLayout.addLayout(self.horizontalLayout_2)
|
||||
self.pushButton_3 = QtWidgets.QPushButton(self.widget)
|
||||
self.pushButton_3.setObjectName("pushButton_3")
|
||||
self.verticalLayout.addWidget(self.pushButton_3)
|
||||
|
||||
self.retranslateUi(Dialog)
|
||||
QtCore.QMetaObject.connectSlotsByName(Dialog)
|
||||
|
||||
def retranslateUi(self, Dialog):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
|
||||
self.label_3.setText(_translate("Dialog", "解密数据库"))
|
||||
self.btn_xml.setText(_translate("Dialog", "点击加载xml文件"))
|
||||
self.label_xml.setText(_translate("Dialog", "xml未就绪"))
|
||||
self.btn_db.setText(_translate("Dialog", "点击加载数据库文件"))
|
||||
self.label_db.setText(_translate("Dialog", "数据库未就绪"))
|
||||
self.pushButton_3.setText(_translate("Dialog", "开始解密数据库"))
|
119
app/Ui/decrypt/decryptUi.ui
Normal file
119
app/Ui/decrypt/decryptUi.ui
Normal file
@ -0,0 +1,119 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Dialog</class>
|
||||
<widget class="QDialog" name="Dialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>110</x>
|
||||
<y>20</y>
|
||||
<width>221</width>
|
||||
<height>51</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>一纸情书</family>
|
||||
<pointsize>20</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>解密数据库</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QProgressBar" name="progressBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>90</x>
|
||||
<y>260</y>
|
||||
<width>271</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>50</number>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_key">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>80</x>
|
||||
<y>230</y>
|
||||
<width>241</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>80</x>
|
||||
<y>80</y>
|
||||
<width>245</width>
|
||||
<height>134</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_xml">
|
||||
<property name="text">
|
||||
<string>点击加载xml文件</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_xml">
|
||||
<property name="text">
|
||||
<string>xml未就绪</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_db">
|
||||
<property name="text">
|
||||
<string>点击加载数据库文件</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_db">
|
||||
<property name="text">
|
||||
<string>数据库未就绪</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_3">
|
||||
<property name="text">
|
||||
<string>开始解密数据库</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
104
app/Ui/mainview.py
Normal file
104
app/Ui/mainview.py
Normal file
@ -0,0 +1,104 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@File : mainview.py
|
||||
@Author : Shuaikang Zhou
|
||||
@Time : 2022/12/13 15:07
|
||||
@IDE : Pycharm
|
||||
@Version : Python3.10
|
||||
@comment : ···
|
||||
"""
|
||||
import socket # 导入socket模块
|
||||
import datetime
|
||||
import json
|
||||
|
||||
from PyQt5.QtWidgets import *
|
||||
from PyQt5.QtCore import *
|
||||
from PyQt5.QtGui import *
|
||||
from .mainviewUi import *
|
||||
from app.DataBase import data
|
||||
from .chat import chat
|
||||
|
||||
|
||||
class MainWinController(QMainWindow, Ui_Dialog):
|
||||
exitSignal = pyqtSignal()
|
||||
|
||||
# username = ''
|
||||
def __init__(self, username, parent=None):
|
||||
super(MainWinController, self).__init__(parent)
|
||||
self.setupUi(self)
|
||||
self.setWindowTitle('WeChat')
|
||||
self.setWindowIcon(QIcon('./app/data/icon.png'))
|
||||
self.Me = data.get_myinfo()
|
||||
self.chatView = chat.ChatController(self.Me, parent=self.frame_main)
|
||||
self.chatView.setVisible(False)
|
||||
|
||||
self.btn_chat.clicked.connect(self.chat_view) # 聊天按钮
|
||||
self.btn_contact.clicked.connect(self.contact_view)
|
||||
self.btn_myinfo.clicked.connect(self.myInfo)
|
||||
self.btn_about.clicked.connect(self.about)
|
||||
self.now_btn = self.btn_chat
|
||||
self.btn_about.setContextMenuPolicy(Qt.CustomContextMenu)
|
||||
self.btn_about.customContextMenuRequested.connect(self.create_rightmenu) # 连接到菜单显示函数
|
||||
self.last_btn = None
|
||||
self.show_avatar()
|
||||
|
||||
# 创建右键菜单函数
|
||||
def create_rightmenu(self):
|
||||
# 菜单对象
|
||||
self.groupBox_menu = QMenu(self)
|
||||
|
||||
self.actionA = QAction(QIcon('image/保存.png'), u'保存数据',
|
||||
self) # self.actionA = self.contextMenu.addAction(QIcon("images/0.png"),u'| 动作A')
|
||||
self.actionA.setShortcut('Ctrl+S') # 设置快捷键
|
||||
self.groupBox_menu.addAction(self.actionA) # 把动作A选项添加到菜单
|
||||
|
||||
self.actionB = QAction(QIcon('image/删除.png'), u'删除数据', self)
|
||||
self.groupBox_menu.addAction(self.actionB)
|
||||
|
||||
# self.actionA.triggered.connect(self.button) # 将动作A触发时连接到槽函数 button
|
||||
# self.actionB.triggered.connect(self.button_2)
|
||||
|
||||
self.groupBox_menu.popup(QCursor.pos()) # 声明当鼠标在groupBox控件上右击时,在鼠标位置显示右键菜单 ,exec_,popup两个都可以,
|
||||
def show_avatar(self):
|
||||
avatar = data.get_avator(self.Me.username)
|
||||
pixmap = QPixmap(avatar).scaled(80, 80) # 按指定路径找到图片
|
||||
self.myavatar.setPixmap(pixmap) # 在label上显示图片
|
||||
|
||||
def chat_view(self):
|
||||
self.now_btn = self.btn_chat
|
||||
self.now_btn.setStyleSheet(
|
||||
"QPushButton {background-color: rgb(198,198,198);}")
|
||||
if self.last_btn and self.last_btn != self.now_btn:
|
||||
self.last_btn.setStyleSheet("QPushButton {background-color: rgb(240,240,240);}"
|
||||
"QPushButton:hover{background-color: rgb(209,209,209);}\n")
|
||||
self.last_btn = self.btn_chat
|
||||
self.setviewVisible(self.chatView)
|
||||
self.chatView.showChat()
|
||||
|
||||
def contact_view(self):
|
||||
self.now_btn = self.btn_contact
|
||||
self.now_btn.setStyleSheet(
|
||||
"QPushButton {background-color: rgb(198,198,198);}")
|
||||
if self.last_btn and self.last_btn != self.now_btn:
|
||||
self.last_btn.setStyleSheet("QPushButton {background-color: rgb(240,240,240);}"
|
||||
"QPushButton:hover{background-color: rgb(209,209,209);}\n")
|
||||
self.last_btn = self.btn_contact
|
||||
|
||||
def myInfo(self):
|
||||
self.now_btn = self.btn_myinfo
|
||||
self.now_btn.setStyleSheet(
|
||||
"QPushButton {background-color: rgb(198,198,198);}")
|
||||
if self.last_btn and self.last_btn != self.now_btn:
|
||||
self.last_btn.setStyleSheet("QPushButton {background-color: rgb(240,240,240);}"
|
||||
"QPushButton:hover{background-color: rgb(209,209,209);}\n")
|
||||
self.last_btn = self.now_btn
|
||||
|
||||
def about(self):
|
||||
QMessageBox.about(self, "关于",
|
||||
"关于作者\n姓名:周帅康\n学号:2020303457"
|
||||
)
|
||||
|
||||
def setviewVisible(self, view):
|
||||
view.setVisible(True)
|
||||
if view != self.chatView:
|
||||
self.chatView.setVisible(False)
|
101
app/Ui/mainviewUi.py
Normal file
101
app/Ui/mainviewUi.py
Normal file
@ -0,0 +1,101 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'mainviewUi.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.15.7
|
||||
#
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
|
||||
class Ui_Dialog(object):
|
||||
def setupUi(self, Dialog):
|
||||
Dialog.setObjectName("Dialog")
|
||||
Dialog.resize(1280, 720)
|
||||
Dialog.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
|
||||
Dialog.setAutoFillBackground(False)
|
||||
self.frame_main = QtWidgets.QFrame(Dialog)
|
||||
self.frame_main.setGeometry(QtCore.QRect(160, 0, 1120, 720))
|
||||
self.frame_main.setFrameShape(QtWidgets.QFrame.StyledPanel)
|
||||
self.frame_main.setFrameShadow(QtWidgets.QFrame.Raised)
|
||||
self.frame_main.setObjectName("frame_main")
|
||||
self.frame_info = QtWidgets.QFrame(Dialog)
|
||||
self.frame_info.setGeometry(QtCore.QRect(0, 0, 161, 721))
|
||||
self.frame_info.setStyleSheet("background-color:rgb(240,240,240)")
|
||||
self.frame_info.setFrameShape(QtWidgets.QFrame.StyledPanel)
|
||||
self.frame_info.setFrameShadow(QtWidgets.QFrame.Sunken)
|
||||
self.frame_info.setObjectName("frame_info")
|
||||
self.verticalLayoutWidget = QtWidgets.QWidget(self.frame_info)
|
||||
self.verticalLayoutWidget.setGeometry(QtCore.QRect(20, 190, 111, 501))
|
||||
self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
|
||||
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.verticalLayoutWidget)
|
||||
self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
|
||||
self.verticalLayout_2.setSpacing(0)
|
||||
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||
self.btn_chat = QtWidgets.QPushButton(self.verticalLayoutWidget)
|
||||
self.btn_chat.setMinimumSize(QtCore.QSize(0, 80))
|
||||
self.btn_chat.setStyleSheet("QPushButton {background-color: rgb(240,240,240);}\n"
|
||||
"QPushButton:hover{background-color: rgb(209,209,209);}")
|
||||
self.btn_chat.setObjectName("btn_chat")
|
||||
self.verticalLayout_2.addWidget(self.btn_chat)
|
||||
self.btn_contact = QtWidgets.QPushButton(self.verticalLayoutWidget)
|
||||
self.btn_contact.setMinimumSize(QtCore.QSize(0, 80))
|
||||
self.btn_contact.setStyleSheet("QPushButton {background-color: rgb(240,240,240);}\n"
|
||||
"QPushButton:hover{background-color: rgb(209,209,209);}")
|
||||
self.btn_contact.setObjectName("btn_contact")
|
||||
self.verticalLayout_2.addWidget(self.btn_contact)
|
||||
self.btn_addC = QtWidgets.QPushButton(self.verticalLayoutWidget)
|
||||
self.btn_addC.setMinimumSize(QtCore.QSize(0, 80))
|
||||
self.btn_addC.setStyleSheet("QPushButton {background-color: rgb(240,240,240);}\n"
|
||||
"QPushButton:hover{background-color: rgb(209,209,209);}")
|
||||
self.btn_addC.setObjectName("btn_addC")
|
||||
self.verticalLayout_2.addWidget(self.btn_addC)
|
||||
self.btn_add_group = QtWidgets.QPushButton(self.verticalLayoutWidget)
|
||||
self.btn_add_group.setMinimumSize(QtCore.QSize(0, 80))
|
||||
self.btn_add_group.setStyleSheet("QPushButton {background-color: rgb(240,240,240);}\n"
|
||||
"QPushButton:hover{background-color: rgb(209,209,209);}")
|
||||
self.btn_add_group.setObjectName("btn_add_group")
|
||||
self.verticalLayout_2.addWidget(self.btn_add_group)
|
||||
self.btn_myinfo = QtWidgets.QPushButton(self.verticalLayoutWidget)
|
||||
self.btn_myinfo.setMinimumSize(QtCore.QSize(100, 80))
|
||||
self.btn_myinfo.setStyleSheet("QPushButton {background-color: rgb(240,240,240);}\n"
|
||||
"QPushButton:hover{background-color: rgb(209,209,209);}")
|
||||
self.btn_myinfo.setObjectName("btn_myinfo")
|
||||
self.verticalLayout_2.addWidget(self.btn_myinfo)
|
||||
self.btn_about = QtWidgets.QPushButton(self.verticalLayoutWidget)
|
||||
self.btn_about.setMinimumSize(QtCore.QSize(100, 80))
|
||||
self.btn_about.setStyleSheet("QPushButton {background-color: rgb(240,240,240);}\n"
|
||||
"QPushButton:hover{background-color: rgb(209,209,209);}")
|
||||
self.btn_about.setObjectName("btn_about")
|
||||
self.verticalLayout_2.addWidget(self.btn_about)
|
||||
self.verticalLayout_2.setStretch(0, 1)
|
||||
self.verticalLayout_2.setStretch(2, 1)
|
||||
self.verticalLayout_2.setStretch(4, 1)
|
||||
self.myavatar = QtWidgets.QLabel(self.frame_info)
|
||||
self.myavatar.setGeometry(QtCore.QRect(30, 50, 100, 100))
|
||||
self.myavatar.setObjectName("myavatar")
|
||||
self.sign_up = QtWidgets.QPushButton(self.frame_info)
|
||||
self.sign_up.setGeometry(QtCore.QRect(0, 0, 71, 28))
|
||||
self.sign_up.setObjectName("sign_up")
|
||||
self.btn_destroy = QtWidgets.QPushButton(self.frame_info)
|
||||
self.btn_destroy.setGeometry(QtCore.QRect(80, 0, 71, 28))
|
||||
self.btn_destroy.setObjectName("btn_destroy")
|
||||
|
||||
self.retranslateUi(Dialog)
|
||||
QtCore.QMetaObject.connectSlotsByName(Dialog)
|
||||
|
||||
def retranslateUi(self, Dialog):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
|
||||
self.btn_chat.setText(_translate("Dialog", "聊天"))
|
||||
self.btn_contact.setText(_translate("Dialog", "联系人"))
|
||||
self.btn_addC.setText(_translate("Dialog", "添加联系人"))
|
||||
self.btn_add_group.setText(_translate("Dialog", "群聊"))
|
||||
self.btn_myinfo.setText(_translate("Dialog", "我的"))
|
||||
self.btn_about.setText(_translate("Dialog", "关于"))
|
||||
self.myavatar.setText(_translate("Dialog", "avatar"))
|
||||
self.sign_up.setText(_translate("Dialog", "退出登录"))
|
||||
self.btn_destroy.setText(_translate("Dialog", "注销账户"))
|
216
app/Ui/mainviewUi.ui
Normal file
216
app/Ui/mainviewUi.ui
Normal file
@ -0,0 +1,216 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Dialog</class>
|
||||
<widget class="QDialog" name="Dialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1280</width>
|
||||
<height>720</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>ArrowCursor</cursorShape>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<widget class="QFrame" name="frame_main">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>160</x>
|
||||
<y>0</y>
|
||||
<width>1120</width>
|
||||
<height>720</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QFrame" name="frame_info">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>161</width>
|
||||
<height>721</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color:rgb(240,240,240)</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<widget class="QWidget" name="verticalLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>190</y>
|
||||
<width>111</width>
|
||||
<height>501</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="1,0,1,0,1,0">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_chat">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton {background-color: rgb(240,240,240);}
|
||||
QPushButton:hover{background-color: rgb(209,209,209);}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>聊天</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_contact">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton {background-color: rgb(240,240,240);}
|
||||
QPushButton:hover{background-color: rgb(209,209,209);}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>联系人</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_addC">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton {background-color: rgb(240,240,240);}
|
||||
QPushButton:hover{background-color: rgb(209,209,209);}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>添加联系人</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_add_group">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton {background-color: rgb(240,240,240);}
|
||||
QPushButton:hover{background-color: rgb(209,209,209);}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>群聊</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_myinfo">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton {background-color: rgb(240,240,240);}
|
||||
QPushButton:hover{background-color: rgb(209,209,209);}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>我的</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_about">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton {background-color: rgb(240,240,240);}
|
||||
QPushButton:hover{background-color: rgb(209,209,209);}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>关于</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QLabel" name="myavatar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>50</y>
|
||||
<width>100</width>
|
||||
<height>100</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>avatar</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="sign_up">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>71</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>退出登录</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="btn_destroy">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>80</x>
|
||||
<y>0</y>
|
||||
<width>71</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>注销账户</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
9
app/__init__.py
Normal file
9
app/__init__.py
Normal file
@ -0,0 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@File : __init__.py.py
|
||||
@Author : Shuaikang Zhou
|
||||
@Time : 2023/1/5 17:43
|
||||
@IDE : Pycharm
|
||||
@Version : Python3.10
|
||||
@comment : ···
|
||||
"""
|
9
app/main/__init__.py
Normal file
9
app/main/__init__.py
Normal file
@ -0,0 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@File : __init__.py.py
|
||||
@Author : Shuaikang Zhou
|
||||
@Time : 2023/1/5 18:11
|
||||
@IDE : Pycharm
|
||||
@Version : Python3.10
|
||||
@comment : ···
|
||||
"""
|
9
auth_info_key_prefs.xml
Normal file
9
auth_info_key_prefs.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
|
||||
<map>
|
||||
<boolean name="auth_info_prefs_use_new_ecdh" value="true" />
|
||||
<int name="_auth_uin" value="-1564169371" />
|
||||
<boolean name="key_auth_info_prefs_created" value="true" />
|
||||
<int name="key_auth_update_version" value="671096663" />
|
||||
<string name="server_id">2503180200000000220b96fd91b700</string>
|
||||
<string name="_auth_key">0a240820122089653ee1b7b77b1a53891bdeb13e3ebebd8c3f973cc8139973199b7549b4286212b80108b20112b20108994e12a601e6a7999e231ed0b9871fa0f9cb11835fb140ab40f308aaf1c81ca2e18619725c6875c908c1cfd43a890f91b772aaf8678e4daebc8f2979f6f3c003b9ded9da0b3e58ad33df24389b572aebe468059dfbb40a28fc5cb0af4c5bcc8b072759e7409cf2069595c90cdc1752163b43c2d576751d26e018a5895e2a9716d99c7bbe590af31e91e41b69bf67c1ad1f3c0d6c68fc770d90362913ecf7101d3de12e3aba0095cf98dafc18afadf79f0a</string>
|
||||
</map>
|
51
main.py
Normal file
51
main.py
Normal file
@ -0,0 +1,51 @@
|
||||
import os
|
||||
from PyQt5.QtWidgets import *
|
||||
from PyQt5.QtCore import *
|
||||
from PyQt5.QtGui import *
|
||||
import sys
|
||||
from app.Ui import *
|
||||
|
||||
|
||||
class ViewController:
|
||||
def loadDecryptView(self):
|
||||
"""
|
||||
登录界面
|
||||
:return:
|
||||
"""
|
||||
self.viewDecrypt = decrypt.DecryptControl() # 需要将viewlogin设为成员变量
|
||||
self.viewDecrypt.DecryptSignal.connect(self.loadMainWinView)
|
||||
self.viewDecrypt.registerSignal.connect(self.loadRegisterView)
|
||||
self.viewDecrypt.show()
|
||||
self.viewDecrypt.db_exist()
|
||||
|
||||
def loadRegisterView(self):
|
||||
"""
|
||||
注册界面
|
||||
:return:
|
||||
"""
|
||||
self.viewDecrypt = register.registerControl() # 需要将viewlogin设为成员变量
|
||||
self.viewDecrypt.DecryptSignal.connect(self.loadDecryptView)
|
||||
self.viewDecrypt.show()
|
||||
|
||||
def loadMainWinView(self, username):
|
||||
"""
|
||||
聊天界面
|
||||
:param username: 账号
|
||||
:return:
|
||||
"""
|
||||
username = ''
|
||||
self.viewMainWIn = mainview.MainWinController(username=username)
|
||||
self.viewMainWIn.setWindowTitle("Chat")
|
||||
# print(username)
|
||||
self.viewMainWIn.username = username
|
||||
# self.viewMainWIn.exitSignal.connect(self.loadDecryptView) # 不需要回到登录界面可以省略
|
||||
self.viewMainWIn.show()
|
||||
# self.viewMainWIn.signUp()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = QApplication(sys.argv)
|
||||
view = ViewController()
|
||||
# view.loadDecryptView() # 进入登录界面,如果viewlogin不是成员变量,则离开作用域后失效。
|
||||
view.loadMainWinView('102')
|
||||
sys.exit(app.exec_())
|
5
sqlcipher-3.0.1/bin/adb.txt
Normal file
5
sqlcipher-3.0.1/bin/adb.txt
Normal file
@ -0,0 +1,5 @@
|
||||
PRAGMA key = '10f35f1';
|
||||
PRAGMA cipher_migrate;
|
||||
ATTACH DATABASE 'plaintext.db' AS plaintext KEY '';
|
||||
SELECT sqlcipher_export('plaintext');
|
||||
DETACH DATABASE plaintext;
|
3
sqlcipher-3.0.1/bin/bat使用说明.txt
Normal file
3
sqlcipher-3.0.1/bin/bat使用说明.txt
Normal file
@ -0,0 +1,3 @@
|
||||
1.将要加密的数据名称改为encrypt.db,并放到当前bin目录下
|
||||
2.编辑adb.txt 文件 PRAGMA key = 'password';这里的password是加密数据的密码
|
||||
3.修改保存完,双击sqlcipher.bat文件
|
3
sqlcipher-3.0.1/bin/sqlcipher - 副本.txt
Normal file
3
sqlcipher-3.0.1/bin/sqlcipher - 副本.txt
Normal file
@ -0,0 +1,3 @@
|
||||
sqlcipher-shell32.exe encrypt.db < adb.txt
|
||||
echo 解密完成
|
||||
pause
|
BIN
sqlcipher-3.0.1/bin/sqlcipher-shell32-debug.exe
Normal file
BIN
sqlcipher-3.0.1/bin/sqlcipher-shell32-debug.exe
Normal file
Binary file not shown.
BIN
sqlcipher-3.0.1/bin/sqlcipher-shell32-debug.pdb
Normal file
BIN
sqlcipher-3.0.1/bin/sqlcipher-shell32-debug.pdb
Normal file
Binary file not shown.
BIN
sqlcipher-3.0.1/bin/sqlcipher-shell32.exe
Normal file
BIN
sqlcipher-3.0.1/bin/sqlcipher-shell32.exe
Normal file
Binary file not shown.
BIN
sqlcipher-3.0.1/bin/sqlcipher-shell64-debug.exe
Normal file
BIN
sqlcipher-3.0.1/bin/sqlcipher-shell64-debug.exe
Normal file
Binary file not shown.
BIN
sqlcipher-3.0.1/bin/sqlcipher-shell64-debug.pdb
Normal file
BIN
sqlcipher-3.0.1/bin/sqlcipher-shell64-debug.pdb
Normal file
Binary file not shown.
BIN
sqlcipher-3.0.1/bin/sqlcipher-shell64.exe
Normal file
BIN
sqlcipher-3.0.1/bin/sqlcipher-shell64.exe
Normal file
Binary file not shown.
3
sqlcipher-3.0.1/bin/sqlcipher.bat
Normal file
3
sqlcipher-3.0.1/bin/sqlcipher.bat
Normal file
@ -0,0 +1,3 @@
|
||||
sqlcipher-shell32.exe encrypt.db < adb.txt
|
||||
echo 解密完成
|
||||
pause
|
BIN
sqlcipher-3.0.1/lib/sqlcipher32-debug.lib
Normal file
BIN
sqlcipher-3.0.1/lib/sqlcipher32-debug.lib
Normal file
Binary file not shown.
BIN
sqlcipher-3.0.1/lib/sqlcipher32-debug.pdb
Normal file
BIN
sqlcipher-3.0.1/lib/sqlcipher32-debug.pdb
Normal file
Binary file not shown.
BIN
sqlcipher-3.0.1/lib/sqlcipher32.lib
Normal file
BIN
sqlcipher-3.0.1/lib/sqlcipher32.lib
Normal file
Binary file not shown.
BIN
sqlcipher-3.0.1/lib/sqlcipher32.pdb
Normal file
BIN
sqlcipher-3.0.1/lib/sqlcipher32.pdb
Normal file
Binary file not shown.
BIN
sqlcipher-3.0.1/lib/sqlcipher64-debug.lib
Normal file
BIN
sqlcipher-3.0.1/lib/sqlcipher64-debug.lib
Normal file
Binary file not shown.
BIN
sqlcipher-3.0.1/lib/sqlcipher64-debug.pdb
Normal file
BIN
sqlcipher-3.0.1/lib/sqlcipher64-debug.pdb
Normal file
Binary file not shown.
BIN
sqlcipher-3.0.1/lib/sqlcipher64.lib
Normal file
BIN
sqlcipher-3.0.1/lib/sqlcipher64.lib
Normal file
Binary file not shown.
BIN
sqlcipher-3.0.1/lib/sqlcipher64.pdb
Normal file
BIN
sqlcipher-3.0.1/lib/sqlcipher64.pdb
Normal file
Binary file not shown.
7304
sqlcipher-3.0.1/sqlcipher/sqlite3.h
Normal file
7304
sqlcipher-3.0.1/sqlcipher/sqlite3.h
Normal file
File diff suppressed because it is too large
Load Diff
84
test.html
Normal file
84
test.html
Normal file
@ -0,0 +1,84 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<style type="text/css">
|
||||
.mobile-page .admin-reply{
|
||||
box-shadow: 0px 0px 2px #ddd;
|
||||
}
|
||||
.mobile-page .user-msg, .mobile-page .admin-msg{
|
||||
width: 75%;
|
||||
position: relative;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<div>
|
||||
<table align="right" style="vertical-align: middle;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="background-color: #9EEA6A;right: 4px;border-radius: 4px;">%s 13245:</td>
|
||||
<td width="55" style=""> </td>
|
||||
<td style="border: 1px #000000 solid"><img align="right" src="./app/data/avatar/2a/42/user_2a427a26f96058921da245444ab542f5.png" width="45" height="45"/></td>
|
||||
<td width="15"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
<!-- <body>
|
||||
<div class="mobile-page">
|
||||
<div class="user-group" style="padding: 6px;
|
||||
display: flex;
|
||||
display: -webkit-flex;
|
||||
justify-content: flex-end;
|
||||
-webkit-justify-content: flex-end;
|
||||
">
|
||||
<div class="user-msg" style="text-align: right;
|
||||
width: 75%;
|
||||
position: relative;">
|
||||
<span class="user-reply" style="display: inline-block;
|
||||
padding: 8px;
|
||||
border-radius: 4px;
|
||||
margin:0 15px 12px;
|
||||
text-align: left;
|
||||
background-color: #9EEA6A;
|
||||
box-shadow: 0px 0px 2px #bbb;
|
||||
">我要抢楼</span>
|
||||
<i style="width: 0;
|
||||
height: 0;
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
display: inline-block;
|
||||
border-top: 10px solid transparent;
|
||||
border-bottom: 10px solid transparent;
|
||||
right: 4px;
|
||||
border-left: 12px solid #9EEA6A;"></i>
|
||||
</div>
|
||||
<img class="user-img" src="./app/data/avatar/2a/42/user_2a427a26f96058921da245444ab542f5.png" width="45px" height="45px";/>
|
||||
</div>
|
||||
<div class="admin-group">
|
||||
<img class="admin-img" src="http://localhost/public/img/aa.jpg"/>
|
||||
<div class="admin-msg">
|
||||
<i class="triangle-admin"></i>
|
||||
<span class="admin-reply">欢迎来抢楼!欢迎来抢楼!欢迎来抢楼!欢迎来抢楼!欢迎来抢楼!欢迎来抢楼!欢迎来抢楼!</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="user-group">
|
||||
<div class="user-msg">
|
||||
<span class="user-reply">我要抢楼我要抢楼我要抢楼。</span>
|
||||
<i class="triangle-user"></i>
|
||||
</div>
|
||||
<img class="user-img" src="img/cc.jpg"/>
|
||||
</div>
|
||||
<div class="admin-group">
|
||||
<img class="admin-img" src="./app/data/avatar/2a/42/user_2a427a26f96058921da245444ab542f5.png"/>
|
||||
<div class="admin-msg">
|
||||
<i class="triangle-admin"></i>
|
||||
<span class="admin-reply">欢迎来抢楼!欢迎来抢楼!欢迎来抢楼!欢迎来抢楼!欢迎来抢楼!欢迎来抢楼!</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body> -->
|
||||
</html>
|
168
wechat.html
Normal file
168
wechat.html
Normal file
@ -0,0 +1,168 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="aplus-terminal" content="1">
|
||||
<meta name="apple-mobile-web-app-title" content="">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
|
||||
<meta name="format-detection" content="telephone=no, address=no">
|
||||
<title>title</title>
|
||||
<style type="text/css">
|
||||
/*公共样式*/
|
||||
body,h1,h2,h3,h4,p,ul,ol,li,form,button,input,textarea,th,td {
|
||||
margin:0;
|
||||
padding:0
|
||||
}
|
||||
body,button,input,select,textarea {
|
||||
font:12px/1.5 Microsoft YaHei UI Light,tahoma,arial,"\5b8b\4f53";
|
||||
*line-height:1.5;
|
||||
-ms-overflow-style:scrollbar
|
||||
}
|
||||
h1,h2,h3,h4{
|
||||
font-size:100%
|
||||
}
|
||||
ul,ol {
|
||||
list-style:none
|
||||
}
|
||||
a {
|
||||
text-decoration:none
|
||||
}
|
||||
a:hover {
|
||||
text-decoration:underline
|
||||
}
|
||||
img {
|
||||
border:0
|
||||
}
|
||||
button,input,select,textarea {
|
||||
font-size:100%
|
||||
}
|
||||
table {
|
||||
border-collapse:collapse;
|
||||
border-spacing:0
|
||||
}
|
||||
|
||||
/*rem*/
|
||||
html {
|
||||
font-size:62.5%;
|
||||
}
|
||||
body {
|
||||
font:16px/1.5 "microsoft yahei", 'tahoma';
|
||||
}
|
||||
body .mobile-page {
|
||||
font-size: 1.6rem;
|
||||
}
|
||||
|
||||
/*浮动*/
|
||||
.fl{
|
||||
float: left;
|
||||
}
|
||||
.fr{
|
||||
float: right;
|
||||
}
|
||||
.clearfix:after{
|
||||
content: '';
|
||||
display: block;
|
||||
height: 0;
|
||||
clear: both;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
body{
|
||||
background-color: #F5F5F5;
|
||||
}
|
||||
.mobile-page{
|
||||
max-width: 600px;
|
||||
}
|
||||
.mobile-page .admin-img, .mobile-page .user-img{
|
||||
width: 45px;
|
||||
height: 45px;
|
||||
}
|
||||
i.triangle-admin,i.triangle-user{
|
||||
width: 0;
|
||||
height: 0;
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
display: inline-block;
|
||||
border-top: 10px solid transparent;
|
||||
border-bottom: 10px solid transparent;
|
||||
}
|
||||
.mobile-page i.triangle-admin{
|
||||
left: 4px;
|
||||
border-right: 12px solid #fff;
|
||||
}
|
||||
.mobile-page i.triangle-user{
|
||||
right: 4px;
|
||||
border-left: 12px solid #9EEA6A;
|
||||
}
|
||||
.mobile-page .admin-group, .mobile-page .user-group{
|
||||
padding: 6px;
|
||||
display: flex;
|
||||
display: -webkit-flex;
|
||||
}
|
||||
.mobile-page .admin-group{
|
||||
justify-content: flex-start;
|
||||
-webkit-justify-content: flex-start;
|
||||
}
|
||||
.mobile-page .user-group{
|
||||
justify-content: flex-end;
|
||||
-webkit-justify-content: flex-end;
|
||||
}
|
||||
.mobile-page .admin-reply, .mobile-page .user-reply{
|
||||
display: inline-block;
|
||||
padding: 8px;
|
||||
border-radius: 4px;
|
||||
background-color: #fff;
|
||||
margin:0 15px 12px;
|
||||
}
|
||||
.mobile-page .admin-reply{
|
||||
box-shadow: 0px 0px 2px #ddd;
|
||||
}
|
||||
.mobile-page .user-reply{
|
||||
text-align: left;
|
||||
background-color: #9EEA6A;
|
||||
box-shadow: 0px 0px 2px #bbb;
|
||||
}
|
||||
.mobile-page .user-msg, .mobile-page .admin-msg{
|
||||
width: 75%;
|
||||
position: relative;
|
||||
}
|
||||
.mobile-page .user-msg{
|
||||
text-align: right;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="mobile-page">
|
||||
<div class="user-group">
|
||||
<div class="user-msg">
|
||||
<span class="user-reply">我要抢楼</span>
|
||||
<i class="triangle-user"></i>
|
||||
</div>
|
||||
<img class="user-img" src="http://localhost/public/img/cc.jpg"/>
|
||||
</div>
|
||||
<div class="admin-group">
|
||||
<img class="admin-img" src="http://localhost/public/img/aa.jpg"/>
|
||||
<div class="admin-msg">
|
||||
<i class="triangle-admin"></i>
|
||||
<span class="admin-reply">欢迎来抢楼!欢迎来抢楼!欢迎来抢楼!欢迎来抢楼!欢迎来抢楼!欢迎来抢楼!欢迎来抢楼!</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="user-group">
|
||||
<div class="user-msg">
|
||||
<span class="user-reply">我要抢楼我要抢楼我要抢楼。</span>
|
||||
<i class="triangle-user"></i>
|
||||
</div>
|
||||
<img class="user-img" src="img/cc.jpg"/>
|
||||
</div>
|
||||
<div class="admin-group">
|
||||
<img class="admin-img" src="img/aa.jpg"/>
|
||||
<div class="admin-msg">
|
||||
<i class="triangle-admin"></i>
|
||||
<span class="admin-reply">欢迎来抢楼!欢迎来抢楼!欢迎来抢楼!欢迎来抢楼!欢迎来抢楼!欢迎来抢楼!</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user