diff --git a/src/slic3r/GUI/CreatePresetsDialog.cpp b/src/slic3r/GUI/CreatePresetsDialog.cpp index 994e1214a..5a8a3c6cc 100644 --- a/src/slic3r/GUI/CreatePresetsDialog.cpp +++ b/src/slic3r/GUI/CreatePresetsDialog.cpp @@ -518,6 +518,20 @@ static char* read_json_file(const std::string &preset_path) return json_contents; } +static std::string get_printer_nozzle_diameter(std::string printer_name) { + + size_t index = printer_name.find(" nozzle"); + if (std::string::npos == index) { + return ""; + } + std::string nozzle = printer_name.substr(0, index); + size_t last_space_index = nozzle.find_last_of(" "); + if (std::string::npos == index) { + return ""; + } + return nozzle.substr(last_space_index + 1); +} + static void adjust_dialog_in_screen(DPIDialog* dialog) { wxSize screen_size = wxGetDisplaySize(); int pos_x, pos_y, size_x, size_y, screen_width, screen_height, dialog_x, dialog_y; @@ -849,13 +863,13 @@ wxBoxSizer *CreateFilamentPresetDialog::create_filament_preset_item() continue; } for (std::string &compatible_printer_name : compatible_printers->values) { - if (m_visible_printers.find(compatible_printer_name) == m_visible_printers.end()) continue; - size_t index = compatible_printer_name.find("nozzle"); - if (index < 4) { - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " compatible printer name encounter exception and name is: " << compatible_printer_name; + if (m_visible_printers.find(compatible_printer_name) == m_visible_printers.end()) { + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "there is a comppatible printer no exist: " << compatible_printer_name + << "and the preset name is: " << preset->name; continue; } - if (nozzle_diameter[compatible_printer_name.substr(index - 4, 3)] == 0) { + std::string nozzle = get_printer_nozzle_diameter(compatible_printer_name); + if (nozzle_diameter[nozzle] == 0) { BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " compatible printer nozzle encounter exception and name is: " << compatible_printer_name; continue; } @@ -1114,10 +1128,14 @@ wxArrayString CreateFilamentPresetDialog::get_filament_preset_choices() for (std::pair filament_presets : m_all_presets_map) { Preset *preset = filament_presets.second; auto inherit = preset->config.option("inherits"); - if (inherit && !inherit->value.empty()) continue; + if (inherit && !inherit->value.empty()) { + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " inherit user preset is:" << preset->name << " and inherits is: " << inherit->value; + continue; + } auto fila_type = preset->config.option("filament_type"); if (!fila_type || fila_type->values.empty() || system_filament_types_map[type_name] != fila_type->values[0]) continue; m_filament_choice_map[preset->filament_id].push_back(preset); + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " base user preset is:" << preset->name; } int suffix = 0; @@ -1269,12 +1287,8 @@ void CreateFilamentPresetDialog::get_filament_presets_by_machine() BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " preset type is not selected type and preset name is: " << preset->name; continue; } - size_t index = compatible_printer_name.find("nozzle"); - if (index < 4) { - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " compatible printer name encounter exception and name is: " << compatible_printer_name; - continue; - } - if (nozzle_diameter[compatible_printer_name.substr(index - 4, 3)] == 0) { + std::string nozzle = get_printer_nozzle_diameter(compatible_printer_name); + if (nozzle_diameter[nozzle] == 0) { BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " compatible printer nozzle encounter exception and name is: " << compatible_printer_name; continue; } @@ -1360,14 +1374,18 @@ void CreateFilamentPresetDialog::sort_printer_by_nozzle(std::vector nozzle_diameter = nozzle_diameter_map; std::sort(printer_name_to_filament_preset.begin(), printer_name_to_filament_preset.end(), [&nozzle_diameter](const std::pair &a, const std::pair &b) { - size_t nozzle_index_a = a.first.find("nozzle"); - size_t nozzle_index_b = b.first.find("nozzle"); + size_t nozzle_index_a = a.first.find(" nozzle"); + size_t nozzle_index_b = b.first.find(" nozzle"); if (nozzle_index_a == std::string::npos || nozzle_index_b == std::string::npos) return a.first < b.first; std::string nozzle_str_a; std::string nozzle_str_b; try { - nozzle_str_a = a.first.substr(nozzle_index_a - 4, 3); - nozzle_str_b = b.first.substr(nozzle_index_b - 4, 3); + nozzle_str_a = a.first.substr(0, nozzle_index_a); + nozzle_str_b = b.first.substr(0, nozzle_index_b); + size_t last_space_index = nozzle_str_a.find_last_of(" "); + nozzle_str_a = nozzle_str_a.substr(last_space_index + 1); + last_space_index = nozzle_str_b.find_last_of(" "); + nozzle_str_b = nozzle_str_b.substr(last_space_index + 1); } catch (...) { BOOST_LOG_TRIVIAL(info) << "substr filed, and printer name is: " << a.first << " and " << b.first; return a.first < b.first; diff --git a/src/slic3r/GUI/StatusPanel.cpp b/src/slic3r/GUI/StatusPanel.cpp index f1fc6cc20..f6973b132 100644 --- a/src/slic3r/GUI/StatusPanel.cpp +++ b/src/slic3r/GUI/StatusPanel.cpp @@ -485,7 +485,7 @@ void PrintingTaskPanel::create_panel(wxWindow* parent) static_score_sizer->Add(static_score_text, 1, wxEXPAND | wxALL, FromDIP(10)); m_has_rated_prompt = new wxStaticText(m_score_subtask_info, wxID_ANY, _L("(The model has already been rated. Your rating will overwrite the previous rating.)"), wxDefaultPosition, wxDefaultSize, 0); m_has_rated_prompt->Wrap(-1); - m_has_rated_prompt->SetForegroundColour(*wxRED); + m_has_rated_prompt->SetForegroundColour(*wxBLACK); m_has_rated_prompt->SetFont(::Label::Body_10); m_has_rated_prompt->Hide();