From 306607c972ef80afdff9dd5b8a5df29fe0a92c6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Wed, 14 Mar 2018 09:30:44 +0100 Subject: [PATCH] =?UTF-8?q?Reintroduce=20glorious=20JOHN=20CENA=20to=20dem?= =?UTF-8?q?o=20=C2=AF\=5F(=E3=83=84)=5F/=C2=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/demo/event_handler_main.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/demo/event_handler_main.py b/src/demo/event_handler_main.py index 6cb9c8a..69d2fd8 100644 --- a/src/demo/event_handler_main.py +++ b/src/demo/event_handler_main.py @@ -4,14 +4,21 @@ from tfw.components.source_code_event_handler import SourceCodeEventHandler from tfw.components.terminado_event_handler import TerminadoEventHandler from tfw.components.process_managing_event_handler import ProcessManagingEventHandler from tfw.config import tfwenv +from tfw.message_sender import MessageSender from tfw.config.logs import logging 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__': ide = SourceCodeEventHandler(key='webide', directory=tfwenv.WEBIDE_WD, exclude=['__pycache__']) 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) eventhandlers = {ide, terminado, processmanager}