Skip to content

Commit

Permalink
尝试修复聊天室卡顿
Browse files Browse the repository at this point in the history
  • Loading branch information
tonquer committed Dec 15, 2021
1 parent 4ad0fff commit 2f781f9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/view/chat/chat_room_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ def LeaveRoom(self):
self.close()
self.url = ""
for info in self.msgInfo.values():
self.verticalLayout_2.removeWidget(info)
info.setParent(None)
self.msgInfo.clear()
self.indexMsgId = 0
Expand Down Expand Up @@ -242,7 +243,9 @@ def _RecvBroadcastMsg(self, data):
info.nameLabel.setText(name)
info.levelLabel.setText("<font color=#130c0e>{}</font>".format(" LV"+str(level))+" ")
info.titleLabel.setText("<font color=#130c0e>{}</font>".format(" " + title + " "))
info.indexLabel.setText("{}".format(str(self.indexMsgId + 1))+ Str.GetStr(Str.Floor))
# info.indexLabel.setText("{}".format(str(self.indexMsgId + 1))+ Str.GetStr(Str.Floor))
date = time.strftime("%H:%M:%S")
info.indexLabel.setText(date)
# info.numLabel.setText("{}楼".format(str(self.indexMsgId+1)))
info.infoLabel.setText(data.get("platform", "")+" ")
imageData = data.get("image")
Expand Down Expand Up @@ -299,6 +302,7 @@ def _RecvBroadcastMsg(self, data):
if len(self.msgInfo) > self.maxMsgInfo:
removeInfo = self.msgInfo.get(self.removeMsgId)
if removeInfo:
self.verticalLayout_2.removeWidget(removeInfo)
removeInfo.setParent(None)
self.msgInfo.pop(self.removeMsgId)
self.removeMsgId += 1
Expand Down

0 comments on commit 2f781f9

Please sign in to comment.