ConfigWizard: Fixed validation of the custom printer name

+ Reload materials pages after load repositories from archive
(follow-up 61834d3f, SPE-2336)
This commit is contained in:
YuSanka 2024-06-05 10:13:19 +02:00
parent a6548a810c
commit de32cd70de
3 changed files with 16 additions and 6 deletions

View File

@ -1470,7 +1470,7 @@ PageCustom::PageCustom(ConfigWizard *parent)
auto *label = new wxStaticText(this, wxID_ANY, _L("Custom profile name:")); auto *label = new wxStaticText(this, wxID_ANY, _L("Custom profile name:"));
wxBoxSizer* profile_name_sizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer* profile_name_sizer = new wxBoxSizer(wxVERTICAL);
profile_name_editor = new SavePresetDialog::Item{ this, profile_name_sizer, default_profile_name }; profile_name_editor = new SavePresetDialog::Item{ this, profile_name_sizer, default_profile_name, &wxGetApp().preset_bundle->printers};
profile_name_editor->Enable(false); profile_name_editor->Enable(false);
cb_custom->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent &) { cb_custom->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent &) {
@ -3796,13 +3796,20 @@ void ConfigWizard::priv::load_pages_from_archive()
check_and_install_missing_materials(T_ANY); check_and_install_missing_materials(T_ANY);
update_materials(T_ANY); update_materials(T_ANY);
if (page_filaments) {
if (!page_filaments && !only_sla_mode) { if (any_fff_selected)
page_filaments->reload_presets();
}
else if(!only_sla_mode) {
add_page(page_filaments = new PageMaterials(q, &filaments, add_page(page_filaments = new PageMaterials(q, &filaments,
_L("Filament Profiles Selection"), _L("Filaments"), _L("Type:"))); _L("Filament Profiles Selection"), _L("Filaments"), _L("Type:")));
} }
if (!page_sla_materials) { if (page_sla_materials) {
if (any_sla_selected)
page_sla_materials->reload_presets();
}
else {
add_page(page_sla_materials = new PageMaterials(q, &sla_materials, add_page(page_sla_materials = new PageMaterials(q, &sla_materials,
_L("SLA Material Profiles Selection") + " ", _L("SLA Materials"), _L("Type:"))); _L("SLA Material Profiles Selection") + " ", _L("SLA Materials"), _L("Type:")));
} }

View File

@ -139,8 +139,9 @@ SavePresetDialog::Item::Item(Preset::Type type, const std::string& suffix, wxBox
update(); update();
} }
SavePresetDialog::Item::Item(wxWindow* parent, wxBoxSizer* sizer, const std::string& def_name, PrinterTechnology pt /*= ptFFF*/): SavePresetDialog::Item::Item(wxWindow* parent, wxBoxSizer* sizer, const std::string& def_name, PresetCollection* presets, PrinterTechnology pt /*= ptFFF*/):
m_preset_name(def_name), m_preset_name(def_name),
m_presets(presets),
m_printer_technology(pt), m_printer_technology(pt),
m_parent(parent), m_parent(parent),
m_valid_bmp(new wxStaticBitmap(m_parent, wxID_ANY, *get_bmp_bundle("tick_mark"))), m_valid_bmp(new wxStaticBitmap(m_parent, wxID_ANY, *get_bmp_bundle("tick_mark"))),
@ -152,6 +153,8 @@ SavePresetDialog::Item::Item(wxWindow* parent, wxBoxSizer* sizer, const std::str
input_name_sizer->Add(m_valid_bmp, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, BORDER_W); input_name_sizer->Add(m_valid_bmp, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, BORDER_W);
init_input_name_ctrl(input_name_sizer, m_preset_name); init_input_name_ctrl(input_name_sizer, m_preset_name);
init_casei_preset_names();
sizer->Add(input_name_sizer,0, wxEXPAND | wxBOTTOM, BORDER_W); sizer->Add(input_name_sizer,0, wxEXPAND | wxBOTTOM, BORDER_W);
sizer->Add(m_valid_label, 0, wxEXPAND | wxLEFT, 3*BORDER_W); sizer->Add(m_valid_label, 0, wxEXPAND | wxLEFT, 3*BORDER_W);

View File

@ -41,7 +41,7 @@ public:
}; };
Item(Preset::Type type, const std::string& suffix, wxBoxSizer* sizer, SavePresetDialog* parent, bool is_for_multiple_save); Item(Preset::Type type, const std::string& suffix, wxBoxSizer* sizer, SavePresetDialog* parent, bool is_for_multiple_save);
Item(wxWindow* parent, wxBoxSizer* sizer, const std::string& def_name, PrinterTechnology pt = ptFFF); Item(wxWindow* parent, wxBoxSizer* sizer, const std::string& def_name, PresetCollection* presets, PrinterTechnology pt = ptFFF);
void update_valid_bmp(); void update_valid_bmp();
void accept(); void accept();