1
0
mirror of https://github.com/avatao-content/test-tutorial-framework synced 2024-10-05 10:23:37 +00:00

Merge pull request #1 from avatao-content/niceimports

Niceimports
This commit is contained in:
Bokros Bálint 2018-04-06 16:25:40 +02:00 committed by GitHub
commit 7b016bb252
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 10 deletions

View File

@ -1,12 +1,8 @@
from tornado.ioloop import IOLoop from tornado.ioloop import IOLoop
from tfw.components.source_code_event_handler import SourceCodeEventHandler from tfw.components import SourceCodeEventHandler, TerminadoEventHandler, ProcessManagingEventHandler, BashMonitor
from tfw.components.terminado_event_handler import TerminadoEventHandler from tfw.networking import MessageSender, TFWServerConnector
from tfw.components.process_managing_event_handler import ProcessManagingEventHandler
from tfw.components.history_monitor import BashMonitor
from tfw.config import TFWENV 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 from tfw.config.logs import logging
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -21,7 +17,7 @@ def selectdir(history):
try: try:
cmd = history[-1].split() cmd = history[-1].split()
if cmd[0] == 'selectdir': if cmd[0] == 'selectdir':
ServerUplinkConnector().send_to_eventhandler('webide', TFWServerConnector().send_to_eventhandler('webide',
{'data': {'command': 'selectdir', {'data': {'command': 'selectdir',
'directory': cmd[1]}}) 'directory': cmd[1]}})
except IndexError: except IndexError:
@ -33,7 +29,7 @@ def toggle_next(history):
try: try:
cmd = history[-1].split() cmd = history[-1].split()
if cmd[0] == 'togglenext': if cmd[0] == 'togglenext':
ServerUplinkConnector().send('messagecontrol', TFWServerConnector().send('messagecontrol',
{'data': {'command': 'showbutton', {'data': {'command': 'showbutton',
'next_visibility': toggle_next.button_state}}) 'next_visibility': toggle_next.button_state}})
except IndexError: except IndexError:
@ -43,7 +39,8 @@ toggle_next.button_state = False
if __name__ == '__main__': if __name__ == '__main__':
# pylint: disable=invalid-name # 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 = TerminadoEventHandler(key='shell', monitor=BashMonitor(TFWENV.HISTFILE))
terminado.historymonitor.subscribe_callback(cenator) terminado.historymonitor.subscribe_callback(cenator)
terminado.historymonitor.subscribe_callback(selectdir) terminado.historymonitor.subscribe_callback(selectdir)

View File

@ -4,9 +4,10 @@ import tornado
from tornado.ioloop import IOLoop from tornado.ioloop import IOLoop
from sql_injection_fsm import SQLInjectionFSM from sql_injection_fsm import SQLInjectionFSM
from tfw.networking.server.tfw_server import TFWServer from tfw.networking import TFWServer
from tfw.config import TFWENV from tfw.config import TFWENV
from tfw.config.logs import logging from tfw.config.logs import logging
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)