mirror of
https://github.com/avatao-content/test-tutorial-framework
synced 2025-01-15 21:31:56 +00:00
Refactor event_handler_main according to pylint suggestions
This commit is contained in:
parent
f9c87d9a31
commit
9509ea88e1
@ -8,11 +8,12 @@ from tfw.config import TFWENV
|
|||||||
from tfw.message_sender import MessageSender
|
from tfw.message_sender import MessageSender
|
||||||
from tfw.networking.event_handlers.server_connector import ServerUplinkConnector
|
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__)
|
||||||
|
|
||||||
|
|
||||||
def cenator(history):
|
def cenator(history):
|
||||||
log.debug('User executed command: "{}"'.format(history[-1]))
|
LOG.debug('User executed command: "%s"', history[-1])
|
||||||
MessageSender().send('JOHN CENA', 'You\'ve executed "{}"'.format(history[-1]))
|
MessageSender().send('JOHN CENA', 'You\'ve executed "{}"'.format(history[-1]))
|
||||||
|
|
||||||
|
|
||||||
@ -23,8 +24,8 @@ def selectdir(history):
|
|||||||
ServerUplinkConnector().send_to_eventhandler('webide',
|
ServerUplinkConnector().send_to_eventhandler('webide',
|
||||||
{'data': {'command': 'selectdir',
|
{'data': {'command': 'selectdir',
|
||||||
'directory': cmd[1]}})
|
'directory': cmd[1]}})
|
||||||
except Exception:
|
except IndexError:
|
||||||
log.exception('Selectdir failed!')
|
LOG.exception('Selectdir failed!')
|
||||||
|
|
||||||
|
|
||||||
def toggle_next(history):
|
def toggle_next(history):
|
||||||
@ -35,12 +36,13 @@ def toggle_next(history):
|
|||||||
ServerUplinkConnector().send('messagecontrol',
|
ServerUplinkConnector().send('messagecontrol',
|
||||||
{'data': {'command': 'showbutton',
|
{'data': {'command': 'showbutton',
|
||||||
'next_visibility': toggle_next.button_state}})
|
'next_visibility': toggle_next.button_state}})
|
||||||
except Exception:
|
except IndexError:
|
||||||
log.exception('Togglenext failed!')
|
LOG.exception('Togglenext failed!')
|
||||||
toggle_next.button_state = False
|
toggle_next.button_state = False
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
# pylint: disable=invalid-name
|
||||||
ide = SourceCodeEventHandler(key='webide', directory=TFWENV.WEBIDE_WD, exclude=['*.pyc'])
|
ide = SourceCodeEventHandler(key='webide', 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)
|
||||||
@ -52,4 +54,5 @@ if __name__ == '__main__':
|
|||||||
try:
|
try:
|
||||||
IOLoop.instance().start()
|
IOLoop.instance().start()
|
||||||
finally:
|
finally:
|
||||||
for eh in eventhandlers: eh.cleanup()
|
for eh in eventhandlers:
|
||||||
|
eh.cleanup()
|
||||||
|
Loading…
Reference in New Issue
Block a user