Partially conform new TFW networking model

This commit is contained in:
Kristóf Tóth 2019-05-26 18:31:16 +02:00
parent a1b4a87864
commit 48efb39ea5
1 changed files with 6 additions and 4 deletions

View File

@ -10,6 +10,7 @@ from tfw.components import IdeEventHandler, TerminalEventHandler
from tfw.components import ProcessManagingEventHandler, BashMonitor
from tfw.components import TerminalCommands, LogMonitoringEventHandler
from tfw.components import FSMManagingEventHandler, DirectorySnapshottingEventHandler
from tfw.components import FrontendEventHandler
from tfw.networking import MessageSender, TFWServerConnector
from tfw.config import TFWENV
from tfw.config.logs import logging
@ -44,7 +45,7 @@ class TestCommands(TerminalCommands):
"""
if not args:
message_template = """'{"key": "", "data": {"command": ""}}'"""
TFWServerConnector().send_to_eventhandler({
TFWServerConnector().send_message({
'key': 'shell',
'data': {
'command': 'write',
@ -52,7 +53,7 @@ class TestCommands(TerminalCommands):
}
})
else:
TFWServerConnector().send(literal_eval(args[0]))
TFWServerConnector().send_message(literal_eval(args[0]))
def command_seppuku_tfw(self, *args):
"""
@ -65,14 +66,14 @@ class TestCommands(TerminalCommands):
'clear && echo "Committed seppuku! :)" && sleep infinity'
)
uplink = TFWServerConnector()
uplink.send_to_eventhandler({
uplink.send_message({
'key': 'shell',
'data': {
'command': 'write',
'value': f'{seppuku}\n'
}
})
uplink.send({
uplink.send_message({
'key': 'dashboard',
'data': {
'command': 'reloadFrontend'
@ -139,6 +140,7 @@ def main():
TFWENV.WEBSERVICE_DIR
]
)
frontend = FrontendEventHandler() # Proxies frontend API calls to frontend
# Your custom event handlers
message_fsm_steps_eh = MessageFSMStepsEventHandler(