2022-11-09 21:57:46 +01:00
|
|
|
@tool
|
2020-05-09 19:07:31 +02:00
|
|
|
extends EditorPlugin
|
|
|
|
|
2023-01-08 10:41:48 +01:00
|
|
|
var pty_supported := OS.get_name() in ["Linux", "FreeBSD", "NetBSD", "OpenBSD", "BSD", "macOS"]
|
2020-09-22 10:31:46 +02:00
|
|
|
var asciicast_import_plugin
|
2021-07-18 18:11:31 +02:00
|
|
|
var xrdb_import_plugin
|
2021-07-11 17:32:13 +02:00
|
|
|
var terminal_panel: Control
|
2020-09-22 10:31:46 +02:00
|
|
|
|
|
|
|
|
2020-05-09 19:07:31 +02:00
|
|
|
func _enter_tree():
|
2021-07-15 16:30:09 +02:00
|
|
|
asciicast_import_plugin = preload("./import_plugins/asciicast_import_plugin.gd").new()
|
2020-09-22 10:31:46 +02:00
|
|
|
add_import_plugin(asciicast_import_plugin)
|
2021-05-26 05:39:48 +02:00
|
|
|
|
2021-07-18 18:11:31 +02:00
|
|
|
xrdb_import_plugin = preload("./import_plugins/xrdb_import_plugin.gd").new()
|
|
|
|
add_import_plugin(xrdb_import_plugin)
|
|
|
|
|
2021-07-15 16:30:09 +02:00
|
|
|
var asciicast_script = preload("./resources/asciicast.gd")
|
2020-09-22 10:31:46 +02:00
|
|
|
add_custom_type("Asciicast", "Animation", asciicast_script, null)
|
2021-05-26 05:39:48 +02:00
|
|
|
|
2021-07-02 19:27:34 +02:00
|
|
|
if pty_supported:
|
2022-11-09 21:57:46 +01:00
|
|
|
terminal_panel = preload("./editor_plugins/terminal/terminal_panel.tscn").instantiate()
|
2021-07-12 18:11:28 +02:00
|
|
|
terminal_panel.editor_plugin = self
|
2021-07-11 17:32:13 +02:00
|
|
|
terminal_panel.editor_interface = get_editor_interface()
|
|
|
|
add_control_to_bottom_panel(terminal_panel, "Terminal")
|
2020-05-09 19:07:31 +02:00
|
|
|
|
|
|
|
|
|
|
|
func _exit_tree():
|
2020-09-22 10:31:46 +02:00
|
|
|
remove_import_plugin(asciicast_import_plugin)
|
|
|
|
asciicast_import_plugin = null
|
2021-05-26 05:39:48 +02:00
|
|
|
|
2021-07-18 18:11:31 +02:00
|
|
|
remove_import_plugin(xrdb_import_plugin)
|
|
|
|
xrdb_import_plugin = null
|
|
|
|
|
2020-09-22 10:31:46 +02:00
|
|
|
remove_custom_type("Asciicast")
|
2021-07-02 19:27:34 +02:00
|
|
|
|
|
|
|
if pty_supported:
|
2021-07-11 17:32:13 +02:00
|
|
|
remove_control_from_bottom_panel(terminal_panel)
|
|
|
|
terminal_panel.free()
|