Merge branch 'main' into feature/zaa-contouring

This commit is contained in:
SoftFever
2026-02-10 13:53:52 +08:00
committed by GitHub
26 changed files with 265 additions and 119 deletions
+24 -12
View File
@@ -3464,8 +3464,9 @@ void Sidebar::sync_ams_list(bool is_from_big_sync_btn)
}
MergeFilamentInfo merge_info;
std::vector<std::pair<DynamicPrintConfig *,std::string>> unknowns;
auto enable_append = wxGetApp().app_config->get_bool("enable_append_color_by_sync_ams");
auto n = wxGetApp().preset_bundle->sync_ams_list(unknowns, !sync_result.direct_sync, sync_result.sync_maps, enable_append, merge_info);
auto enable_append = wxGetApp().app_config->get_bool("enable_append_color_by_sync_ams");
auto sync_color_only = wxGetApp().app_config->get("sync_ams_filament_mode") == "1";
auto n = wxGetApp().preset_bundle->sync_ams_list(unknowns, !sync_result.direct_sync, sync_result.sync_maps, enable_append, merge_info, sync_color_only);
wxString detail;
for (auto & uk : unknowns) {
auto tray_name = uk.first->opt_string("tray_name", 0u);
@@ -3497,9 +3498,11 @@ void Sidebar::sync_ams_list(bool is_from_big_sync_btn)
_L("Sync filaments with AMS"), wxOK);
dlg.ShowModal();
}
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "on_filament_count_change";
wxGetApp().plater()->on_filament_count_change(n);
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "finish on_filament_count_change";
if (!sync_color_only) {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "on_filament_count_change";
wxGetApp().plater()->on_filament_count_change(n);
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "finish on_filament_count_change";
}
for (auto& c : p->combos_filament)
c->update();
// Expand filament list
@@ -3523,14 +3526,23 @@ void Sidebar::sync_ams_list(bool is_from_big_sync_btn)
}
Layout();
// Perform preset selection and list update first — these may rebuild combo widgets,
// which clears any badge state. Badges must be set AFTER these calls to persist.
wxGetApp().get_tab(Preset::TYPE_FILAMENT)->select_preset(wxGetApp().preset_bundle->filament_presets[0]);
wxGetApp().preset_bundle->export_selections(*wxGetApp().app_config);
update_dynamic_filament_list();
// For full sync, preset selection/list update may rebuild combo widgets.
// For color-only, keep current presets untouched and refresh colors only.
if (!sync_color_only) {
wxGetApp().get_tab(Preset::TYPE_FILAMENT)->select_preset(wxGetApp().preset_bundle->filament_presets[0]);
wxGetApp().preset_bundle->export_selections(*wxGetApp().app_config);
update_dynamic_filament_list();
} else {
wxGetApp().plater()->update_filament_colors_in_full_config();
for (auto &c : p->combos_filament)
c->update();
obj_list()->update_filament_colors();
update_dynamic_filament_list();
}
auto badge_combox_filament = [](PlaterPresetComboBox *c) {
auto tip = _L("Filament type and color information have been synchronized, but slot information is not included.");
auto badge_combox_filament = [sync_color_only](PlaterPresetComboBox *c) {
auto tip = sync_color_only ? _L("Only filament color information has been synchronized from printer.") :
_L("Filament type and color information have been synchronized, but slot information is not included.");
c->SetToolTip(tip);
c->ShowBadge(true);
};