Make printer profile swithing faster (#14437)

* Fix issue that switching printer profile is slow.
`wxGetApp().get_tab(preset_type)->select_preset(preset_name);` is called twice when switching printer profiles. Only one needed.

* Avoid unnecessary type conversion & function call during printer profile switching:
- Don't call `config->opt_string("printer_model")` repeatedly
- Use ref when possible during iterating
- Avoid unnecessary `wxString` to `std::string` conversion
This commit is contained in:
Noisyfox
2026-07-13 09:52:18 +08:00
committed by GitHub
parent 78692aa08f
commit 6a254c35d4
3 changed files with 16 additions and 15 deletions

View File

@@ -9684,11 +9684,14 @@ void Plater::priv::on_select_preset(wxCommandEvent &evt)
}
}
}
} else {
// BBS
// wxWindowUpdateLocker noUpdates1(sidebar->print_panel());
wxWindowUpdateLocker noUpdates2(sidebar->filament_panel());
wxGetApp().get_tab(preset_type)->select_preset(preset_name);
// update plater with new config
q->on_config_change(wxGetApp().preset_bundle->full_config());
}
//BBS
//wxWindowUpdateLocker noUpdates1(sidebar->print_panel());
wxWindowUpdateLocker noUpdates2(sidebar->filament_panel());
wxGetApp().get_tab(preset_type)->select_preset(preset_name);
}
// ORCA: Always refresh the selected filament combo so its color swatch (clr_picker)