diff options
author | Lucas Fryzek <lucas.fryzek@fryzekconcepts.com> | 2025-01-15 21:14:35 +0000 |
---|---|---|
committer | Lucas Fryzek <lucas.fryzek@fryzekconcepts.com> | 2025-01-15 21:14:35 +0000 |
commit | a34196f2fa184755e0dc336341b8ed92e5d0a398 (patch) | |
tree | 026566161dee7ff20c0d10c6c74f8d33f64e7fa3 /src/chat.py | |
parent | 1310a03148eac23db565ca0c6bbd5ae490024637 (diff) |
chat: Improve rendering of messages
Reduces the slowdown from receiving lots of messages at once. TODO look
to see if adding messages can be done without freezing the UI.
Diffstat (limited to 'src/chat.py')
-rw-r--r-- | src/chat.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/chat.py b/src/chat.py index b659395..3ee0438 100644 --- a/src/chat.py +++ b/src/chat.py @@ -166,9 +166,7 @@ class WeegtkChat(Adw.Bin): last = self.model.get_string(count - 1) last_data = json.loads(last) if last_data["username"] == user: - last_data["text"].append(msg) - self.model.splice(count - 1, 1, [json.dumps(last_data)]) - return + msg_type = "message_append" data = { "username": user, @@ -177,6 +175,10 @@ class WeegtkChat(Adw.Bin): } self.model.append(json.dumps(data)) + def clear(self): + # TODO clear chat buffer + pass + @Gtk.Template.Callback() def entry_activate(self, *args): entry_buffer = self.text_entry.get_buffer() |