Allow to show only strings missing translation

This commit is contained in:
Marc Gilleron 2020-06-19 23:23:50 +01:00
parent 36c7e48fd3
commit bce3d75453
2 changed files with 24 additions and 6 deletions

View File

@ -39,6 +39,7 @@ onready var _translation_tab_container : TabContainer = \
onready var _notes_edit : TextEdit = \ onready var _notes_edit : TextEdit = \
$VBoxContainer/Main/RightPane/VSplitContainer/VBoxContainer/NotesEdit $VBoxContainer/Main/RightPane/VSplitContainer/VBoxContainer/NotesEdit
onready var _status_label : Label = $VBoxContainer/StatusBar/Label onready var _status_label : Label = $VBoxContainer/StatusBar/Label
onready var _show_untranslated_checkbox : CheckBox = $VBoxContainer/MenuBar/ShowUntranslated
var _string_edit_dialog : StringEditionDialog = null var _string_edit_dialog : StringEditionDialog = null
var _language_selection_dialog : LanguageSelectionDialog = null var _language_selection_dialog : LanguageSelectionDialog = null
@ -439,14 +440,15 @@ func _refresh_list():
prev_selected_strid = _string_list.get_item_text(prev_selection[0]) prev_selected_strid = _string_list.get_item_text(prev_selection[0])
var search_text := _search_edit.text.strip_edges() var search_text := _search_edit.text.strip_edges()
var show_untranslated := _show_untranslated_checkbox.pressed
var sorted_strids := [] var sorted_strids := []
if search_text == "": for strid in _data.keys():
sorted_strids = _data.keys() if show_untranslated and _get_string_status(strid) == STATUS_TRANSLATED:
else: continue
for strid in _data.keys(): if search_text != "" and strid.find(search_text) == -1:
if strid.find(search_text) != -1: continue
sorted_strids.append(strid) sorted_strids.append(strid)
sorted_strids.sort() sorted_strids.sort()
@ -680,3 +682,7 @@ func _on_ClearSearch_pressed():
_search_edit.text = "" _search_edit.text = ""
# LineEdit does not emit `text_changed` when doing this # LineEdit does not emit `text_changed` when doing this
_on_Search_text_changed(_search_edit.text) _on_Search_text_changed(_search_edit.text)
func _on_ShowUntranslated_toggled(button_pressed):
_refresh_list()

View File

@ -55,6 +55,17 @@ margin_right = 147.0
margin_bottom = 24.0 margin_bottom = 24.0
icon = ExtResource( 3 ) icon = ExtResource( 3 )
[node name="VSeparator2" type="VSeparator" parent="VBoxContainer/MenuBar"]
margin_left = 151.0
margin_right = 155.0
margin_bottom = 24.0
[node name="ShowUntranslated" type="CheckBox" parent="VBoxContainer/MenuBar"]
margin_left = 159.0
margin_right = 304.0
margin_bottom = 24.0
text = "Show untranslated"
[node name="Main" type="HSplitContainer" parent="VBoxContainer"] [node name="Main" type="HSplitContainer" parent="VBoxContainer"]
margin_top = 28.0 margin_top = 28.0
margin_right = 1016.0 margin_right = 1016.0
@ -154,6 +165,7 @@ margin_bottom = 14.0
text = "Status" text = "Status"
[connection signal="pressed" from="VBoxContainer/MenuBar/OpenButton" to="." method="_on_OpenButton_pressed"] [connection signal="pressed" from="VBoxContainer/MenuBar/OpenButton" to="." method="_on_OpenButton_pressed"]
[connection signal="pressed" from="VBoxContainer/MenuBar/SaveButton" to="." method="_on_SaveButton_pressed"] [connection signal="pressed" from="VBoxContainer/MenuBar/SaveButton" to="." method="_on_SaveButton_pressed"]
[connection signal="toggled" from="VBoxContainer/MenuBar/ShowUntranslated" to="." method="_on_ShowUntranslated_toggled"]
[connection signal="text_changed" from="VBoxContainer/Main/LeftPane/Search/Search" to="." method="_on_Search_text_changed"] [connection signal="text_changed" from="VBoxContainer/Main/LeftPane/Search/Search" to="." method="_on_Search_text_changed"]
[connection signal="pressed" from="VBoxContainer/Main/LeftPane/Search/ClearSearch" to="." method="_on_ClearSearch_pressed"] [connection signal="pressed" from="VBoxContainer/Main/LeftPane/Search/ClearSearch" to="." method="_on_ClearSearch_pressed"]
[connection signal="item_selected" from="VBoxContainer/Main/LeftPane/StringList" to="." method="_on_StringList_item_selected"] [connection signal="item_selected" from="VBoxContainer/Main/LeftPane/StringList" to="." method="_on_StringList_item_selected"]