mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-12-23 08:01:57 +00:00
Implement example command callback to toggle the next button
This commit is contained in:
parent
f354fd73dc
commit
e3c533de76
@ -25,11 +25,26 @@ def selectdir(history):
|
||||
except Exception:
|
||||
log.exception('Selectdir failed!')
|
||||
|
||||
|
||||
def toggle_next(history):
|
||||
toggle_next.button_state = not toggle_next.button_state
|
||||
try:
|
||||
cmd = history[-1].split()
|
||||
if cmd[0] == 'togglenext':
|
||||
ServerUplinkConnector().send('messagecontrol',
|
||||
{'data': {'command': 'showbutton',
|
||||
'next_visibility': toggle_next.button_state}})
|
||||
except Exception:
|
||||
log.exception('Togglenext failed!')
|
||||
toggle_next.button_state = False
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
ide = SourceCodeEventHandler(key='webide', directory=tfwenv.WEBIDE_WD, exclude=['__pycache__'])
|
||||
terminado = TerminadoEventHandler(key='shell')
|
||||
terminado.historymonitor.subscribe_callback(cenator)
|
||||
terminado.historymonitor.subscribe_callback(selectdir)
|
||||
terminado.historymonitor.subscribe_callback(toggle_next)
|
||||
processmanager = ProcessManagingEventHandler(key='processmanager', dirmonitor=ide.monitor)
|
||||
|
||||
eventhandlers = {ide, terminado, processmanager}
|
||||
|
Loading…
Reference in New Issue
Block a user