From a6a3f443d7202c8c831f166b8ce335b563c910c5 Mon Sep 17 00:00:00 2001 From: "maosheng.wei" Date: Tue, 12 Dec 2023 10:48:21 +0800 Subject: [PATCH] FIX: Allow vendors that are not entirely numerical github: #3082 Change-Id: I318f4df7f65c934ab6703e0970d775b754b24276 --- src/slic3r/GUI/CreatePresetsDialog.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/CreatePresetsDialog.cpp b/src/slic3r/GUI/CreatePresetsDialog.cpp index b48fb8bb7..927807c24 100644 --- a/src/slic3r/GUI/CreatePresetsDialog.cpp +++ b/src/slic3r/GUI/CreatePresetsDialog.cpp @@ -121,6 +121,13 @@ static std::string remove_special_key(const std::string &str) return res_str; } +static bool str_is_all_digit(const std::string &str) { + for (const char &c : str) { + if (!std::isdigit(c)) return false; + } + return true; +} + static bool delete_filament_preset_by_name(std::string delete_preset_name, std::string &selected_preset_name) { BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format("select preset, name %1%") % delete_preset_name; @@ -980,7 +987,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_button_item() dlg.ShowModal(); return; } - if (m_can_not_find_vendor_checkbox->GetValue() && vendor_name[0] >= '0' && vendor_name[0] <= '9') { + if (m_can_not_find_vendor_checkbox->GetValue() && str_is_all_digit(vendor_name)) { MessageDialog dlg(this, _L("The beginning of the vendor can not be a number. Please re-enter."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxYES | wxYES_DEFAULT | wxCENTRE); dlg.ShowModal();