FIX: reduce ams update
Change-Id: I6a3c34580df77135c3b56e9273edc7643d58eec3 Jira: STUDIO-10383
This commit is contained in:
parent
09c0b004cd
commit
c52e54e58a
|
@ -369,12 +369,12 @@ struct ExtruderGroup : StaticGroup
|
||||||
|
|
||||||
void set_ams_count(int n4, int n1)
|
void set_ams_count(int n4, int n1)
|
||||||
{
|
{
|
||||||
|
if (n4 == ams_n4 || n1 == ams_n1)
|
||||||
|
return;
|
||||||
ams_n4 = n4;
|
ams_n4 = n4;
|
||||||
ams_n1 = n1;
|
ams_n1 = n1;
|
||||||
|
|
||||||
if (btn_edit) {
|
if (btn_edit) {
|
||||||
if (GUI::wxGetApp().plater())
|
update_ams();
|
||||||
GUI::wxGetApp().plater()->update_machine_sync_status();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -967,6 +967,7 @@ ExtruderGroup::ExtruderGroup(wxWindow * parent, int index, wxString const &title
|
||||||
hsizer_ams->Add(label_ams, 0, wxALIGN_CENTER);
|
hsizer_ams->Add(label_ams, 0, wxALIGN_CENTER);
|
||||||
if (btn_edit)
|
if (btn_edit)
|
||||||
hsizer_ams->Add(btn_edit, 0, wxLEFT | wxALIGN_CENTER, FromDIP(2));
|
hsizer_ams->Add(btn_edit, 0, wxLEFT | wxALIGN_CENTER, FromDIP(2));
|
||||||
|
hsizer_ams->Add(ams_not_installed_msg, 0, wxALIGN_CENTER);
|
||||||
|
|
||||||
btn_up = new ScalableButton(this, wxID_ANY, "page_up", "", {-1, FromDIP(14)});
|
btn_up = new ScalableButton(this, wxID_ANY, "page_up", "", {-1, FromDIP(14)});
|
||||||
btn_up->SetBackgroundColour(*wxWHITE);
|
btn_up->SetBackgroundColour(*wxWHITE);
|
||||||
|
@ -1080,17 +1081,23 @@ void ExtruderGroup::update_ams()
|
||||||
|
|
||||||
void ExtruderGroup::sync_ams(MachineObject const *obj, std::vector<Ams *> const &ams4, std::vector<Ams *> const &ams1)
|
void ExtruderGroup::sync_ams(MachineObject const *obj, std::vector<Ams *> const &ams4, std::vector<Ams *> const &ams1)
|
||||||
{
|
{
|
||||||
auto sync = [obj](std::vector<AMSinfo> &infos, std::vector<Ams *> const &ams) {
|
if (ams_4.empty() && ams4.empty()
|
||||||
infos.clear();
|
&& ams_1.empty() && ams1.empty())
|
||||||
|
return;
|
||||||
|
auto sync = [obj](std::vector<AMSinfo> &infos, std::vector<Ams *> const &ams) -> bool {
|
||||||
|
std::vector<AMSinfo> infos2;
|
||||||
for (auto a : ams) {
|
for (auto a : ams) {
|
||||||
AMSinfo ams_info;
|
AMSinfo ams_info;
|
||||||
ams_info.parse_ams_info(const_cast<MachineObject*>(obj), a, obj->ams_calibrate_remain_flag, obj->is_support_ams_humidity);
|
ams_info.parse_ams_info(const_cast<MachineObject*>(obj), a, obj->ams_calibrate_remain_flag, obj->is_support_ams_humidity);
|
||||||
infos.push_back(ams_info);
|
infos.push_back(ams_info);
|
||||||
}
|
}
|
||||||
|
if (infos == infos2)
|
||||||
|
return false;
|
||||||
|
infos.swap(infos2);
|
||||||
|
return true;
|
||||||
};
|
};
|
||||||
sync(ams_4, ams4);
|
if (sync(ams_4, ams4) || sync(ams_1, ams1))
|
||||||
sync(ams_1, ams1);
|
update_ams();
|
||||||
update_ams();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sidebar::priv::switch_diameter(bool single)
|
bool Sidebar::priv::switch_diameter(bool single)
|
||||||
|
|
|
@ -26,7 +26,7 @@ void StaticGroup::ShowBadge(bool show)
|
||||||
badge->SetBackgroundColour("#F7F7F7");
|
badge->SetBackgroundColour("#F7F7F7");
|
||||||
LayoutBadge();
|
LayoutBadge();
|
||||||
}
|
}
|
||||||
if (badge)
|
if (badge && badge->IsShown() != show)
|
||||||
badge->Show(show);
|
badge->Show(show);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -75,8 +75,9 @@ void StaticGroup::PaintForeground(wxDC &dc, const struct tagRECT &rc)
|
||||||
|
|
||||||
void StaticGroup::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
void StaticGroup::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||||
{
|
{
|
||||||
|
auto size = GetSize();
|
||||||
wxStaticBox::DoSetSize(x, y, width, height, sizeFlags);
|
wxStaticBox::DoSetSize(x, y, width, height, sizeFlags);
|
||||||
if (badge)
|
if (badge && size != GetSize())
|
||||||
LayoutBadge();
|
LayoutBadge();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue