From a24ce6a14da8300200ffc0f56dda485958e8dc81 Mon Sep 17 00:00:00 2001
From: shuaikangzhou <863909694@qq.com>
Date: Fri, 17 Nov 2023 22:44:55 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=81=8A=E5=A4=A9=E6=B0=94?=
=?UTF-8?q?=E6=B3=A1=E4=B8=8D=E8=83=BD=E6=9B=B4=E6=94=B9=E5=A4=A7=E5=B0=8F?=
=?UTF-8?q?=E7=9A=84bug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/workspace.xml | 91 +++++++++++++++------------
app/DataBase/micro_msg.py | 1 +
app/components/bubble_message.py | 2 +
app/person.py | 15 ++++-
app/ui_pc/chat/chatInfoUi.py | 1 -
app/ui_pc/chat/chatUi.py | 68 ++++++++++++++++++++
app/ui_pc/chat/chatUi.ui | 105 +++++++++++++++++++++++++++++++
app/ui_pc/chat/chat_info.py | 25 +++++---
8 files changed, 254 insertions(+), 54 deletions(-)
create mode 100644 app/ui_pc/chat/chatUi.py
create mode 100644 app/ui_pc/chat/chatUi.ui
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a969bc2..f0acf67 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,19 +4,13 @@
-
-
-
-
+
-
-
-
-
-
+
+
@@ -155,27 +149,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -260,13 +233,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
@@ -282,13 +276,6 @@
1672848140146
-
- 1684598124207
-
-
-
- 1684598124207
-
1684598177829
@@ -625,7 +612,14 @@
1700150198343
-
+
+ 1700228064961
+
+
+
+ 1700228064961
+
+
@@ -661,7 +655,6 @@
-
@@ -686,7 +679,8 @@
-
+
+
@@ -708,6 +702,21 @@
103
+
+ file://$PROJECT_DIR$/app/person.py
+ 116
+
+
+
+ file://$PROJECT_DIR$/app/person.py
+ 114
+
+
+
+ file://$PROJECT_DIR$/app/person.py
+ 115
+
+
diff --git a/app/DataBase/micro_msg.py b/app/DataBase/micro_msg.py
index 6f1cba0..5c0b78d 100644
--- a/app/DataBase/micro_msg.py
+++ b/app/DataBase/micro_msg.py
@@ -31,6 +31,7 @@ def get_contact():
from Contact inner join ContactHeadImgUrl on Contact.UserName = ContactHeadImgUrl.usrName
where Type=3 and Alias is not null
order by PYInitial
+ limit 30
'''
cursor.execute(sql)
result = cursor.fetchall()
diff --git a/app/components/bubble_message.py b/app/components/bubble_message.py
index 152f5e1..8b44654 100644
--- a/app/components/bubble_message.py
+++ b/app/components/bubble_message.py
@@ -292,6 +292,7 @@ class MyWidget(QWidget):
bubble_message1 = BubbleMessage("D:\Project\Python\PyQt-master\QLabel\Data\\fg1.png", avatar, Type=3,
is_send=False)
layout0.addWidget(bubble_message1)
+
self.spacerItem = QSpacerItem(10, 10, QSizePolicy.Minimum, QSizePolicy.Expanding)
layout0.addItem(self.spacerItem)
# layout.setStretch(0, 1)
@@ -302,6 +303,7 @@ class Test(QWidget):
def __init__(self):
super().__init__()
layout = QVBoxLayout()
+ self.resize(500, 600)
w1 = MyWidget()
w2 = QLabel("nihao")
layout.addWidget(w1)
diff --git a/app/person.py b/app/person.py
index 11c15f8..deb07b9 100644
--- a/app/person.py
+++ b/app/person.py
@@ -13,6 +13,7 @@ from app.Ui.Icon import Icon
class Person:
def __init__(self, wxid: str):
+
self.wxid = wxid
self.conRemark = data.get_conRemark(wxid)
self.nickname, self.alias = data.get_nickname(wxid)
@@ -52,7 +53,15 @@ def singleton(cls):
@singleton
class MePC:
- def __init__(self, contact_info: Dict):
+ def __init__(self):
+ contact_info = {
+ 'UserName': 'contact_info_list[0]',
+ 'Alias': 'contact_info_list[1]',
+ 'Type': 'contact_info_list[2]',
+ 'Remark': 'contact_info_list[3]',
+ 'NickName': 'contact_info_list[4]',
+ 'smallHeadImgUrl': 'contact_info_list[7]'
+ }
self.wxid = contact_info.get('UserName')
self.remark = contact_info.get('Remark')
# Alias,Type,Remark,NickName,PYInitial,RemarkPYInitial,ContactHeadImgUrl.smallHeadImgUrl,ContactHeadImgUrl,bigHeadImgUrl
@@ -105,4 +114,6 @@ class Group(Person):
if __name__ == '__main__':
- pass
+ p1 = MePC()
+ p2 = MePC()
+ print(p1 == p2)
diff --git a/app/ui_pc/chat/chatInfoUi.py b/app/ui_pc/chat/chatInfoUi.py
index e92486e..62c03c5 100644
--- a/app/ui_pc/chat/chatInfoUi.py
+++ b/app/ui_pc/chat/chatInfoUi.py
@@ -14,7 +14,6 @@ from PyQt5 import QtCore, QtWidgets
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
- Form.resize(817, 748)
self.verticalLayout = QtWidgets.QVBoxLayout(Form)
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.verticalLayout.setSpacing(0)
diff --git a/app/ui_pc/chat/chatUi.py b/app/ui_pc/chat/chatUi.py
new file mode 100644
index 0000000..b617835
--- /dev/null
+++ b/app/ui_pc/chat/chatUi.py
@@ -0,0 +1,68 @@
+# -*- 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, QtWidgets
+
+
+class Ui_Form(object):
+ def setupUi(self, Form):
+ Form.setObjectName("Form")
+ Form.resize(840, 752)
+ Form.setStyleSheet("background: rgb(240, 240, 240);")
+ self.horizontalLayout_2 = QtWidgets.QHBoxLayout(Form)
+ self.horizontalLayout_2.setObjectName("horizontalLayout_2")
+ self.verticalLayout_2 = QtWidgets.QVBoxLayout()
+ self.verticalLayout_2.setSpacing(0)
+ self.verticalLayout_2.setObjectName("verticalLayout_2")
+ self.verticalLayout = QtWidgets.QVBoxLayout()
+ self.verticalLayout.setObjectName("verticalLayout")
+ self.horizontalLayout = QtWidgets.QHBoxLayout()
+ self.horizontalLayout.setObjectName("horizontalLayout")
+ self.label = QtWidgets.QLabel(Form)
+ self.label.setText("")
+ self.label.setObjectName("label")
+ self.horizontalLayout.addWidget(self.label)
+ self.lineEdit = QtWidgets.QLineEdit(Form)
+ self.lineEdit.setMinimumSize(QtCore.QSize(200, 30))
+ self.lineEdit.setMaximumSize(QtCore.QSize(200, 16777215))
+ self.lineEdit.setStyleSheet("background:transparent;\n"
+ " border-width:0;\n"
+ " border-style:outset;\n"
+ " background-color:rgb(226,226,226);\n"
+ " ")
+ self.lineEdit.setCursorMoveStyle(QtCore.Qt.VisualMoveStyle)
+ self.lineEdit.setObjectName("lineEdit")
+ self.horizontalLayout.addWidget(self.lineEdit)
+ self.label_2 = QtWidgets.QLabel(Form)
+ self.label_2.setText("")
+ self.label_2.setObjectName("label_2")
+ self.horizontalLayout.addWidget(self.label_2)
+ self.verticalLayout.addLayout(self.horizontalLayout)
+ self.verticalLayout_2.addLayout(self.verticalLayout)
+ self.listWidget = QtWidgets.QListWidget(Form)
+ self.listWidget.setMinimumSize(QtCore.QSize(250, 0))
+ self.listWidget.setMaximumSize(QtCore.QSize(250, 16777215))
+ self.listWidget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
+ self.listWidget.setObjectName("listWidget")
+ self.verticalLayout_2.addWidget(self.listWidget)
+ self.verticalLayout_2.setStretch(1, 1)
+ self.horizontalLayout_2.addLayout(self.verticalLayout_2)
+ self.stackedWidget = QtWidgets.QStackedWidget(Form)
+ self.stackedWidget.setObjectName("stackedWidget")
+ self.horizontalLayout_2.addWidget(self.stackedWidget)
+ self.horizontalLayout_2.setStretch(1, 1)
+
+ self.retranslateUi(Form)
+ self.stackedWidget.setCurrentIndex(-1)
+ QtCore.QMetaObject.connectSlotsByName(Form)
+
+ def retranslateUi(self, Form):
+ _translate = QtCore.QCoreApplication.translate
+ Form.setWindowTitle(_translate("Form", "Form"))
diff --git a/app/ui_pc/chat/chatUi.ui b/app/ui_pc/chat/chatUi.ui
new file mode 100644
index 0000000..116c90c
--- /dev/null
+++ b/app/ui_pc/chat/chatUi.ui
@@ -0,0 +1,105 @@
+
+
+ Form
+
+
+
+ 0
+ 0
+ 840
+ 752
+
+
+
+ Form
+
+
+ background: rgb(240, 240, 240);
+
+
+ -
+
+
+ 0
+
+
-
+
+
-
+
+
-
+
+
+
+
+
+
+ -
+
+
+
+ 200
+ 30
+
+
+
+
+ 200
+ 16777215
+
+
+
+ background:transparent;
+ border-width:0;
+ border-style:outset;
+ background-color:rgb(226,226,226);
+
+
+
+ Qt::VisualMoveStyle
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+ 250
+ 0
+
+
+
+
+ 250
+ 16777215
+
+
+
+ Qt::ScrollBarAlwaysOff
+
+
+
+
+
+ -
+
+
+ -1
+
+
+
+
+
+
+
+
diff --git a/app/ui_pc/chat/chat_info.py b/app/ui_pc/chat/chat_info.py
index 72bb635..47fab74 100644
--- a/app/ui_pc/chat/chat_info.py
+++ b/app/ui_pc/chat/chat_info.py
@@ -1,36 +1,40 @@
from PyQt5.QtCore import QThread, pyqtSignal, Qt
-from PyQt5.QtWidgets import QWidget, QVBoxLayout, QSpacerItem, QSizePolicy
+from PyQt5.QtWidgets import QWidget, QVBoxLayout, QSpacerItem, QSizePolicy, QLabel, QHBoxLayout
from app.DataBase import msg
from app.components.bubble_message import BubbleMessage, ScrollBar, ScrollArea, ScrollAreaContent
-from .chatInfoUi import Ui_Form
-class ChatInfo(QWidget, Ui_Form):
+class ChatInfo(QWidget):
def __init__(self, contact, parent=None):
super().__init__(parent)
- self.scrollArea = None
- self.setupUi(self)
self.contact = contact
+
self.init_ui()
self.show_chats()
def init_ui(self):
+ self.label_reamrk = QLabel(self.contact.remark)
+
+ self.hBoxLayout = QHBoxLayout()
+ self.hBoxLayout.addWidget(self.label_reamrk)
+
+ self.vBoxLayout = QVBoxLayout()
+ self.vBoxLayout.setSpacing(0)
+ # self.vBoxLayout.addLayout(self.hBoxLayout)
- self.label_reamrk.setText(self.contact.remark)
self.scrollArea = ScrollArea()
-
- self.verticalLayout_2.addWidget(self.scrollArea, 1)
-
self.scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
scrollBar = ScrollBar()
self.scrollArea.setVerticalScrollBar(scrollBar)
self.scrollAreaWidgetContents = ScrollAreaContent()
- self.scrollAreaWidgetContents.setMinimumSize(200, 100)
+ self.scrollAreaWidgetContents.setMinimumSize(200, 10000)
self.scrollArea.setWidget(self.scrollAreaWidgetContents)
+ self.vBoxLayout.addWidget(self.scrollArea)
self.scroolAreaLayout = QVBoxLayout()
+ self.scroolAreaLayout.setSpacing(0)
self.scrollAreaWidgetContents.setLayout(self.scroolAreaLayout)
def show_chats(self):
@@ -42,6 +46,7 @@ class ChatInfo(QWidget, Ui_Form):
def show_finish(self, ok):
self.spacerItem = QSpacerItem(10, 10, QSizePolicy.Minimum, QSizePolicy.Expanding)
self.scroolAreaLayout.addItem(self.spacerItem)
+ self.setLayout(self.vBoxLayout)
def show_chat(self, message):
try: