Added views in post displaying dialog

This commit is contained in:
Manuel Cortez 2019-01-09 17:42:11 -06:00
parent c5246e73ca
commit 38e56254ff
3 changed files with 16 additions and 0 deletions

View File

@ -9,6 +9,7 @@
* When displaying someone's profile, the dialog should be loaded dramatically faster than before. A message will be spoken when all data of the profile is loaded. * When displaying someone's profile, the dialog should be loaded dramatically faster than before. A message will be spoken when all data of the profile is loaded.
* When opening a timeline, if the current user is not allowed to do it, an error message should be displayed and the buffer will not be created. Before the buffer was partially created in the main window. ([#22.](https://code.manuelcortez.net/manuelcortez/socializer/issues/22)) * When opening a timeline, if the current user is not allowed to do it, an error message should be displayed and the buffer will not be created. Before the buffer was partially created in the main window. ([#22.](https://code.manuelcortez.net/manuelcortez/socializer/issues/22))
* Added basic support to handle group chats. At the current moment it is possible to receive and reply to chat messages only. Chat groups will be placed inside the conversations section. ([#23.](https://code.manuelcortez.net/manuelcortez/socializer/issues/23)) * Added basic support to handle group chats. At the current moment it is possible to receive and reply to chat messages only. Chat groups will be placed inside the conversations section. ([#23.](https://code.manuelcortez.net/manuelcortez/socializer/issues/23))
* It is possible to see how many people has read a wall post when showing it in the dialog.
* Added functionality regarding comments in wall posts: * Added functionality regarding comments in wall posts:
* when reading a post, you can press enter in any comment to display a dialog from where it is possible to view attachments, translate, check spelling or reply to the thread. If there are replies made to this comment, these will be visible in a section called replies. Pressing enter in a reply will also open the same dialog. * when reading a post, you can press enter in any comment to display a dialog from where it is possible to view attachments, translate, check spelling or reply to the thread. If there are replies made to this comment, these will be visible in a section called replies. Pressing enter in a reply will also open the same dialog.
* A new field called "replies" has been added to the comments' list. * A new field called "replies" has been added to the comments' list.

View File

@ -109,6 +109,10 @@ class displayPostPresenter(base.basePresenter):
# And we add a counter for views. # And we add a counter for views.
post = self.session.vk.client.wall.getById(posts="{owner_id}_{post_id}".format(owner_id=self.post[self.user_identifier], post_id=self.post[self.post_identifier])) post = self.session.vk.client.wall.getById(posts="{owner_id}_{post_id}".format(owner_id=self.post[self.user_identifier], post_id=self.post[self.post_identifier]))
self.post = post[0] self.post = post[0]
if "views" in self.post and self.post["views"]["count"] > 0:
self.send_message("set", control="views", value=str(self.post["views"]["count"]))
else:
self.send_message("disable_control", control="views")
if "owner_id" not in self.post: if "owner_id" not in self.post:
self.user_identifier = "from_id" self.user_identifier = "from_id"
else: else:

View File

@ -21,6 +21,15 @@ class displayBasicPost(widgetUtils.BaseDialog):
box.Add(self.post_view, 0, wx.ALL, 5) box.Add(self.post_view, 0, wx.ALL, 5)
return box return box
def create_views_control(self):
lbl = wx.StaticText(self.panel, -1, _("Views"))
self.views = wx.TextCtrl(self.panel, -1, style=wx.TE_READONLY|wx.TE_MULTILINE)
box = wx.BoxSizer(wx.HORIZONTAL)
box.Add(lbl, 0, wx.ALL, 5)
box.Add(self.views, 0, wx.ALL, 5)
return box
def create_comments_list(self): def create_comments_list(self):
lbl = wx.StaticText(self.panel, -1, _("Comments")) lbl = wx.StaticText(self.panel, -1, _("Comments"))
self.comments = widgetUtils.list(self.panel, _("User"), _("Comment"), _("Date"), _("Likes"), _("replies"), style=wx.LC_REPORT) self.comments = widgetUtils.list(self.panel, _("User"), _("Comment"), _("Date"), _("Likes"), _("replies"), style=wx.LC_REPORT)
@ -117,6 +126,8 @@ class displayPost(displayBasicPost):
super(displayPost, self).__init__(*args, **kwargs) super(displayPost, self).__init__(*args, **kwargs)
post_view_box = self.create_post_view() post_view_box = self.create_post_view()
self.sizer.Add(post_view_box, 0, wx.ALL, 5) self.sizer.Add(post_view_box, 0, wx.ALL, 5)
views_box = self.create_views_control()
self.sizer.Add(views_box, 0, wx.ALL, 5)
attachments_box = self.create_attachments() attachments_box = self.create_attachments()
self.sizer.Add(attachments_box, 0, wx.ALL, 5) self.sizer.Add(attachments_box, 0, wx.ALL, 5)
self.attachments.list.Enable(False) self.attachments.list.Enable(False)