From d44515c3d19d0f7dc11e0067b8dd3d116a7556c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Fri, 6 Apr 2018 15:22:14 +0200 Subject: [PATCH 1/3] Comply new import API --- solvable/src/event_handler_main.py | 12 +++++------- solvable/src/tfw_server.py | 3 ++- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/solvable/src/event_handler_main.py b/solvable/src/event_handler_main.py index cb95bbf..c7f88d4 100644 --- a/solvable/src/event_handler_main.py +++ b/solvable/src/event_handler_main.py @@ -1,12 +1,9 @@ from tornado.ioloop import IOLoop -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.components.history_monitor import BashMonitor +from tfw.components import SourceCodeEventHandler, TerminadoEventHandler, ProcessManagingEventHandler, BashMonitor +from tfw.networking import MessageSender +from tfw.networking.event_handlers import ServerUplinkConnector from tfw.config import TFWENV -from tfw.message_sender import MessageSender -from tfw.networking.event_handlers.server_connector import ServerUplinkConnector from tfw.config.logs import logging LOG = logging.getLogger(__name__) @@ -43,7 +40,8 @@ toggle_next.button_state = False if __name__ == '__main__': # pylint: disable=invalid-name - ide = SourceCodeEventHandler(key='webide', allowed_directories=[TFWENV.WEBIDE_WD], directory=TFWENV.WEBIDE_WD, exclude=['*.pyc']) + ide = SourceCodeEventHandler(key='webide', allowed_directories=[TFWENV.WEBIDE_WD], + directory=TFWENV.WEBIDE_WD, exclude=['*.pyc']) terminado = TerminadoEventHandler(key='shell', monitor=BashMonitor(TFWENV.HISTFILE)) terminado.historymonitor.subscribe_callback(cenator) terminado.historymonitor.subscribe_callback(selectdir) diff --git a/solvable/src/tfw_server.py b/solvable/src/tfw_server.py index f5122aa..cb2b076 100644 --- a/solvable/src/tfw_server.py +++ b/solvable/src/tfw_server.py @@ -4,9 +4,10 @@ import tornado from tornado.ioloop import IOLoop from sql_injection_fsm import SQLInjectionFSM -from tfw.networking.server.tfw_server import TFWServer +from tfw.networking.server import TFWServer from tfw.config import TFWENV from tfw.config.logs import logging + LOG = logging.getLogger(__name__) From de4c53456802cd2056dc5581199db7a96f64092c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Fri, 6 Apr 2018 16:05:52 +0200 Subject: [PATCH 2/3] Make use of new import API --- solvable/src/event_handler_main.py | 3 +-- solvable/src/tfw_server.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/solvable/src/event_handler_main.py b/solvable/src/event_handler_main.py index c7f88d4..4a2ee6b 100644 --- a/solvable/src/event_handler_main.py +++ b/solvable/src/event_handler_main.py @@ -1,8 +1,7 @@ from tornado.ioloop import IOLoop from tfw.components import SourceCodeEventHandler, TerminadoEventHandler, ProcessManagingEventHandler, BashMonitor -from tfw.networking import MessageSender -from tfw.networking.event_handlers import ServerUplinkConnector +from tfw.networking import MessageSender, ServerUplinkConnector from tfw.config import TFWENV from tfw.config.logs import logging diff --git a/solvable/src/tfw_server.py b/solvable/src/tfw_server.py index cb2b076..116e2a9 100644 --- a/solvable/src/tfw_server.py +++ b/solvable/src/tfw_server.py @@ -4,7 +4,7 @@ import tornado from tornado.ioloop import IOLoop from sql_injection_fsm import SQLInjectionFSM -from tfw.networking.server import TFWServer +from tfw.networking import TFWServer from tfw.config import TFWENV from tfw.config.logs import logging From 4fa9895854a2e8b842b8afd9a6f63e559971bae2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Fri, 6 Apr 2018 16:23:20 +0200 Subject: [PATCH 3/3] Use ServerUplinkConnector with new name TFWServerConnector --- solvable/src/event_handler_main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/solvable/src/event_handler_main.py b/solvable/src/event_handler_main.py index 4a2ee6b..2f4f825 100644 --- a/solvable/src/event_handler_main.py +++ b/solvable/src/event_handler_main.py @@ -1,7 +1,7 @@ from tornado.ioloop import IOLoop from tfw.components import SourceCodeEventHandler, TerminadoEventHandler, ProcessManagingEventHandler, BashMonitor -from tfw.networking import MessageSender, ServerUplinkConnector +from tfw.networking import MessageSender, TFWServerConnector from tfw.config import TFWENV from tfw.config.logs import logging @@ -17,7 +17,7 @@ def selectdir(history): try: cmd = history[-1].split() if cmd[0] == 'selectdir': - ServerUplinkConnector().send_to_eventhandler('webide', + TFWServerConnector().send_to_eventhandler('webide', {'data': {'command': 'selectdir', 'directory': cmd[1]}}) except IndexError: @@ -29,7 +29,7 @@ def toggle_next(history): try: cmd = history[-1].split() if cmd[0] == 'togglenext': - ServerUplinkConnector().send('messagecontrol', + TFWServerConnector().send('messagecontrol', {'data': {'command': 'showbutton', 'next_visibility': toggle_next.button_state}}) except IndexError: