From 33ab63c1bc72c2dd4dc387091c8614501dedf307 Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Sun, 15 Sep 2019 10:52:01 -0500 Subject: [PATCH] Added chat buffer count in the preferences dialog --- changelog.md | 1 + src/controller/mainController.py | 2 +- src/interactors/configuration.py | 1 + src/presenters/configuration.py | 1 + src/session.defaults | 5 +++-- src/views/dialogs/configuration.py | 7 +++++++ 6 files changed, 14 insertions(+), 3 deletions(-) diff --git a/changelog.md b/changelog.md index 4468a6b..fca9817 100644 --- a/changelog.md +++ b/changelog.md @@ -6,6 +6,7 @@ * when selecting multiple audio files in audio buffers, multiple actions can be performed in all items, these actions are present in the contextual menu of the buffer (namely play, add/remove from the library and move to a different playlist). This means you can select all the audios you want and Socializer will perform the selected options in all items, making it a bit easier to operate with multiple songs. * Now it is possible to like and see who liked a comment when displaying it individually. This applies to comments in wall posts and topics. +* Now it is possible to choose how many items Socializer will load in conversation buffers, from the General tab in the preferences dialog. The default value is 50 items, and the maximum value is 200. ### bugfixes diff --git a/src/controller/mainController.py b/src/controller/mainController.py index afd6e98..9f8951d 100644 --- a/src/controller/mainController.py +++ b/src/controller/mainController.py @@ -416,7 +416,7 @@ class Controller(object): elif user_id > 2000000000: chat = self.session.vk.client.messages.getChat(chat_id=user_id-2000000000) name = chat["title"] - pub.sendMessage("create_buffer", buffer_type="chatBuffer", buffer_title=name, parent_tab="chats", get_items=True, kwargs=dict(parent=self.window.tb, name="{0}_messages".format(user_id,), composefunc="render_message", parent_endpoint="messages", endpoint="getHistory", session=self.session, unread=unread, count=200, peer_id=user_id, rev=0, extended=True, fields="id, user_id, date, read_state, out, body, attachments, deleted")) + pub.sendMessage("create_buffer", buffer_type="chatBuffer", buffer_title=name, parent_tab="chats", get_items=True, kwargs=dict(parent=self.window.tb, name="{0}_messages".format(user_id,), composefunc="render_message", parent_endpoint="messages", endpoint="getHistory", session=self.session, unread=unread, count=self.session.settings["buffers"]["count_for_chat_buffers"], peer_id=user_id, rev=0, extended=True, fields="id, user_id, date, read_state, out, body, attachments, deleted")) # if setfocus: # pos = self.window.search(buffer.name) # self.window.change_buffer(pos) diff --git a/src/interactors/configuration.py b/src/interactors/configuration.py index 895ce0a..f9677e9 100644 --- a/src/interactors/configuration.py +++ b/src/interactors/configuration.py @@ -44,6 +44,7 @@ class configurationInteractor(base.baseInteractor): def on_save_settings(self, *args, **kwargs): self.presenter.update_setting(section="buffers", setting="count_for_wall_buffers", value=self.view.get_value("general", "wall_buffer_count")) self.presenter.update_setting(section="buffers", setting="count_for_video_buffers", value=self.view.get_value("general", "video_buffers_count")) + self.presenter.update_setting(section="buffers", setting="count_for_chat_buffers", value=self.view.get_value("general", "chat_buffers_count")) self.presenter.update_setting(section="general", setting="load_images", value=self.view.get_value("general", "load_images")) update_channel = self.presenter.get_update_channel_type(self.view.get_value("general", "update_channel")) if update_channel != self.presenter.session.settings["general"]["update_channel"]: diff --git a/src/presenters/configuration.py b/src/presenters/configuration.py index 28c046b..95166a0 100644 --- a/src/presenters/configuration.py +++ b/src/presenters/configuration.py @@ -53,6 +53,7 @@ class configurationPresenter(base.basePresenter): self.send_message("set_language", language=id) self.send_message("set", tab="general", setting="wall_buffer_count", value=self.session.settings["buffers"]["count_for_wall_buffers"]) self.send_message("set", tab="general", setting="video_buffers_count", value=self.session.settings["buffers"]["count_for_video_buffers"]) + self.send_message("set", tab="general", setting="chat_buffers_count", value=self.session.settings["buffers"]["count_for_chat_buffers"]) self.send_message("set", tab="general", setting="load_images", value=self.session.settings["general"]["load_images"]) self.send_message("set", tab="general", setting="use_proxy", value=config.app["app-settings"]["use_proxy"]) self.send_message("set", tab="general", setting="update_channel", value=self.get_update_channel_label(self.session.settings["general"]["update_channel"])) diff --git a/src/session.defaults b/src/session.defaults index 4bb51e5..00f854e 100644 --- a/src/session.defaults +++ b/src/session.defaults @@ -13,9 +13,10 @@ load_images = boolean(default=True) update_channel = string(default="stable") [buffers] -count_for_wall_buffers = integer(default=100) -count_for_video_buffers = integer(default=200) +count_for_wall_buffers = integer(default=50) +count_for_video_buffers = integer(default=50) count_for_audio_buffers = integer(default=1000) +count_for_chat_buffers = integer(default=50) [chat] notify_online = boolean(default=True) diff --git a/src/views/dialogs/configuration.py b/src/views/dialogs/configuration.py index 774e93d..3c8a209 100644 --- a/src/views/dialogs/configuration.py +++ b/src/views/dialogs/configuration.py @@ -26,6 +26,13 @@ class general(wx.Panel, widgetUtils.BaseDialog): box3.Add(lbl3, 0, wx.ALL, 5) box3.Add(self.video_buffers_count, 0, wx.ALL, 5) sizer.Add(box3, 0, wx.ALL, 5) + lbl4 = wx.StaticText(self, wx.NewId(), _("Number of items to load in conversation buffers (maximun 200)")) + self.chat_buffers_count = wx.SpinCtrl(self, wx.NewId()) + self.chat_buffers_count.SetRange(1, 200) + box4 = wx.BoxSizer(wx.HORIZONTAL) + box4.Add(lbl4, 0, wx.ALL, 5) + box4.Add(self.chat_buffers_count, 0, wx.ALL, 5) + sizer.Add(box4, 0, wx.ALL, 5) self.load_images = wx.CheckBox(self, wx.NewId(), _("Load images in posts")) sizer.Add(self.load_images, 0, wx.ALL, 5) self.use_proxy = wx.CheckBox(self, wx.NewId(), _("Use proxy"))