mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-20 09:22:13 +00:00
FIX:fix crash for no valid filaments
jira: none Change-Id: I9433da99d2ad355f088917e88350c5fd36bd1aea (cherry picked from commit 52442fa6d58d4d9204c386ec1a2ccfedf7115151)
This commit is contained in:
@@ -2791,6 +2791,20 @@ void Sidebar::sync_ams_list(bool is_from_big_sync_btn)
|
||||
p->plater->pop_warning_and_go_to_device_page(printer_name, Plater::PrinterWarningType::NOT_CONNECTED, _L("Sync printer information"));
|
||||
return;
|
||||
}
|
||||
bool exist_at_list_one_filament =false;
|
||||
for (auto &cur : list) {
|
||||
auto temp_config = cur.second;
|
||||
auto filament_type = temp_config.opt_string("filament_type", 0u);
|
||||
auto filament_color = temp_config.opt_string("filament_colour", 0u);
|
||||
if (!filament_type.empty() || temp_config.opt_bool("filament_exist", 0u)) {
|
||||
exist_at_list_one_filament = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!exist_at_list_one_filament) {
|
||||
p->plater->pop_warning_and_go_to_device_page("", Plater::PrinterWarningType::EMPTY_FILAMENT, _L("Sync printer information"));
|
||||
return;
|
||||
}
|
||||
if (!wxGetApp().plater()->is_same_printer_for_connected_and_selected()) {
|
||||
return;
|
||||
}
|
||||
@@ -15325,6 +15339,10 @@ void Plater::pop_warning_and_go_to_device_page(wxString printer_name, PrinterWar
|
||||
|
||||
} else if (type == PrinterWarningType::INCONSISTENT) {
|
||||
content = wxString::Format(_L("The currently connected printer on the device page is not an %s. Please switch to an %s before syncing."), printer_name, printer_name);
|
||||
} else if (type == PrinterWarningType::UNINSTALL_FILAMENT) {
|
||||
content = _L("There are no filaments on the printer. Please load the filaments on the printer first.");
|
||||
} else if (type == PrinterWarningType::EMPTY_FILAMENT) {
|
||||
content = _L("The filaments on the printer are all unknown types. Please go to the printer screen or software device page to set the filament type.");
|
||||
}
|
||||
MessageDialog dlg(this, content, title, wxOK | wxFORWARD | wxICON_WARNING, _L("Device Page"));
|
||||
auto result = dlg.ShowModal();
|
||||
|
||||
Reference in New Issue
Block a user