mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-08-08 14:29:01 +08:00
FIX: ENH: Cannot save when illegal characters in the preset name
Jira: 5981 Change-Id: I5cce1a258230ea2d23f6f2400a14dee7e53b7705
This commit is contained in:
parent
8aabee9982
commit
139df6a9a4
@ -519,7 +519,7 @@ std::string PresetBundle::get_hotend_model_for_printer_model(std::string model_n
|
||||
|
||||
PresetsConfigSubstitutions PresetBundle::load_user_presets(std::string user, ForwardCompatibilitySubstitutionRule substitution_rule)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << __LINE__ << " entry and user is: " << user;
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ", " << __LINE__ << " entry and user is: " << user;
|
||||
PresetsConfigSubstitutions substitutions;
|
||||
std::string errors_cummulative;
|
||||
|
||||
@ -3380,7 +3380,7 @@ std::pair<PresetsConfigSubstitutions, size_t> PresetBundle::load_vendor_configs_
|
||||
loaded.description = description;
|
||||
loaded.setting_id = setting_id;
|
||||
loaded.filament_id = filament_id;
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " " << __LINE__ << loaded.name << " load filament_id: " << filament_id;
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " " << __LINE__ << ", " << loaded.name << " load filament_id: " << filament_id;
|
||||
if (presets_collection->type() == Preset::TYPE_FILAMENT) {
|
||||
if (filament_id.empty() && "Template" != vendor_name) {
|
||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__<< ": can not find filament_id for " << preset_name;
|
||||
|
@ -85,7 +85,13 @@ SavePresetDialog::Item::Item(Preset::Type type, const std::string &suffix, wxBox
|
||||
m_input_ctrl = new ::TextInput(parent, from_u8(preset_name), wxEmptyString, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER);
|
||||
StateColor input_bg(std::pair<wxColour, int>(wxColour("#F0F0F1"), StateColor::Disabled), std::pair<wxColour, int>(*wxWHITE, StateColor::Enabled));
|
||||
m_input_ctrl->SetBackgroundColor(input_bg);
|
||||
m_input_ctrl->Bind(wxEVT_TEXT, [this](wxCommandEvent &) { update(); });
|
||||
m_input_ctrl->Bind(wxEVT_TEXT, [this](wxCommandEvent &) {
|
||||
update();
|
||||
if (m_can_save)
|
||||
m_parent->m_confirm->Enable();
|
||||
else
|
||||
m_parent->m_confirm->Disable();
|
||||
});
|
||||
m_input_ctrl->SetMinSize(wxSize(SAVE_PRESET_DIALOG_INPUT_SIZE));
|
||||
m_input_ctrl->SetMaxSize(wxSize(SAVE_PRESET_DIALOG_INPUT_SIZE));
|
||||
|
||||
@ -179,7 +185,7 @@ void SavePresetDialog::Item::update()
|
||||
|
||||
m_valid_type = Valid;
|
||||
wxString info_line;
|
||||
|
||||
m_can_save = true;
|
||||
const char *unusable_symbols = "<>[]:/\\|?*\"";
|
||||
|
||||
const std::string unusable_suffix = PresetCollection::get_suffix_modified(); //"(modified)";
|
||||
@ -187,6 +193,7 @@ void SavePresetDialog::Item::update()
|
||||
if (m_preset_name.find_first_of(unusable_symbols[i]) != std::string::npos) {
|
||||
info_line = _L("Name is invalid;") + "\n" + _L("illegal characters:") + " " + unusable_symbols;
|
||||
m_valid_type = NoValid;
|
||||
m_can_save = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -194,6 +201,7 @@ void SavePresetDialog::Item::update()
|
||||
if (m_valid_type == Valid && m_preset_name.find(unusable_suffix) != std::string::npos) {
|
||||
info_line = _L("Name is invalid;") + "\n" + _L("illegal suffix:") + "\n\t" + from_u8(PresetCollection::get_suffix_modified());
|
||||
m_valid_type = NoValid;
|
||||
m_can_save = false;
|
||||
}
|
||||
|
||||
if (m_valid_type == Valid &&
|
||||
@ -249,8 +257,13 @@ void SavePresetDialog::Item::update()
|
||||
m_radio_user->Disable();
|
||||
m_radio_project->Disable();
|
||||
} else {
|
||||
if (m_can_save) {
|
||||
m_radio_user->Enable();
|
||||
m_radio_project->Enable();
|
||||
} else {
|
||||
m_radio_user->Disable();
|
||||
m_radio_project->Disable();
|
||||
}
|
||||
|
||||
m_radio_user->SetValue(!m_save_to_project);
|
||||
m_radio_project->SetValue(m_save_to_project);
|
||||
@ -339,11 +352,14 @@ void SavePresetDialog::build(std::vector<Preset::Type> types, std::string suffix
|
||||
btns->Add(0, 0, 1, wxEXPAND, 5);
|
||||
|
||||
m_confirm = new Button(this, _L("OK"));
|
||||
StateColor btn_bg_green(std::pair<wxColour, int>(wxColour(27, 136, 68), StateColor::Pressed),
|
||||
StateColor btn_bg_green(std::pair<wxColour, int>(wxColour(144, 144, 144), StateColor::Disabled),
|
||||
std::pair<wxColour, int>(wxColour(27, 136, 68), StateColor::Pressed),
|
||||
std::pair<wxColour, int>(wxColour(61, 203, 115), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(wxColour(0, 174, 66), StateColor::Normal));
|
||||
StateColor btn_br_green(std::pair<wxColour, int>(wxColour(144, 144, 144), StateColor::Disabled),
|
||||
std::pair<wxColour, int>(wxColour(0, 174, 66), StateColor::Normal));
|
||||
m_confirm->SetBackgroundColor(btn_bg_green);
|
||||
m_confirm->SetBorderColor(wxColour(0, 174, 66));
|
||||
m_confirm->SetBorderColor(btn_br_green);
|
||||
m_confirm->SetTextColor(wxColour("#FFFFFE"));
|
||||
m_confirm->SetMinSize(SAVE_PRESET_DIALOG_BUTTON_SIZE);
|
||||
m_confirm->SetCornerRadius(FromDIP(12));
|
||||
|
@ -72,6 +72,7 @@ class SavePresetDialog : public DPIDialog
|
||||
RadioBox * m_radio_user{nullptr};
|
||||
RadioBox * m_radio_project{nullptr};
|
||||
bool m_save_to_project {false};
|
||||
bool m_can_save{true};
|
||||
|
||||
void update();
|
||||
};
|
||||
|
@ -772,14 +772,12 @@ void PrintingTaskPanel::market_scoring_show()
|
||||
{
|
||||
m_score_staticline->Show();
|
||||
m_score_subtask_info->Show();
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " show market scoring page";
|
||||
}
|
||||
|
||||
void PrintingTaskPanel::market_scoring_hide()
|
||||
{
|
||||
m_score_staticline->Hide();
|
||||
m_score_subtask_info->Hide();
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " hide market scoring page";
|
||||
}
|
||||
|
||||
void PrintingTaskPanel::set_star_count(int star_count)
|
||||
|
Loading…
x
Reference in New Issue
Block a user