修复时间插入位置

This commit is contained in:
shuaikangzhou 2023-11-18 20:13:56 +08:00
parent 954454905b
commit 2714ca6577
2 changed files with 31 additions and 29 deletions

View File

@ -4,10 +4,9 @@
<option name="autoReloadType" value="SELECTIVE" /> <option name="autoReloadType" value="SELECTIVE" />
</component> </component>
<component name="ChangeListManager"> <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="update readme">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/DataBase/micro_msg.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/DataBase/micro_msg.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/app/ui_pc/chat/chat_info.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/ui_pc/chat/chat_info.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/readme.md" beforeDir="false" afterPath="$PROJECT_DIR$/readme.md" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -273,27 +272,6 @@
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1672848140146</updated> <updated>1672848140146</updated>
</task> </task>
<task id="LOCAL-00027" summary="mainwindows文件修正">
<created>1684726034556</created>
<option name="number" value="00027" />
<option name="presentableId" value="LOCAL-00027" />
<option name="project" value="LOCAL" />
<updated>1684726034556</updated>
</task>
<task id="LOCAL-00028" summary="mainwindows文件修正">
<created>1684726338618</created>
<option name="number" value="00028" />
<option name="presentableId" value="LOCAL-00028" />
<option name="project" value="LOCAL" />
<updated>1684726338618</updated>
</task>
<task id="LOCAL-00029" summary="match语法说明">
<created>1692427491271</created>
<option name="number" value="00029" />
<option name="presentableId" value="LOCAL-00029" />
<option name="project" value="LOCAL" />
<updated>1692427491271</updated>
</task>
<task id="LOCAL-00030" summary="update readme"> <task id="LOCAL-00030" summary="update readme">
<created>1698248435600</created> <created>1698248435600</created>
<option name="number" value="00030" /> <option name="number" value="00030" />
@ -616,7 +594,28 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1700289701718</updated> <updated>1700289701718</updated>
</task> </task>
<option name="localTasksCounter" value="76" /> <task id="LOCAL-00076" summary="update readme">
<created>1700290543397</created>
<option name="number" value="00076" />
<option name="presentableId" value="LOCAL-00076" />
<option name="project" value="LOCAL" />
<updated>1700290543397</updated>
</task>
<task id="LOCAL-00077" summary="update readme">
<created>1700290549743</created>
<option name="number" value="00077" />
<option name="presentableId" value="LOCAL-00077" />
<option name="project" value="LOCAL" />
<updated>1700290549743</updated>
</task>
<task id="LOCAL-00078" summary="update readme">
<created>1700290555508</created>
<option name="number" value="00078" />
<option name="presentableId" value="LOCAL-00078" />
<option name="project" value="LOCAL" />
<updated>1700290555508</updated>
</task>
<option name="localTasksCounter" value="79" />
<servers /> <servers />
</component> </component>
<component name="UnknownFeatures"> <component name="UnknownFeatures">
@ -668,7 +667,6 @@
<MESSAGE value="修复情感分析数值显示过长的bug" /> <MESSAGE value="修复情感分析数值显示过长的bug" />
<MESSAGE value="新增聊天记录导出csv格式" /> <MESSAGE value="新增聊天记录导出csv格式" />
<MESSAGE value="导出所有数据库的聊天记录" /> <MESSAGE value="导出所有数据库的聊天记录" />
<MESSAGE value="update readme" />
<MESSAGE value="数据库加锁避免多线程访问报错" /> <MESSAGE value="数据库加锁避免多线程访问报错" />
<MESSAGE value="修复聊天气泡不能更改大小的bug" /> <MESSAGE value="修复聊天气泡不能更改大小的bug" />
<MESSAGE value="更改头像显示" /> <MESSAGE value="更改头像显示" />
@ -677,7 +675,8 @@
<MESSAGE value="聊天记录从后往前显示" /> <MESSAGE value="聊天记录从后往前显示" />
<MESSAGE value="聊天消息自适应" /> <MESSAGE value="聊天消息自适应" />
<MESSAGE value="新版本更新" /> <MESSAGE value="新版本更新" />
<option name="LAST_COMMIT_MESSAGE" value="新版本更新" /> <MESSAGE value="update readme" />
<option name="LAST_COMMIT_MESSAGE" value="update readme" />
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="true" /> <option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="true" />
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="true" /> <option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="true" />
</component> </component>

View File

@ -10,9 +10,9 @@ class ChatInfo(QWidget):
def __init__(self, contact, parent=None): def __init__(self, contact, parent=None):
super().__init__(parent) super().__init__(parent)
self.last_timestamp = 0 self.last_timestamp = 0
self.last_str_time = ''
self.last_pos = 0 self.last_pos = 0
self.contact = contact self.contact = contact
self.init_ui() self.init_ui()
self.show_chats() self.show_chats()
@ -71,6 +71,7 @@ class ChatInfo(QWidget):
def is_5_min(self, timestamp): def is_5_min(self, timestamp):
if abs(timestamp - self.last_timestamp) > 300: if abs(timestamp - self.last_timestamp) > 300:
self.last_timestamp = timestamp self.last_timestamp = timestamp
return True return True
return False return False
@ -85,7 +86,8 @@ class ChatInfo(QWidget):
timestamp = message[5] timestamp = message[5]
if type_ == 1: if type_ == 1:
if self.is_5_min(timestamp): 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) self.chat_window.add_message_item(time_message, 0)
bubble_message = BubbleMessage( bubble_message = BubbleMessage(
str_content, str_content,
@ -96,6 +98,7 @@ class ChatInfo(QWidget):
# print(str_content) # print(str_content)
# self.scroolAreaLayout.addWidget(bubble_message) # self.scroolAreaLayout.addWidget(bubble_message)
self.chat_window.add_message_item(bubble_message, 0) self.chat_window.add_message_item(bubble_message, 0)
except: except:
print(message) print(message)