Reintroduce glorious JOHN CENA to demo ¯\_(ツ)_/¯

This commit is contained in:
Kristóf Tóth 2018-03-14 09:30:44 +01:00
parent 3e0592c176
commit 306607c972

View File

@ -4,14 +4,21 @@ from tfw.components.source_code_event_handler import SourceCodeEventHandler
from tfw.components.terminado_event_handler import TerminadoEventHandler from tfw.components.terminado_event_handler import TerminadoEventHandler
from tfw.components.process_managing_event_handler import ProcessManagingEventHandler from tfw.components.process_managing_event_handler import ProcessManagingEventHandler
from tfw.config import tfwenv from tfw.config import tfwenv
from tfw.message_sender import MessageSender
from tfw.config.logs import logging from tfw.config.logs import logging
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
def cenator(history):
message_sender = MessageSender()
log.debug('User executed command: "{}"'.format(history[-1]))
message_sender.send('JOHN CENA', 'You\'ve executed "{}"'.format(history[-1]))
if __name__ == '__main__': if __name__ == '__main__':
ide = SourceCodeEventHandler(key='webide', directory=tfwenv.WEBIDE_WD, exclude=['__pycache__']) ide = SourceCodeEventHandler(key='webide', directory=tfwenv.WEBIDE_WD, exclude=['__pycache__'])
terminado = TerminadoEventHandler(key='shell') terminado = TerminadoEventHandler(key='shell')
terminado.historymonitor.subscribe_callback(callback=lambda hist: log.debug('User executed command: "{}"'.format(hist[-1]))) terminado.historymonitor.subscribe_callback(cenator)
processmanager = ProcessManagingEventHandler(key='processmanager', dirmonitor=ide.monitor) processmanager = ProcessManagingEventHandler(key='processmanager', dirmonitor=ide.monitor)
eventhandlers = {ide, terminado, processmanager} eventhandlers = {ide, terminado, processmanager}