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:
parent
cfe3aad3fc
commit
5e1ffe3a2c
|
@ -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");
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1668,7 +1668,8 @@ 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")) {
|
||||
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) {
|
||||
|
@ -1677,6 +1678,24 @@ wxBoxSizer* MainFrame::create_side_tools()
|
|||
}
|
||||
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 (m_slice_select == eSliceAll)
|
||||
wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_SLICE_ALL));
|
||||
|
|
Loading…
Reference in New Issue