From e228c2ac5301461b4f23a155de56aea74ce75fad Mon Sep 17 00:00:00 2001 From: sqozz Date: Wed, 24 Feb 2021 20:59:20 +0100 Subject: [PATCH] Event override test --- webinterface.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/webinterface.py b/webinterface.py index 9ea48e7..005ec10 100644 --- a/webinterface.py +++ b/webinterface.py @@ -2,8 +2,19 @@ from bottle import route, get, static_file, run from bottle.ext.websocket import GeventWebSocketServer from bottle.ext.websocket import websocket from os.path import join as pathjoin +from statemachine import DialingState import threading +class WebDialingState(DialingState): + def __init__(self, controller): + super().__init__(controller) + + def on_nummernschalter_input(self, num): + print("calling super method") + super().on_nummernschalter_input(num) + print("local method got num: " + str(num)) + + class FeTapWeb(): def __init__(self, config, statemachine_controller): self.config = config @@ -19,6 +30,9 @@ class FeTapWeb(): return "

Hello world!

" def publish_status(self): + if isinstance(self.controller.state, DialingState): + self.controller.state = WebDialingState(self.controller) + print("dialing") for ws in self.websockets: ws.send("this is a message triggered from the server") return "ok"