From a4b07e549e190b77cf7404d4ca971fd2492646c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Mon, 5 Mar 2018 16:24:36 +0100 Subject: [PATCH] Rename & expose as property TerminadoEventHandler.monitor --- lib/tfw/components/terminado_event_handler.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/tfw/components/terminado_event_handler.py b/lib/tfw/components/terminado_event_handler.py index 9368f34..e6fa2cd 100644 --- a/lib/tfw/components/terminado_event_handler.py +++ b/lib/tfw/components/terminado_event_handler.py @@ -10,13 +10,17 @@ class TerminadoEventHandler(TriggerlessEventHandler): def __init__(self, key): super().__init__(key) self.working_directory = tfwenv.TERMINADO_DIR - self.monitor = HistoryMonitor(tfwenv.HISTFILE) + self._historymonitor = HistoryMonitor(tfwenv.HISTFILE) self.terminado_server = TerminadoMiniServer('/terminal', tfwenv.TERMINADO_PORT, tfwenv.TERMINADO_WD, ['bash']) self.commands = {'write': self.write, 'read': self.read} - self.monitor.watch() + self._historymonitor.watch() self.terminado_server.listen() + @property + def historymonitor(self): + return self._historymonitor + def handle_event(self, key, data_json): log.debug('TerminadoEventHandler received event: {}'.format(data_json)) data = data_json['data'] @@ -28,5 +32,5 @@ class TerminadoEventHandler(TriggerlessEventHandler): def read(self, data): data['count'] = int(data.get('count', 1)) - data['history'] = self.monitor.history[-data['count']:] + data['history'] = self.historymonitor.history[-data['count']:] return data