Refactor callback subscription stuff to a mixin

This commit is contained in:
Kristóf Tóth
2018-03-07 10:12:58 +01:00
parent 6db4c80671
commit 6a6236e704
5 changed files with 29 additions and 21 deletions

View File

@ -11,7 +11,7 @@ log = logging.getLogger(__name__)
if __name__ == '__main__':
ide = SourceCodeEventHandler('webide', tfwenv.WEBIDE_WD)
terminado = TerminadoEventHandler('shell')
terminado.historymonitor.callbacks.append(lambda hist: log.debug('User executed command: "{}"'.format(hist[-1])))
terminado.historymonitor.subscribe_callback(lambda hist: log.debug('User executed command: "{}"'.format(hist[-1])))
processmanager = ProcessManagingEventHandler('processmanager', ide.monitor)
eventhandlers = {ide, terminado, processmanager}