FIX:Switching printer requires that cleared status of synchronization button

jira: STUDIO-12413
Change-Id: I86ad8125cd2b0b4c870cedd3b9b54c20c91dd9af
This commit is contained in:
zhou.xu 2025-05-27 15:34:38 +08:00 committed by lane.wei
parent fa66f5369f
commit b8d2657515

View File

@ -1271,7 +1271,8 @@ bool Sidebar::priv::sync_extruder_list(bool &only_external_material)
void Sidebar::priv::update_sync_status(const MachineObject *obj)
{
auto clear_all_sync_status = [this]() {
StateColor not_synced_colour(std::pair<wxColour, int>(wxColour("#00AE42"), StateColor::Normal));
auto clear_all_sync_status = [this, &not_synced_colour]() {
panel_printer_preset->ShowBadge(false);
panel_printer_bed->ShowBadge(false);
left_extruder->ShowBadge(false);
@ -1280,6 +1281,8 @@ void Sidebar::priv::update_sync_status(const MachineObject *obj)
right_extruder->sync_ams(nullptr, {}, {});
single_extruder->ShowBadge(false);
single_extruder->sync_ams(nullptr, {}, {});
btn_sync_printer->SetBorderColor(not_synced_colour);
btn_sync_printer->SetIcon("printer_sync");
};
if (!obj || !obj->is_info_ready()) {
@ -1426,7 +1429,6 @@ void Sidebar::priv::update_sync_status(const MachineObject *obj)
}
StateColor synced_colour(std::pair<wxColour, int>(wxColour("#CECECE"), StateColor::Normal));
StateColor not_synced_colour(std::pair<wxColour, int>(wxColour("#00AE42"), StateColor::Normal));
bool all_extruder_synced = std::all_of(extruder_synced.begin(), extruder_synced.end(), [](bool value) { return value; });
if (printer_synced && all_extruder_synced) {
btn_sync_printer->SetBorderColor(synced_colour);