From f09d1b5da10074517b2601dc6524a77bed3df50c Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Thu, 31 Jan 2019 16:46:26 -0600 Subject: [PATCH] Added a buffer for displaying topics. Community buffers will keep group_info on them so we can check for group permissions and available post types --- src/controller/buffers.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/controller/buffers.py b/src/controller/buffers.py index b7af62e..a3c569c 100644 --- a/src/controller/buffers.py +++ b/src/controller/buffers.py @@ -481,6 +481,25 @@ class communityBuffer(feedBuffer): print(self.group_info["counters"]) super(communityBuffer, self).get_items(*args, **kwargs) +class topicBuffer(feedBuffer): + + def create_tab(self, parent): + self.tab = home.topicTab(parent) + self.connect_events() + self.tab.name = self.name + if hasattr(self, "can_post") and self.can_post == False and hasattr(self.tab, "post"): + self.tab.post.Enable(False) + + def onFocus(self, *args, **kwargs): + pass + + def open_post(self, *args, **kwargs): + """ Opens the currently focused post.""" + post = self.get_post() + if post == None: + return + a = presenters.displayTopicPresenter(session=self.session, postObject=post, group_id=self.kwargs["group_id"], interactor=interactors.displayPostInteractor(), view=views.displayTopic()) + class audioBuffer(feedBuffer): """ this buffer was supposed to be used with audio elements but is deprecated as VK removed its audio support for third party apps."""