Added settings to control creation of buffers for audio albums, video albums and community buffers at startup
This commit is contained in:
@@ -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"]
|
||||
|
@@ -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()
|
@@ -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:
|
||||
|
@@ -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)
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user