Skip to content

Commit eab19a1

Browse files
committed
Add version information to bottom toolbar
1 parent be92cc5 commit eab19a1

File tree

6 files changed

+66
-25
lines changed

6 files changed

+66
-25
lines changed

addons/parley/components/bottom_panel.gd

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
# Copyright 2024-2025 the Bisterix Studio authors. All rights reserved. MIT license.
22

33
@tool
4-
extends MarginContainer
4+
class_name ParleyBottomPanel extends MarginContainer
55

66
#region DEFS
77
const back_icon: Texture2D = preload('res://addons/parley/assets/Back.svg')
88
const forward_icon: Texture2D = preload('res://addons/parley/assets/Forward.svg')
99

1010
@onready var toggle_sidebar_button: Button = %ToggleSidebarButton
11+
@onready var version_label: LinkButton = %Version
1112

1213
var is_sidebar_open: bool = true: set = _is_sidebar_open_setter
14+
var version: String = "" : set = _set_version
15+
const version_label_tooltip: StringName = &"Click to copy the version information"
1316

1417
signal sidebar_toggled(is_sidebar_open: bool)
1518
#endregion
@@ -21,6 +24,11 @@ func _ready() -> void:
2124
#endregion
2225

2326
#region SETTERS
27+
func _set_version(new_version: String) -> void:
28+
version = new_version
29+
_render_version_label()
30+
31+
2432
func _is_sidebar_open_setter(new_value: bool) -> void:
2533
is_sidebar_open = new_value
2634
_render_sidebar_button()
@@ -34,9 +42,19 @@ func _render_sidebar_button() -> void:
3442
toggle_sidebar_button.icon = back_icon
3543
else:
3644
toggle_sidebar_button.icon = forward_icon
45+
46+
47+
func _render_version_label() -> void:
48+
if version_label:
49+
version_label.tooltip_text = version_label_tooltip
50+
version_label.text = "v%s" % version
3751
#endregion
3852

3953
#region SIGNALS
4054
func _on_toggle_sidebar_button_pressed() -> void:
4155
is_sidebar_open = !is_sidebar_open
56+
57+
58+
func _on_version_pressed() -> void:
59+
DisplayServer.clipboard_set("Parley [v%s]" % [version])
4260
#endregion

addons/parley/components/bottom_panel.tscn

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44
[ext_resource type="Script" uid="uid://gu5an32ya6bh" path="res://addons/parley/components/bottom_panel.gd" id="1_v1no1"]
55

66
[node name="BottomPanel" type="MarginContainer"]
7+
offset_right = 286.0
8+
offset_bottom = 73.0
79
size_flags_horizontal = 3
810
theme_override_constants/margin_top = 0
9-
theme_override_constants/margin_bottom = 10
11+
theme_override_constants/margin_right = 5
12+
theme_override_constants/margin_bottom = 0
1013
script = ExtResource("1_v1no1")
1114

1215
[node name="BottomPanelContainer" type="HBoxContainer" parent="."]
@@ -25,4 +28,13 @@ flat = true
2528
[node name="RightContainer" type="HBoxContainer" parent="BottomPanelContainer"]
2629
layout_mode = 2
2730

31+
[node name="Version" type="LinkButton" parent="BottomPanelContainer/RightContainer"]
32+
unique_name_in_owner = true
33+
modulate = Color(1, 1, 1, 0.6)
34+
layout_mode = 2
35+
size_flags_horizontal = 8
36+
size_flags_vertical = 4
37+
underline = 1
38+
2839
[connection signal="pressed" from="BottomPanelContainer/LeftContainer/ToggleSidebarButton" to="." method="_on_toggle_sidebar_button_pressed"]
40+
[connection signal="pressed" from="BottomPanelContainer/RightContainer/Version" to="." method="_on_version_pressed"]

addons/parley/main_panel.gd

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ var parley_manager: ParleyManager
4444
@onready var export_to_csv_modal: ParleyExportToCsvModal = %ExportToCsvModal
4545
@onready var editor: HSplitContainer = %EditorView
4646
@onready var sidebar: ParleySidebar = %Sidebar
47-
@onready var bottom_panel: MarginContainer = %BottomPanel
47+
@onready var bottom_panel: ParleyBottomPanel = %BottomPanel
4848

4949

