diff --git a/bbl/i18n/BambuStudio.pot b/bbl/i18n/BambuStudio.pot index 42bb563e27e..e508e3646dc 100644 --- a/bbl/i18n/BambuStudio.pot +++ b/bbl/i18n/BambuStudio.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-22 18:39+0800\n" +"POT-Creation-Date: 2022-07-23 18:15+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -3225,7 +3225,9 @@ msgstr "" msgid "The printer is busy on other print job" msgstr "" -msgid "Printer firmware does not support material = >ams slot mapping." +msgid "" +"The filament index exceeds the AMS's slot count and cannot send the print " +"job." msgstr "" msgid "" @@ -3238,6 +3240,11 @@ msgid "" "sending the print job" msgstr "" +msgid "" +"The printer firmware only supports sequential mapping of filament => AMS " +"slot." +msgstr "" + msgid "Preparing print job" msgstr "" diff --git a/bbl/i18n/de/BambuStudio_de.po b/bbl/i18n/de/BambuStudio_de.po index 4ab95126d32..0abaa1cb636 100644 --- a/bbl/i18n/de/BambuStudio_de.po +++ b/bbl/i18n/de/BambuStudio_de.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: Bambu Studio\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-22 18:39+0800\n" +"POT-Creation-Date: 2022-07-23 18:15+0800\n" "PO-Revision-Date: \n" "Last-Translator: \n" "Language-Team: \n" @@ -3431,7 +3431,9 @@ msgstr "" msgid "The printer is busy on other print job" msgstr "The printer is busy with another print job." -msgid "Printer firmware does not support material = >ams slot mapping." +msgid "" +"The filament index exceeds the AMS's slot count and cannot send the print " +"job." msgstr "" msgid "" @@ -3448,6 +3450,11 @@ msgstr "" "Please click each filament above to specify its mapping AMS slot before " "sending the print job" +msgid "" +"The printer firmware only supports sequential mapping of filament => AMS " +"slot." +msgstr "" + msgid "Preparing print job" msgstr "Preparing print job" diff --git a/bbl/i18n/en/BambuStudio_en.po b/bbl/i18n/en/BambuStudio_en.po index 26900e11f51..3a313e16bd3 100644 --- a/bbl/i18n/en/BambuStudio_en.po +++ b/bbl/i18n/en/BambuStudio_en.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: Bambu Studio\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-22 18:39+0800\n" +"POT-Creation-Date: 2022-07-23 18:15+0800\n" "PO-Revision-Date: \n" "Last-Translator: \n" "Language-Team: \n" @@ -3371,7 +3371,9 @@ msgstr "" msgid "The printer is busy on other print job" msgstr "The printer is busy with another print job." -msgid "Printer firmware does not support material = >ams slot mapping." +msgid "" +"The filament index exceeds the AMS's slot count and cannot send the print " +"job." msgstr "" msgid "" @@ -3388,6 +3390,11 @@ msgstr "" "Please click each filament above to specify its mapping AMS slot before " "sending the print job" +msgid "" +"The printer firmware only supports sequential mapping of filament => AMS " +"slot." +msgstr "" + msgid "Preparing print job" msgstr "Preparing print job" diff --git a/bbl/i18n/es/BambuStudio_es.po b/bbl/i18n/es/BambuStudio_es.po index 6c761238de9..9a444fdd010 100644 --- a/bbl/i18n/es/BambuStudio_es.po +++ b/bbl/i18n/es/BambuStudio_es.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: Bambu Studio\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-22 18:39+0800\n" +"POT-Creation-Date: 2022-07-23 18:15+0800\n" "PO-Revision-Date: \n" "Last-Translator: \n" "Language-Team: \n" @@ -3420,7 +3420,9 @@ msgstr "" msgid "The printer is busy on other print job" msgstr "The printer is busy with another print job." -msgid "Printer firmware does not support material = >ams slot mapping." +msgid "" +"The filament index exceeds the AMS's slot count and cannot send the print " +"job." msgstr "" msgid "" @@ -3437,6 +3439,11 @@ msgstr "" "Please click each filament above to specify its mapping AMS slot before " "sending the print job" +msgid "" +"The printer firmware only supports sequential mapping of filament => AMS " +"slot." +msgstr "" + msgid "Preparing print job" msgstr "Preparing print job" diff --git a/bbl/i18n/fr/BambuStudio_fr.po b/bbl/i18n/fr/BambuStudio_fr.po index 1662ebfd31f..b3ae6e11320 100644 --- a/bbl/i18n/fr/BambuStudio_fr.po +++ b/bbl/i18n/fr/BambuStudio_fr.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: Bambu Studio\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-22 18:39+0800\n" +"POT-Creation-Date: 2022-07-23 18:15+0800\n" "PO-Revision-Date: \n" "Last-Translator: \n" "Language-Team: \n" @@ -3403,7 +3403,9 @@ msgstr "" msgid "The printer is busy on other print job" msgstr "The printer is busy with another print job." -msgid "Printer firmware does not support material = >ams slot mapping." +msgid "" +"The filament index exceeds the AMS's slot count and cannot send the print " +"job." msgstr "" msgid "" @@ -3420,6 +3422,11 @@ msgstr "" "Please click each filament above to specify its mapping AMS slot before " "sending the print job" +msgid "" +"The printer firmware only supports sequential mapping of filament => AMS " +"slot." +msgstr "" + msgid "Preparing print job" msgstr "Preparing print job" diff --git a/bbl/i18n/nl/BambuStudio_nl.po b/bbl/i18n/nl/BambuStudio_nl.po index 3012cbc3cb6..fce24136802 100644 --- a/bbl/i18n/nl/BambuStudio_nl.po +++ b/bbl/i18n/nl/BambuStudio_nl.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: Bambu Studio\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-22 18:39+0800\n" +"POT-Creation-Date: 2022-07-23 18:15+0800\n" "PO-Revision-Date: \n" "Last-Translator: \n" "Language-Team: \n" @@ -3438,7 +3438,9 @@ msgstr "" msgid "The printer is busy on other print job" msgstr "The printer is busy with another print job." -msgid "Printer firmware does not support material = >ams slot mapping." +msgid "" +"The filament index exceeds the AMS's slot count and cannot send the print " +"job." msgstr "" msgid "" @@ -3455,6 +3457,11 @@ msgstr "" "Please click each filament above to specify its mapping AMS slot before " "sending the print job" +msgid "" +"The printer firmware only supports sequential mapping of filament => AMS " +"slot." +msgstr "" + msgid "Preparing print job" msgstr "Preparing print job" diff --git a/bbl/i18n/sv/BambuStudio_sv.po b/bbl/i18n/sv/BambuStudio_sv.po index 5f64727728f..46ff2a97bac 100644 --- a/bbl/i18n/sv/BambuStudio_sv.po +++ b/bbl/i18n/sv/BambuStudio_sv.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: Bambu Studio\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-22 18:39+0800\n" +"POT-Creation-Date: 2022-07-23 18:15+0800\n" "PO-Revision-Date: \n" "Last-Translator: \n" "Language-Team: \n" @@ -3369,7 +3369,9 @@ msgstr "" msgid "The printer is busy on other print job" msgstr "The printer is busy with another print job." -msgid "Printer firmware does not support material = >ams slot mapping." +msgid "" +"The filament index exceeds the AMS's slot count and cannot send the print " +"job." msgstr "" msgid "" @@ -3386,6 +3388,11 @@ msgstr "" "Please click each filament above to specify its mapping AMS slot before " "sending the print job" +msgid "" +"The printer firmware only supports sequential mapping of filament => AMS " +"slot." +msgstr "" + msgid "Preparing print job" msgstr "Preparing print job" @@ -5890,8 +5897,8 @@ msgid "" "interface is Concentric" msgstr "" "Linje mönster för support gränssnittsytan .Standardmönstret för olösligt " -"(material) support gränssnittet är Räta medan standardmönstret för lösligt" -"(material) stödgränssnittet är koncentriskt" +"(material) support gränssnittet är Räta medan standardmönstret för " +"lösligt(material) stödgränssnittet är koncentriskt" msgid "Base pattern spacing" msgstr "Basens mönster mellanrum" diff --git a/bbl/i18n/zh_cn/BambuStudio_zh_CN.po b/bbl/i18n/zh_cn/BambuStudio_zh_CN.po index fd99631ba23..f83ab5c5783 100644 --- a/bbl/i18n/zh_cn/BambuStudio_zh_CN.po +++ b/bbl/i18n/zh_cn/BambuStudio_zh_CN.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Slic3rPE\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-07-22 18:39+0800\n" +"POT-Creation-Date: 2022-07-23 18:15+0800\n" "PO-Revision-Date: 2022-07-22 13:28+0800\n" "Last-Translator: Jiang Yue \n" "Language-Team: \n" @@ -1228,8 +1228,8 @@ msgid "" "Bambu Studio is based on PrusaSlicer by PrusaResearch and SuperSlicer by " "Merill(supermerill)." msgstr "" -"Bambu Studio是以PrusaResearch的PrusaSlicer和Merill的SuperSlicer" -"(supermerill)为基础的。" +"Bambu Studio是以PrusaResearch的PrusaSlicer和Merill(supermerill)的" +"SuperSlicer为基础的。" msgid "PrusaSlicer is originally based on Slic3r by Alessandro Ranellucci." msgstr "MerillPrusasicle最初是以Alessandro Ranellucci为基础的Slic3r。" @@ -3309,8 +3309,12 @@ msgstr "打印机正在执行指令,请在其结束后重新发起打印" msgid "The printer is busy on other print job" msgstr "打印机正在执行其他打印任务" -msgid "Printer firmware does not support material = >ams slot mapping." -msgstr "打印机固件不支持材料=>AMS槽位映射" +msgid "" +"The filament index exceeds the AMS's slot count and cannot send the print " +"job." +msgstr "" +"打印机固件仅支持材料=>AMS槽位的顺序映射。材料编号超过AMS的槽位数量,无法发送" +"打印任务。" msgid "" "Filaments to AMS slots mappings have been established. You can click a " @@ -3324,6 +3328,11 @@ msgid "" "sending the print job" msgstr "请在发送打印前点击上方各个耗材丝,指定其所对应的AMS槽位" +msgid "" +"The printer firmware only supports sequential mapping of filament => AMS " +"slot." +msgstr "打印机固件版本仅支持材料=>AMS槽位的顺序映射。" + msgid "Preparing print job" msgstr "正在准备打印任务" @@ -6048,6 +6057,9 @@ msgstr "支撑:正在修补层%d的空洞" msgid "Support: propagate branches at layer %d" msgstr "支撑:正在生长层%d的树枝" +#~ msgid "Printer firmware does not support material = >ams slot mapping." +#~ msgstr "打印机固件不支持材料=>AMS槽位映射" + #~ msgid "Creating" #~ msgstr "正在创建" diff --git a/resources/i18n/de/BambuStudio.mo b/resources/i18n/de/BambuStudio.mo index 02c02345e75..e43445e1087 100644 Binary files a/resources/i18n/de/BambuStudio.mo and b/resources/i18n/de/BambuStudio.mo differ diff --git a/resources/i18n/en/BambuStudio.mo b/resources/i18n/en/BambuStudio.mo index 0793698f015..6d236e2dbc0 100644 Binary files a/resources/i18n/en/BambuStudio.mo and b/resources/i18n/en/BambuStudio.mo differ diff --git a/resources/i18n/es/BambuStudio.mo b/resources/i18n/es/BambuStudio.mo index 81f8d49d02e..c4073f6b2da 100644 Binary files a/resources/i18n/es/BambuStudio.mo and b/resources/i18n/es/BambuStudio.mo differ diff --git a/resources/i18n/fr/BambuStudio.mo b/resources/i18n/fr/BambuStudio.mo index 929dd898567..2b7d74b33a6 100644 Binary files a/resources/i18n/fr/BambuStudio.mo and b/resources/i18n/fr/BambuStudio.mo differ diff --git a/resources/i18n/nl/BambuStudio.mo b/resources/i18n/nl/BambuStudio.mo index 7364aa8afe8..fb2434853e9 100644 Binary files a/resources/i18n/nl/BambuStudio.mo and b/resources/i18n/nl/BambuStudio.mo differ diff --git a/resources/i18n/sv/BambuStudio.mo b/resources/i18n/sv/BambuStudio.mo index 4c8c8884839..10b9685dc04 100644 Binary files a/resources/i18n/sv/BambuStudio.mo and b/resources/i18n/sv/BambuStudio.mo differ diff --git a/resources/i18n/zh_cn/BambuStudio.mo b/resources/i18n/zh_cn/BambuStudio.mo index 6150ae74622..86819d6ac7e 100644 Binary files a/resources/i18n/zh_cn/BambuStudio.mo and b/resources/i18n/zh_cn/BambuStudio.mo differ diff --git a/src/libslic3r/AppConfig.cpp b/src/libslic3r/AppConfig.cpp index 527e94da39e..c7f64c5a2ce 100644 --- a/src/libslic3r/AppConfig.cpp +++ b/src/libslic3r/AppConfig.cpp @@ -993,6 +993,9 @@ void AppConfig::update_last_backup_dir(const std::string& dir) std::string AppConfig::get_region() { +#if BBL_RELEASE_TO_PUBLIC + return this->get("region"); +#else std::string sel = get("iot_environment"); std::string region; if (sel == ENV_DEV_HOST) @@ -1004,12 +1007,15 @@ std::string AppConfig::get_region() if (region.empty()) return this->get("region"); return region; +#endif } std::string AppConfig::get_country_code() { std::string region = get_region(); +#if !BBL_RELEASE_TO_PUBLIC if (is_engineering_region()) { return region; } +#endif if (region == "CHN" || region == "China") return "CN"; else if (region == "USA") diff --git a/src/slic3r/GUI/AmsMappingPopup.cpp b/src/slic3r/GUI/AmsMappingPopup.cpp index 94f33fdf997..80c1a284eff 100644 --- a/src/slic3r/GUI/AmsMappingPopup.cpp +++ b/src/slic3r/GUI/AmsMappingPopup.cpp @@ -62,7 +62,6 @@ void MaterialItem::on_selected() m_selected = true; Refresh(); } - } void MaterialItem::on_warning() @@ -184,13 +183,19 @@ void MaterialItem::doRender(wxDC &dc) SetMinSize(wxSize(FromDIP(220), -1)); SetMaxSize(wxSize(FromDIP(220), -1)); Bind(wxEVT_PAINT, &AmsMapingPopup::paintEvent, this); - SetBackgroundColour(*wxWHITE); + + #if __APPLE__ + Bind(wxEVT_LEFT_DOWN, &AmsMapingPopup::on_left_down, this); + #endif + + SetBackgroundColour(*wxWHITE); m_sizer_main = new wxBoxSizer(wxVERTICAL); //m_sizer_main->Add(0, 0, 1, wxEXPAND, 0); SetSizer(m_sizer_main); Layout(); + } @@ -205,14 +210,30 @@ void AmsMapingPopup::set_tag_texture(std::string texture) } -bool AmsMapingPopup::is_match_material(int id, std::string material) +bool AmsMapingPopup::is_match_material(std::string material) { return m_tag_material == material ? true : false; } +void AmsMapingPopup::on_left_down(wxMouseEvent &evt) +{ + auto pos = ClientToScreen(evt.GetPosition()); + for (MappingItem *item : m_mapping_item_list) { + auto p_rect = item->ClientToScreen(wxPoint(0, 0)); + auto left = item->GetSize(); + + if (pos.x > p_rect.x && pos.y > p_rect.y && pos.x < (p_rect.x + item->GetSize().x) && pos.y < (p_rect.y + item->GetSize().y)) { + if (item->m_tray_data.type == TrayType::NORMAL && !is_match_material(item->m_tray_data.name)) return; + item->send_event(m_current_filament_id); + Dismiss(); + } + } +} + void AmsMapingPopup::update_ams_data(std::map amsList) { + m_mapping_item_list.clear(); if (m_amsmapping_sizer_list.size() > 0) { for (wxBoxSizer *bz : m_amsmapping_sizer_list) { bz->Clear(true); } m_amsmapping_sizer_list.clear(); @@ -272,80 +293,63 @@ void AmsMapingPopup::add_ams_mapping(std::vector tray_data) // set button - Button *m_filament_name = new Button(this, "", wxEmptyString); + MappingItem *m_filament_name = new MappingItem(this); m_filament_name->SetSize(wxSize(FromDIP(38), FromDIP(20))); m_filament_name->SetMinSize(wxSize(FromDIP(38), FromDIP(20))); m_filament_name->SetMaxSize(wxSize(FromDIP(38), FromDIP(20))); - m_filament_name->SetCornerRadius(5); + //m_filament_name->SetCornerRadius(5); m_filament_name->SetFont(::Label::Body_12); + m_mapping_item_list.push_back(m_filament_name); if (tray_data[i].type == NORMAL) { - - if (m_filament_name->GetTextExtent(tray_data[i].name).x > FromDIP(38)) { - m_filament_name->SetFont(::Label::Body_10); - auto name = tray_data[i].name.substr(0, 3) + "." + tray_data[i].name.substr(tray_data[i].name.length() - 1); - m_filament_name->SetLabel(name); - } else { - m_filament_name->SetLabel(tray_data[i].name); - } - - auto material_name_colour = tray_data[i].colour.GetLuminance() < 0.5 ? *wxWHITE : wxColour(0x26, 0x2E, 0x30); - m_filament_name->SetTextColor(material_name_colour); - m_filament_name->SetBackgroundColor(tray_data[i].colour); - - if (tray_data[i].colour == *wxWHITE) { - m_filament_name->SetBorderColor(wxColour(0xAC, 0xAC, 0xAC)); - } else { - m_filament_name->SetBorderColor(tray_data[i].colour); - } - - m_filament_name->Bind(wxEVT_BUTTON, [this, tray_data, i](wxCommandEvent &e) { - if (!is_match_material(tray_data[i].id, tray_data[i].name)) return; - wxCommandEvent event(EVT_SET_FINISH_MAPPING); - event.SetInt(tray_data[i].id); - wxString param = wxString::Format("%d|%d|%d|%02d|%d", tray_data[i].colour.Red(), tray_data[i].colour.Green(), tray_data[i].colour.Blue(), tray_data[i].id + 1, m_current_filament_id); - event.SetString(param); - event.SetEventObject(this->GetParent()); - wxPostEvent(this->GetParent(), event); + m_filament_name->set_data(tray_data[i].colour, tray_data[i].name, tray_data[i]); + m_filament_name->Bind(wxEVT_LEFT_DOWN, [this, tray_data, i, m_filament_name](wxMouseEvent &e) { + if (!is_match_material(tray_data[i].name)) return; + m_filament_name->send_event(m_current_filament_id); Dismiss(); + /* wxCommandEvent event(EVT_SET_FINISH_MAPPING); + event.SetInt(tray_data[i].id); + wxString param = wxString::Format("%d|%d|%d|%02d|%d", tray_data[i].colour.Red(), tray_data[i].colour.Green(), tray_data[i].colour.Blue(), tray_data[i].id + 1, + m_current_filament_id); + event.SetString(param); + event.SetEventObject(this->GetParent()); + wxPostEvent(this->GetParent(), event); + Dismiss();*/ }); } // temp if (tray_data[i].type == EMPTY) { - m_filament_name->SetLabel("-"); - m_filament_name->SetTextColor(*wxWHITE); - m_filament_name->SetBackgroundColor(wxColour(0x6B, 0x6B, 0x6B)); - m_filament_name->SetBorderColor(wxColour(0x6B, 0x6B, 0x6B)); - m_filament_name->Bind(wxEVT_BUTTON, [this, tray_data, i](wxCommandEvent &e) { - wxCommandEvent event(EVT_SET_FINISH_MAPPING); - event.SetInt(tray_data[i].id); - wxString param = wxString::Format("%d|%d|%d|%02d|%d", 0x6B, 0x6B, 0x6B, tray_data[i].id + 1, m_current_filament_id); - event.SetString(param); - event.SetEventObject(this->GetParent()); - wxPostEvent(this->GetParent(), event); + m_filament_name->set_data(wxColour(0x6B, 0x6B, 0x6B), "-", tray_data[i]); + m_filament_name->Bind(wxEVT_LEFT_DOWN, [this, tray_data, i, m_filament_name](wxMouseEvent &e) { + m_filament_name->send_event(m_current_filament_id); + /* wxCommandEvent event(EVT_SET_FINISH_MAPPING); + event.SetInt(tray_data[i].id); + wxString param = wxString::Format("%d|%d|%d|%02d|%d", 0x6B, 0x6B, 0x6B, tray_data[i].id + 1, m_current_filament_id); + event.SetString(param); + event.SetEventObject(this->GetParent()); + wxPostEvent(this->GetParent(), event);*/ Dismiss(); }); } // third party if (tray_data[i].type == THIRD) { - m_filament_name->SetLabel("?"); - m_filament_name->SetTextColor(*wxWHITE); - m_filament_name->SetBackgroundColor(wxColour(0x6B, 0x6B, 0x6B)); - m_filament_name->SetBorderColor(wxColour(0x6B, 0x6B, 0x6B)); - m_filament_name->Bind(wxEVT_BUTTON, [this, tray_data, i](wxCommandEvent &e) { - wxCommandEvent event(EVT_SET_FINISH_MAPPING); - event.SetInt(tray_data[i].id); - wxString param = wxString::Format("%d|%d|%d|%02d|%d", 0x6B, 0x6B, 0x6B, tray_data[i].id + 1, m_current_filament_id); - event.SetString(param); - event.SetEventObject(this->GetParent()); - wxPostEvent(this->GetParent(), event); + m_filament_name->set_data(wxColour(0x6B, 0x6B, 0x6B), "?", tray_data[i]); + m_filament_name->Bind(wxEVT_LEFT_DOWN, [this, tray_data, i, m_filament_name](wxMouseEvent &e) { + m_filament_name->send_event(m_current_filament_id); + //wxCommandEvent event(EVT_SET_FINISH_MAPPING); + //event.SetInt(tray_data[i].id); + //wxString param = wxString::Format("%d|%d|%d|%02d|%d", 0x6B, 0x6B, 0x6B, tray_data[i].id + 1, m_current_filament_id); + //event.SetString(param); + //event.SetEventObject(this->GetParent()); + //wxPostEvent(this->GetParent(), event); Dismiss(); }); } + sizer_mapping_item->Add(number, 0, wxALIGN_CENTER_HORIZONTAL, 0); sizer_mapping_item->Add(m_filament_name, 0, wxALIGN_CENTER_HORIZONTAL, 0); sizer_mapping_list->Add(sizer_mapping_item, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, FromDIP(5)); @@ -372,4 +376,106 @@ void AmsMapingPopup::paintEvent(wxPaintEvent &evt) dc.DrawRoundedRectangle(0, 0, GetSize().x, GetSize().y, 0); } + MappingItem::MappingItem(wxWindow *parent) + : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize) +{ +#ifdef __WINDOWS__ + SetDoubleBuffered(true); +#endif //__WINDOWS__ + SetBackgroundColour(*wxWHITE); + Bind(wxEVT_PAINT, &MappingItem::paintEvent, this); +} + + MappingItem::~MappingItem() +{ +} + + +void MappingItem::send_event(int fliament_id) +{ + wxCommandEvent event(EVT_SET_FINISH_MAPPING); + event.SetInt(m_tray_data.id); + wxString param = wxString::Format("%d|%d|%d|%02d|%d", m_coloul.Red(), m_coloul.Green(), m_coloul.Blue(), m_tray_data.id + 1, fliament_id); + event.SetString(param); + event.SetEventObject(this->GetParent()->GetParent()); + wxPostEvent(this->GetParent()->GetParent(), event); + + /* wxCommandEvent event(EVT_SET_FINISH_MAPPING); + event.SetInt(tray_data[i].id); + wxString param = wxString::Format("%d|%d|%d|%02d|%d", tray_data[i].colour.Red(), tray_data[i].colour.Green(), tray_data[i].colour.Blue(), tray_data[i].id + 1, + m_current_filament_id); + event.SetString(param); + event.SetEventObject(this->GetParent()); + wxPostEvent(this->GetParent(), event);*/ +} + + void MappingItem::msw_rescale() +{ +} + +void MappingItem::paintEvent(wxPaintEvent &evt) +{ + wxPaintDC dc(this); + render(dc); + + // PrepareDC(buffdc); + // PrepareDC(dc); +} + +void MappingItem::render(wxDC &dc) +{ +#ifdef __WXMSW__ + wxSize size = GetSize(); + wxMemoryDC memdc; + wxBitmap bmp(size.x, size.y); + memdc.SelectObject(bmp); + memdc.Blit({0, 0}, size, &dc, {0, 0}); + + { + wxGCDC dc2(memdc); + doRender(dc2); + } + + memdc.SelectObject(wxNullBitmap); + dc.DrawBitmap(bmp, 0, 0); +#else + doRender(dc); +#endif + + // materials name + dc.SetFont(::Label::Body_13); + + auto txt_colour = m_coloul.GetLuminance() < 0.5 ? *wxWHITE : wxColour(0x26, 0x2E, 0x30); + dc.SetTextForeground(txt_colour); + + if (dc.GetTextExtent(m_name).x > GetSize().x - 10) { + dc.SetFont(::Label::Body_10); + m_name = m_name.substr(0, 3) + "." + m_name.substr(m_name.length() - 1); + } + + auto txt_size = dc.GetTextExtent(m_name); + dc.DrawText(m_name, wxPoint((GetSize().x - txt_size.x) / 2, (GetSize().y - txt_size.y) / 2)); +} + +void MappingItem::set_data(wxColour colour, wxString name, TrayData data) +{ + m_tray_data = data; + if (m_coloul != colour || m_name != name) { + m_coloul = colour; + m_name = name; + Refresh(); + } +} + +void MappingItem::doRender(wxDC &dc) +{ + dc.SetPen(m_coloul); + dc.SetBrush(wxBrush(m_coloul)); + dc.DrawRoundedRectangle(0, 0, GetSize().x, GetSize().y,5); + if (m_coloul == *wxWHITE) { + dc.SetPen(wxPen(wxColour(0xAC, 0xAC, 0xAC),1)); + dc.DrawRoundedRectangle(0, 0, GetSize().x, GetSize().y, 5); + } +} + }} // namespace Slic3r::GUI diff --git a/src/slic3r/GUI/AmsMappingPopup.hpp b/src/slic3r/GUI/AmsMappingPopup.hpp index 2acc95af0ea..fd0fe52eeea 100644 --- a/src/slic3r/GUI/AmsMappingPopup.hpp +++ b/src/slic3r/GUI/AmsMappingPopup.hpp @@ -85,6 +85,24 @@ class MaterialItem: public wxPanel void doRender(wxDC &dc); }; +class MappingItem : public wxPanel +{ +public: + MappingItem(wxWindow *parent); + ~MappingItem(); + + void update_data(TrayData data); + void send_event(int fliament_id); + wxColour m_coloul; + wxString m_name; + TrayData m_tray_data; + + void msw_rescale(); + void paintEvent(wxPaintEvent &evt); + void render(wxDC &dc); + void set_data(wxColour colour, wxString name, TrayData data); + void doRender(wxDC &dc); +}; class AmsMapingPopup : public wxPopupTransientWindow { @@ -94,6 +112,7 @@ class AmsMapingPopup : public wxPopupTransientWindow std::vector m_materials_list; std::vector m_amsmapping_sizer_list; + std::vector m_mapping_item_list; int m_current_filament_id; std::string m_tag_material; @@ -105,7 +124,8 @@ class AmsMapingPopup : public wxPopupTransientWindow void add_ams_mapping(std::vector tray_data); void set_current_filament_id(int id){m_current_filament_id = id;}; int get_current_filament_id(){return m_current_filament_id;}; - bool is_match_material(int id, std::string material); + bool is_match_material(std::string material); + void on_left_down(wxMouseEvent &evt); virtual void OnDismiss() wxOVERRIDE; virtual bool ProcessLeftDown(wxMouseEvent &event) wxOVERRIDE; void paintEvent(wxPaintEvent &evt); diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index ff2d74f0ebd..34590047700 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -647,10 +647,10 @@ int MachineObject::ams_filament_mapping(std::vector filaments, std for (int i = 0; i < filaments.size(); i++) { FilamentInfo info; info.id = filaments[i].id; - info.tray_id = -1; + info.tray_id = filaments[i].id; result.push_back(info); } - return 0; + return 1; } char buffer[256]; @@ -791,14 +791,33 @@ int MachineObject::ams_filament_mapping(std::vector filaments, std bool MachineObject::is_valid_mapping_result(std::vector& result) { - bool valid_ams_mapping_result = true; - for (int i = 0; i < result.size(); i++) { - if (result[i].tray_id == -1) { - valid_ams_mapping_result = false; - break; + if (is_support_ams_mapping()) { + bool valid_ams_mapping_result = true; + for (int i = 0; i < result.size(); i++) { + if (result[i].tray_id == -1) { + valid_ams_mapping_result = false; + break; + } + } + return valid_ams_mapping_result; + } else { + bool is_valid = true; + // invalid mapping result + if (result.empty()) return false; + for (int i = 0; i < result.size(); i++) { + // invalid mapping result + if (result[i].tray_id < 0) + return false; + else { + int ams_id = result[i].tray_id / 4; + if (amsList.find(std::to_string(ams_id)) == amsList.end()) { + return false; + } + } } + return is_valid; } - return valid_ams_mapping_result; + return true; } diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 6084dae66d3..73ed61a739a 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -1233,7 +1233,7 @@ int GUI_App::download_plugin(InstallProgressFn pro_fn, WasCancelledFn cancel_fn) return result; } - + if (download_url.empty()) { BOOST_LOG_TRIVIAL(info) << "[download_plugin]: no availaible plugin found for this app version: " << SLIC3R_VERSION; if (pro_fn) pro_fn(InstallStatusDownloadFailed, 0, cancel); @@ -1310,12 +1310,14 @@ int GUI_App::install_plugin(InstallProgressFn pro_fn, WasCancelledFn cancel_fn) mz_zip_archive archive; mz_zip_zero_struct(&archive); if (!open_zip_reader(&archive, target_file_path)) { + BOOST_LOG_TRIVIAL(error) << boost::format("install_plugin: %1%, open zip file failed")%__LINE__; if (pro_fn) pro_fn(InstallStatusDownloadFailed, 0, cancel); return InstallStatusUnzipFailed; } mz_uint num_entries = mz_zip_reader_get_num_files(&archive); mz_zip_archive_file_stat stat; + BOOST_LOG_TRIVIAL(error) << boost::format("install_plugin: %1%, got %2% files")%__LINE__ %num_entries; for (mz_uint i = 0; i < num_entries; i++) { if (m_networking_cancel_update || cancel) { BOOST_LOG_TRIVIAL(info) << boost::format("install_plugin: %1%, cancelled by user")%__LINE__; @@ -1368,6 +1370,9 @@ int GUI_App::install_plugin(InstallProgressFn pro_fn, WasCancelledFn cancel_fn) } } } + else { + BOOST_LOG_TRIVIAL(error) << boost::format("install_plugin: %1%, mz_zip_reader_file_stat for file %2% failed")%__LINE__%i; + } } close_zip_reader(&archive); @@ -1380,7 +1385,7 @@ int GUI_App::install_plugin(InstallProgressFn pro_fn, WasCancelledFn cancel_fn) void GUI_App::restart_networking() { - BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< boost::format("enter, mainframe %1%")%mainframe; + BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< boost::format(" enter, mainframe %1%")%mainframe; on_init_network(); if(m_agent) { init_networking_callbacks(); @@ -1402,7 +1407,7 @@ void GUI_App::restart_networking() if (plater_) plater_->get_notification_manager()->bbl_close_plugin_install_notification(); } - BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< boost::format("exit, m_agent=%1%")%m_agent; + BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< boost::format(" exit, m_agent=%1%")%m_agent; } int GUI_App::updating_bambu_networking() @@ -1957,6 +1962,8 @@ bool GUI_App::on_init_inner() // Suppress the '- default -' presets. preset_bundle->set_default_suppressed(true); + Bind(EVT_USER_LOGIN, &GUI_App::on_user_login, this); + on_init_network(); //BBS if load user preset failed @@ -2058,7 +2065,7 @@ bool GUI_App::on_init_inner() //#endif //__APPLE__ Bind(EVT_HTTP_ERROR, &GUI_App::on_http_error, this); - Bind(EVT_USER_LOGIN, &GUI_App::on_user_login, this); + Bind(wxEVT_IDLE, [this](wxIdleEvent& event) { @@ -2121,7 +2128,15 @@ bool GUI_App::on_init_network() BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": on_init_network, load dll ok"; if (check_networking_version()) { BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": on_init_network, compatibility version"; - create_network_agent = true; + auto bambu_source = Slic3r::NetworkAgent::get_bambu_source_entry(); + if (!bambu_source) { + BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": can not get bambu source module!"; + if (app_config->get("installed_networking") == "1") { + m_networking_need_update = true; + } + } + else + create_network_agent = true; } else { BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": on_init_network, version dismatch, need upload network module"; if (app_config->get("installed_networking") == "1") { @@ -2508,6 +2523,7 @@ void GUI_App::recreate_GUI(const wxString& msg_name) dlg.Update(80, _L("Loading current presets") + dots); load_current_presets(); mainframe->Show(true); + mainframe->refresh_plugin_tips(); dlg.Update(90, _L("Loading a mode view") + dots); @@ -3586,7 +3602,7 @@ bool GUI_App::load_language(wxString language, bool initial) // Get the active language from PrusaSlicer.ini, or empty string if the key does not exist. language = app_config->get("language"); if (! language.empty()) - BOOST_LOG_TRIVIAL(trace) << boost::format("language provided by PrusaSlicer.ini: %1%") % language; + BOOST_LOG_TRIVIAL(trace) << boost::format("language provided by PBambuStudio.conf: %1%") % language; else { // Get the system language. const wxLanguage lang_system = wxLanguage(wxLocale::GetSystemLanguage()); @@ -3697,6 +3713,32 @@ bool GUI_App::load_language(wxString language, bool initial) } #endif + if (! wxLocale::IsAvailable(language_info->Language)&&initial) { + language_info = wxLocale::GetLanguageInfo(wxLANGUAGE_ENGLISH_UK); + app_config->set("language", language_info->CanonicalName.ToUTF8().data()); + } + else if (initial) { + // bbs supported languages + //TODO: use a global one with Preference + wxLanguage supported_languages[] {wxLANGUAGE_ENGLISH, wxLANGUAGE_CHINESE_SIMPLIFIED, wxLANGUAGE_GERMAN, wxLANGUAGE_FRENCH, wxLANGUAGE_SPANISH, wxLANGUAGE_SWEDISH, wxLANGUAGE_DUTCH }; + std::string cur_language = app_config->get("language"); + if (cur_language != "") { + //cleanup the language wrongly set before + const wxLanguageInfo *langinfo = nullptr; + bool embedded_language = false; + for (auto index = 0; index < 7; index++) { + langinfo = wxLocale::GetLanguageInfo(supported_languages[index]); + std::string temp_lan = langinfo->CanonicalName.ToUTF8().data(); + if (cur_language == temp_lan) { + embedded_language = true; + break; + } + } + if (!embedded_language) + app_config->erase("app", "language"); + } + } + if (! wxLocale::IsAvailable(language_info->Language)) { // Loading the language dictionary failed. wxString message = "Switching Bambu Studio to language " + language_info->CanonicalName + " failed."; diff --git a/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp b/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp index 5b0697593a7..92331c80962 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp @@ -397,16 +397,20 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l show_tooltip_information(caption_max, x, get_cur_y); ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(6.0f, 5.0f)); ImGui::SameLine(); - if (m_imgui->button(m_desc.at("perform_filter"))) { - Plater::TakeSnapshot snapshot(wxGetApp().plater(), "Reset selection", UndoRedo::SnapshotType::GizmoAction); - for (int i = 0; i < m_triangle_selectors.size(); i++) { - TriangleSelectorPatch *ts_mm = dynamic_cast(m_triangle_selectors[i].get()); - ts_mm->update_selector_triangles(); - ts_mm->request_update_render_data(true); + // Perform button is for gap fill + if (m_current_tool == ImGui::FragmentFilterIcon) { + if (m_imgui->button(m_desc.at("perform_filter"))) { + Plater::TakeSnapshot snapshot(wxGetApp().plater(), "Reset selection", UndoRedo::SnapshotType::GizmoAction); + + for (int i = 0; i < m_triangle_selectors.size(); i++) { + TriangleSelectorPatch* ts_mm = dynamic_cast(m_triangle_selectors[i].get()); + ts_mm->update_selector_triangles(); + ts_mm->request_update_render_data(true); + } + update_model_object(); + m_parent.set_as_dirty(); } - update_model_object(); - m_parent.set_as_dirty(); } ImGui::SameLine(); diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index f6846263f59..cf426cb6f78 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -634,7 +634,6 @@ wxWindow* PreferencesDialog::create_general_page() // bbs supported languages wxLanguage supported_languages[]{wxLANGUAGE_ENGLISH, wxLANGUAGE_CHINESE_SIMPLIFIED, wxLANGUAGE_GERMAN, wxLANGUAGE_FRENCH, wxLANGUAGE_SPANISH, wxLANGUAGE_SWEDISH, wxLANGUAGE_DUTCH }; - auto translations = wxTranslations::Get()->GetAvailableTranslations(SLIC3R_APP_KEY); std::vector language_infos; language_infos.emplace_back(wxLocale::GetLanguageInfo(wxLANGUAGE_ENGLISH)); @@ -643,7 +642,7 @@ wxWindow* PreferencesDialog::create_general_page() if (langinfo == nullptr) continue; - for (auto si = 0; si < sizeof(supported_languages); si++) { + for (auto si = 0; si < 7; si++) { if (langinfo == wxLocale::GetLanguageInfo(supported_languages[si])) { language_infos.emplace_back(langinfo); } diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index c79a9589014..e1776abcdcf 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -1064,7 +1064,7 @@ void SelectMachineDialog::sync_ams_mapping_result(std::vector &res ams_col = AmsTray::decode_color(f->color); } else { // default color - ams_col = wxColour(0x6B, 0x6B, 0x6B); + ams_col = wxColour(0xEE, 0xEE, 0xEE); } m->set_ams_info(ams_col, ams_id); @@ -1105,8 +1105,22 @@ bool SelectMachineDialog::do_ams_mapping(MachineObject *obj_) sync_ams_mapping_result(m_ams_mapping_result); BOOST_LOG_TRIVIAL(info) << "ams_mapping_array=" << ams_array; } + return obj_->is_valid_mapping_result(m_ams_mapping_result); + } else { + // do not support ams mapping try to use order mapping + bool is_valid = obj_->is_valid_mapping_result(m_ams_mapping_result); + if (!is_valid) { + // reset invalid result + for (int i = 0; i < m_ams_mapping_result.size(); i++) { + m_ams_mapping_result[i].tray_id = -1; + m_ams_mapping_result[i].distance = 99999; + } + } + sync_ams_mapping_result(m_ams_mapping_result); + return is_valid; } - return obj_->is_valid_mapping_result(m_ams_mapping_result); + + return true; } bool SelectMachineDialog::get_ams_mapping_result(std::string &mapping_array_str) @@ -1292,13 +1306,13 @@ void SelectMachineDialog::show_status(PrintDialogStatus status) Enable_Send_Button(false); Enable_Refresh_Button(true); } else if (status == PrintDialogStatus::PrintStatusNeedUpgradingAms) { - wxString msg_text = _L("Printer firmware does not support material = >ams slot mapping."); - update_print_status_msg(msg_text, true, true); - Enable_Send_Button(true); + wxString msg_text = _L("The filament index exceeds the AMS's slot count and cannot send the print job."); + update_print_status_msg(msg_text, true, false); + Enable_Send_Button(false); Enable_Refresh_Button(true); } else if (status == PrintDialogStatus::PrintStatusAmsMappingSuccess){ wxString msg_text = _L("Filaments to AMS slots mappings have been established. You can click a filament above to change its mapping AMS slot"); - update_print_status_msg(msg_text, true, false); + update_print_status_msg(msg_text, false, false); Enable_Send_Button(true); Enable_Refresh_Button(true); } else if (status == PrintDialogStatus::PrintStatusAmsMappingInvalid) { @@ -1326,7 +1340,7 @@ void SelectMachineDialog::show_status(PrintDialogStatus status) Enable_Send_Button(true); Enable_Refresh_Button(true); } else if (status == PrintDialogStatus::PrintStatusAmsMappingByOrder) { - wxString msg_text = _L("Printer firmware does not support material = >ams slot mapping."); + wxString msg_text = _L("The printer firmware only supports sequential mapping of filament => AMS slot."); update_print_status_msg(msg_text, false, false); Enable_Send_Button(true); Enable_Refresh_Button(true); @@ -1768,7 +1782,11 @@ void SelectMachineDialog::update_show_status() } if (!obj_->is_support_ams_mapping()) { - show_status(PrintDialogStatus::PrintStatusNeedUpgradingAms); + if (obj_->is_valid_mapping_result(m_ams_mapping_result)) { + show_status(PrintDialogStatus::PrintStatusAmsMappingByOrder); + } else { + show_status(PrintDialogStatus::PrintStatusNeedUpgradingAms); + } return; } @@ -1950,6 +1968,10 @@ void SelectMachineDialog::set_default() m_sizer_material->Add(item, 0, wxALL, FromDIP(4)); item->Bind(wxEVT_LEFT_UP, [this, item, materials, extruder](wxMouseEvent &e) { + + }); + + item->Bind(wxEVT_LEFT_DOWN, [this, item, materials, extruder](wxMouseEvent &e) { MaterialHash::iterator iter = m_materialList.begin(); while (iter != m_materialList.end()) { int id = iter->first; @@ -1961,9 +1983,8 @@ void SelectMachineDialog::set_default() m_current_filament_id = extruder; item->on_selected(); - }); - item->Bind(wxEVT_LEFT_DOWN, [this, item, materials, extruder](wxMouseEvent &e) { + auto mouse_pos = ClientToScreen(e.GetPosition()); wxPoint rect = item->ClientToScreen(wxPoint(0, 0)); // update ams data diff --git a/version.inc b/version.inc index 90d37ecdb20..7fbfb655e2f 100644 --- a/version.inc +++ b/version.inc @@ -7,4 +7,4 @@ set(SLIC3R_APP_KEY "BambuStudio") if(NOT DEFINED BBL_RELEASE_TO_PUBLIC) set(BBL_RELEASE_TO_PUBLIC "0") endif() -set(SLIC3R_VERSION "01.01.00.13") +set(SLIC3R_VERSION "01.01.00.14")