diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index 138d4ef14..b23ff1121 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -374,6 +374,14 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater) m_text_printer_msg->SetFont(::Label::Body_13); m_text_printer_msg->Hide(); + m_text_printer_msg_tips = new Label(m_basic_panel); + m_text_printer_msg_tips->SetMinSize(wxSize(FromDIP(420), FromDIP(24))); + m_text_printer_msg_tips->SetMaxSize(wxSize(FromDIP(420), FromDIP(24))); + m_text_printer_msg_tips->SetFont(::Label::Body_13); + m_text_printer_msg_tips->SetForegroundColour(wxColour(0x6B, 0x6B, 0x6B)); + m_text_printer_msg_tips->Hide(); + m_text_printer_msg_tips->GetAlignment(); + sizer_basic_right_info->Add(sizer_rename, 0, wxTOP, 0); sizer_basic_right_info->Add(0, 0, 0, wxTOP, FromDIP(5)); sizer_basic_right_info->Add(m_sizer_basic_weight_time, 0, wxTOP, 0); @@ -385,6 +393,8 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater) sizer_basic_right_info->Add(sizer_printer_area, 0, wxTOP, 0); sizer_basic_right_info->Add(0, 0, 0, wxTOP, FromDIP(4)); sizer_basic_right_info->Add(m_text_printer_msg, 0, wxLEFT, 0); + sizer_basic_right_info->AddSpacer(FromDIP(10)); + sizer_basic_right_info->Add(m_text_printer_msg_tips, 0, wxLEFT, 0); m_basicl_sizer->Add(m_sizer_thumbnail_area, 0, wxLEFT, 0); @@ -1530,13 +1540,11 @@ bool SelectMachineDialog::is_nozzle_type_match(ExtderData data, wxString& error_ pos = _L("right"); } - const wxString& tips = _L("Tips: If you changed your nozzle of your printer lately, Please go to 'Device -> Printer parts' to change your nozzle setting."); error_message = wxString::Format(_L("The nozzle flow setting of %snozzle(%s) doesn't match with the slicing file(%s). " "Please make sure the nozzle installed matches with settings in printer, " "then set the corresponding printer preset while slicing."), pos, flow_type_of_machine[target_machine_nozzle_id], used_extruders_flow[it->first]); - error_message = error_message + "\n" + tips; return false; } } @@ -1628,6 +1636,41 @@ void SelectMachineDialog::update_priner_status_msg(wxString msg, bool is_warning } } +void SelectMachineDialog::update_printer_status_msg_tips(const wxString& msg_tips) +{ + if (msg_tips.empty()) + { + if (!m_text_printer_msg_tips->GetLabel().empty()) + { + m_text_printer_msg_tips->SetLabel(wxEmptyString); + m_text_printer_msg_tips->Hide(); + Layout(); + Fit(); + } + } + else + { + auto str_new = msg_tips.utf8_string(); + stripWhiteSpace(str_new); + + auto str_old = m_text_printer_msg_tips->GetLabel().utf8_string(); + stripWhiteSpace(str_old); + + if (str_new != str_old) + { + if (m_text_printer_msg_tips->GetLabel() != msg_tips) { + m_text_printer_msg_tips->SetLabel(msg_tips); + m_text_printer_msg_tips->SetMinSize(wxSize(FromDIP(420), -1)); + m_text_printer_msg_tips->SetMaxSize(wxSize(FromDIP(420), -1)); + m_text_printer_msg_tips->Wrap(FromDIP(420)); + m_text_printer_msg_tips->Show(); + Layout(); + Fit(); + } + } + } +} + void SelectMachineDialog::update_print_status_msg(wxString msg, bool is_warning, bool is_printer_msg) { if (is_printer_msg) { @@ -3290,6 +3333,7 @@ void SelectMachineDialog::update_show_status() { std::vector params { error_message }; show_status(PrintDialogStatus::PrintStatusNozzleMatchInvalid, params); + update_printer_status_msg_tips(_L("Tips: If you changed your nozzle of your printer lately, Please go to 'Device -> Printer parts' to change your nozzle setting.")); return; } } @@ -3301,14 +3345,13 @@ void SelectMachineDialog::update_show_status() if (!is_same_nozzle_diameters(nozzle_diameter)) { std::vector error_msg; - const wxString& tips = _L("Tips: If you changed your nozzle of your printer lately, Please go to 'Device -> Printer parts' to change your nozzle setting."); if (obj_->m_extder_data.total_extder_count == 2) { const wxString& nozzle_config = wxString::Format(_L("The current nozzle diameter (Left: %.1fmm Right: %.1fmm) doesn't match with the slicing file (%.1fmm). " "Please make sure the nozzle installed matches with settings in printer, then set the " "corresponding printer preset when slicing."), obj_->m_extder_data.extders[1].current_nozzle_diameter, obj_->m_extder_data.extders[0].current_nozzle_diameter, nozzle_diameter); - error_msg.emplace_back(nozzle_config + "\n\n" + tips); + error_msg.emplace_back(nozzle_config); } else { @@ -3316,9 +3359,10 @@ void SelectMachineDialog::update_show_status() "Please make sure the nozzle installed matches with settings in printer, then set the " "corresponding printer preset when slicing."), obj_->m_extder_data.extders[0].current_nozzle_diameter, nozzle_diameter); - error_msg.emplace_back(nozzle_config + "\n\n" + tips); + error_msg.emplace_back(nozzle_config); } + update_printer_status_msg_tips(_L("Tips: If you changed your nozzle of your printer lately, Please go to 'Device -> Printer parts' to change your nozzle setting.")); return show_status(PrintDialogStatus::PrintStatusNozzleDiameterMismatch, error_msg); } diff --git a/src/slic3r/GUI/SelectMachine.hpp b/src/slic3r/GUI/SelectMachine.hpp index 3fe724587..70761da5b 100644 --- a/src/slic3r/GUI/SelectMachine.hpp +++ b/src/slic3r/GUI/SelectMachine.hpp @@ -369,6 +369,7 @@ protected: Label* m_statictext_ams_msg{ nullptr }; Label* m_txt_change_filament_times{ nullptr }; Label* m_text_printer_msg{ nullptr }; + Label* m_text_printer_msg_tips{ nullptr }; wxStaticText* m_staticText_bed_title{ nullptr }; wxStaticText* m_stext_sending{ nullptr }; wxStaticText* m_statictext_finish{nullptr}; @@ -472,6 +473,7 @@ public: void stripWhiteSpace(std::string& str); void update_ams_status_msg(wxString msg, bool is_warning = false); void update_priner_status_msg(wxString msg, bool is_warning = false); + void update_printer_status_msg_tips(const wxString& msg_tips); void update_print_status_msg(wxString msg, bool is_warning = false, bool is_printer = true); void update_print_error_info(int code, std::string msg, std::string extra); void set_flow_calibration_state(bool state, bool show_tips = true);