diff --git a/src/slic3r/GUI/PrintOptionsDialog.cpp b/src/slic3r/GUI/PrintOptionsDialog.cpp index 6cc17be1a..4f6c1e9a5 100644 --- a/src/slic3r/GUI/PrintOptionsDialog.cpp +++ b/src/slic3r/GUI/PrintOptionsDialog.cpp @@ -385,4 +385,181 @@ bool PrintOptionsDialog::Show(bool show) return DPIDialog::Show(show); } +PrinterPartsDialog::PrinterPartsDialog(wxWindow* parent) +: DPIDialog(parent, wxID_ANY, _L("Printer Parts"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX) +{ + nozzle_type_map[0] = "hardened_steel"; + nozzle_type_map[1] = "stainless_steel"; + + nozzle_stainless_diameter_map[0] = 0.2; + nozzle_stainless_diameter_map[1] = 0.4; + + nozzle_hard_diameter_map[0] = 0.4; + nozzle_hard_diameter_map[1] = 0.6; + nozzle_hard_diameter_map[2] = 0.8; + + SetBackgroundColour(*wxWHITE); + wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); + + + auto m_line = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 1), wxTAB_TRAVERSAL); + m_line->SetBackgroundColour(wxColour(166, 169, 170)); + + //nozzle type + wxBoxSizer* line_sizer_nozzle_type = new wxBoxSizer(wxHORIZONTAL); + + auto nozzle_type = new Label(this, _L("Nozzle Type")); + nozzle_type->SetFont(Label::Body_14); + nozzle_type->SetMinSize(wxSize(FromDIP(180), -1)); + nozzle_type->SetMaxSize(wxSize(FromDIP(180), -1)); + nozzle_type->SetForegroundColour(STATIC_TEXT_CAPTION_COL); + nozzle_type->Wrap(-1); + + nozzle_type_checkbox = new ComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(FromDIP(140), -1), 0, NULL, wxCB_READONLY); + nozzle_type_checkbox->Append(_L("Stainless Steel")); + nozzle_type_checkbox->Append(_L("Hardened Steel")); + nozzle_type_checkbox->SetSelection(0); + + + line_sizer_nozzle_type->Add(nozzle_type, 0, wxALIGN_CENTER, 5); + line_sizer_nozzle_type->Add(0, 0, 1, wxEXPAND, 5); + line_sizer_nozzle_type->Add(nozzle_type_checkbox, 0, wxALIGN_CENTER, 5); + + + //nozzle diameter + wxBoxSizer* line_sizer_nozzle_diameter = new wxBoxSizer(wxHORIZONTAL); + auto nozzle_diameter = new Label(this, _L("Nozzle Diameter")); + nozzle_diameter->SetFont(Label::Body_14); + nozzle_diameter->SetMinSize(wxSize(FromDIP(180), -1)); + nozzle_diameter->SetMaxSize(wxSize(FromDIP(180), -1)); + nozzle_diameter->SetForegroundColour(STATIC_TEXT_CAPTION_COL); + nozzle_diameter->Wrap(-1); + + nozzle_diameter_checkbox = new ComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(FromDIP(140), -1), 0, NULL, wxCB_READONLY); + + + line_sizer_nozzle_diameter->Add(nozzle_diameter, 0, wxALIGN_CENTER, 5); + line_sizer_nozzle_diameter->Add(0, 0, 1, wxEXPAND, 5); + line_sizer_nozzle_diameter->Add(nozzle_diameter_checkbox, 0, wxALIGN_CENTER, 5); + + sizer->Add(m_line, 0, wxEXPAND, 0); + sizer->Add(0, 0, 0, wxTOP, FromDIP(24)); + sizer->Add(line_sizer_nozzle_type, 0, wxALIGN_CENTER|wxLEFT|wxRIGHT, FromDIP(18)); + sizer->Add(0, 0, 0, wxTOP, FromDIP(20)); + sizer->Add(line_sizer_nozzle_diameter, 0, wxALIGN_CENTER|wxLEFT|wxRIGHT, FromDIP(18)); + sizer->Add(0, 0, 0, wxTOP, FromDIP(24)); + + + nozzle_type_checkbox->Connect( wxEVT_COMBOBOX, wxCommandEventHandler(PrinterPartsDialog::set_nozzle_type), NULL, this ); + nozzle_diameter_checkbox->Connect( wxEVT_COMBOBOX, wxCommandEventHandler(PrinterPartsDialog::set_nozzle_diameter), NULL, this ); + + SetSizer(sizer); + Layout(); + Fit(); + wxGetApp().UpdateDlgDarkUI(this); +} + +PrinterPartsDialog::~PrinterPartsDialog() +{ + nozzle_type_checkbox->Disconnect(wxEVT_COMBOBOX, wxCommandEventHandler(PrinterPartsDialog::set_nozzle_type), NULL, this); + nozzle_diameter_checkbox->Disconnect(wxEVT_COMBOBOX, wxCommandEventHandler(PrinterPartsDialog::set_nozzle_diameter), NULL, this); +} + +void PrinterPartsDialog::set_nozzle_type(wxCommandEvent& evt) +{ + auto type = nozzle_type_map[nozzle_type_checkbox->GetSelection()]; + + if (type == last_nozzle_type) { + return; + } + + std::map diameter_list; + if (type == "hardened_steel") { + diameter_list = nozzle_hard_diameter_map; + } + else if (type == "stainless_steel") { + diameter_list = nozzle_stainless_diameter_map; + } + + nozzle_diameter_checkbox->Clear(); + for (int i = 0; i < diameter_list.size(); i++) + { + nozzle_diameter_checkbox->Append(wxString::Format(_L("%.1f"), diameter_list[i])); + } + nozzle_diameter_checkbox->SetSelection(0); + last_nozzle_type = type; + set_nozzle_diameter(evt); +} + +void PrinterPartsDialog::set_nozzle_diameter(wxCommandEvent& evt) +{ + if (obj) { + try + { + auto nozzle_type = nozzle_type_map[nozzle_type_checkbox->GetSelection()]; + auto nozzle_diameter = std::stof(nozzle_diameter_checkbox->GetStringSelection().ToStdString()); + nozzle_diameter = round(nozzle_diameter * 10) / 10; + obj->command_set_printer_nozzle(nozzle_type, nozzle_diameter); + } + catch (...) {} + } +} + +void PrinterPartsDialog::on_dpi_changed(const wxRect& suggested_rect) +{ + Fit(); +} + +void PrinterPartsDialog::update_machine_obj(MachineObject* obj_) +{ + obj = obj_; +} + +bool PrinterPartsDialog::Show(bool show) +{ + if (show) { + wxGetApp().UpdateDlgDarkUI(this); + CentreOnParent(); + + auto type = obj->nozzle_type; + auto diameter = round(obj->nozzle_diameter * 10) / 10; + + nozzle_type_checkbox->Clear(); + nozzle_diameter_checkbox->Clear(); + + if (type.empty()) { + nozzle_type_checkbox->Disable(); + nozzle_diameter_checkbox->Disable(); + return DPIDialog::Show(show); + } + + last_nozzle_type = type; + + for (int i=0; i < nozzle_type_map.size(); i++) + { + nozzle_type_checkbox->Append( nozzle_type_map[i] ); + if (nozzle_type_map[i] == type) { + nozzle_type_checkbox->SetSelection(i); + } + } + + std::map diameter_list; + if (type == "hardened_steel") { + diameter_list = nozzle_hard_diameter_map; + } + else if (type == "stainless_steel") { + diameter_list = nozzle_stainless_diameter_map; + } + + for (int i = 0; i < diameter_list.size(); i++) + { + nozzle_diameter_checkbox->Append( wxString::Format(_L("%.1f"), diameter_list[i])); + if (diameter_list[i] == diameter) { + nozzle_diameter_checkbox->SetSelection(i); + } + } + } + return DPIDialog::Show(show); +} + }} // namespace Slic3r::GUI diff --git a/src/slic3r/GUI/PrintOptionsDialog.hpp b/src/slic3r/GUI/PrintOptionsDialog.hpp index 21865bda3..ce67b7672 100644 --- a/src/slic3r/GUI/PrintOptionsDialog.hpp +++ b/src/slic3r/GUI/PrintOptionsDialog.hpp @@ -18,6 +18,27 @@ namespace Slic3r { namespace GUI { +class PrinterPartsDialog : public DPIDialog +{ +protected: + MachineObject* obj{ nullptr }; + ComboBox* nozzle_type_checkbox; + ComboBox* nozzle_diameter_checkbox; + std::string last_nozzle_type; + std::map nozzle_type_map; + std::map nozzle_stainless_diameter_map; + std::map nozzle_hard_diameter_map; +public: + PrinterPartsDialog(wxWindow* parent); + ~PrinterPartsDialog(); + void set_nozzle_type(wxCommandEvent& evt); + void set_nozzle_diameter(wxCommandEvent& evt); + void on_dpi_changed(const wxRect& suggested_rect) override; + void update_machine_obj(MachineObject* obj_); + bool Show(bool show) override; +}; + + class PrintOptionsDialog : public DPIDialog { protected: diff --git a/src/slic3r/GUI/ReleaseNote.cpp b/src/slic3r/GUI/ReleaseNote.cpp index 59964d37b..2f2d87040 100644 --- a/src/slic3r/GUI/ReleaseNote.cpp +++ b/src/slic3r/GUI/ReleaseNote.cpp @@ -976,16 +976,46 @@ void ConfirmBeforeSendDialog::update_text(wxString text) sizer_text_release_note->Add(bottom_blank_sizer, 0, wxALIGN_CENTER | wxALL, FromDIP(5)); m_vebview_release_note->SetSizer(sizer_text_release_note); } - m_staticText_release_note->SetMaxSize(wxSize(FromDIP(330), -1)); - m_staticText_release_note->SetMinSize(wxSize(FromDIP(330), -1)); + m_staticText_release_note->SetMaxSize(wxSize(FromDIP(380), -1)); + m_staticText_release_note->SetMinSize(wxSize(FromDIP(380), -1)); m_staticText_release_note->SetLabelText(text); m_vebview_release_note->Layout(); auto text_size = m_staticText_release_note->GetBestSize(); - if (text_size.y < FromDIP(360)) - m_vebview_release_note->SetMinSize(wxSize(FromDIP(360), text_size.y + FromDIP(25))); + if (text_size.y < FromDIP(380)) + m_vebview_release_note->SetMinSize(wxSize(FromDIP(400), text_size.y + FromDIP(25))); else { - m_vebview_release_note->SetMinSize(wxSize(FromDIP(360), FromDIP(360))); + m_vebview_release_note->SetMinSize(wxSize(FromDIP(400), FromDIP(380))); + } + + Layout(); + Fit(); +} + +void ConfirmBeforeSendDialog::update_text(std::vector texts) +{ + wxBoxSizer* sizer_text_release_note = new wxBoxSizer(wxVERTICAL); + m_vebview_release_note->SetSizer(sizer_text_release_note); + + auto height = 0; + for (auto text : texts) { + auto label_item = new Label(m_vebview_release_note, text.text, LB_AUTO_WRAP); + if (text.level == ConfirmBeforeSendInfo::InfoLevel::Warning) { + label_item->SetForegroundColour(wxColour(0xFF, 0x6F, 0x00)); + } + label_item->SetMaxSize(wxSize(FromDIP(380), -1)); + label_item->SetMinSize(wxSize(FromDIP(380), -1)); + label_item->Wrap(FromDIP(380)); + label_item->Layout(); + sizer_text_release_note->Add(label_item, 0, wxALIGN_CENTER | wxALL, FromDIP(3)); + height += label_item->GetSize().y; + } + + m_vebview_release_note->Layout(); + if (height < FromDIP(380)) + m_vebview_release_note->SetMinSize(wxSize(FromDIP(400), height + FromDIP(25))); + else { + m_vebview_release_note->SetMinSize(wxSize(FromDIP(400), FromDIP(380))); } Layout(); @@ -1046,12 +1076,28 @@ void ConfirmBeforeSendDialog::on_dpi_changed(const wxRect& suggested_rect) rescale(); } -void ConfirmBeforeSendDialog::show_update_nozzle_button() +void ConfirmBeforeSendDialog::show_update_nozzle_button(bool show) { - m_button_update_nozzle->Show(true); + m_button_update_nozzle->Show(show); Layout(); } +void ConfirmBeforeSendDialog::disable_button_ok() +{ + m_button_ok->Disable(); + m_button_ok->SetBackgroundColor(wxColour(0x90, 0x90, 0x90)); + m_button_ok->SetBorderColor(wxColour(0x90, 0x90, 0x90)); +} + +void ConfirmBeforeSendDialog::enable_button_ok() +{ + m_button_ok->Enable(); + StateColor btn_bg_green(std::pair(wxColour(61, 203, 115), StateColor::Pressed), std::pair(wxColour(61, 203, 115), StateColor::Hovered), + std::pair(AMS_CONTROL_BRAND_COLOUR, StateColor::Normal)); + m_button_ok->SetBackgroundColor(btn_bg_green); + m_button_ok->SetBorderColor(btn_bg_green); +} + void ConfirmBeforeSendDialog::rescale() { m_button_ok->Rescale(); diff --git a/src/slic3r/GUI/ReleaseNote.hpp b/src/slic3r/GUI/ReleaseNote.hpp index 0f535a121..203455e00 100644 --- a/src/slic3r/GUI/ReleaseNote.hpp +++ b/src/slic3r/GUI/ReleaseNote.hpp @@ -157,6 +157,18 @@ public: std::string show_again_config_text = ""; }; + +struct ConfirmBeforeSendInfo +{ + enum InfoLevel { + Normal = 0, + Warning = 1 + }; + InfoLevel level; + wxString text; + ConfirmBeforeSendInfo(wxString txt, InfoLevel lev = Normal) : text(txt), level(lev) {} +}; + class ConfirmBeforeSendDialog : public DPIDialog { public: @@ -176,12 +188,15 @@ public: bool not_show_again_check = false ); void update_text(wxString text); + void update_text(std::vector texts); void on_show(); void on_hide(); void update_btn_label(wxString ok_btn_text, wxString cancel_btn_text); void rescale(); void on_dpi_changed(const wxRect& suggested_rect); - void show_update_nozzle_button(); + void show_update_nozzle_button(bool show = false); + void disable_button_ok(); + void enable_button_ok(); wxString format_text(wxString str, int warp); ~ConfirmBeforeSendDialog(); diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index b3a450659..508972436 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -2376,7 +2376,7 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event) { bool has_slice_warnings = false; - bool has_update_nozzle = false; + bool is_printing_block = false; DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager(); if (!dev) return; @@ -2384,14 +2384,13 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event) if (!obj_) return; - std::vector confirm_text; - confirm_text.push_back(_L("Please check the following:") + "\n\n"); + std::vector confirm_text; + confirm_text.push_back(ConfirmBeforeSendInfo(_L("Please check the following:"))); //Check Printer Model Id bool is_same_printer_type = is_same_printer_model(); if (!is_same_printer_type && (m_print_type == PrintFromType::FROM_NORMAL)) { - confirm_text.push_back(_L("The printer type selected when generating G-Code is not consistent with the currently selected printer. It is recommended that you use the same printer type for slicing.") + "\n"); - + confirm_text.push_back(ConfirmBeforeSendInfo(_L("The printer type selected when generating G-Code is not consistent with the currently selected printer. It is recommended that you use the same printer type for slicing."))); has_slice_warnings = true; } @@ -2419,7 +2418,7 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event) if (in_blacklist && action == "warning") { wxString prohibited_error = wxString::FromUTF8(info); - confirm_text.push_back(prohibited_error + "\n"); + confirm_text.push_back(ConfirmBeforeSendInfo(prohibited_error)); has_slice_warnings = true; } } @@ -2435,20 +2434,20 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event) } else if (warning.msg == NOT_SUPPORT_TRADITIONAL_TIMELAPSE) { if (obj_->get_printer_arch() == PrinterArch::ARCH_I3 && m_checkbox_list["timelapse"]->GetValue()) { - confirm_text.push_back(Plater::get_slice_warning_string(warning) + "\n"); + confirm_text.push_back(ConfirmBeforeSendInfo(Plater::get_slice_warning_string(warning))); has_slice_warnings = true; } } else if (warning.msg == NOT_GENERATE_TIMELAPSE) { continue; } - else { + else if(warning.msg == NOZZLE_HRC_CHECKER){ wxString error_info = Plater::get_slice_warning_string(warning); if (error_info.IsEmpty()) { error_info = wxString::Format("%s\n", warning.msg); - confirm_text.push_back(error_info + "\n"); - } else - confirm_text.push_back(error_info + "\n"); + } + + confirm_text.push_back(ConfirmBeforeSendInfo(error_info)); has_slice_warnings = true; } } @@ -2506,7 +2505,7 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event) if (has_unknown_filament) { has_slice_warnings = true; - confirm_text.push_back(_L("There are some unknown filaments in the AMS mappings. Please check whether they are the required filaments. If they are okay, press \"Confirm\" to start printing.") + "\n"); + confirm_text.push_back(ConfirmBeforeSendInfo(_L("There are some unknown filaments in the AMS mappings. Please check whether they are the required filaments. If they are okay, press \"Confirm\" to start printing."))); } std::string nozzle_diameter; @@ -2516,23 +2515,24 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event) if (!obj_->nozzle_type.empty() && (m_print_type == PrintFromType::FROM_NORMAL)) { if (!is_same_nozzle_diameters(tag_nozzle_type, nozzle_diameter)) { has_slice_warnings = true; - has_update_nozzle = true; + is_printing_block = true; wxString nozzle_in_preset = wxString::Format(_L("nozzle in preset: %s %s"),nozzle_diameter, ""); wxString nozzle_in_printer = wxString::Format(_L("nozzle memorized: %.1f %s"), obj_->nozzle_diameter, ""); - confirm_text.push_back(_L("Your nozzle diameter in preset is not consistent with memorized nozzle diameter. Did you change your nozzle lately?") + confirm_text.push_back(ConfirmBeforeSendInfo(_L("Your nozzle diameter in sliced file is not consistent with memorized nozzle. If you changed your nozzle lately, please go to Device > Printer Parts to change settings.") + "\n " + nozzle_in_preset + "\n " + nozzle_in_printer - + "\n"); + + "\n", ConfirmBeforeSendInfo::InfoLevel::Warning)); } - else if (!is_same_nozzle_type(filament_type, tag_nozzle_type)){ + + if (!is_same_nozzle_type(filament_type, tag_nozzle_type)){ has_slice_warnings = true; - has_update_nozzle = true; + is_printing_block = true; nozzle_diameter = wxString::Format("%.1f", obj_->nozzle_diameter).ToStdString(); - wxString nozzle_in_preset = wxString::Format(_L("*Printing %s material with %s may cause nozzle damage"), filament_type, format_steel_name(obj_->nozzle_type)); - confirm_text.push_back(nozzle_in_preset + "\n"); + wxString nozzle_in_preset = wxString::Format(_L("Printing high temperature material(%s material) with %s may cause nozzle damage"), filament_type, format_steel_name(obj_->nozzle_type)); + confirm_text.push_back(ConfirmBeforeSendInfo(nozzle_in_preset, ConfirmBeforeSendInfo::InfoLevel::Warning)); } } @@ -2541,7 +2541,13 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event) wxString confirm_title = _L("Warning"); ConfirmBeforeSendDialog confirm_dlg(this, wxID_ANY, confirm_title); - if(has_update_nozzle){confirm_dlg.show_update_nozzle_button();} + if(is_printing_block){ + confirm_dlg.disable_button_ok(); + confirm_text.push_back(ConfirmBeforeSendInfo(_L("Please fix the error above, otherwise printing cannot continue."), ConfirmBeforeSendInfo::InfoLevel::Warning)); + } + else { + confirm_text.push_back(ConfirmBeforeSendInfo(_L("Please click the confirm button if you still want to proceed with printing."))); + } confirm_dlg.Bind(EVT_SECONDARY_CHECK_CONFIRM, [this, &confirm_dlg](wxCommandEvent& e) { confirm_dlg.on_hide(); @@ -2553,34 +2559,34 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event) } }); - confirm_dlg.Bind(EVT_UPDATE_NOZZLE, [this, obj_, tag_nozzle_type, nozzle_diameter, &confirm_dlg](wxCommandEvent& e) { - if (obj_ && !tag_nozzle_type.empty() && !nozzle_diameter.empty()) { - try - { - float diameter = std::stof(nozzle_diameter); - diameter = round(diameter * 10) / 10; - obj_->command_set_printer_nozzle(tag_nozzle_type, diameter); - } - catch (...) {} - } - }); + //confirm_dlg.Bind(EVT_UPDATE_NOZZLE, [this, obj_, tag_nozzle_type, nozzle_diameter, &confirm_dlg](wxCommandEvent& e) { + // if (obj_ && !tag_nozzle_type.empty() && !nozzle_diameter.empty()) { + // try + // { + // float diameter = std::stof(nozzle_diameter); + // diameter = round(diameter * 10) / 10; + // obj_->command_set_printer_nozzle(tag_nozzle_type, diameter); + // } + // catch (...) {} + // } + // }); - confirm_text.push_back(_L("Please click the confirm button if you still want to proceed with printing.") + "\n"); + wxString info_msg = wxEmptyString; for (auto i = 0; i < confirm_text.size(); i++) { if (i == 0) { - info_msg += confirm_text[i]; + //info_msg += confirm_text[i]; } else if (i == confirm_text.size() - 1) { - info_msg += confirm_text[i]; + //info_msg += confirm_text[i]; } else { - info_msg += wxString::Format("%d. %s\n",i, confirm_text[i]); + confirm_text[i].text = wxString::Format("%d. %s",i, confirm_text[i].text); } } - confirm_dlg.update_text(info_msg); + confirm_dlg.update_text(confirm_text); confirm_dlg.on_show(); } else { diff --git a/src/slic3r/GUI/StatusPanel.cpp b/src/slic3r/GUI/StatusPanel.cpp index f8e56b4cb..289508484 100644 --- a/src/slic3r/GUI/StatusPanel.cpp +++ b/src/slic3r/GUI/StatusPanel.cpp @@ -1017,6 +1017,13 @@ wxBoxSizer *StatusBasePanel::create_machine_control_page(wxWindow *parent) std::pair(wxColour(61, 203, 115), StateColor::Hovered), std::pair(AMS_CONTROL_BRAND_COLOUR, StateColor::Normal)); StateColor btn_bd_green(std::pair(AMS_CONTROL_WHITE_COLOUR, StateColor::Disabled), std::pair(AMS_CONTROL_BRAND_COLOUR, StateColor::Enabled)); + m_parts_btn = new Button(m_panel_control_title, _L("Printer Parts")); + m_parts_btn->SetBackgroundColor(btn_bg_green); + m_parts_btn->SetBorderColor(btn_bd_green); + m_parts_btn->SetTextColor(wxColour("#FFFFFE")); + m_parts_btn->SetSize(wxSize(FromDIP(128), FromDIP(26))); + m_parts_btn->SetMinSize(wxSize(-1, FromDIP(26))); + m_options_btn = new Button(m_panel_control_title, _L("Print Options")); m_options_btn->SetBackgroundColor(btn_bg_green); m_options_btn->SetBorderColor(btn_bd_green); @@ -1034,6 +1041,7 @@ wxBoxSizer *StatusBasePanel::create_machine_control_page(wxWindow *parent) bSizer_control_title->Add(m_staticText_control, 1, wxALIGN_CENTER_VERTICAL | wxLEFT, PAGE_TITLE_LEFT_MARGIN); bSizer_control_title->Add(0, 0, 1, wxEXPAND, 0); + bSizer_control_title->Add(m_parts_btn, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, FromDIP(10)); bSizer_control_title->Add(m_options_btn, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, FromDIP(10)); bSizer_control_title->Add(m_calibration_btn, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, FromDIP(10)); @@ -1696,6 +1704,7 @@ StatusPanel::StatusPanel(wxWindow *parent, wxWindowID id, const wxPoint &pos, co m_switch_speed->Connect(wxEVT_LEFT_DOWN, wxCommandEventHandler(StatusPanel::on_switch_speed), NULL, this); m_calibration_btn->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_start_calibration), NULL, this); m_options_btn->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_show_print_options), NULL, this); + m_parts_btn->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_show_parts_options), NULL, this); } StatusPanel::~StatusPanel() @@ -1728,6 +1737,7 @@ StatusPanel::~StatusPanel() m_switch_speed->Disconnect(wxEVT_LEFT_DOWN, wxCommandEventHandler(StatusPanel::on_switch_speed), NULL, this); m_calibration_btn->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_start_calibration), NULL, this); m_options_btn->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_show_print_options), NULL, this); + m_parts_btn->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_show_parts_options), NULL, this); m_button_unload->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(StatusPanel::on_start_unload), NULL, this); // remove warning dialogs @@ -2011,6 +2021,8 @@ void StatusPanel::update(MachineObject *obj) m_options_btn->Hide(); } + m_parts_btn->Show(); + //support edit chamber temp if (obj->is_support_chamber_edit) { m_tempCtrl_chamber->SetReadOnly(false); @@ -3965,7 +3977,8 @@ void StatusPanel::on_xyz_abs(wxCommandEvent &event) if (obj) obj->command_xyz_abs(); } -void StatusPanel::on_show_print_options(wxCommandEvent &event) + +void StatusPanel::on_show_print_options(wxCommandEvent& event) { if (obj) { if (print_options_dlg == nullptr) { @@ -3980,6 +3993,22 @@ void StatusPanel::on_show_print_options(wxCommandEvent &event) } } + +void StatusPanel::on_show_parts_options(wxCommandEvent &event) +{ + if (obj) { + if (print_parts_dlg == nullptr) { + print_parts_dlg = new PrinterPartsDialog(this); + print_parts_dlg->update_machine_obj(obj); + print_parts_dlg->ShowModal(); + } + else { + print_parts_dlg->update_machine_obj(obj); + print_parts_dlg->ShowModal(); + } + } +} + void StatusPanel::on_start_calibration(wxCommandEvent &event) { if (obj) { @@ -4033,6 +4062,7 @@ void StatusPanel::set_default() m_setting_button->Show(); m_tempCtrl_chamber->Show(); m_options_btn->Show(); + m_parts_btn->Show(); reset_temp_misc_control(); m_ams_control->Hide(); @@ -4055,11 +4085,13 @@ void StatusPanel::show_status(int status) show_printing_status(false, false); m_calibration_btn->Disable(); m_options_btn->Disable(); + m_parts_btn->Disable(); m_panel_monitoring_title->Disable(); } else if ((status & (int) MonitorStatus::MONITOR_NORMAL) != 0) { show_printing_status(true, true); m_calibration_btn->Disable(); m_options_btn->Enable(); + m_parts_btn->Enable(); m_panel_monitoring_title->Enable(); } } @@ -4184,7 +4216,10 @@ void StatusPanel::msw_rescale() m_calibration_btn->Rescale(); m_options_btn->SetMinSize(wxSize(-1, FromDIP(26))); - m_options_btn->Rescale(); + m_options_btn->Rescale(); + + m_parts_btn->SetMinSize(wxSize(-1, FromDIP(26))); + m_parts_btn->Rescale(); rescale_camera_icons(); diff --git a/src/slic3r/GUI/StatusPanel.hpp b/src/slic3r/GUI/StatusPanel.hpp index 9d77ec41f..289052b69 100644 --- a/src/slic3r/GUI/StatusPanel.hpp +++ b/src/slic3r/GUI/StatusPanel.hpp @@ -388,6 +388,7 @@ protected: wxStaticText* m_staticText_calibration_caption; wxStaticText* m_staticText_calibration_caption_top; wxStaticText* m_calibration_text; + Button* m_parts_btn; Button* m_options_btn; Button* m_calibration_btn; StepIndicator* m_calibration_flow; @@ -454,6 +455,7 @@ protected: std::shared_ptr m_camera_popup; std::set rated_model_id; AMSSetting *m_ams_setting_dlg{nullptr}; + PrinterPartsDialog* print_parts_dlg { nullptr }; PrintOptionsDialog* print_options_dlg { nullptr }; CalibrationDialog* calibration_dlg {nullptr}; AMSMaterialsSetting *m_filament_setting_dlg{nullptr}; @@ -568,6 +570,7 @@ protected: void on_auto_leveling(wxCommandEvent &event); void on_xyz_abs(wxCommandEvent &event); + void on_show_parts_options(wxCommandEvent& event); /* print options */ void on_show_print_options(wxCommandEvent &event);