5050
# TODO: remove this
@@ -186,18 +186,27 @@ func _on_dialogue_ast_changed(new_dialogue_ast: ParleyDialogueSequenceAst) -> vo
186186

187187
#region RENDERERS
188188
func _render_toolbar() -> void:
189-
# TODO: we might need to register this dynamically at a later date
190-
# it seems that it only does this at the project level atm.
191-
save_button.tooltip_text = &"Save the current Dialogue Sequence."
189+
if save_button:
190+
# TODO: we might need to register this dynamically at a later date
191+
# it seems that it only does this at the project level atm.
192+
save_button.tooltip_text = &"Save the current Dialogue Sequence."
192193

193-
arrange_nodes_button.tooltip_text = &"Arrange the current Dialogue Sequence nodes."
194+
if arrange_nodes_button:
195+
arrange_nodes_button.tooltip_text = &"Arrange the current Dialogue Sequence nodes."
194196

195-
refresh_button.tooltip_text = &"Refresh the current Dialogue Sequence."
197+
if refresh_button:
198+
refresh_button.tooltip_text = &"Refresh the current Dialogue Sequence."
196199

197-
docs_button.icon = get_theme_icon("Help", "EditorIcons")
198-
docs_button.text = &"Docs"
199-
docs_button.tooltip_text = &"Navigate to the Parley Documentation."
200-
docs_button.flat = true
200+
if docs_button:
201+
docs_button.icon = get_theme_icon("Help", "EditorIcons")
202+
docs_button.text = &"Docs"
203+
docs_button.tooltip_text = &"Navigate to the Parley Documentation."
204+
docs_button.flat = true
205+
206+
207+
func _render_bottom_panel() -> void:
208+
if bottom_panel and parley_manager:
209+
bottom_panel.version = parley_manager.get_plugin_version()
201210
#endregion
202211

203212

@@ -206,6 +215,7 @@ func _setup() -> void:
206215
_setup_file_menu()
207216
_setup_insert_menu()
208217
_render_toolbar()
218+
_render_bottom_panel()
209219

210220

211221
## Set up the file menu

addons/parley/main_panel.tscn

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[gd_scene load_steps=40 format=3 uid="uid://ckubjbp3e7yy3"]
1+
[gd_scene load_steps=39 format=3 uid="uid://ckubjbp3e7yy3"]
22

33
[ext_resource type="Script" uid="uid://ctp441gxhvg80" path="res://addons/parley/main_panel.gd" id="1_06n3w"]
44
[ext_resource type="Texture2D" uid="uid://ct6iywe1qjuh3" path="res://addons/parley/assets/New.svg" id="3_4ui00"]
@@ -33,12 +33,6 @@
3333
[ext_resource type="Script" uid="uid://3nqtsewsmim0" path="res://addons/parley/models/node_ast.gd" id="31_tp54n"]
3434
[ext_resource type="Script" uid="uid://btn7s5anok7p4" path="res://addons/parley/models/dialogue_sequence_ast.gd" id="32_pogw7"]
3535

36-
[sub_resource type="Resource" id="Resource_owjo5"]
37-
script = ExtResource("32_pogw7")
38-
title = ""
39-
edges = Array[ExtResource("30_rspbv")]([])
40-
nodes = Array[ExtResource("31_tp54n")]([])
41-
4236
[sub_resource type="Resource" id="Resource_s5oy3"]
4337
script = ExtResource("26_anq7l")
4438
actions = Array[ExtResource("9_anq7l")]([])
@@ -54,7 +48,7 @@ script = ExtResource("28_anq7l")
5448
characters = Array[ExtResource("11_7jaih")]([])
5549
id = ""
5650

