diff --git a/src/presenters/displayPosts/basePost.py b/src/presenters/displayPosts/basePost.py index 8bf5cb1..1962ac5 100644 --- a/src/presenters/displayPosts/basePost.py +++ b/src/presenters/displayPosts/basePost.py @@ -58,7 +58,13 @@ class displayPostPresenter(base.basePresenter): self.worker = threading.Thread(target=self.load_all_components) self.worker.finished = threading.Event() self.worker.start() + # connect here the pubsub event for successful posting of comments. + pub.subscribe(self.posted, "posted") self.run() + pub.unsubscribe(self.posted, "posted") + + def posted(self, from_buffer=None): + self.clear_comments_list() def get_comments(self): """ Get comments and insert them in a list.""" diff --git a/src/presenters/displayPosts/comment.py b/src/presenters/displayPosts/comment.py index 2a7ab3e..9c2d234 100644 --- a/src/presenters/displayPosts/comment.py +++ b/src/presenters/displayPosts/comment.py @@ -40,7 +40,10 @@ class displayCommentPresenter(basePost.displayPostPresenter): # We'll put images here, so it will be easier to work with them. self.images = [] self.imageIndex = 0 + # connect here the pubsub event for successful posting of comments. + pub.subscribe(self.posted, "posted") self.run() + pub.unsubscribe(self.posted, "posted") def load_all_components(self): self.get_post_information()