socializer should not stop responding when loading conversation buffers

This commit is contained in:
Manuel Cortez 2020-07-23 08:59:30 -05:00
parent c1865b3ecd
commit c43de3e9e5
3 changed files with 9 additions and 8 deletions

View File

@ -13,6 +13,7 @@
### Changes
* The spelling correction module has been rewritten to take advantage of the newest enchant Python module which is more stable and can be added properly to the distribution, as opposed to the first enchant module we have tried.
* Better performance on Socializer should be noticed for users with many conversations opened. Before, socializer could freeze while loading all messages in conversations. Now that should work more efficiently and the application should not stop responding.
## News in Version 0.24

View File

@ -1187,9 +1187,9 @@ class chatBuffer(baseBuffer):
if show_nextpage == False:
if self.tab.history.GetValue() != "" and num > 0:
v = [i for i in self.session.db[self.name]["items"][:num]]
[wx.CallAfter(self.insert, i, False) for i in v]
[self.insert(i, False) for i in v]
else:
[wx.CallAfter(self.insert, i) for i in self.session.db[self.name]["items"][:num]]
[self.insert(i) for i in self.session.db[self.name]["items"][:num]]
else:
if num > 0:
# At this point we save more CPU and mathematical work if we just delete everything in the chat history and readd all messages.
@ -1197,14 +1197,14 @@ class chatBuffer(baseBuffer):
# Firstly, we'd have to save the current focused object so we will place the user in the right part of the text after loading everything again.
focused_post = self.get_post()
self.chats = dict()
self.tab.history.SetValue("")
wx.CallAfter(self.tab.history.SetValue, "")
v = [i for i in self.session.db[self.name]["items"]]
[wx.CallAfter(self.insert, i) for i in v]
[self.insert(i) for i in v]
# Now it's time to set back the focus in the post.
for i in self.chats.keys():
if self.chats[i] == focused_post["id"]:
line = i[0]
self.tab.history.SetInsertionPoint(self.tab.history.XYToPosition(0, line))
wx.CallAfter(self.tab.history.SetInsertionPoint, self.tab.history.XYToPosition(0, line))
output.speak(_("Items loaded"))
break
if self.unread == True and num > 0:

View File

@ -256,10 +256,10 @@ class chatTab(wx.Panel):
old_line = self.history.GetNumberOfLines()#.count("\n")
point = self.history.GetInsertionPoint()
if reverse:
self.history.SetValue(message+"\n"+self.history.GetValue())
wx.CallAfter(self.history.SetValue, message+"\n"+self.history.GetValue())
else:
self.history.AppendText(message+"\n")
self.history.SetInsertionPoint(point)
wx.CallAfter(self.history.AppendText, message+"\n")
wx.CallAfter(self.history.SetInsertionPoint, point)
new_line = self.history.GetNumberOfLines()#.count("\n")
return (old_line, new_line)