Fix: Switching between multi-extruder printers using tabs can cause t… (#7483)

fix: Switching between multi-extruder printers using tabs can cause the filament count to be incorrect.
This commit is contained in:
xiaoyeliu 2024-12-14 14:38:35 +08:00 committed by GitHub
parent ef28de69a5
commit 1af51d66c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 9 deletions

View file

@ -5115,8 +5115,14 @@ bool Tab::select_preset(std::string preset_name, bool delete_current /*=false*/,
// Orca: update presets for the selected printer
if (m_type == Preset::TYPE_PRINTER && wxGetApp().app_config->get_bool("remember_printer_config")) {
m_preset_bundle->update_selections(*wxGetApp().app_config);
wxGetApp().plater()->sidebar().on_filaments_change(m_preset_bundle->filament_presets.size());
m_preset_bundle->update_selections(*wxGetApp().app_config);
int extruders_count = m_preset_bundle->printers.get_edited_preset().config.opt<ConfigOptionFloats>("nozzle_diameter")->values.size();
if (extruders_count > 1) {
// multi tool
wxGetApp().plater()->sidebar().on_filaments_change(extruders_count);
} else {
wxGetApp().plater()->sidebar().on_filaments_change(m_preset_bundle->filament_presets.size());
}
}
load_current_preset();
@ -6098,8 +6104,9 @@ void Page::update_visibility(ConfigOptionMode mode, bool update_contolls_visibil
#ifdef __WXMSW__
if (!m_show) return;
// BBS: fix field control position
wxTheApp->CallAfter([this]() {
for (auto group : m_optgroups) {
auto groups = this->m_optgroups;
wxTheApp->CallAfter([groups]() {
for (auto group : groups) {
if (group->custom_ctrl) group->custom_ctrl->fixup_items_positions();
}
});