Added block in people buffers' menu and blacklist management in the application menu
This commit is contained in:
parent
f274ba9caa
commit
19a5216373
@ -9,6 +9,7 @@
|
|||||||
* 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 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.
|
* 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.
|
||||||
* There is a new tab called buffer settings, in the preferences dialog. Settings related to how many items should be loaded in certain buffer types have been moved to this tab, so it will separate better the configuration options in the application.
|
* There is a new tab called buffer settings, in the preferences dialog. Settings related to how many items should be loaded in certain buffer types have been moved to this tab, so it will separate better the configuration options in the application.
|
||||||
|
* Added management of the Blacklist on VK. Users can be blocked from people buffers (friends, online, or any buffer inside friend requests). You can access the blacklist from the application menu, located in the menu bar. From there, you can unblock any previously blocked user.
|
||||||
|
|
||||||
### bugfixes
|
### bugfixes
|
||||||
|
|
||||||
@ -17,6 +18,7 @@
|
|||||||
* Fixed a traceback that was being logged when attempting to load an image but cancel the dialog for attaching it.
|
* Fixed a traceback that was being logged when attempting to load an image but cancel the dialog for attaching it.
|
||||||
* Fixed an error that was making Socializer to fail when loading the newsfeed buffer, thus not loading any other buffers. This error was caused due to VK sending a new object type representing push subscriptions. The item is ignored by Socializer so it will not break the newsfeed buffer anymore.
|
* Fixed an error that was making Socializer to fail when loading the newsfeed buffer, thus not loading any other buffers. This error was caused due to VK sending a new object type representing push subscriptions. The item is ignored by Socializer so it will not break the newsfeed buffer anymore.
|
||||||
* Fixed an error that was making the status bar to not fit the full size of the Window. This was cutting the messages placed on it, now, all messages are displayed properly again.
|
* Fixed an error that was making the status bar to not fit the full size of the Window. This was cutting the messages placed on it, now, all messages are displayed properly again.
|
||||||
|
* fixed an unhandled condition when playing a song and voice message at the same time, that was potentially making Socializer to stop loading certain buffers.
|
||||||
|
|
||||||
### Changes
|
### Changes
|
||||||
|
|
||||||
|
@ -1362,6 +1362,7 @@ class peopleBuffer(feedBuffer):
|
|||||||
else:
|
else:
|
||||||
m = menus.peopleMenu(is_request=False)
|
m = menus.peopleMenu(is_request=False)
|
||||||
widgetUtils.connect_event(m, widgetUtils.MENU, self.decline_friendship, menuitem=m.decline)
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.decline_friendship, menuitem=m.decline)
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.block_person, menuitem=m.block)
|
||||||
# It is not allowed to send messages to people who is not your friends, so let's disable it if we're in a pending or outgoing requests buffer.
|
# It is not allowed to send messages to people who is not your friends, so let's disable it if we're in a pending or outgoing requests buffer.
|
||||||
if "friend_requests" in self.name:
|
if "friend_requests" in self.name:
|
||||||
m.message.Enable(False)
|
m.message.Enable(False)
|
||||||
@ -1395,6 +1396,21 @@ class peopleBuffer(feedBuffer):
|
|||||||
self.session.db[self.name]["items"].pop(self.tab.list.get_selected())
|
self.session.db[self.name]["items"].pop(self.tab.list.get_selected())
|
||||||
self.tab.list.remove_item(self.tab.list.get_selected())
|
self.tab.list.remove_item(self.tab.list.get_selected())
|
||||||
|
|
||||||
|
def block_person(self, *args, **kwargs):
|
||||||
|
person = self.get_post()
|
||||||
|
if person == None:
|
||||||
|
return
|
||||||
|
user = self.session.get_user(person["id"])
|
||||||
|
question = commonMessages.block_person(user)
|
||||||
|
if question == widgetUtils.NO:
|
||||||
|
return
|
||||||
|
result = self.session.vk.client.account.ban(owner_id=person["id"])
|
||||||
|
if result == 1:
|
||||||
|
msg = _("You've blocked {user1_nom} from your friends.").format(**user,)
|
||||||
|
pub.sendMessage("notify", message=msg)
|
||||||
|
self.session.db[self.name]["items"].pop(self.tab.list.get_selected())
|
||||||
|
self.tab.list.remove_item(self.tab.list.get_selected())
|
||||||
|
|
||||||
def keep_as_follower(self, *args, **kwargs):
|
def keep_as_follower(self, *args, **kwargs):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -624,6 +624,7 @@ class Controller(object):
|
|||||||
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.changelog, menuitem=self.window.changelog)
|
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.changelog, menuitem=self.window.changelog)
|
||||||
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.open_logs, menuitem=self.window.open_logs)
|
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.open_logs, menuitem=self.window.open_logs)
|
||||||
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.open_config, menuitem=self.window.open_config)
|
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.open_config, menuitem=self.window.open_config)
|
||||||
|
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.blacklist, menuitem=self.window.blacklist)
|
||||||
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.configuration, menuitem=self.window.settings_dialog)
|
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.configuration, menuitem=self.window.settings_dialog)
|
||||||
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.new_timeline, menuitem=self.window.timeline)
|
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.new_timeline, menuitem=self.window.timeline)
|
||||||
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.create_audio_album, menuitem=self.window.audio_album)
|
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.create_audio_album, menuitem=self.window.audio_album)
|
||||||
@ -723,10 +724,15 @@ class Controller(object):
|
|||||||
os.chdir("documentation/%s" % (lang,))
|
os.chdir("documentation/%s" % (lang,))
|
||||||
webbrowser.open("changelog.html")
|
webbrowser.open("changelog.html")
|
||||||
os.chdir("../../")
|
os.chdir("../../")
|
||||||
|
|
||||||
def configuration(self, *args, **kwargs):
|
def configuration(self, *args, **kwargs):
|
||||||
""" Opens the global settings dialogue."""
|
""" Opens the global settings dialogue."""
|
||||||
presenter = presenters.configurationPresenter(session=self.session, view=views.configurationDialog(title=_("Preferences")), interactor=interactors.configurationInteractor())
|
presenter = presenters.configurationPresenter(session=self.session, view=views.configurationDialog(title=_("Preferences")), interactor=interactors.configurationInteractor())
|
||||||
|
|
||||||
|
def blacklist(self, *args, **kwargs):
|
||||||
|
""" Opens the blacklist presenter."""
|
||||||
|
presenter = presenters.blacklistPresenter(session=self.session, view=views.blacklistDialog(), interactor=interactors.blacklistInteractor())
|
||||||
|
|
||||||
def open_logs(self, *args, **kwargs):
|
def open_logs(self, *args, **kwargs):
|
||||||
subprocess.call(["explorer", paths.logs_path()])
|
subprocess.call(["explorer", paths.logs_path()])
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
from .attach import *
|
from .attach import *
|
||||||
from . audioRecorder import *
|
from . audioRecorder import *
|
||||||
|
from . blacklist import *
|
||||||
from .configuration import *
|
from .configuration import *
|
||||||
from .postCreation import *
|
from .postCreation import *
|
||||||
from .postDisplayer import *
|
from .postDisplayer import *
|
||||||
|
31
src/interactors/blacklist.py
Normal file
31
src/interactors/blacklist.py
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import widgetUtils
|
||||||
|
from wxUI import commonMessages
|
||||||
|
from pubsub import pub
|
||||||
|
from . import base
|
||||||
|
|
||||||
|
class blacklistInteractor(base.baseInteractor):
|
||||||
|
|
||||||
|
def add_items(self, control, items):
|
||||||
|
if not hasattr(self.view, control):
|
||||||
|
raise AttributeError("The control is not present in the view.")
|
||||||
|
for i in items:
|
||||||
|
getattr(self.view, control).insert_item(False, *i)
|
||||||
|
|
||||||
|
def install(self, *args, **kwargs):
|
||||||
|
super(blacklistInteractor, self).install(*args, **kwargs)
|
||||||
|
widgetUtils.connect_event(self.view.unblock, widgetUtils.BUTTON_PRESSED, self.on_unblock)
|
||||||
|
pub.subscribe(self.add_items, self.modulename+"_add_items")
|
||||||
|
|
||||||
|
def uninstall(self):
|
||||||
|
super(blacklistInteractor, self).uninstall()
|
||||||
|
pub.unsubscribe(self.add_items, self.modulename+"_add_items")
|
||||||
|
|
||||||
|
|
||||||
|
def on_unblock(self, *args, **kwargs):
|
||||||
|
question = commonMessages.unblock_person()
|
||||||
|
if question == widgetUtils.NO:
|
||||||
|
return
|
||||||
|
item = self.view.persons.get_selected()
|
||||||
|
if self.presenter.unblock_person(item) == 1:
|
||||||
|
self.view.persons.remove_item(item)
|
@ -13,6 +13,7 @@
|
|||||||
"""
|
"""
|
||||||
from .attach import *
|
from .attach import *
|
||||||
from .audioRecorder import *
|
from .audioRecorder import *
|
||||||
|
from .blacklist import *
|
||||||
from .createPosts import *
|
from .createPosts import *
|
||||||
from .displayPosts import *
|
from .displayPosts import *
|
||||||
from .configuration import *
|
from .configuration import *
|
||||||
|
30
src/presenters/blacklist.py
Normal file
30
src/presenters/blacklist.py
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import threading
|
||||||
|
from pubsub import pub
|
||||||
|
from . import base
|
||||||
|
|
||||||
|
class blacklistPresenter(base.basePresenter):
|
||||||
|
|
||||||
|
def __init__(self, session, view, interactor):
|
||||||
|
self.session = session
|
||||||
|
super(blacklistPresenter, self).__init__(view=view, interactor=interactor, modulename="blacklist")
|
||||||
|
self.worker = threading.Thread(target=self.load_information)
|
||||||
|
self.worker.finished = threading.Event()
|
||||||
|
self.worker.start()
|
||||||
|
self.run()
|
||||||
|
|
||||||
|
def load_information(self):
|
||||||
|
banned_users = self.session.vk.client.account.getBanned(count=200)
|
||||||
|
self.users = banned_users["profiles"]
|
||||||
|
items = []
|
||||||
|
for i in self.users:
|
||||||
|
str_user = "{first_name} {last_name}".format(first_name=i["first_name"], last_name=i["last_name"])
|
||||||
|
items.append([str_user])
|
||||||
|
self.send_message("add_items", control="persons", items=items)
|
||||||
|
|
||||||
|
def unblock_person(self, item):
|
||||||
|
result = self.session.vk.client.account.unban(owner_id=self.users[item]["id"])
|
||||||
|
if result == 1:
|
||||||
|
msg = _("You've unblocked {user1_nom} from your friends.").format(**self.session.get_user(self.users[item]["id"]),)
|
||||||
|
pub.sendMessage("notify", message=msg)
|
||||||
|
return result
|
@ -5,6 +5,7 @@
|
|||||||
"""
|
"""
|
||||||
from .dialogs.attach import *
|
from .dialogs.attach import *
|
||||||
from .dialogs.audioRecorder import *
|
from .dialogs.audioRecorder import *
|
||||||
|
from .dialogs.blacklist import *
|
||||||
from .dialogs.postCreation import *
|
from .dialogs.postCreation import *
|
||||||
from .dialogs.postDisplay import *
|
from .dialogs.postDisplay import *
|
||||||
from .dialogs.configuration import *
|
from .dialogs.configuration import *
|
||||||
|
20
src/views/dialogs/blacklist.py
Normal file
20
src/views/dialogs/blacklist.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
import wx
|
||||||
|
import widgetUtils
|
||||||
|
|
||||||
|
class blacklistDialog(widgetUtils.BaseDialog):
|
||||||
|
def __init__(self):
|
||||||
|
super(blacklistDialog, self).__init__(parent=None, title=_("blacklist"))
|
||||||
|
panel = wx.Panel(self)
|
||||||
|
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||||
|
box1 = wx.StaticBoxSizer(parent=panel, orient=wx.HORIZONTAL, label=_("blocked users"))
|
||||||
|
self.persons = widgetUtils.list(panel, _("User"), style=wx.LC_REPORT)
|
||||||
|
box1.Add(self.persons.list, 0, wx.ALL, 5)
|
||||||
|
sizer.Add(box1, 0, wx.ALL, 5)
|
||||||
|
self.unblock = wx.Button(panel, wx.NewId(), _("Unblock"))
|
||||||
|
sizer.Add(self.unblock, 0, wx.ALL, 5)
|
||||||
|
close = wx.Button(panel, wx.ID_CLOSE)
|
||||||
|
sizer.Add(close, 0, wx.ALL, 5)
|
||||||
|
panel.SetSizer(sizer)
|
||||||
|
self.SetClientSize(sizer.CalcMin())
|
@ -68,5 +68,11 @@ def community_no_items():
|
|||||||
def delete_conversation():
|
def delete_conversation():
|
||||||
return wx.MessageDialog(None, _("do you really want to delete all messages of this conversation in VK?"), _("Attention"), style=wx.ICON_QUESTION|wx.YES_NO).ShowModal()
|
return wx.MessageDialog(None, _("do you really want to delete all messages of this conversation in VK?"), _("Attention"), style=wx.ICON_QUESTION|wx.YES_NO).ShowModal()
|
||||||
|
|
||||||
|
def block_person(person):
|
||||||
|
return wx.MessageDialog(None, _("Are you really sure you want to block {user1_nom} from your VK account?").format(**person,), _("Attention"), style=wx.ICON_QUESTION|wx.YES_NO).ShowModal()
|
||||||
|
|
||||||
|
def unblock_person():
|
||||||
|
return wx.MessageDialog(None, _("Are you sure you want to unblock this user?"), _("Attention"), style=wx.ICON_QUESTION|wx.YES_NO).ShowModal()
|
||||||
|
|
||||||
def post_failed():
|
def post_failed():
|
||||||
return wx.MessageDialog(None, _("Unfortunately, we could not send your last post or message to VK. Would you like to try again?"), _("Post failed"), style=wx.ICON_QUESTION|wx.YES_NO).ShowModal()
|
return wx.MessageDialog(None, _("Unfortunately, we could not send your last post or message to VK. Would you like to try again?"), _("Post failed"), style=wx.ICON_QUESTION|wx.YES_NO).ShowModal()
|
@ -15,6 +15,7 @@ class mainWindow(wx.Frame):
|
|||||||
self.delete_audio_album = delete.Append(wx.NewId(), _("Audio album"))
|
self.delete_audio_album = delete.Append(wx.NewId(), _("Audio album"))
|
||||||
self.delete_video_album = delete.Append(wx.NewId(), _("Video album"))
|
self.delete_video_album = delete.Append(wx.NewId(), _("Video album"))
|
||||||
app_.Append(wx.NewId(), _("Delete"), delete)
|
app_.Append(wx.NewId(), _("Delete"), delete)
|
||||||
|
self.blacklist = app_.Append(wx.NewId(), _("Blacklist"))
|
||||||
self.settings_dialog = app_.Append(wx.NewId(), _("Preferences"))
|
self.settings_dialog = app_.Append(wx.NewId(), _("Preferences"))
|
||||||
me = wx.Menu()
|
me = wx.Menu()
|
||||||
profile = wx.Menu()
|
profile = wx.Menu()
|
||||||
|
@ -45,15 +45,18 @@ class peopleMenu(wx.Menu):
|
|||||||
self.common_friends = self.Append(wx.NewId(), _("View friends in common"))
|
self.common_friends = self.Append(wx.NewId(), _("View friends in common"))
|
||||||
if is_request == False and is_subscriber == False and not_friend == False:
|
if is_request == False and is_subscriber == False and not_friend == False:
|
||||||
self.decline = self.Append(wx.NewId(), _("Remove from friends"))
|
self.decline = self.Append(wx.NewId(), _("Remove from friends"))
|
||||||
|
self.block = self.Append(wx.NewId(), _("Block"))
|
||||||
self.open_in_browser = self.Append(wx.NewId(), _("Open in vk.com"))
|
self.open_in_browser = self.Append(wx.NewId(), _("Open in vk.com"))
|
||||||
|
|
||||||
def create_request_items(self):
|
def create_request_items(self):
|
||||||
self.accept = self.Append(wx.NewId(), _("Accept"))
|
self.accept = self.Append(wx.NewId(), _("Accept"))
|
||||||
self.decline = self.Append(wx.NewId(), _("Decline"))
|
self.decline = self.Append(wx.NewId(), _("Decline"))
|
||||||
self.keep_as_follower = self.Append(wx.NewId(), _("Keep as follower"))
|
self.keep_as_follower = self.Append(wx.NewId(), _("Keep as follower"))
|
||||||
|
self.block = self.Append(wx.NewId(), _("Block"))
|
||||||
|
|
||||||
def create_subscriber_items(self):
|
def create_subscriber_items(self):
|
||||||
self.add = self.Append(wx.NewId(), _("Add to friends"))
|
self.add = self.Append(wx.NewId(), _("Add to friends"))
|
||||||
|
self.block = self.Append(wx.NewId(), _("Block"))
|
||||||
|
|
||||||
class documentMenu(wx.Menu):
|
class documentMenu(wx.Menu):
|
||||||
def __init__(self, added=False, *args, **kwargs):
|
def __init__(self, added=False, *args, **kwargs):
|
||||||
|
Loading…
Reference in New Issue
Block a user