FIX: the error display when reset virtual slot

jira: none
Change-Id: I5ae5899baf1bfc2aaadb832083b277855a669fd5
This commit is contained in:
zhimin.zeng 2024-04-15 19:39:56 +08:00 committed by Lane.Wei
parent 427deda14e
commit 8bdda5afb9
2 changed files with 16 additions and 6 deletions

View File

@ -13,6 +13,13 @@ namespace Slic3r { namespace GUI {
wxDEFINE_EVENT(EVT_SELECTED_COLOR, wxCommandEvent);
static std::string float_to_string_with_precision(float value, int precision = 3)
{
std::stringstream stream;
stream << std::fixed << std::setprecision(precision) << value;
return stream.str();
}
AMSMaterialsSetting::AMSMaterialsSetting(wxWindow *parent, wxWindowID id)
: DPIDialog(parent, id, _L("AMS Materials Setting"), wxDefaultPosition, wxDefaultSize, wxBORDER_NONE)
, m_color_picker_popup(ColorPickerPopup(this))
@ -940,8 +947,8 @@ void AMSMaterialsSetting::on_select_cali_result(wxCommandEvent &evt)
{
m_pa_cali_select_id = evt.GetSelection();
if (m_pa_cali_select_id >= 0) {
m_input_k_val->GetTextCtrl()->SetValue(std::to_string(m_pa_profile_items[m_pa_cali_select_id].k_value));
m_input_n_val->GetTextCtrl()->SetValue(std::to_string(m_pa_profile_items[m_pa_cali_select_id].n_coef));
m_input_k_val->GetTextCtrl()->SetValue(float_to_string_with_precision(m_pa_profile_items[m_pa_cali_select_id].k_value));
m_input_n_val->GetTextCtrl()->SetValue(float_to_string_with_precision(m_pa_profile_items[m_pa_cali_select_id].n_coef));
}
else{
m_input_k_val->GetTextCtrl()->SetValue(std::to_string(0.00));
@ -1030,6 +1037,8 @@ void AMSMaterialsSetting::on_select_filament(wxCommandEvent &evt)
m_button_confirm->SetBorderColor(wxColour(0x90, 0x90, 0x90));
m_comboBox_cali_result->Clear();
m_comboBox_cali_result->SetValue(wxEmptyString);
m_input_k_val->GetTextCtrl()->SetValue(wxEmptyString);
m_input_n_val->GetTextCtrl()->SetValue(wxEmptyString);
return;
}
else {
@ -1094,8 +1103,8 @@ void AMSMaterialsSetting::on_select_filament(wxCommandEvent &evt)
}
if (cali_select_idx >= 0) {
m_input_k_val->GetTextCtrl()->SetValue(std::to_string(m_pa_profile_items[cali_select_idx].k_value));
m_input_n_val->GetTextCtrl()->SetValue(std::to_string(m_pa_profile_items[cali_select_idx].n_coef));
m_input_k_val->GetTextCtrl()->SetValue(float_to_string_with_precision(m_pa_profile_items[cali_select_idx].k_value));
m_input_n_val->GetTextCtrl()->SetValue(float_to_string_with_precision(m_pa_profile_items[cali_select_idx].n_coef));
}
}
else {

View File

@ -711,13 +711,14 @@ void NewCalibrationHistoryDialog::on_ok(wxCommandEvent &event)
return item.name == m_new_result.name && item.filament_id == m_new_result.filament_id;
});
if (iter != curr_obj->pa_calib_tab.end()) {
if (iter != m_history_results.end()) {
MessageDialog msg_dlg(nullptr,
wxString::Format(_L("There is already a historical calibration result with the same name: %s. Only one of the results with the same name "
"is saved. Are you sure you want to override the historical result?"),
m_new_result.name),
wxEmptyString, wxICON_WARNING | wxYES_NO);
if (msg_dlg.ShowModal() != wxID_YES) return;
if (msg_dlg.ShowModal() != wxID_YES)
return;
}
}