forked from genewildish/Mainline
feat(display): add configurable multi-backend display system
This commit is contained in:
@@ -33,13 +33,25 @@ from engine.websocket_display import WebSocketDisplay
|
||||
|
||||
|
||||
def _get_display():
|
||||
"""Get the appropriate display based on config."""
|
||||
if config.WEBSOCKET:
|
||||
"""Get the appropriate display(s) based on config."""
|
||||
from engine.display import MultiDisplay, TerminalDisplay
|
||||
|
||||
displays = []
|
||||
|
||||
if config.DISPLAY in ("terminal", "both"):
|
||||
displays.append(TerminalDisplay())
|
||||
|
||||
if config.DISPLAY in ("websocket", "both") or config.WEBSOCKET:
|
||||
ws = WebSocketDisplay(host="0.0.0.0", port=config.WEBSOCKET_PORT)
|
||||
ws.start_server()
|
||||
ws.start_http_server()
|
||||
return ws
|
||||
return None
|
||||
displays.append(ws)
|
||||
|
||||
if not displays:
|
||||
return None
|
||||
if len(displays) == 1:
|
||||
return displays[0]
|
||||
return MultiDisplay(displays)
|
||||
|
||||
|
||||
TITLE = [
|
||||
|
||||
Reference in New Issue
Block a user