Added settings to control creation of buffers for audio albums, video albums and community buffers at startup

This commit is contained in:
Manuel Cortez 2019-01-14 02:23:38 -06:00
parent 86aa453093
commit 70a511a141
6 changed files with 35 additions and 2 deletions

View File

@ -13,6 +13,7 @@
* It is possible to delete a conversation buffer from the buffer menu. Deleting a conversation will only dismiss the buffer, no data is deleted at VK.
* During the first start of Socializer, an invitation will be shown to join the Socializer's group in case the current user is not already a member.
* It is possible to see how many people has read a wall post when showing it in the dialog. ([#28.](https://code.manuelcortez.net/manuelcortez/socializer/issues/28))
* A new tab has been added to the preferences dialog. From the new section, it is possible to control whether socializer should create buffers for the first 1000 audio albums, video albums and communities when starting.
* 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.
* A new "replies" field has been added to the comments' list.

View File

@ -475,6 +475,8 @@ class Controller(object):
time.sleep(1)
def get_audio_albums(self, user_id=None, create_buffers=True):
if self.session.settings["load_at_startup"]["audio_albums"] == False:
return
log.debug("Create audio albums...")
if self.session.settings["vk"]["use_alternative_tokens"]:
albums = self.session.vk.client_audio.get_albums(owner_id=user_id)
@ -488,6 +490,8 @@ class Controller(object):
time.sleep(0.6)
def get_video_albums(self, user_id=None, create_buffers=True):
if self.session.settings["load_at_startup"]["video_albums"] == False:
return
log.debug("Create video albums...")
albums = self.session.vk.client.video.getAlbums(owner_id=user_id)
self.session.video_albums = albums["items"]
@ -509,6 +513,8 @@ class Controller(object):
commonMessages.group_joined()
else:
log.error("Invalid result when joining the Socializer's group: %d" % (result))
if self.session.settings["load_at_startup"]["communities"] == False:
return
log.debug("Create community buffers...")
groups= self.session.vk.client.groups.get(user_id=user_id, extended=1, fields="city, country, place, description, wiki_page, members_count, counters, start_date, finish_date, can_post, can_see_all_posts, activity, status, contacts, links, fixed_post, verified, site, can_create_topic", count=1000)
self.session.groups=groups["items"]

View File

@ -49,4 +49,7 @@ class configurationInteractor(base.baseInteractor):
self.presenter.update_setting(section="chat", setting="open_unread_conversations", value=self.view.get_value("chat", "open_unread_conversations"))
self.presenter.update_setting(section="chat", setting="automove_to_conversations", value=self.view.get_value("chat", "automove_to_conversations"))
self.presenter.update_setting(section="chat", setting="notifications", value=self.presenter.get_notification_type(self.view.get_value("chat", "notifications")))
self.presenter.update_setting(section="load_at_startup", setting="audio_albums", value=self.view.get_value("startup", "audio_albums"))
self.presenter.update_setting(section="load_at_startup", setting="video_albums", value=self.view.get_value("startup", "video_albums"))
self.presenter.update_setting(section="load_at_startup", setting="communities", value=self.view.get_value("startup", "communities"))
self.presenter.save_settings_file()

View File

@ -10,7 +10,6 @@ class configurationPresenter(base.basePresenter):
self.create_config()
self.run()
def get_notification_label(self, value):
if value == "native":
return _("Native")
@ -51,6 +50,10 @@ class configurationPresenter(base.basePresenter):
self.send_message("set", tab="chat", setting="open_unread_conversations", value=self.session.settings["chat"]["open_unread_conversations"])
self.send_message("set", tab="chat", setting="automove_to_conversations", value=self.session.settings["chat"]["automove_to_conversations"])
self.send_message("set", tab="chat", setting="notifications", value=self.get_notification_label(self.session.settings["chat"]["notifications"]))
self.send_message("create_tab", tab="startup_options")
self.send_message("set", tab="startup", setting="audio_albums", value=self.session.settings["load_at_startup"]["audio_albums"])
self.send_message("set", tab="startup", setting="video_albums", value=self.session.settings["load_at_startup"]["video_albums"])
self.send_message("set", tab="startup", setting="communities", value=self.session.settings["load_at_startup"]["communities"])
def update_setting(self, section, setting, value):
if section not in self.session.settings:

View File

@ -27,4 +27,9 @@ notify_online = boolean(default=True)
notify_offline = boolean(default=True)
open_unread_conversations = boolean(default=True)
automove_to_conversations = boolean(default=True)
notifications = string(default="custom")
notifications = string(default="custom")
[load_at_startup]
audio_albums = boolean(default=False)
video_albums = boolean(default=False)
communities = boolean(default=False)

View File

@ -51,6 +51,18 @@ class chat(wx.Panel, widgetUtils.BaseDialog):
sizer.Add(nbox, 0, wx.ALL, 5)
self.SetSizer(sizer)
class loadAtStartup(wx.Panel, widgetUtils.BaseDialog):
def __init__(self, panel):
super(loadAtStartup, self).__init__(panel)
sizer = wx.BoxSizer(wx.VERTICAL)
self.audio_albums = wx.CheckBox(self, wx.NewId(), _("Create buffers for audio albums at startup"))
sizer.Add(self.audio_albums, 0, wx.ALL, 5)
self.video_albums = wx.CheckBox(self, wx.NewId(), _("Create buffers for video albums at startup"))
sizer.Add(self.video_albums, 0, wx.ALL, 5)
self.communities = wx.CheckBox(self, wx.NewId(), _("Create buffers for communities and public pages at startup"))
sizer.Add(self.communities, 0, wx.ALL, 5)
self.SetSizer(sizer)
class configurationDialog(widgetUtils.BaseDialog):
def __init__(self, title):
@ -68,6 +80,9 @@ class configurationDialog(widgetUtils.BaseDialog):
self.chat = chat(self.notebook)
self.notebook.AddPage(self.chat, _("Chat settings"))
def create_startup_options(self):
self.startup = loadAtStartup(self.notebook)
self.notebook.AddPage(self.startup, _("Optional buffers"))
def realize(self):
self.sizer.Add(self.notebook, 0, wx.ALL, 5)