mirror of
https://github.com/LC044/WeChatMsg
synced 2025-02-22 19:02:17 +08:00
加快打开速度
This commit is contained in:
parent
c8194fe2d9
commit
bb692bbec1
@ -4,13 +4,10 @@
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="84e65474-7da9-466d-baf3-cc88dde3ffdd" name="变更" comment="修改联系人视图架构">
|
||||
<list default="true" id="84e65474-7da9-466d-baf3-cc88dde3ffdd" name="变更" comment="修改部分UI">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/Ui/ICON.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/ICON.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/Ui/contact/contactInfo.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/contact/contactInfo.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/Ui/contact/contactInfoUi.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/contact/contactInfoUi.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/Ui/contact/contactInfoUi.ui" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/contact/contactInfoUi.ui" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/Ui/mainview.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/mainview.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/Ui/contact/contact.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/contact/contact.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -39,6 +36,9 @@
|
||||
"state": "OPEN"
|
||||
}
|
||||
}</component>
|
||||
<component name="GitToolBoxStore">
|
||||
<option name="projectConfigVersion" value="5" />
|
||||
</component>
|
||||
<component name="GithubPullRequestsUISettings">
|
||||
<option name="selectedUrlAndAccountId">
|
||||
<UrlAndAccount>
|
||||
@ -502,7 +502,14 @@
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1699190056580</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="44" />
|
||||
<task id="LOCAL-00044" summary="修改部分UI">
|
||||
<created>1699275644642</created>
|
||||
<option name="number" value="00044" />
|
||||
<option name="presentableId" value="LOCAL-00044" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1699275644642</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="45" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="UnknownFeatures">
|
||||
@ -554,7 +561,6 @@
|
||||
<MESSAGE value="增加群二维码" />
|
||||
<MESSAGE value="支持导出csv格式聊天记录" />
|
||||
<MESSAGE value="增加几个图标" />
|
||||
<MESSAGE value="修改部分UI" />
|
||||
<MESSAGE value="重构一些class,删除一些不必要的文件" />
|
||||
<MESSAGE value="用stackedWidget实现导航栏" />
|
||||
<MESSAGE value="修复部分bug" />
|
||||
@ -563,7 +569,8 @@
|
||||
<MESSAGE value="update readme" />
|
||||
<MESSAGE value="用stackWidget重写contactUI" />
|
||||
<MESSAGE value="修改联系人视图架构" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="修改联系人视图架构" />
|
||||
<MESSAGE value="修改部分UI" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="修改部分UI" />
|
||||
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="true" />
|
||||
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="true" />
|
||||
</component>
|
||||
@ -577,7 +584,7 @@
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
|
||||
<url>file://$PROJECT_DIR$/main.py</url>
|
||||
<line>18</line>
|
||||
<line>19</line>
|
||||
<option name="timeStamp" value="8" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
|
@ -44,37 +44,33 @@ class ContactController(QWidget, Ui_Dialog):
|
||||
self.show_flag = False
|
||||
self.last_talkerId = None
|
||||
self.now_talkerId = None
|
||||
self.showContact()
|
||||
# self.showContact()
|
||||
self.show_thread = ShowContactThread()
|
||||
self.show_thread.showSingal.connect(self.showContact)
|
||||
self.show_thread.heightSingal.connect(self.setScreenAreaHeight)
|
||||
self.show_thread.start()
|
||||
|
||||
def showContact(self):
|
||||
def showContact(self, data_):
|
||||
"""
|
||||
data:Tuple[rconversation,index:int]
|
||||
显示联系人
|
||||
: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))
|
||||
rconversation, i = data_
|
||||
username = rconversation[1]
|
||||
# print(username)
|
||||
pushButton_2 = MyLabel.ContactUi(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.Contact)
|
||||
self.contacts[username] = pushButton_2
|
||||
self.contactInfo[username] = ContactInfo(username, self.Me)
|
||||
self.stackedWidget.addWidget(self.contactInfo[username])
|
||||
|
||||
for i in range(len(rconversations)):
|
||||
rconversation = rconversations[i]
|
||||
username = rconversation[1]
|
||||
# 创建联系人按钮对象
|
||||
# 将实例化对象添加到self.contacts储存起来
|
||||
# pushButton_2 = Contact(self.scrollAreaWidgetContents, i, rconversation)
|
||||
pushButton_2 = MyLabel.ContactUi(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.Contact)
|
||||
self.contacts[username] = pushButton_2
|
||||
self.contactInfo[username] = ContactInfo(username, self.Me)
|
||||
self.stackedWidget.addWidget(self.contactInfo[username])
|
||||
def setScreenAreaHeight(self, height: int):
|
||||
self.scrollAreaWidgetContents.setGeometry(
|
||||
QtCore.QRect(0, 0, 300, height))
|
||||
|
||||
def Contact(self, talkerId):
|
||||
"""
|
||||
@ -101,3 +97,19 @@ class ContactController(QWidget, Ui_Dialog):
|
||||
self.chatroomFlag = True
|
||||
else:
|
||||
self.chatroomFlag = False
|
||||
|
||||
|
||||
class ShowContactThread(QThread):
|
||||
showSingal = pyqtSignal(tuple)
|
||||
heightSingal = pyqtSignal(int)
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
def run(self) -> None:
|
||||
rconversations = data.get_rconversation()
|
||||
max_height = max(len(rconversations) * 80, 680)
|
||||
# 设置滚动区域的高度
|
||||
self.heightSingal.emit(max_height)
|
||||
for i in range(len(rconversations)):
|
||||
self.showSingal.emit((rconversations[i], i))
|
||||
|
@ -104,7 +104,6 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
|
||||
"QPushButton:hover{background-color: rgb(209,209,209);}\n")
|
||||
self.last_btn = self.btn_contact
|
||||
self.stackedWidget.setCurrentIndex(1)
|
||||
self.contactView.showContact()
|
||||
|
||||
def myInfo(self):
|
||||
"""
|
||||
|
4
main.py
4
main.py
@ -1,4 +1,5 @@
|
||||
import sys
|
||||
import time
|
||||
|
||||
from PyQt5.QtWidgets import *
|
||||
|
||||
@ -42,12 +43,15 @@ class ViewController:
|
||||
:return:
|
||||
"""
|
||||
username = ''
|
||||
start = time.time()
|
||||
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()
|
||||
end = time.time()
|
||||
print('ok', end - start)
|
||||
# self.viewMainWIn.signUp()
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user