Event override test

This commit is contained in:
sqozz 2021-02-24 20:59:20 +01:00
parent 24848c9afb
commit e228c2ac53
1 changed files with 14 additions and 0 deletions

View File

@ -2,8 +2,19 @@ from bottle import route, get, static_file, run
from bottle.ext.websocket import GeventWebSocketServer from bottle.ext.websocket import GeventWebSocketServer
from bottle.ext.websocket import websocket from bottle.ext.websocket import websocket
from os.path import join as pathjoin from os.path import join as pathjoin
from statemachine import DialingState
import threading 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(): class FeTapWeb():
def __init__(self, config, statemachine_controller): def __init__(self, config, statemachine_controller):
self.config = config self.config = config
@ -19,6 +30,9 @@ class FeTapWeb():
return "<h1>Hello world!</h1>" return "<h1>Hello world!</h1>"
def publish_status(self): def publish_status(self):
if isinstance(self.controller.state, DialingState):
self.controller.state = WebDialingState(self.controller)
print("dialing")
for ws in self.websockets: for ws in self.websockets:
ws.send("this is a message triggered from the server") ws.send("this is a message triggered from the server")
return "ok" return "ok"