From a427a4200e4a90b7c5163270fe6fc3010d6190d8 Mon Sep 17 00:00:00 2001 From: Jeremy Wright Date: Fri, 15 Oct 2021 16:21:04 -0400 Subject: [PATCH] Minor fix for when a user clicks Edit with no parameters selected --- GUI.gd | 4 ++++ GUI.tscn | 61 ++++++++++++++++++++++++++++++-------------------------- 2 files changed, 37 insertions(+), 28 deletions(-) diff --git a/GUI.gd b/GUI.gd index 748366f..f5a91a5 100644 --- a/GUI.gd +++ b/GUI.gd @@ -981,6 +981,10 @@ Called when a parameter entry is selected for editing. func _on_ParametersTree_item_activated(): var tree = $GUI/VBoxContainer/WorkArea/TreeViewTabs/Data/ParametersTree + # Make sure that something was visible/selected in the tree + if tree.get_selected() == null: + return + var name_text = tree.get_selected().get_text(0) var value_text = tree.get_selected().get_text(1) diff --git a/GUI.tscn b/GUI.tscn index 7d8aa19..ab4a3b4 100644 --- a/GUI.tscn +++ b/GUI.tscn @@ -1146,8 +1146,8 @@ __meta__ = { [node name="AddParameterDialog" type="WindowDialog" parent="."] margin_right = 250.0 -margin_bottom = 277.0 -rect_min_size = Vector2( 250, 277 ) +margin_bottom = 293.0 +rect_min_size = Vector2( 250, 293 ) window_title = "Add/Edit Parameter" script = ExtResource( 29 ) __meta__ = { @@ -1164,7 +1164,7 @@ size_flags_vertical = 3 [node name="VBoxContainer" type="VBoxContainer" parent="AddParameterDialog/MarginContainer"] margin_right = 240.0 -margin_bottom = 266.0 +margin_bottom = 284.0 rect_min_size = Vector2( 140, 100 ) size_flags_horizontal = 3 size_flags_vertical = 3 @@ -1184,29 +1184,6 @@ margin_bottom = 42.0 size_flags_horizontal = 3 text = "parameter_name" -[node name="ParamTypeContainer" type="HBoxContainer" parent="AddParameterDialog/MarginContainer/VBoxContainer"] -margin_right = 40.0 -margin_bottom = 40.0 - -[node name="StringCheckBox" type="CheckBox" parent="AddParameterDialog/MarginContainer/VBoxContainer/ParamTypeContainer"] -margin_right = 24.0 -margin_bottom = 24.0 -pressed = true -group = SubResource( 34 ) -text = "String" - -[node name="NumCheckBox" type="CheckBox" parent="AddParameterDialog/MarginContainer/VBoxContainer/ParamTypeContainer"] -margin_right = 24.0 -margin_bottom = 24.0 -group = SubResource( 35 ) -text = "Number" - -[node name="TupleListCheckBox" type="CheckBox" parent="AddParameterDialog/MarginContainer/VBoxContainer/ParamTypeContainer"] -margin_right = 24.0 -margin_bottom = 24.0 -group = SubResource( 36 ) -text = "Point List" - [node name="ParamValueLabel" type="Label" parent="AddParameterDialog/MarginContainer/VBoxContainer"] margin_top = 46.0 margin_right = 278.0 @@ -1230,12 +1207,40 @@ CanBeNegative = true [node name="TupleList" type="Tree" parent="AddParameterDialog/MarginContainer/VBoxContainer"] visible = false margin_right = 40.0 -margin_bottom = 40.0 +margin_bottom = 80.0 rect_min_size = Vector2( 40, 80 ) columns = 3 hide_root = true script = ExtResource( 32 ) +[node name="ParamTypeLabel" type="Label" parent="AddParameterDialog/MarginContainer/VBoxContainer"] +margin_right = 40.0 +margin_bottom = 14.0 +text = "Type" + +[node name="ParamTypeContainer" type="HBoxContainer" parent="AddParameterDialog/MarginContainer/VBoxContainer"] +margin_right = 240.0 +margin_bottom = 40.0 + +[node name="StringCheckBox" type="CheckBox" parent="AddParameterDialog/MarginContainer/VBoxContainer/ParamTypeContainer"] +margin_right = 24.0 +margin_bottom = 24.0 +pressed = true +group = SubResource( 34 ) +text = "String" + +[node name="NumCheckBox" type="CheckBox" parent="AddParameterDialog/MarginContainer/VBoxContainer/ParamTypeContainer"] +margin_right = 24.0 +margin_bottom = 24.0 +group = SubResource( 35 ) +text = "Number" + +[node name="TupleListCheckBox" type="CheckBox" parent="AddParameterDialog/MarginContainer/VBoxContainer/ParamTypeContainer"] +margin_right = 24.0 +margin_bottom = 24.0 +group = SubResource( 36 ) +text = "Point List" + [node name="CommentLabel" type="Label" parent="AddParameterDialog/MarginContainer/VBoxContainer"] margin_left = -5.0 margin_top = -5.0 @@ -1478,10 +1483,10 @@ text = "Cancel" [connection signal="edit_parameter" from="AddParameterDialog" to="." method="_on_AddParameterDialog_edit_parameter"] [connection signal="error" from="AddParameterDialog" to="." method="_on_error"] [connection signal="popup_hide" from="AddParameterDialog" to="GUI/VBoxContainer/WorkArea/DocumentTabs" method="_dialog_popup_hide"] +[connection signal="activate_data_popup" from="AddParameterDialog/MarginContainer/VBoxContainer/TupleList" to="AddParameterDialog" method="_on_TupleList_activate_data_popup"] [connection signal="button_down" from="AddParameterDialog/MarginContainer/VBoxContainer/ParamTypeContainer/StringCheckBox" to="AddParameterDialog" method="_on_StringCheckBox_button_down"] [connection signal="button_down" from="AddParameterDialog/MarginContainer/VBoxContainer/ParamTypeContainer/NumCheckBox" to="AddParameterDialog" method="_on_NumCheckBox_button_down"] [connection signal="button_down" from="AddParameterDialog/MarginContainer/VBoxContainer/ParamTypeContainer/TupleListCheckBox" to="AddParameterDialog" method="_on_TupleListCheckBox_button_down"] -[connection signal="activate_data_popup" from="AddParameterDialog/MarginContainer/VBoxContainer/TupleList" to="AddParameterDialog" method="_on_TupleList_activate_data_popup"] [connection signal="button_down" from="AddParameterDialog/MarginContainer/VBoxContainer/OKButton" to="AddParameterDialog" method="_on_OKButton_button_down"] [connection signal="button_down" from="AddParameterDialog/MarginContainer/VBoxContainer/CancelButton" to="AddParameterDialog" method="_on_CancelButton_button_down"] [connection signal="about_to_show" from="ExportDXFDialog" to="GUI/VBoxContainer/WorkArea/DocumentTabs" method="_dialog_about_to_show"]