Move terminal.gd and pty.gd to godot_xterm directory

Makes for pretty paths when extending scripts:
`extends "res://addons/godot_xterm/terminal.gd"`
vs.
`extends "res://addons/godot_xterm/nodes/terminal/terminal.gd"`

Currently "res://addons/godot_xterm/pty.gd" is acutally `pty_unix.gd`.
This is okay for now as the PTY node is only supported on Unix
platforms. However, we will need to sort it out when adding Windows
support as part of #25.

Also remove the GDXterm namespace.
This commit is contained in:
Leroy Hopson 2021-07-26 00:31:23 +07:00
parent e6db81615e
commit 9d15420df3
No known key found for this signature in database
GPG key ID: D2747312A6DB51AA
22 changed files with 46 additions and 43 deletions

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://addons/godot_xterm/nodes/terminal/terminal.gd" type="Script" id=1]
[ext_resource path="res://addons/godot_xterm/terminal.gd" type="Script" id=1]
[ext_resource path="res://examples/asciicast/example.cast" type="Animation" id=6]
[node name="Terminal" type="Control"]

View file

@ -8,6 +8,8 @@ extends Control
# - https://tldp.org/HOWTO/Bash-Prompt-HOWTO/x361.html
# - https://www.youtube.com/watch?v=jTSQlIK_92w
const TPut = preload("res://addons/godot_xterm/util/tput.gd")
# Title generated using command: toilet -f pagga GODOT XTERM
const TITLE = """
\r
@ -36,10 +38,12 @@ var row: int
var menu_start_row: int
var offset: int
onready var tput = GDXterm.TPut.new($Terminal)
onready var tput = TPut.new($Terminal)
func _ready():
if not $Terminal.is_connected("key_pressed", self, "_on_Terminal_key_pressed"):
$Terminal.connect("key_pressed", self, "_on_Terminal_key_pressed")
# warning-ignore:return_value_discarded
$Terminal.connect("size_changed", self, "draw_all")
$Terminal.grab_focus()

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://addons/godot_xterm/nodes/terminal/terminal.gd" type="Script" id=1]
[ext_resource path="res://addons/godot_xterm/terminal.gd" type="Script" id=1]
[ext_resource path="res://examples/menu/menu.gd" type="Script" id=2]
[node name="Menu" type="Control"]
@ -19,4 +19,9 @@ script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="key_pressed" from="Terminal" to="." method="_on_Terminal_key_pressed"]
update_mode = 1
copy_on_selection = false
bell_muted = false
bell_cooldown = 0.1
blink_on_time = 0.6
blink_off_time = 0.3

View file

@ -1,4 +1,4 @@
extends "res://addons/godot_xterm/nodes/terminal/terminal.gd"
extends "res://addons/godot_xterm/terminal.gd"
export (String) var exec_path := "bash"
export (String) var socat_path := "socat" # E.g. /usr/bin/socat

View file

@ -10,5 +10,4 @@ script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="data_sent" from="." to="." method="_on_Terminal_data_sent"]

View file

@ -1,4 +1,4 @@
extends "res://addons/godot_xterm/nodes/terminal/terminal.gd"
extends "res://addons/godot_xterm/terminal.gd"
onready var pty = $PTY

View file

@ -1,9 +1,10 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://themes/audio/bell.wav" type="AudioStream" id=1]
[ext_resource path="res://addons/godot_xterm/nodes/pty/unix/pty_unix.gd" type="Script" id=2]
[ext_resource path="res://addons/godot_xterm/pty.gd" type="Script" id=2]
[ext_resource path="res://examples/terminal/terminal.gd" type="Script" id=3]
[node name="Terminal" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0

View file

@ -1,8 +1,9 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://addons/godot_xterm/nodes/terminal/terminal.gd" type="Script" id=2]
[ext_resource path="res://addons/godot_xterm/terminal.gd" type="Script" id=2]
[ext_resource path="res://examples/web_console/web_console.gd" type="Script" id=3]
[node name="WebConsole" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0