From 583edf1e325b4f032356741bbf26370d2a2a85f1 Mon Sep 17 00:00:00 2001 From: "chunmao.guo" Date: Thu, 2 Jan 2025 14:44:15 +0800 Subject: [PATCH] FIX: something 1. split translate filament_extruder_variant 2. printer sync icon dark mode 3. translate Extruder 1/2 to Left/Right Extruder 4. parse error code from get_camera_url 5. smaller printer bed image Jira: STUDIO-8542, STUDIO-9056, STUDIO-7681, STUDIO-9487 Change-Id: I8a10fbe4e6d17e7a3e35e8846e3d964084d07f50 (cherry picked from commit 626256beb6fb8a90a99578b5208cb588ead5dd80) (cherry picked from commit 9c81c2cf5e0e50a65c99903445734e0f16529198) --- src/slic3r/GUI/MediaFilePanel.cpp | 8 +++++++- src/slic3r/GUI/MediaPlayCtrl.cpp | 5 +++++ src/slic3r/GUI/Plater.cpp | 16 ++++++++++------ src/slic3r/GUI/Tab.cpp | 2 ++ 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/slic3r/GUI/MediaFilePanel.cpp b/src/slic3r/GUI/MediaFilePanel.cpp index f2b5e103d4..d030bb133a 100644 --- a/src/slic3r/GUI/MediaFilePanel.cpp +++ b/src/slic3r/GUI/MediaFilePanel.cpp @@ -504,7 +504,13 @@ void MediaFilePanel::fetchUrl(boost::weak_ptr wfs) fs->SetUrl(url); } else { m_image_grid->SetStatus(m_bmp_failed, _L("Connection Failed. Please check the network and try again")); - fs->SetUrl("3"); + std::string res = "3"; + if (boost::ends_with(url, "]")) { + size_t n = url.find_last_of('['); + if (n != std::string::npos) + res = url.substr(n + 1, url.length() - n - 2); + } + fs->SetUrl(res); } }); }); diff --git a/src/slic3r/GUI/MediaPlayCtrl.cpp b/src/slic3r/GUI/MediaPlayCtrl.cpp index 80b71295e1..23594375b7 100644 --- a/src/slic3r/GUI/MediaPlayCtrl.cpp +++ b/src/slic3r/GUI/MediaPlayCtrl.cpp @@ -353,6 +353,11 @@ void MediaPlayCtrl::Play() if (m_last_state == MEDIASTATE_INITIALIZING) { if (url.empty() || !boost::algorithm::starts_with(url, "bambu:///")) { m_failed_code = 3; + if (boost::ends_with(url, "]")) { + size_t n = url.find_last_of('['); + if (n != std::string::npos) + m_failed_code = std::atoi(url.substr(n + 1, url.length() - n - 2).c_str()); + } Stop(_L("Connection Failed. Please check the network and try again"), from_u8(url)); } else { m_url = url; diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index c249479e91..8212953fcd 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -1275,6 +1275,7 @@ void Sidebar::priv::update_sync_status(const MachineObject *obj) } #define PRINTER_THUMBNAIL_SIZE (wxSize(FromDIP(48), FromDIP(48))) +#define PRINTER_THUMBNAIL_SIZE_SMALL (wxSize(FromDIP(32), FromDIP(32))) #define PRINTER_PANEL_SIZE_SMALL (wxSize(FromDIP(98), FromDIP(68))) #define PRINTER_PANEL_SIZE (wxSize(FromDIP(98), FromDIP(98))) @@ -1435,8 +1436,8 @@ Sidebar::Sidebar(Plater *parent) wxLaunchDefaultBrowser("https://wiki.bambulab.com/en/x1/manual/compatibility-and-parameter-settings-of-filaments"); }); - ScalableBitmap bitmap_bed(p->panel_printer_bed, "printer_placeholder", 48); - p->image_printer_bed = new wxStaticBitmap(p->panel_printer_bed, wxID_ANY, bitmap_bed.bmp(), wxDefaultPosition, PRINTER_THUMBNAIL_SIZE, 0); + ScalableBitmap bitmap_bed(p->panel_printer_bed, "printer_placeholder", 32); + p->image_printer_bed = new wxStaticBitmap(p->panel_printer_bed, wxID_ANY, bitmap_bed.bmp(), wxDefaultPosition, PRINTER_THUMBNAIL_SIZE_SMALL, 0); p->combo_printer_bed = new ComboBox(p->panel_printer_bed, wxID_ANY, wxString(""), wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_READONLY | wxALIGN_CENTER_HORIZONTAL); p->combo_printer_bed->SetBorderWidth(0); @@ -1450,7 +1451,7 @@ Sidebar::Sidebar(Plater *parent) p->combo_printer_bed->Bind(wxEVT_COMBOBOX, [this](auto &e) { int selection = p->combo_printer_bed->GetSelection(); - p->image_printer_bed->SetBitmap(create_scaled_bitmap(bed_type_thumbnails[BedType(selection + 1)], this, 48)); + p->image_printer_bed->SetBitmap(create_scaled_bitmap(bed_type_thumbnails[BedType(selection + 1)], this, 32)); e.Skip();//fix bug:Event spreads to sidebar }); @@ -1471,8 +1472,8 @@ Sidebar::Sidebar(Plater *parent) bed_type_hsizer->Add(bed_type_hsizer2, 1); bed_type_hsizer->Add(p->image_printer_bed, 0); bed_type_hsizer->AddStretchSpacer(1); - bed_type_sizer->Add(bed_type_hsizer, 0, wxALIGN_CENTER | wxLEFT | wxTOP | wxRIGHT, FromDIP(4)); - bed_type_sizer->Add(p->combo_printer_bed, 0, wxEXPAND | wxALL, FromDIP(4)); + bed_type_sizer->Add(bed_type_hsizer, 0, wxALIGN_CENTER | wxLEFT | wxTOP | wxRIGHT, FromDIP(2)); + bed_type_sizer->Add(p->combo_printer_bed, 0, wxEXPAND | wxALL, FromDIP(2)); bed_type_sizer->AddStretchSpacer(1); p->panel_printer_bed->SetSizer(bed_type_sizer); @@ -2148,6 +2149,8 @@ void Sidebar::msw_rescale() ->SetMinSize(-1, 3 * wxGetApp().em_unit()); p->m_printer_icon->msw_rescale(); p->m_printer_setting->msw_rescale(); + p->image_printer->SetSize(PRINTER_THUMBNAIL_SIZE); + p->image_printer_bed->SetSize(PRINTER_THUMBNAIL_SIZE_SMALL); p->m_filament_icon->msw_rescale(); p->m_bpButton_add_filament->msw_rescale(); p->m_bpButton_del_filament->msw_rescale(); @@ -2223,7 +2226,8 @@ void Sidebar::sys_color_changed() for (wxWindow* win : std::vector{ p->scrolled, p->presets_panel }) wxGetApp().UpdateAllStaticTextDarkUI(win); #endif - //for (wxWindow* btn : std::vector{ p->btn_reslice, p->btn_export_gcode }) + p->btn_sync_printer->SetIcon("ams_nozzle_sync"); + // for (wxWindow* btn : std::vector{ p->btn_reslice, p->btn_export_gcode }) // wxGetApp().UpdateDarkUI(btn, true); p->m_printer_icon->msw_rescale(); p->m_printer_setting->msw_rescale(); diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 1cf4092a92..453182f9e9 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -630,6 +630,8 @@ Slic3r::GUI::PageShp Tab::add_options_page(const wxString& title, const std::str wxString Tab::translate_category(const wxString& title, Preset::Type preset_type) { if (preset_type == Preset::TYPE_PRINTER && title.Contains("Extruder ")) { + if (title == "Extruder 1") return _("Left Extruder"); + if (title == "Extruder 2") return _("Right Extruder"); return _("Extruder") + title.SubString(8, title.Last()); } return _(title);