diff --git a/src/libslic3r/AppConfig.cpp b/src/libslic3r/AppConfig.cpp index cf05c5e63..7a44a1e25 100644 --- a/src/libslic3r/AppConfig.cpp +++ b/src/libslic3r/AppConfig.cpp @@ -429,6 +429,10 @@ void AppConfig::set_defaults() if (get("play_slicing_video").empty()) { set_bool("play_slicing_video", true); } + if (get("play_tpu_printing_video").empty()) { + set_bool("play_tpu_printing_video", true); + } + // Remove legacy window positions/sizes erase("app", "main_frame_maximized"); erase("app", "main_frame_pos"); diff --git a/src/slic3r/GUI/FilamentGroupPopup.cpp b/src/slic3r/GUI/FilamentGroupPopup.cpp index 6f0eddac1..21d384234 100644 --- a/src/slic3r/GUI/FilamentGroupPopup.cpp +++ b/src/slic3r/GUI/FilamentGroupPopup.cpp @@ -57,6 +57,18 @@ bool play_dual_extruder_slice_video() return false; } +bool play_dual_extruder_print_tpu_video() +{ + // TO be replaced + const wxString video_url = "https://e.bambulab.com/t?c=mOkvsXkJ9pldGYp9"; + if (wxLaunchDefaultBrowser(video_url)){ + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format("Print Tpu Video is being played using the system's default browser."); + return true; + } + BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format("launch system's default browser failed"); + return false; +} + bool open_filament_group_wiki() { const wxString wiki_url = "https://e.bambulab.com/t?c=mOkvsXkJ9pldGYp9"; diff --git a/src/slic3r/GUI/FilamentGroupPopup.hpp b/src/slic3r/GUI/FilamentGroupPopup.hpp index 509a95884..b8b0998f0 100644 --- a/src/slic3r/GUI/FilamentGroupPopup.hpp +++ b/src/slic3r/GUI/FilamentGroupPopup.hpp @@ -11,6 +11,7 @@ class Plater; bool play_dual_extruder_slice_video(); +bool play_dual_extruder_print_tpu_video(); bool open_filament_group_wiki(); class FilamentGroupPopup : public PopupWindow diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index cfa424746..50992ec65 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -1668,15 +1668,34 @@ wxBoxSizer* MainFrame::create_side_tools() if (slice) { std::string printer_model = wxGetApp().preset_bundle->printers.get_edited_preset().config.opt_string("printer_model"); - if ((wxGetApp().app_config->get("play_slicing_video") == "true") && (printer_model == "Bambu Lab H2D")) { - MessageDialog dlg(this, _L("This is your first time slicing with the H2D machine.\nWould you like to watch a quick tutorial video?"), _L("First Guide"), wxYES_NO); - auto res = dlg.ShowModal(); - if (res == wxID_YES) { - play_dual_extruder_slice_video(); - slice = false; + if (printer_model == "Bambu Lab H2D") { + if (wxGetApp().app_config->get("play_slicing_video") == "true") { + MessageDialog dlg(this, _L("This is your first time slicing with the H2D machine.\nWould you like to watch a quick tutorial video?"), _L("First Guide"), wxYES_NO); + auto res = dlg.ShowModal(); + if (res == wxID_YES) { + play_dual_extruder_slice_video(); + slice = false; + } + wxGetApp().app_config->set("play_slicing_video", "false"); + } + + if ((wxGetApp().app_config->get("play_tpu_printing_video") == "true") ) { + auto used_filaments = curr_plate->get_extruders(); + std::transform(used_filaments.begin(), used_filaments.end(), used_filaments.begin(), [](auto i) {return i - 1; }); + auto full_config = wxGetApp().preset_bundle->full_config(); + auto filament_types = full_config.option("filament_type")->values; + if (std::any_of(used_filaments.begin(), used_filaments.end(), [filament_types](int idx) { return filament_types[idx] == "TPU"; })) { + MessageDialog dlg(this, _L("This is your first time printing tpu filaments with the H2D machine.\nWould you like to watch a quick tutorial video?"), _L("First Guide"), wxYES_NO); + auto res = dlg.ShowModal(); + if (res == wxID_YES) { + play_dual_extruder_print_tpu_video(); + slice = false; + } + wxGetApp().app_config->set("play_tpu_printing_video", "false"); + } } - wxGetApp().app_config->set("play_slicing_video", "false"); } + if (slice) { if (m_slice_select == eSliceAll) wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_SLICE_ALL));