diff --git a/.idea/PRD-TU-MP550.iml b/.idea/PRD-TU-MP550.iml index 15e76cf..e0a6e47 100644 --- a/.idea/PRD-TU-MP550.iml +++ b/.idea/PRD-TU-MP550.iml @@ -3,5 +3,6 @@ + \ No newline at end of file diff --git a/others-Н1 b/others-Н1 deleted file mode 100644 index 0637a08..0000000 --- a/others-Н1 +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/project.godot b/project.godot index 6ab7c36..6c313a7 100644 --- a/project.godot +++ b/project.godot @@ -33,7 +33,7 @@ window/size/viewport_height=940 [editor] -run/main_run_args="-- testsave-path D://PRD-TU-MP550//testsave//" +run/main_run_args="-- testsave-path D://PRD-TU-MP550//" [rendering] diff --git a/scripts/PRD.gd b/scripts/PRD.gd index 8d718ea..2a2d920 100644 --- a/scripts/PRD.gd +++ b/scripts/PRD.gd @@ -12,7 +12,7 @@ var CONTROL_TABLE: Array var isa_from_yau07b: Dictionary = {} var JSOON = JSON.new() var status_pribor = null -var save_path = "D://PRD-TU-MP550//save//" +var save_path = "D://temp//" var need_port: Array = [ 0x122, @@ -30,7 +30,6 @@ func _ready() -> void: if args[i] == "testsave-path" and i + 1 < args.size(): save_path = args[i + 1] break - print("путь сохранения: ", save_path) # Таблица УКП_1 node_select1 = $TabContainer/PRD/body_grid/litera_2_4_6/table_ukp_1 @@ -194,11 +193,18 @@ func _on_mfs_select() -> void: func _on_save_config(): + var da = DirAccess.open(save_path) + var base_path = save_path + "save//" + if da == null: + return + else: + da.dir_exists(base_path) + da.make_dir_recursive(base_path) var file_dialog = FileDialog.new() file_dialog.title = "Сохранить файл как" file_dialog.set_size(Vector2(600, 400)) file_dialog.mode = FileDialog.FILE_MODE_SAVE_FILE - file_dialog.current_dir = save_path + file_dialog.current_dir = base_path file_dialog.set_current_file("ЭМС-Г" + "-" + status_pribor) file_dialog.connect("file_selected", Callable(self, "_save_selected_file")) add_child(file_dialog) @@ -206,6 +212,7 @@ func _on_save_config(): func _save_selected_file(file_path: String): + var data = Constants.EMS_G_PORT_DATA_HOLDER var param_ems_g: Dictionary = {} var other_data: Dictionary = {} @@ -263,10 +270,11 @@ func _on_file_selected(file_path: String): func _on_load_config(): var file_dialog = FileDialog.new() + var base_path = save_path + "save//" file_dialog.set_title("Выберите файл") file_dialog.set_size(Vector2(600, 400)) - file_dialog.current_dir = save_path file_dialog.access = FileDialog.ACCESS_FILESYSTEM + file_dialog.current_dir = base_path add_child(file_dialog) file_dialog.popup_centered()