FIX: show the refill graph only if it's enabled
jira: [none] Change-Id: I8a1f015a92ac965972f6de46a143a6b0f02340a0
This commit is contained in:
parent
32597b43f9
commit
403a3b42e7
|
@ -1886,71 +1886,74 @@ void AmsReplaceMaterialDialog::update_to_nozzle(int nozzle_id)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// traverse the amd list
|
|
||||||
std::unordered_map<int, AmsTray*> id2tray;// tray id to tray
|
|
||||||
try
|
|
||||||
{
|
|
||||||
for (const auto& ams_info : m_obj->amsList)
|
|
||||||
{
|
|
||||||
int ams_device_id = atoi(ams_info.first.c_str());
|
|
||||||
if (ams_device_id < 128)
|
|
||||||
{
|
|
||||||
int ams_base_id = ams_device_id * 4;
|
|
||||||
for (auto tray_info : ams_info.second->trayList)
|
|
||||||
{
|
|
||||||
int tray_offset = atoi(tray_info.first.c_str());
|
|
||||||
id2tray[ams_base_id + tray_offset] = tray_info.second;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (ams_info.second->trayList.size() == 1)/*n3f*/
|
|
||||||
{
|
|
||||||
id2tray[ams_device_id] = ams_info.second->trayList.begin()->second;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (...) {}
|
|
||||||
|
|
||||||
//update group
|
//update group
|
||||||
int group_index = 0;
|
int group_index = 0;
|
||||||
m_groups_sizer->Clear(true);
|
m_groups_sizer->Clear(true);
|
||||||
const Extder& extder = m_obj->m_extder_data.extders[nozzle_id];
|
if (m_obj->is_support_filament_backup && m_obj->ams_auto_switch_filament_flag)
|
||||||
for (int filam : extder.filam_bak)
|
|
||||||
{
|
{
|
||||||
std::map<std::string, wxColour> group_info;
|
// traverse the amd list
|
||||||
std::string group_material;
|
std::unordered_map<int, AmsTray*> id2tray;// tray id to tray
|
||||||
bool is_in_tray = false;
|
try
|
||||||
|
|
||||||
//get color & material
|
|
||||||
const auto& trayid_group = _GetBackupStatus(filam);
|
|
||||||
for (const auto& elem : trayid_group)
|
|
||||||
{
|
{
|
||||||
if (elem.second)
|
for (const auto& ams_info : m_obj->amsList)
|
||||||
{
|
{
|
||||||
AmsTray* cur_tray = id2tray[elem.first];
|
int ams_device_id = atoi(ams_info.first.c_str());
|
||||||
if (cur_tray)
|
if (ams_device_id < 128)
|
||||||
{
|
{
|
||||||
auto tray_name = wxGetApp().transition_tridid(elem.first, elem.first > 127).ToStdString();
|
int ams_base_id = ams_device_id * 4;
|
||||||
auto it = std::find(m_tray_used.begin(), m_tray_used.end(), tray_name);
|
for (auto tray_info : ams_info.second->trayList)
|
||||||
if (it != m_tray_used.end())
|
|
||||||
{
|
{
|
||||||
is_in_tray = true;
|
int tray_offset = atoi(tray_info.first.c_str());
|
||||||
|
id2tray[ams_base_id + tray_offset] = tray_info.second;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
group_info[tray_name] = AmsTray::decode_color(cur_tray->color);
|
else if (ams_info.second->trayList.size() == 1)/*n3f*/
|
||||||
group_material = cur_tray->get_display_filament_type();
|
{
|
||||||
|
id2tray[ams_device_id] = ams_info.second->trayList.begin()->second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (...) {}
|
||||||
|
|
||||||
if (group_info.size() < 2) /* do not show refill if there is one tray*/
|
const Extder& extder = m_obj->m_extder_data.extders[nozzle_id];
|
||||||
|
for (int filam : extder.filam_bak)
|
||||||
{
|
{
|
||||||
continue;
|
std::map<std::string, wxColour> group_info;
|
||||||
}
|
std::string group_material;
|
||||||
|
bool is_in_tray = false;
|
||||||
|
|
||||||
if (is_in_tray || m_tray_used.size() <= 0)
|
//get color & material
|
||||||
{
|
const auto& trayid_group = _GetBackupStatus(filam);
|
||||||
m_groups_sizer->Add(create_backup_group(wxString::Format("%s%d", _L("Group"), group_index + 1), group_info, group_material), 0, wxALL, FromDIP(10));
|
for (const auto& elem : trayid_group)
|
||||||
group_index++;
|
{
|
||||||
|
if (elem.second)
|
||||||
|
{
|
||||||
|
AmsTray* cur_tray = id2tray[elem.first];
|
||||||
|
if (cur_tray)
|
||||||
|
{
|
||||||
|
auto tray_name = wxGetApp().transition_tridid(elem.first, elem.first > 127).ToStdString();
|
||||||
|
auto it = std::find(m_tray_used.begin(), m_tray_used.end(), tray_name);
|
||||||
|
if (it != m_tray_used.end())
|
||||||
|
{
|
||||||
|
is_in_tray = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
group_info[tray_name] = AmsTray::decode_color(cur_tray->color);
|
||||||
|
group_material = cur_tray->get_display_filament_type();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (group_info.size() < 2) /* do not show refill if there is one tray*/
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_in_tray || m_tray_used.size() <= 0)
|
||||||
|
{
|
||||||
|
m_groups_sizer->Add(create_backup_group(wxString::Format("%s%d", _L("Group"), group_index + 1), group_info, group_material), 0, wxALL, FromDIP(10));
|
||||||
|
group_index++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue