FIX: fix crash when loading a 3mf

fix plate name encoding issue in Object List

Change-Id: I7d5a3261998c9af87b20dab822c7048a4b689790
Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
Stone Li 2023-06-25 09:05:13 +08:00 committed by Lane.Wei
parent 633d206732
commit e0e8d1467d
3 changed files with 12 additions and 8 deletions

View File

@ -933,9 +933,11 @@ void MainFrame::init_tabpanel()
wxString url; wxString url;
if (cfg.has("print_host_webui") && !cfg.opt_string("print_host_webui").empty()) { if (cfg.has("print_host_webui") && !cfg.opt_string("print_host_webui").empty()) {
url = cfg.opt_string("print_host_webui"); url = cfg.opt_string("print_host_webui");
} else if (cfg.has("print_host") && !cfg.opt_string("print_host").empty()) {
url = cfg.opt_string("print_host");
} }
else { else {
url = cfg.opt_string("print_host"); ;
} }
if (url.empty()) { if (url.empty()) {
wxString url = wxString::Format("file://%s/web/device/missing_connection.html", from_u8(resources_dir())); wxString url = wxString::Format("file://%s/web/device/missing_connection.html", from_u8(resources_dir()));

View File

@ -1255,10 +1255,9 @@ void ObjectDataViewModel::SetCurSelectedPlateFullNmae(int plate_idx, const std::
for (auto plate : m_plates) { for (auto plate : m_plates) {
if (plate->m_plate_idx == plate_idx) { if (plate->m_plate_idx == plate_idx) {
wxString plate_full_name =_L("Plate"); wxString plate_full_name =_L("Plate");
if (custom_name.length() > 0) { plate_full_name += wxString::Format(" %d", plate_idx + 1);
plate_full_name << " " << plate_idx + 1 << " (" << custom_name << ")"; if (!custom_name.empty()) {
} else { plate_full_name += wxString(" (", wxConvUTF8) + from_u8(custom_name) + wxString(")", wxConvUTF8);
plate_full_name << " " << plate_idx + 1;
} }
plate->SetName(plate_full_name); plate->SetName(plate_full_name);
} }

View File

@ -1059,9 +1059,12 @@ void Sidebar::update_all_preset_comboboxes()
wxString url; wxString url;
if (cfg.has("print_host_webui") && !cfg.opt_string("print_host_webui").empty()) { if (cfg.has("print_host_webui") && !cfg.opt_string("print_host_webui").empty()) {
url = cfg.opt_string("print_host_webui"); url = cfg.opt_string("print_host_webui");
} else { } else if (cfg.has("print_host") && !cfg.opt_string("print_host").empty()) {
url = cfg.opt_string("print_host"); url = cfg.opt_string("print_host");
} else {
;
} }
if(!url.empty()) if(!url.empty())
{ {
if(!url.Lower().starts_with("http")) if(!url.Lower().starts_with("http"))