ENH: play a video for first tpu printing

jira: NONE

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: I0c1e9d97043436c6e74da13b84727706bab71ea3
This commit is contained in:
xun.zhang 2025-03-23 16:21:28 +08:00 committed by lane.wei
parent cfe3aad3fc
commit 5e1ffe3a2c
4 changed files with 43 additions and 7 deletions

View File

@ -429,6 +429,10 @@ void AppConfig::set_defaults()
if (get("play_slicing_video").empty()) { if (get("play_slicing_video").empty()) {
set_bool("play_slicing_video", true); 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 // Remove legacy window positions/sizes
erase("app", "main_frame_maximized"); erase("app", "main_frame_maximized");
erase("app", "main_frame_pos"); erase("app", "main_frame_pos");

View File

@ -57,6 +57,18 @@ bool play_dual_extruder_slice_video()
return false; 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() bool open_filament_group_wiki()
{ {
const wxString wiki_url = "https://e.bambulab.com/t?c=mOkvsXkJ9pldGYp9"; const wxString wiki_url = "https://e.bambulab.com/t?c=mOkvsXkJ9pldGYp9";

View File

@ -11,6 +11,7 @@ class Plater;
bool play_dual_extruder_slice_video(); bool play_dual_extruder_slice_video();
bool play_dual_extruder_print_tpu_video();
bool open_filament_group_wiki(); bool open_filament_group_wiki();
class FilamentGroupPopup : public PopupWindow class FilamentGroupPopup : public PopupWindow

View File

@ -1668,7 +1668,8 @@ wxBoxSizer* MainFrame::create_side_tools()
if (slice) { if (slice) {
std::string printer_model = wxGetApp().preset_bundle->printers.get_edited_preset().config.opt_string("printer_model"); 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")) { 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); 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(); auto res = dlg.ShowModal();
if (res == wxID_YES) { if (res == wxID_YES) {
@ -1677,6 +1678,24 @@ wxBoxSizer* MainFrame::create_side_tools()
} }
wxGetApp().app_config->set("play_slicing_video", "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<ConfigOptionStrings>("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");
}
}
}
if (slice) { if (slice) {
if (m_slice_select == eSliceAll) if (m_slice_select == eSliceAll)
wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_SLICE_ALL)); wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_SLICE_ALL));