57-
[sub_resource type="Image" id="Image_8yxrj"]
51+
[sub_resource type="Image" id="Image_kaj3b"]
5852
data = {
5953
"data": PackedByteArray(255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 0, 255, 92, 92, 127, 255, 92, 92, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 0, 255, 93, 93, 255, 255, 92, 92, 127, 255, 92, 92, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 92, 92, 127, 255, 92, 92, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 92, 92, 127, 255, 92, 92, 0, 255, 92, 92, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 231, 255, 90, 90, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 231, 255, 90, 90, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 0, 255, 93, 93, 0, 255, 91, 91, 0, 255, 91, 91, 0, 255, 91, 91, 42, 255, 90, 90, 0, 255, 94, 94, 0, 255, 91, 91, 42, 255, 93, 93, 233, 255, 92, 92, 232, 255, 93, 93, 41, 255, 90, 90, 0, 255, 94, 94, 0, 255, 91, 91, 42, 255, 93, 93, 233, 255, 92, 92, 232, 255, 92, 92, 0, 255, 92, 92, 0, 255, 91, 91, 0, 255, 91, 91, 0, 255, 91, 91, 0, 255, 91, 91, 45, 255, 93, 93, 44, 255, 91, 91, 0, 255, 91, 91, 42, 255, 91, 91, 42, 255, 93, 93, 0, 255, 91, 91, 45, 255, 93, 93, 44, 255, 91, 91, 0, 255, 91, 91, 42, 255, 91, 91, 42, 255, 91, 91, 0, 255, 91, 91, 0, 255, 91, 91, 0, 255, 91, 91, 0, 255, 91, 91, 45, 255, 92, 92, 235, 255, 92, 92, 234, 255, 89, 89, 43, 255, 91, 91, 0, 255, 91, 91, 0, 255, 91, 91, 45, 255, 92, 92, 235, 255, 92, 92, 234, 255, 89, 89, 43, 255, 91, 91, 0, 255, 91, 91, 0, 255, 91, 91, 0, 255, 91, 91, 0, 255, 92, 92, 0, 255, 92, 92, 0, 255, 92, 92, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 91, 91, 59, 255, 92, 92, 61, 255, 92, 92, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 91, 91, 59, 255, 92, 92, 61, 255, 92, 92, 0, 255, 92, 92, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0, 255, 93, 93, 0),
6054
"format": "RGBA8",
@@ -63,8 +57,8 @@ data = {
6357
"width": 16
6458
}
6559

66-
[sub_resource type="ImageTexture" id="ImageTexture_h2jtb"]
67-
image = SubResource("Image_8yxrj")
60+
[sub_resource type="ImageTexture" id="ImageTexture_s5oy3"]
61+
image = SubResource("Image_kaj3b")
6862

6963
[sub_resource type="Resource" id="Resource_7hjis"]
7064
script = ExtResource("32_pogw7")
@@ -83,7 +77,6 @@ grow_vertical = 2
8377
size_flags_horizontal = 3
8478
size_flags_vertical = 3
8579
script = ExtResource("1_06n3w")
86-
dialogue_ast = SubResource("Resource_owjo5")
8780
action_store = SubResource("Resource_s5oy3")
8881
fact_store = SubResource("Resource_kaj3b")
8982
character_store = SubResource("Resource_h2jtb")
@@ -255,7 +248,7 @@ unique_name_in_owner = true
255248
layout_mode = 2
256249
tooltip_text = "Navigate to the Parley Documentation."
257250
text = "Docs"
258-
icon = SubResource("ImageTexture_h2jtb")
251+
icon = SubResource("ImageTexture_s5oy3")
259252
flat = true
260253

261254
[node name="EditorView" type="HSplitContainer" parent="MarginContainer/MainContainer/HSplitContainer/MainViewPanel/MainViewContainer"]

addons/parley/parley_manager.gd

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,14 @@ func _get_fact_store() -> ParleyFactStore:
146146

147147
# TODO: should this file be split into editor and non-editor files (e.g. ParleyManager, ParleyRuntime)
148148
#region EDITOR
149-
## Plugin use only
149+
## Get Parley plugin version
150+
func get_plugin_version() -> String:
151+
var plugin: EditorPlugin = Engine.get_meta(ParleyConstants.PARLEY_PLUGIN_METADATA)
152+
if not plugin:
153+
return "Unknown"
154+
return plugin.get_plugin_version()
155+
156+
150157
func set_current_dialogue_sequence(path: Variant) -> void:
151158
if not Engine.is_editor_hint():
152159
return

addons/parley/translation_parser.gd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ func _parse_file(path: String) -> Array[PackedStringArray]:
1414
# TODO: handle this at the node level to be much more maintainable
1515
var text: Variant = node.get("text")
1616
if is_instance_of(text, TYPE_STRING) and text:
17+
# TODO: add support for nodes to have a custom translation key
1718
ret.append(PackedStringArray([text, ParleyUtils.translation.get_msg_ctx(uid, node, 'text')])) # id,ctx
1819
return ret
1920

0 commit comments

Comments
 (0)