diff --git a/src/slic3r/GUI/CreatePresetsDialog.cpp b/src/slic3r/GUI/CreatePresetsDialog.cpp index 0fb233912..615e8f712 100644 --- a/src/slic3r/GUI/CreatePresetsDialog.cpp +++ b/src/slic3r/GUI/CreatePresetsDialog.cpp @@ -3367,6 +3367,10 @@ ExportConfigsDialog::~ExportConfigsDialog() } } } + + // Delete the Temp folder + boost::filesystem::path temp_folder(data_dir() + "/" + PRESET_USER_DIR + "/" + "Temp"); + if (boost::filesystem::exists(temp_folder)) boost::filesystem::remove_all(temp_folder); } void ExportConfigsDialog::on_dpi_changed(const wxRect &suggested_rect) { @@ -3435,6 +3439,26 @@ bool ExportConfigsDialog::preset_is_not_compatible_bbl_printer(Preset *preset) return false; } +bool ExportConfigsDialog::earse_preset_fields_for_safe(Preset *preset) +{ + if (preset->type != Preset::Type::TYPE_PRINTER) return true; + + boost::filesystem::path file_path(data_dir() + "/" + PRESET_USER_DIR + "/" + "Temp" + "/" + (preset->name + ".json")); + preset->file = file_path.make_preferred().string(); + + DynamicPrintConfig &config = preset->config; + config.erase("print_host"); + config.erase("print_host_webui"); + config.erase("printhost_apikey"); + config.erase("printhost_cafile"); + config.erase("printhost_user"); + config.erase("printhost_password"); + config.erase("printhost_port"); + + preset->save(nullptr); + return true; +} + std::string ExportConfigsDialog::initial_file_path(const wxString &path, const std::string &sub_file_path) { std::string export_path = into_u8(path); @@ -4182,19 +4206,45 @@ wxBoxSizer *ExportConfigsDialog::create_select_printer(wxWindow *parent) void ExportConfigsDialog::data_init() { + // Delete the Temp folder + boost::filesystem::path folder(data_dir() + "/" + PRESET_USER_DIR + "/" + "Temp"); + if (boost::filesystem::exists(folder)) boost::filesystem::remove_all(folder); + + boost::system::error_code ec; + boost::filesystem::path user_folder(data_dir() + "/" + PRESET_USER_DIR); + bool temp_folder_exist = true; + if (!boost::filesystem::exists(user_folder)) { + if (!boost::filesystem::create_directories(user_folder, ec)) { + BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << " create directory failed: " << user_folder << " "< & printer_presets = preset_bundle.printers.get_presets(); for (const Preset &printer_preset : printer_presets) { std::string preset_name = printer_preset.name; - if (!printer_preset.is_visible || "Default Printer" == preset_name) continue; + if (!printer_preset.is_visible || printer_preset.is_default || printer_preset.is_project_embedded) continue; if (preset_bundle.printers.select_preset_by_name(preset_name, false)) { preset_bundle.update_compatible(PresetSelectCompatibleType::Always); const std::deque &filament_presets = preset_bundle.filaments.get_presets(); for (const Preset &filament_preset : filament_presets) { - if (filament_preset.is_system || filament_preset.is_default) continue; + if (filament_preset.is_system || filament_preset.is_default || filament_preset.is_project_embedded) continue; if (filament_preset.is_compatible) { Preset *new_filament_preset = new Preset(filament_preset); m_filament_presets[preset_name].push_back(new_filament_preset); @@ -4203,7 +4253,7 @@ void ExportConfigsDialog::data_init() const std::deque &process_presets = preset_bundle.prints.get_presets(); for (const Preset &process_preset : process_presets) { - if (process_preset.is_system || process_preset.is_default) continue; + if (process_preset.is_system || process_preset.is_default || process_preset.is_project_embedded) continue; if (process_preset.is_compatible) { Preset *new_prpcess_preset = new Preset(process_preset); m_process_presets[preset_name].push_back(new_prpcess_preset); @@ -4211,6 +4261,7 @@ void ExportConfigsDialog::data_init() } Preset *new_printer_preset = new Preset(printer_preset); + earse_preset_fields_for_safe(new_printer_preset); m_printer_presets[preset_name] = new_printer_preset; } } diff --git a/src/slic3r/GUI/CreatePresetsDialog.hpp b/src/slic3r/GUI/CreatePresetsDialog.hpp index ba603db32..78dea466e 100644 --- a/src/slic3r/GUI/CreatePresetsDialog.hpp +++ b/src/slic3r/GUI/CreatePresetsDialog.hpp @@ -263,6 +263,7 @@ private: void show_export_result(const ExportCase &export_case); bool has_check_box_selected(); bool preset_is_not_compatible_bbl_printer(Preset *preset); + bool earse_preset_fields_for_safe(Preset *preset); std::string initial_file_path(const wxString &path, const std::string &sub_file_path); std::string initial_file_name(const wxString &path, const std::string file_name); wxBoxSizer *create_export_config_item(wxWindow *parent); diff --git a/src/slic3r/GUI/MsgDialog.cpp b/src/slic3r/GUI/MsgDialog.cpp index 26cf4c24e..ede723e75 100644 --- a/src/slic3r/GUI/MsgDialog.cpp +++ b/src/slic3r/GUI/MsgDialog.cpp @@ -582,7 +582,7 @@ wxBoxSizer *Newer3mfVersionDialog::get_btn_sizer() } if (!file_version_newer) { - m_later_btn = new Button(this, _L("Not for new")); + m_later_btn = new Button(this, _L("Not for now")); m_later_btn->SetBackgroundColor(btn_bg_white); m_later_btn->SetBorderColor(wxColour(38, 46, 48)); } else {