Skip to content

Commit

Permalink
修复时间插入位置
Browse files Browse the repository at this point in the history
  • Loading branch information
LC044 committed Nov 18, 2023
1 parent 9544549 commit 2714ca6
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 29 deletions.
53 changes: 26 additions & 27 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions app/ui_pc/chat/chat_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ class ChatInfo(QWidget):
def __init__(self, contact, parent=None):
super().__init__(parent)
self.last_timestamp = 0
self.last_str_time = ''
self.last_pos = 0
self.contact = contact

self.init_ui()
self.show_chats()

Expand Down Expand Up @@ -71,6 +71,7 @@ def setScrollBarPos(self):
def is_5_min(self, timestamp):
if abs(timestamp - self.last_timestamp) > 300:
self.last_timestamp = timestamp

return True
return False

Expand All @@ -85,7 +86,8 @@ def add_message(self, message):
timestamp = message[5]
if type_ == 1:
if self.is_5_min(timestamp):
time_message = Notice(str_time)
time_message = Notice(self.last_str_time)
self.last_str_time = str_time
self.chat_window.add_message_item(time_message, 0)
bubble_message = BubbleMessage(
str_content,
Expand All @@ -96,6 +98,7 @@ def add_message(self, message):
# print(str_content)
# self.scroolAreaLayout.addWidget(bubble_message)
self.chat_window.add_message_item(bubble_message, 0)

except:
print(message)

Expand Down

0 comments on commit 2714ca6

Please sign in to comment.