Added block in people buffers' menu and blacklist management in the application menu
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from .attach import *
|
||||
from . audioRecorder import *
|
||||
from . blacklist import *
|
||||
from .configuration import *
|
||||
from .postCreation 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)
|
Reference in New Issue
Block a user