ENH:add protection when update task data

jira:[STUDIO-4517]

Change-Id: I183d18a0d9a547328f48a9086548b80bab375b06
This commit is contained in:
tao wang 2023-09-19 15:38:54 +08:00 committed by Lane.Wei
parent 13dc92363c
commit ac876996ce
1 changed files with 5 additions and 28 deletions

View File

@ -1922,13 +1922,10 @@ void StatusPanel::update(MachineObject *obj)
|| obj->is_support_build_plate_marker_detect
|| obj->is_support_auto_recovery_step_loss) {
m_options_btn->Show();
if (print_options_dlg == nullptr) {
print_options_dlg = new PrintOptionsDialog(this);
print_options_dlg->update_machine_obj(obj);
} else {
if (print_options_dlg) {
print_options_dlg->update_machine_obj(obj);
print_options_dlg->update_options(obj);
}
print_options_dlg->update_options(obj);
} else {
m_options_btn->Hide();
}
@ -1956,33 +1953,11 @@ void StatusPanel::update(MachineObject *obj)
if (iter_connect_type != m_print_connect_types.end()) {
if (iter_connect_type->second != obj->dev_connection_type) {
//lan = > cloud
if (iter_connect_type->second == "lan" && obj->dev_connection_type == "cloud") {
/*wxString txt = _L("Disconnected from printer [%s] due to LAN mode disabled.Please reconnect the printer by logging in with your user account.");
wxString msg = wxString::Format(txt, obj->dev_name);
if (!m_show_mode_changed) {
m_show_mode_changed = true;
MessageDialog msg_wingow(nullptr, msg, wxEmptyString, wxICON_WARNING | wxOK);
msg_wingow.SetSize(wxSize(FromDIP(600), FromDIP(200)));
if (msg_wingow.ShowModal() == wxID_OK || msg_wingow.ShowModal() == wxID_CLOSE) {
m_show_mode_changed = false;
}
}*/
m_print_connect_types[obj->dev_id] = obj->dev_connection_type;
}
//cloud = > lan
if (iter_connect_type->second == "cloud" && obj->dev_connection_type == "lan") {
/*wxString txt = _L("Disconnected from printer [%s] due to LAN mode enabled.Please reconnect the printer by inputting Access Code which can be gotten from printer screen.");
wxString msg = wxString::Format(txt, obj->dev_name);
if (!m_show_mode_changed) {
m_show_mode_changed = true;
MessageDialog msg_wingow(nullptr, msg, wxEmptyString, wxICON_WARNING | wxOK);
msg_wingow.SetSize(wxSize(FromDIP(600), FromDIP(200)));
if (msg_wingow.ShowModal() == wxID_OK || msg_wingow.ShowModal() == wxID_CLOSE) {
m_show_mode_changed = false;
}
}*/
m_print_connect_types[obj->dev_id] = obj->dev_connection_type;
}
}
@ -2719,7 +2694,9 @@ void StatusPanel::update_basic_print_data(bool def)
void StatusPanel::update_model_info()
{
auto get_subtask_fn = [this](BBLModelTask* subtask) {
obj->set_modeltask(subtask);
if (obj && obj->subtask_id_ == subtask->task_id) {
obj->set_modeltask(subtask);
}
};