FIX: Unable to edit existing flow calibration result
github: 6274 Change-Id: I96ef3e2f62a28ee8343c25799a75ddc940948c18
This commit is contained in:
parent
09313c8542
commit
27f60bd85b
|
@ -491,6 +491,7 @@ EditCalibrationHistoryDialog::EditCalibrationHistoryDialog(wxWindow
|
||||||
: DPIDialog(parent, wxID_ANY, _L("Edit Flow Dynamics Calibration"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE)
|
: DPIDialog(parent, wxID_ANY, _L("Edit Flow Dynamics Calibration"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE)
|
||||||
, m_new_result(result)
|
, m_new_result(result)
|
||||||
, m_history_results(history_results)
|
, m_history_results(history_results)
|
||||||
|
, m_old_name(result.name)
|
||||||
{
|
{
|
||||||
curr_obj = obj;
|
curr_obj = obj;
|
||||||
|
|
||||||
|
@ -617,21 +618,23 @@ void EditCalibrationHistoryDialog::on_save(wxCommandEvent& event) {
|
||||||
m_k_value->GetTextCtrl()->SetValue(k_str);
|
m_k_value->GetTextCtrl()->SetValue(k_str);
|
||||||
m_new_result.k_value = k;
|
m_new_result.k_value = k;
|
||||||
|
|
||||||
auto iter = std::find_if(m_history_results.begin(), m_history_results.end(), [this](const PACalibResult &item) {
|
if (m_new_result.name != m_old_name) {
|
||||||
bool has_same_name = item.name == m_new_result.name && item.filament_id == m_new_result.filament_id;
|
auto iter = std::find_if(m_history_results.begin(), m_history_results.end(), [this](const PACalibResult &item) {
|
||||||
if (curr_obj && curr_obj->is_multi_extruders()) {
|
bool has_same_name = item.name == m_new_result.name && item.filament_id == m_new_result.filament_id;
|
||||||
has_same_name &= (item.extruder_id == m_new_result.extruder_id && item.nozzle_volume_type == m_new_result.nozzle_volume_type);
|
if (curr_obj && curr_obj->is_multi_extruders()) {
|
||||||
}
|
has_same_name &= (item.extruder_id == m_new_result.extruder_id && item.nozzle_volume_type == m_new_result.nozzle_volume_type);
|
||||||
return has_same_name;
|
}
|
||||||
});
|
return has_same_name;
|
||||||
|
});
|
||||||
|
|
||||||
if (iter != m_history_results.end()) {
|
if (iter != m_history_results.end()) {
|
||||||
wxString duplicate_name_info = wxString::Format(
|
wxString duplicate_name_info = wxString::Format(_L("Within the same extruder, the name '%s' must be unique when the filament type, nozzle diameter, and nozzle flow "
|
||||||
_L("Within the same extruder, the name '%s' must be unique when the filament type, nozzle diameter, and nozzle flow are identical. Please choose a different name."),
|
"are identical. Please choose a different name."),
|
||||||
m_new_result.name);
|
m_new_result.name);
|
||||||
MessageDialog msg_dlg(nullptr, duplicate_name_info, wxEmptyString, wxICON_WARNING | wxOK);
|
MessageDialog msg_dlg(nullptr, duplicate_name_info, wxEmptyString, wxICON_WARNING | wxOK);
|
||||||
msg_dlg.ShowModal();
|
msg_dlg.ShowModal();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EndModal(wxID_OK);
|
EndModal(wxID_OK);
|
||||||
|
|
|
@ -54,6 +54,7 @@ protected:
|
||||||
virtual void on_cancel(wxCommandEvent& event);
|
virtual void on_cancel(wxCommandEvent& event);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
std::string m_old_name;
|
||||||
PACalibResult m_new_result;
|
PACalibResult m_new_result;
|
||||||
std::vector<PACalibResult> m_history_results;
|
std::vector<PACalibResult> m_history_results;
|
||||||
const MachineObject * curr_obj;
|
const MachineObject * curr_obj;
|
||||||
|
|
Loading…
Reference in New Issue