Added display of people who shared the post in the post displayer dialog

This commit is contained in:
Manuel Cortez 2019-04-16 09:41:32 -05:00
parent 7c90103af4
commit b02137c216
2 changed files with 12 additions and 0 deletions

View File

@ -52,6 +52,8 @@ class displayPostInteractor(base.baseInteractor):
widgetUtils.connect_event(self.view.tools, widgetUtils.BUTTON_PRESSED, self.on_show_tools_menu) widgetUtils.connect_event(self.view.tools, widgetUtils.BUTTON_PRESSED, self.on_show_tools_menu)
if hasattr(self.view, "likes"): if hasattr(self.view, "likes"):
widgetUtils.connect_event(self.view.likes, widgetUtils.BUTTON_PRESSED, self.on_show_likes_menu) widgetUtils.connect_event(self.view.likes, widgetUtils.BUTTON_PRESSED, self.on_show_likes_menu)
if hasattr(self.view, "shares"):
widgetUtils.connect_event(self.view.shares, widgetUtils.BUTTON_PRESSED, self.on_show_shares_menu)
if hasattr(self.view, "repost"): if hasattr(self.view, "repost"):
widgetUtils.connect_event(self.view.repost, widgetUtils.BUTTON_PRESSED, self.on_repost) widgetUtils.connect_event(self.view.repost, widgetUtils.BUTTON_PRESSED, self.on_repost)
self.view.comments.list.Bind(wx.EVT_LIST_ITEM_FOCUSED, self.on_focus) self.view.comments.list.Bind(wx.EVT_LIST_ITEM_FOCUSED, self.on_focus)
@ -139,6 +141,9 @@ class displayPostInteractor(base.baseInteractor):
def on_show_likes_menu(self, *args, **kwargs): def on_show_likes_menu(self, *args, **kwargs):
self.presenter.show_likes() self.presenter.show_likes()
def on_show_shares_menu(self, *args, **kwargs):
self.presenter.show_shares()
class displayAudioInteractor(base.baseInteractor): class displayAudioInteractor(base.baseInteractor):
def set(self, control, value): def set(self, control, value):

View File

@ -425,6 +425,13 @@ class displayPostPresenter(base.basePresenter):
post = {"source_id": self.post[self.user_identifier], "friends": {"items": result["items"]}} post = {"source_id": self.post[self.user_identifier], "friends": {"items": result["items"]}}
pub.sendMessage("open-post", post_object=post, controller_="displayFriendship", vars=dict(caption=_("people who liked this"))) pub.sendMessage("open-post", post_object=post, controller_="displayFriendship", vars=dict(caption=_("people who liked this")))
def show_shares(self):
data = dict(type="post", owner_id=self.post[self.user_identifier], item_id=self.post["id"], extended=True, count=1000, skip_own=True, filter="copies")
result = self.session.vk.client.likes.getList(**data)
if result["count"] > 0:
post = {"source_id": self.post[self.user_identifier], "friends": {"items": result["items"]}}
pub.sendMessage("open-post", post_object=post, controller_="displayFriendship", vars=dict(caption=_("people who shared this")))
class displayCommentPresenter(displayPostPresenter): class displayCommentPresenter(displayPostPresenter):
def __init__(self, session, postObject, view, interactor): def __init__(self, session, postObject, view, interactor):