Added quick save button

This commit is contained in:
Marc Gilleron 2018-11-13 21:47:38 +00:00
parent d41fb3e786
commit 95fe113366
3 changed files with 81 additions and 29 deletions

View File

@ -80,10 +80,7 @@ func _on_FileMenu_id_pressed(id):
MENU_FILE_OPEN:
_open_dialog.popup_centered_ratio()
MENU_FILE_SAVE:
if _current_file == null:
_save_dialog.popup_centered_ratio()
else:
save_file(_current_file)
_save()
MENU_FILE_SAVE_AS:
_save_dialog.popup_centered_ratio()
@ -100,6 +97,17 @@ func _on_SaveDialog_file_selected(filepath):
save_file(filepath)
func _on_SaveButton_pressed():
_save()
func _save():
if _current_file == null:
_save_dialog.popup_centered_ratio()
else:
save_file(_current_file)
func load_file(filepath):
var ext = filepath.get_extension()
if ext == "po":

View File

@ -1,6 +1,7 @@
[gd_scene load_steps=2 format=2]
[gd_scene load_steps=3 format=2]
[ext_resource path="res://addons/zylann.translation_editor/tools/translation_editor.gd" type="Script" id=1]
[ext_resource path="res://addons/zylann.translation_editor/tools/icons/icon_save.svg" type="Texture" id=2]
[node name="TranslationEditor" type="Panel" index="0"]
@ -42,8 +43,8 @@ anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 792.0
margin_bottom = 20.0
margin_right = 1016.0
margin_bottom = 24.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 1
@ -59,7 +60,7 @@ anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 35.0
margin_bottom = 20.0
margin_bottom = 24.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
@ -84,7 +85,7 @@ anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 39.0
margin_right = 75.0
margin_bottom = 20.0
margin_bottom = 24.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
@ -101,15 +102,55 @@ flat = true
align = 1
items = [ ]
[node name="VSeparator" type="VSeparator" parent="VBoxContainer/MenuBar" index="2"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 79.0
margin_right = 83.0
margin_bottom = 24.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
[node name="SaveButton" type="ToolButton" parent="VBoxContainer/MenuBar" index="3"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 87.0
margin_right = 115.0
margin_bottom = 24.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
toggle_mode = false
enabled_focus_mode = 2
shortcut = null
group = null
icon = ExtResource( 2 )
flat = true
align = 1
[node name="Main" type="HSplitContainer" parent="VBoxContainer" index="1"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 24.0
margin_right = 792.0
margin_bottom = 454.0
margin_top = 28.0
margin_right = 1016.0
margin_bottom = 574.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
@ -128,7 +169,7 @@ anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 273.0
margin_bottom = 430.0
margin_bottom = 546.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 1
@ -167,7 +208,7 @@ anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 28.0
margin_right = 273.0
margin_bottom = 406.0
margin_bottom = 522.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = true
focus_mode = 2
@ -188,9 +229,9 @@ anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 410.0
margin_top = 526.0
margin_right = 273.0
margin_bottom = 430.0
margin_bottom = 546.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 1
@ -277,8 +318,8 @@ anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 285.0
margin_right = 792.0
margin_bottom = 430.0
margin_right = 1016.0
margin_bottom = 546.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 1
@ -293,8 +334,8 @@ anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 507.0
margin_bottom = 430.0
margin_right = 731.0
margin_bottom = 546.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
@ -312,7 +353,7 @@ anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 507.0
margin_right = 731.0
margin_bottom = 286.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
@ -330,8 +371,8 @@ anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 298.0
margin_right = 507.0
margin_bottom = 430.0
margin_right = 731.0
margin_bottom = 546.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 1
@ -346,7 +387,7 @@ anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 507.0
margin_right = 731.0
margin_bottom = 14.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
@ -366,8 +407,8 @@ anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 18.0
margin_right = 507.0
margin_bottom = 132.0
margin_right = 731.0
margin_bottom = 248.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
@ -399,9 +440,9 @@ anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 458.0
margin_right = 792.0
margin_bottom = 472.0
margin_top = 578.0
margin_right = 1016.0
margin_bottom = 592.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 1
@ -429,6 +470,8 @@ percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
[connection signal="pressed" from="VBoxContainer/MenuBar/SaveButton" to="." method="_on_SaveButton_pressed"]
[connection signal="item_selected" from="VBoxContainer/Main/LeftPane/StringList" to="." method="_on_StringList_item_selected"]
[connection signal="pressed" from="VBoxContainer/Main/LeftPane/StringListActions/AddButton" to="." method="_on_AddButton_pressed"]

View File

@ -11,6 +11,7 @@ config_version=3
[application]
config/name="TranslationEditor"
run/main_scene="res://addons/zylann.translation_editor/tools/translation_editor.tscn"
config/icon="res://icon.png"
[rendering]