Added console panel with device and host console, logs and domain console.
This commit is contained in:
1 parent
6038b816b7
commit
b98ed82619
17 files changed
+551
-22
No files matched your search
@@ -0,0 +1,32 @@
|
||||
extends VBoxContainer
|
||||
|
||||
@onready var console = $ConsolePanel
|
||||
var _log_index := 0
|
||||
|
||||
func _ready() -> void:
|
||||
console.command_requested.connect(_demo_command)
|
||||
for id in ["rov", "host", "logs", "server"]:
|
||||
console.set_connection(id, true, "SIMULATED · " + id)
|
||||
console.append_output("rov", "[demo] ROV shell ready. Try help, pwd or status.\n")
|
||||
console.append_output("host", "[demo] Host shell ready. Try help or pwd.\n")
|
||||
console.append_output("server", "[demo] Server shell ready. Try help or status.\n")
|
||||
$Controls/Contrast.toggled.connect(func(high: bool) -> void:
|
||||
theme = load("res://themes/theme_highcontrast.tres" if high else "res://themes/theme.tres")
|
||||
)
|
||||
$Controls/Feed.toggled.connect(func(enabled: bool) -> void: $LogTimer.paused = not enabled)
|
||||
$LogTimer.timeout.connect(_append_log)
|
||||
_append_log()
|
||||
|
||||
func _demo_command(id: String, command: String) -> void:
|
||||
match command.strip_edges():
|
||||
"help": console.append_output(id, "Demo commands: help, status, pwd, clear\n")
|
||||
"status": console.append_output(id, "[demo] Vehicle ready · stationkeep · no live transport\n")
|
||||
"pwd": console.append_output(id, "/" + id + " (simulated)\n")
|
||||
"clear": console.session(id).clear_output()
|
||||
_: console.append_output(id, "[demo] Received: " + command + "\n")
|
||||
|
||||
func _append_log() -> void:
|
||||
_log_index += 1
|
||||
var level := "WARN" if _log_index % 5 == 0 else "INFO"
|
||||
var message := "sample telemetry delayed" if level == "WARN" else "sample telemetry received"
|
||||
console.append_output("logs", "%04d %s rov-server: %s\n" % [_log_index, level, message])
|
||||
Reference in new issue
Block a user