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;
if (cfg.has("print_host_webui") && !cfg.opt_string("print_host_webui").empty()) {
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 {
url = cfg.opt_string("print_host");
;
}
if (url.empty()) {
wxString url = wxString::Format("file://%s/web/device/missing_connection.html", from_u8(resources_dir()));

View File

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

View File

@ -1059,9 +1059,12 @@ void Sidebar::update_all_preset_comboboxes()
wxString url;
if (cfg.has("print_host_webui") && !cfg.opt_string("print_host_webui").empty()) {
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");
} else {
;
}
if(!url.empty())
{
if(!url.Lower().starts_with("http"))