add files.txt generation function

This commit is contained in:
Lera Elvoé 2022-06-23 21:35:07 +03:00
parent 9fae276011
commit d3764d3c4a
2 changed files with 14 additions and 2 deletions

View File

@ -24,6 +24,7 @@ onready var file_tree_context_menu := $"%FileTreeContextMenu"
onready var document_input_textedit := $"%DocInputTextEdit" onready var document_input_textedit := $"%DocInputTextEdit"
onready var content_preview_richtextlabel := $"%ContentPreviewRichTextLabel" onready var content_preview_richtextlabel := $"%ContentPreviewRichTextLabel"
onready var document_input_timer := $"%EditedTimeout"
onready var server_folder_dialog := $"%ServerFolderDialog" onready var server_folder_dialog := $"%ServerFolderDialog"
@ -147,7 +148,7 @@ func set_server_running(running: bool) -> void:
is_server_running = running # TODO: logic for disabling and enabling certain nodes is_server_running = running # TODO: logic for disabling and enabling certain nodes
func _generate_filestxt() -> String: func _generate_filestxt():
var files := "" var files := ""
for file in working_files: for file in working_files:
@ -155,7 +156,13 @@ func _generate_filestxt() -> String:
if file.include_in_filestxt: if file.include_in_filestxt:
files += "%s %s %s\n" % [file.file_path, file.date, file.title] files += "%s %s %s\n" % [file.file_path, file.date, file.title]
return files var f := File.new()
if f.open(server_dir.plus_file("files.txt"), File.WRITE) == OK:
f.store_string(files)
f.close()
else:
push_error("File.txt open for save error!")
func _is_file_in_filestxt(path: String) -> bool: func _is_file_in_filestxt(path: String) -> bool:

View File

@ -206,6 +206,11 @@ size_flags_vertical = 3
show_line_numbers = true show_line_numbers = true
wrap_enabled = true wrap_enabled = true
[node name="EditedTimeout" type="Timer" parent="VBoxContainer/HSplitContainer/VBoxContainer/HBoxContainer/VBoxContainer/HSplitContainer/ContentEditContainer/DocInputTextEdit"]
unique_name_in_owner = true
wait_time = 3.0
one_shot = true
[node name="ContentPreviewContainer" type="VBoxContainer" parent="VBoxContainer/HSplitContainer/VBoxContainer/HBoxContainer/VBoxContainer/HSplitContainer"] [node name="ContentPreviewContainer" type="VBoxContainer" parent="VBoxContainer/HSplitContainer/VBoxContainer/HBoxContainer/VBoxContainer/HSplitContainer"]
margin_left = 390.0 margin_left = 390.0
margin_right = 848.0 margin_right = 848.0