From 7c5dee1eda14fb7a06cf65f9d5c337dc6eecea57 Mon Sep 17 00:00:00 2001 From: "zhimin.zeng" Date: Tue, 5 Nov 2024 20:14:57 +0800 Subject: [PATCH] ENH: support auto pa cali for multi_extruder printer jira: none Change-Id: I835a0e20de81f9af7c40983e00bdb37ea6c95a68 (cherry picked from commit 4e387d4ace4332a7c2b6c0ab695b80a51597d0c7) --- src/libslic3r/calib.hpp | 1 + src/slic3r/GUI/AMSMaterialsSetting.cpp | 12 + src/slic3r/GUI/CaliHistoryDialog.cpp | 1 + src/slic3r/GUI/CalibrationWizardSavePage.cpp | 261 +++++++++++++++++-- src/slic3r/GUI/CalibrationWizardSavePage.hpp | 5 +- src/slic3r/GUI/DeviceManager.cpp | 47 +++- src/slic3r/GUI/Widgets/Label.cpp | 6 +- src/slic3r/GUI/Widgets/Label.hpp | 4 +- src/slic3r/Utils/CalibUtils.cpp | 10 + src/slic3r/Utils/CalibUtils.hpp | 1 + 10 files changed, 322 insertions(+), 26 deletions(-) diff --git a/src/libslic3r/calib.hpp b/src/libslic3r/calib.hpp index e862cf7b5c..b0cea42410 100644 --- a/src/libslic3r/calib.hpp +++ b/src/libslic3r/calib.hpp @@ -140,6 +140,7 @@ struct PACalibExtruderInfo NozzleVolumeType nozzle_volume_type; float nozzle_diameter; std::string filament_id = ""; + bool use_nozzle_volume_type{true}; }; struct PACalibTabInfo diff --git a/src/slic3r/GUI/AMSMaterialsSetting.cpp b/src/slic3r/GUI/AMSMaterialsSetting.cpp index 5b22114fde..f7028c42c6 100644 --- a/src/slic3r/GUI/AMSMaterialsSetting.cpp +++ b/src/slic3r/GUI/AMSMaterialsSetting.cpp @@ -1155,6 +1155,15 @@ void AMSMaterialsSetting::on_select_filament(wxCommandEvent &evt) m_pa_profile_items.clear(); m_comboBox_cali_result->SetValue(wxEmptyString); + int extruder_id = obj->get_extruder_id_by_ams_id(std::to_string(ams_id)); + NozzleVolumeType nozzle_volume_type = NozzleVolumeType::nvtNormal; + if (obj->m_extder_data.extders[extruder_id].current_nozzle_flow_type == NozzleFlowType::NONE_FLOWTYPE) { + MessageDialog dlg(nullptr, _L("There are unset nozzle types. Please set the nozzle types of all extruders before synchronizing."), _L("Warning"), wxICON_WARNING | wxOK); + dlg.ShowModal(); + } + else { + nozzle_volume_type = NozzleVolumeType(obj->m_extder_data.extders[extruder_id].current_nozzle_flow_type - 1); + } if (obj->cali_version >= 0) { // add default item PACalibResult default_item; @@ -1169,6 +1178,9 @@ void AMSMaterialsSetting::on_select_filament(wxCommandEvent &evt) std::vector cali_history = this->obj->pa_calib_tab; for (auto cali_item : cali_history) { if (cali_item.filament_id == ams_filament_id) { + if (obj->is_multi_extruders() && (cali_item.extruder_id != extruder_id || cali_item.nozzle_volume_type != nozzle_volume_type)) { + continue; + } items.push_back(from_u8(cali_item.name)); m_pa_profile_items.push_back(cali_item); } diff --git a/src/slic3r/GUI/CaliHistoryDialog.cpp b/src/slic3r/GUI/CaliHistoryDialog.cpp index 9c344338b9..22f84e43e0 100644 --- a/src/slic3r/GUI/CaliHistoryDialog.cpp +++ b/src/slic3r/GUI/CaliHistoryDialog.cpp @@ -232,6 +232,7 @@ void HistoryWindow::reqeust_history_result(MachineObject* obj) if (nozzle_value > 0) { PACalibExtruderInfo cali_info; cali_info.nozzle_diameter = nozzle_value; + cali_info.use_nozzle_volume_type = false; CalibUtils::emit_get_PA_calib_infos(cali_info); m_tips->SetLabel(_L("Refreshing the historical Flow Dynamics Calibration records")); BOOST_LOG_TRIVIAL(info) << "request calib history"; diff --git a/src/slic3r/GUI/CalibrationWizardSavePage.cpp b/src/slic3r/GUI/CalibrationWizardSavePage.cpp index 4d9fb67a5e..3f524e1d30 100644 --- a/src/slic3r/GUI/CalibrationWizardSavePage.cpp +++ b/src/slic3r/GUI/CalibrationWizardSavePage.cpp @@ -6,6 +6,8 @@ namespace Slic3r { namespace GUI { +#define CALIBRATION_SAVE_AMS_NAME_SIZE wxSize(FromDIP(20), FromDIP(24)) +#define CALIBRATION_SAVE_NUMBER_INPUT_SIZE wxSize(FromDIP(100), FromDIP(24)) #define CALIBRATION_SAVE_INPUT_SIZE wxSize(FromDIP(240), FromDIP(24)) #define FLOW_RATE_MAX_VALUE 1.15 @@ -56,7 +58,7 @@ static wxString get_default_name(wxString filament_name, CalibMode mode){ return filament_name; } -static wxString get_tray_name_by_tray_id(int tray_id) +static wxString get_tray_name_by_tray_id(int tray_id) { wxString tray_name; if (tray_id == VIRTUAL_TRAY_ID) { @@ -125,14 +127,14 @@ CaliPASaveAutoPanel::CaliPASaveAutoPanel( const wxPoint& pos, const wxSize& size, long style) - : wxPanel(parent, id, pos, size, style) + : wxPanel(parent, id, pos, size, style) { SetBackgroundColour(*wxWHITE); m_top_sizer = new wxBoxSizer(wxVERTICAL); - + create_panel(this); - + this->SetSizer(m_top_sizer); m_top_sizer->Fit(this); } @@ -200,6 +202,11 @@ std::vector> CaliPASaveAutoPanel::default_naming(std void CaliPASaveAutoPanel::sync_cali_result(const std::vector& cali_result, const std::vector& history_result) { + if (m_obj && m_obj->is_multi_extruders()) { + sync_cali_result_for_multi_extruder(cali_result, history_result); + return; + } + m_history_results = history_result; m_calib_results.clear(); for (auto& item : cali_result) { @@ -391,7 +398,7 @@ void CaliPASaveAutoPanel::save_to_result_from_widgets(wxWindow* window, bool* ou } m_calib_results[tray_id].name = into_u8(name); } - + auto childern = window->GetChildren(); for (auto child : childern) { save_to_result_from_widgets(child, out_is_valid, out_msg); @@ -444,6 +451,230 @@ bool CaliPASaveAutoPanel::get_result(std::vector& out_result) { } } +void CaliPASaveAutoPanel::sync_cali_result_for_multi_extruder(const std::vector& cali_result, const std::vector& history_result) +{ + if (!m_obj) + return; + + m_is_all_failed = true; + bool part_failed = false; + if (cali_result.empty()) + part_failed = true; + + m_history_results = history_result; + m_calib_results.clear(); + for (auto &item : cali_result) { + if (item.confidence == 0) { + int tray_id = 4 * item.ams_id + item.slot_id; + m_calib_results[tray_id] = item; + } + } + m_grid_panel->DestroyChildren(); + auto grid_sizer = new wxBoxSizer(wxHORIZONTAL); + const int COLUMN_GAP = FromDIP(10); + const int ROW_GAP = FromDIP(10); + + wxStaticBoxSizer* left_sizer = new wxStaticBoxSizer(wxVERTICAL, m_grid_panel, "Left extruder"); + wxStaticBoxSizer* right_sizer = new wxStaticBoxSizer(wxVERTICAL, m_grid_panel, "Right extruder"); + grid_sizer->Add(left_sizer); + grid_sizer->AddSpacer(COLUMN_GAP); + grid_sizer->Add(right_sizer); + + wxFlexGridSizer *left_grid_sizer = new wxFlexGridSizer(3, COLUMN_GAP, ROW_GAP); + wxFlexGridSizer *right_grid_sizer = new wxFlexGridSizer(3, COLUMN_GAP, ROW_GAP); + left_sizer->Add(left_grid_sizer); + right_sizer->Add(right_grid_sizer); + + // main extruder + { + left_grid_sizer->Add(new wxStaticText(m_grid_panel, wxID_ANY, ""), 1, wxEXPAND); // fill empty space + + auto brand_title = new Label(m_grid_panel, _L("Name"), 0, CALIBRATION_SAVE_INPUT_SIZE); + brand_title->SetFont(Label::Head_14); + left_grid_sizer->Add(brand_title, 1, wxALIGN_CENTER); + + auto k_title = new Label(m_grid_panel, _L("Factor K"), 0, CALIBRATION_SAVE_NUMBER_INPUT_SIZE); + k_title->SetFont(Label::Head_14); + left_grid_sizer->Add(k_title, 1, wxALIGN_CENTER); + } + + // deputy extruder + { + right_grid_sizer->Add(new wxStaticText(m_grid_panel, wxID_ANY, ""), 1, wxEXPAND); // fill empty space + + auto brand_title = new Label(m_grid_panel, _L("Name"), 0, CALIBRATION_SAVE_INPUT_SIZE); + brand_title->SetFont(Label::Head_14); + right_grid_sizer->Add(brand_title, 1, wxALIGN_CENTER); + + auto k_title = new Label(m_grid_panel, _L("Factor K"), 0, CALIBRATION_SAVE_NUMBER_INPUT_SIZE); + k_title->SetFont(Label::Head_14); + right_grid_sizer->Add(k_title, 1, wxALIGN_CENTER); + } + + std::vector> preset_names; + for (auto &info : m_obj->selected_cali_preset) { + preset_names.push_back({info.tray_id, info.name}); + } + preset_names = default_naming(preset_names); + + bool left_first_add_item = true; + bool right_first_add_item = true; + for (auto &item : cali_result) { + bool result_failed = false; + if (item.confidence != 0) { + result_failed = true; + part_failed = true; + } else { + m_is_all_failed = false; + } + + //wxBoxSizer *item_data_sizer = new wxBoxSizer(wxHORIZONTAL); + auto tray_title = new Label(m_grid_panel, "", 0, CALIBRATION_SAVE_AMS_NAME_SIZE); + tray_title->SetFont(Label::Head_14); + wxString tray_name = get_tray_name_by_tray_id(item.tray_id); + tray_title->SetLabel(tray_name); + + auto k_value = new GridTextInput(m_grid_panel, "", "", CALIBRATION_SAVE_NUMBER_INPUT_SIZE, item.tray_id, GridTextInputType::K); + auto n_value = new GridTextInput(m_grid_panel, "", "", CALIBRATION_SAVE_NUMBER_INPUT_SIZE, item.tray_id, GridTextInputType::N); + k_value->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC)); + n_value->GetTextCtrl()->SetValidator(wxTextValidator(wxFILTER_NUMERIC)); + auto k_value_failed = new Label(m_grid_panel, _L("Failed")); + auto n_value_failed = new Label(m_grid_panel, _L("Failed")); + + auto comboBox_tray_name = new GridComboBox(m_grid_panel, CALIBRATION_SAVE_INPUT_SIZE, item.tray_id); + auto tray_name_failed = new Label(m_grid_panel, " - "); + wxArrayString selections; + static std::vector filtered_results; + filtered_results.clear(); + for (auto history : history_result) { + if (history.filament_id == item.filament_id + && history.extruder_id == item.extruder_id + && history.nozzle_volume_type == item.nozzle_volume_type + && history.nozzle_diameter == item.nozzle_diameter) { + filtered_results.push_back(history); + selections.push_back(from_u8(history.name)); + } + } + comboBox_tray_name->Set(selections); + + auto set_edit_mode = [this, k_value, n_value, k_value_failed, n_value_failed, comboBox_tray_name, tray_name_failed](std::string str) { + if (str == "normal") { + comboBox_tray_name->Show(); + tray_name_failed->Show(false); + k_value->Show(); + n_value->Show(); + k_value_failed->Show(false); + n_value_failed->Show(false); + } + if (str == "failed") { + comboBox_tray_name->Show(false); + tray_name_failed->Show(); + k_value->Show(false); + n_value->Show(false); + k_value_failed->Show(); + n_value_failed->Show(); + } + + // hide n value + n_value->Hide(); + n_value_failed->Hide(); + + m_grid_panel->Layout(); + m_grid_panel->Update(); + }; + + if (!result_failed) { + set_edit_mode("normal"); + + auto k_str = wxString::Format("%.3f", item.k_value); + auto n_str = wxString::Format("%.3f", item.n_coef); + k_value->GetTextCtrl()->SetValue(k_str); + n_value->GetTextCtrl()->SetValue(n_str); + + for (auto &name : preset_names) { + if (item.tray_id == name.first) { comboBox_tray_name->SetValue(from_u8(name.second)); } + } + + comboBox_tray_name->Bind(wxEVT_COMBOBOX, [this, comboBox_tray_name, k_value, n_value](auto &e) { + int selection = comboBox_tray_name->GetSelection(); + auto history = filtered_results[selection]; + }); + } else { + set_edit_mode("failed"); + } + + if ((m_obj->is_main_extruder_on_left() && item.extruder_id == 0) + || (!m_obj->is_main_extruder_on_left() && item.extruder_id == 1)) { + if (left_first_add_item) { + wxString title_name = left_sizer->GetStaticBox()->GetLabel(); + title_name += " - "; + title_name += get_nozzle_volume_type_name(item.nozzle_volume_type); + left_sizer->GetStaticBox()->SetLabel(title_name); + left_first_add_item = false; + } + + left_grid_sizer->Add(tray_title, 1, wxEXPAND); + + if (comboBox_tray_name->IsShown()) { + left_grid_sizer->Add(comboBox_tray_name, 1, wxEXPAND); + } else { + left_grid_sizer->Add(tray_name_failed, 1, wxEXPAND); + } + + if (k_value->IsShown()) { + left_grid_sizer->Add(k_value, 1, wxEXPAND); + } else { + left_grid_sizer->Add(k_value_failed, 1, wxEXPAND); + } + } + else { + if (right_first_add_item) { + wxString title_name = right_sizer->GetStaticBox()->GetLabel(); + title_name += " - "; + title_name += get_nozzle_volume_type_name(item.nozzle_volume_type); + right_sizer->GetStaticBox()->SetLabel(title_name); + right_first_add_item = false; + } + right_grid_sizer->Add(tray_title, 1, wxEXPAND); + + if (comboBox_tray_name->IsShown()) { + right_grid_sizer->Add(comboBox_tray_name, 1, wxEXPAND); + } else { + right_grid_sizer->Add(tray_name_failed, 1, wxEXPAND); + } + + if (k_value->IsShown()) { + right_grid_sizer->Add(k_value, 1, wxEXPAND); + } else { + right_grid_sizer->Add(k_value_failed, 1, wxEXPAND); + } + } + } + + if (left_first_add_item) + left_sizer->Show(false); + if (right_first_add_item) + right_sizer->Show(false); + + m_grid_panel->SetSizer(grid_sizer, true); + m_grid_panel->Bind(wxEVT_LEFT_DOWN, [this](auto &e) { SetFocusIgnoringChildren(); }); + + if (part_failed) { + m_part_failed_panel->Show(); + m_complete_text_panel->Show(); + if (m_is_all_failed) { + m_complete_text_panel->Hide(); + } + } else { + m_complete_text_panel->Show(); + m_part_failed_panel->Hide(); + } + + wxGetApp().UpdateDarkUIWin(this); + + Layout(); +} + CaliPASaveManualPanel::CaliPASaveManualPanel( wxWindow* parent, wxWindowID id, @@ -521,7 +752,7 @@ void CaliPASaveManualPanel::create_panel(wxWindow* parent) } void CaliPASaveManualPanel::set_save_img() { - if (wxGetApp().app_config->get_language_code() == "zh-cn") { + if (wxGetApp().app_config->get_language_code() == "zh-cn") { m_picture_panel->set_bmp(ScalableBitmap(this, "fd_calibration_manual_result_CN", 330)); } else { m_picture_panel->set_bmp(ScalableBitmap(this, "fd_calibration_manual_result", 330)); @@ -778,19 +1009,19 @@ void CaliSavePresetValuePanel::set_save_name_title(const wxString& title) { m_save_name_title->SetLabel(title); } -void CaliSavePresetValuePanel::get_value(double& value) -{ - m_input_value->GetTextCtrl()->GetValue().ToDouble(&value); +void CaliSavePresetValuePanel::get_value(double& value) +{ + m_input_value->GetTextCtrl()->GetValue().ToDouble(&value); } void CaliSavePresetValuePanel::get_save_name(std::string& name) -{ - name = into_u8(m_input_name->GetTextCtrl()->GetValue()); +{ + name = into_u8(m_input_name->GetTextCtrl()->GetValue()); } void CaliSavePresetValuePanel::set_save_name(const std::string& name) -{ - m_input_name->GetTextCtrl()->SetValue(name); +{ + m_input_name->GetTextCtrl()->SetValue(name); } void CaliSavePresetValuePanel::msw_rescale() @@ -1307,7 +1538,7 @@ void CalibrationFlowCoarseSavePage::create_page(wxWindow* parent) } void CalibrationFlowCoarseSavePage::set_save_img() { - if (wxGetApp().app_config->get_language_code() == "zh-cn") { + if (wxGetApp().app_config->get_language_code() == "zh-cn") { m_picture_panel->set_bmp(ScalableBitmap(this, "flow_rate_calibration_coarse_result_CN", 350)); } else { m_picture_panel->set_bmp(ScalableBitmap(this, "flow_rate_calibration_coarse_result", 350)); @@ -1491,7 +1722,7 @@ void CalibrationFlowFineSavePage::create_page(wxWindow* parent) } void CalibrationFlowFineSavePage::set_save_img() { - if (wxGetApp().app_config->get_language_code() == "zh-cn") { + if (wxGetApp().app_config->get_language_code() == "zh-cn") { m_picture_panel->set_bmp(ScalableBitmap(this, "flow_rate_calibration_fine_result_CN", 350)); } else { m_picture_panel->set_bmp(ScalableBitmap(this, "flow_rate_calibration_fine_result", 350)); diff --git a/src/slic3r/GUI/CalibrationWizardSavePage.hpp b/src/slic3r/GUI/CalibrationWizardSavePage.hpp index 6b76b22acb..aa63a75a18 100644 --- a/src/slic3r/GUI/CalibrationWizardSavePage.hpp +++ b/src/slic3r/GUI/CalibrationWizardSavePage.hpp @@ -98,6 +98,9 @@ public: bool get_result(std::vector& out_result); bool is_all_failed() { return m_is_all_failed; } +protected: + void sync_cali_result_for_multi_extruder(const std::vector &cali_result, const std::vector &history_result); + protected: wxBoxSizer* m_top_sizer; wxPanel* m_complete_text_panel; @@ -218,7 +221,7 @@ public: bool is_all_failed() { return m_is_all_failed; } virtual bool Show(bool show = true) override; - + void msw_rescale() override; protected: diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index 6e0dd4dc88..addf5771b6 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -194,6 +194,41 @@ void split_string(std::string s, std::vector& v) { v.push_back(t); } +wxString generate_nozzle_id(NozzleVolumeType nozzle_type, const std::string& diameter) +{ + // HS00-0.4 + std::string nozzle_id = "H"; + switch (nozzle_type) { + case NozzleVolumeType::nvtNormal: { + nozzle_id += "S"; + break; + } + case NozzleVolumeType::nvtBigTraffic: { + nozzle_id += "H"; + break; + } + default: break; + } + nozzle_id += "00"; + nozzle_id += "-"; + nozzle_id += diameter; + return nozzle_id; +} + +NozzleVolumeType convert_to_nozzle_type(const std::string &str) +{ + if (str.size() < 8) { + assert(false); + return NozzleVolumeType::nvtNormal; + } + NozzleVolumeType res = NozzleVolumeType::nvtNormal; + if (str[1] == 'S') + res = NozzleVolumeType::nvtNormal; + else if (str[1] == 'H') + res = NozzleVolumeType::nvtBigTraffic; + return res; +} + PrinterArch get_printer_arch_by_str(std::string arch_str) { if (arch_str == "i3") { @@ -2159,8 +2194,8 @@ int MachineObject::command_start_pa_calibration(const X1CCalibInfos &pa_data, in j["print"]["filaments"][i]["nozzle_temp"] = pa_data.calib_datas[i].nozzle_temp; j["print"]["filaments"][i]["ams_id"] = pa_data.calib_datas[i].ams_id; j["print"]["filaments"][i]["slot_id"] = pa_data.calib_datas[i].slot_id; - j["print"]["filaments"][i]["nozzle_volume_type"] = int(pa_data.calib_datas[i].nozzle_volume_type); - j["print"]["filaments"][i]["nozzle_diameter"] = pa_data.calib_datas[i].nozzle_diameter; + j["print"]["filaments"][i]["nozzle_id"] = generate_nozzle_id(pa_data.calib_datas[i].nozzle_volume_type,to_string_nozzle_diameter(pa_data.calib_datas[i].nozzle_diameter)).ToStdString(); + j["print"]["filaments"][i]["nozzle_diameter"] = to_string_nozzle_diameter(pa_data.calib_datas[i].nozzle_diameter); j["print"]["filaments"][i]["max_volumetric_speed"] = std::to_string(pa_data.calib_datas[i].max_volumetric_speed); if (i > 0) filament_ids += ","; @@ -2199,7 +2234,8 @@ int MachineObject::command_set_pa_calibration(const std::vector & j["print"]["filaments"][i]["cali_idx"] = pa_calib_values[i].cali_idx; j["print"]["filaments"][i]["tray_id"] = pa_calib_values[i].tray_id; j["print"]["filaments"][i]["extruder_id"] = pa_calib_values[i].extruder_id; - j["print"]["filaments"][i]["nozzle_volume_type"] = int(pa_calib_values[i].nozzle_volume_type); + j["print"]["filaments"][i]["nozzle_id"] = generate_nozzle_id(pa_calib_values[i].nozzle_volume_type, to_string_nozzle_diameter(pa_calib_values[i].nozzle_diameter)).ToStdString(); + j["print"]["filaments"][i]["nozzle_diameter"] = to_string_nozzle_diameter(pa_calib_values[i].nozzle_diameter); j["print"]["filaments"][i]["ams_id"] = pa_calib_values[i].ams_id; j["print"]["filaments"][i]["slot_id"] = pa_calib_values[i].slot_id; j["print"]["filaments"][i]["filament_id"] = pa_calib_values[i].filament_id; @@ -2225,7 +2261,7 @@ int MachineObject::command_delete_pa_calibration(const PACalibIndexInfo& pa_cali j["print"]["command"] = "extrusion_cali_del"; j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++); j["print"]["extruder_id"] = pa_calib.extruder_id; - j["print"]["nozzle_volume_type"] = int(pa_calib.nozzle_volume_type); + j["print"]["nozzle_id"] = generate_nozzle_id(pa_calib.nozzle_volume_type, to_string_nozzle_diameter(pa_calib.nozzle_diameter)).ToStdString(); j["print"]["filament_id"] = pa_calib.filament_id; j["print"]["cali_idx"] = pa_calib.cali_idx; j["print"]["nozzle_diameter"] = to_string_nozzle_diameter(pa_calib.nozzle_diameter); @@ -2243,7 +2279,8 @@ int MachineObject::command_get_pa_calibration_tab(const PACalibExtruderInfo &cal j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++); j["print"]["filament_id"] = calib_info.filament_id; j["print"]["extruder_id"] = calib_info.extruder_id; - j["print"]["nozzle_volume_type"] = int(calib_info.nozzle_volume_type); + if (calib_info.use_nozzle_volume_type) + j["print"]["nozzle_id"] = generate_nozzle_id(calib_info.nozzle_volume_type, to_string_nozzle_diameter(calib_info.nozzle_diameter)).ToStdString(); j["print"]["nozzle_diameter"] = to_string_nozzle_diameter(calib_info.nozzle_diameter); BOOST_LOG_TRIVIAL(trace) << "extrusion_cali_get: " << j.dump(); diff --git a/src/slic3r/GUI/Widgets/Label.cpp b/src/slic3r/GUI/Widgets/Label.cpp index 7482f3c618..5171c257ab 100644 --- a/src/slic3r/GUI/Widgets/Label.cpp +++ b/src/slic3r/GUI/Widgets/Label.cpp @@ -254,10 +254,10 @@ wxSize Label::split_lines(wxDC &dc, int width, const wxString &text, wxString &m return dc.GetMultiLineTextExtent(multiline_text); } -Label::Label(wxWindow *parent, wxString const &text, long style) : Label(parent, Body_14, text, style) {} +Label::Label(wxWindow *parent, wxString const &text, long style, wxSize size) : Label(parent, Body_14, text, style, size) {} -Label::Label(wxWindow *parent, wxFont const &font, wxString const &text, long style) - : wxStaticText(parent, wxID_ANY, text, wxDefaultPosition, wxDefaultSize, style) +Label::Label(wxWindow *parent, wxFont const &font, wxString const &text, long style, wxSize size) + : wxStaticText(parent, wxID_ANY, text, wxDefaultPosition, size, style) { this->m_font = font; this->m_text = text; diff --git a/src/slic3r/GUI/Widgets/Label.hpp b/src/slic3r/GUI/Widgets/Label.hpp index ea15128ec7..6c7809fea6 100644 --- a/src/slic3r/GUI/Widgets/Label.hpp +++ b/src/slic3r/GUI/Widgets/Label.hpp @@ -11,9 +11,9 @@ class Label : public wxStaticText { public: - Label(wxWindow *parent, wxString const &text = {}, long style = 0); + Label(wxWindow *parent, wxString const &text = {}, long style = 0, wxSize size = wxDefaultSize); - Label(wxWindow *parent, wxFont const &font, wxString const &text = {}, long style = 0); + Label(wxWindow *parent, wxFont const &font, wxString const &text = {}, long style = 0, wxSize size = wxDefaultSize); void SetLabel(const wxString& label) override; diff --git a/src/slic3r/Utils/CalibUtils.cpp b/src/slic3r/Utils/CalibUtils.cpp index 57c01077a1..830cf97477 100644 --- a/src/slic3r/Utils/CalibUtils.cpp +++ b/src/slic3r/Utils/CalibUtils.cpp @@ -35,6 +35,16 @@ static std::string MachineBedTypeString[7] = { }; +wxString get_nozzle_volume_type_name(NozzleVolumeType type) +{ + if (NozzleVolumeType::nvtNormal == type) { + return _L("Normal"); + } else if (NozzleVolumeType::nvtBigTraffic == type) { + return _L("BigTraffic"); + } + return wxString(); +} + std::string get_calib_mode_name(CalibMode cali_mode, int stage) { switch(cali_mode) { diff --git a/src/slic3r/Utils/CalibUtils.hpp b/src/slic3r/Utils/CalibUtils.hpp index c1137ae584..e3b6cedd52 100644 --- a/src/slic3r/Utils/CalibUtils.hpp +++ b/src/slic3r/Utils/CalibUtils.hpp @@ -78,5 +78,6 @@ private: static void send_to_print(const CalibInfo &calib_info, wxString& error_message, int flow_ratio_mode = 0); // 0: none 1: coarse 2: fine }; +extern wxString get_nozzle_volume_type_name(NozzleVolumeType type); } } \ No newline at end of file