NEW: [4073] create new nozzle for exist printer
Jira: STUDIO-4073 Change-Id: Idee8067faf96d75cdf20928559c05debcf9b3f3b
This commit is contained in:
parent
00e9062e15
commit
adbed9c88d
|
@ -2150,7 +2150,7 @@ bool PresetCollection::create_presets_from_template_for_printer(std::vector<Pres
|
||||||
bool force_rewritten)
|
bool force_rewritten)
|
||||||
{
|
{
|
||||||
return clone_presets(templates, failures, [printer, create_filament_id](Preset &preset, Preset::Type &type) {
|
return clone_presets(templates, failures, [printer, create_filament_id](Preset &preset, Preset::Type &type) {
|
||||||
preset.name = preset.name.substr(0, preset.name.find("@")) + " @" + printer;
|
preset.name = preset.name.substr(0, preset.name.find(" @")) + " @" + printer;
|
||||||
auto *compatible_printers = dynamic_cast<ConfigOptionStrings *>(preset.config.option("compatible_printers"));
|
auto *compatible_printers = dynamic_cast<ConfigOptionStrings *>(preset.config.option("compatible_printers"));
|
||||||
compatible_printers->values = std::vector<std::string>{ printer };
|
compatible_printers->values = std::vector<std::string>{ printer };
|
||||||
preset.is_visible = true;
|
preset.is_visible = true;
|
||||||
|
@ -2882,6 +2882,21 @@ const Preset* PrinterPresetCollection::find_system_preset_by_model_and_variant(c
|
||||||
return it != cend() ? &*it : nullptr;
|
return it != cend() ? &*it : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Preset *PrinterPresetCollection::find_custom_preset_by_model_and_variant(const std::string &model_id, const std::string &variant) const
|
||||||
|
{
|
||||||
|
if (model_id.empty()) { return nullptr; }
|
||||||
|
|
||||||
|
const auto it = std::find_if(cbegin(), cend(), [&](const Preset &preset) {
|
||||||
|
if (preset.config.opt_string("printer_model") != model_id)
|
||||||
|
return false;
|
||||||
|
if (variant.empty())
|
||||||
|
return true;
|
||||||
|
return preset.config.opt_string("printer_variant") == variant;
|
||||||
|
});
|
||||||
|
|
||||||
|
return it != cend() ? &*it : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
bool PrinterPresetCollection::only_default_printers() const
|
bool PrinterPresetCollection::only_default_printers() const
|
||||||
{
|
{
|
||||||
for (const auto& printer : get_presets()) {
|
for (const auto& printer : get_presets()) {
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#define PRESET_PROFILES_DIR "profiles"
|
#define PRESET_PROFILES_DIR "profiles"
|
||||||
#define PRESET_PROFILES_TEMOLATE_DIR "profiles_template"
|
#define PRESET_PROFILES_TEMOLATE_DIR "profiles_template"
|
||||||
#define PRESET_TEMPLATE_DIR "Template"
|
#define PRESET_TEMPLATE_DIR "Template"
|
||||||
|
#define PRESET_CUSTOM_VENDOR "Custom"
|
||||||
|
|
||||||
//BBS: iot preset type strings
|
//BBS: iot preset type strings
|
||||||
#define PRESET_IOT_PRINTER_TYPE "printer"
|
#define PRESET_IOT_PRINTER_TYPE "printer"
|
||||||
|
@ -777,6 +778,7 @@ public:
|
||||||
const Preset& default_preset_for(const DynamicPrintConfig &config) const override;
|
const Preset& default_preset_for(const DynamicPrintConfig &config) const override;
|
||||||
|
|
||||||
const Preset* find_system_preset_by_model_and_variant(const std::string &model_id, const std::string &variant) const;
|
const Preset* find_system_preset_by_model_and_variant(const std::string &model_id, const std::string &variant) const;
|
||||||
|
const Preset* find_custom_preset_by_model_and_variant(const std::string &model_id, const std::string &variant) const;
|
||||||
|
|
||||||
bool only_default_printers() const;
|
bool only_default_printers() const;
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -1324,8 +1324,8 @@ std::pair<PresetsConfigSubstitutions, std::string> PresetBundle::load_system_fil
|
||||||
VendorProfile PresetBundle::get_custom_vendor_models() const
|
VendorProfile PresetBundle::get_custom_vendor_models() const
|
||||||
{
|
{
|
||||||
VendorProfile vendor;
|
VendorProfile vendor;
|
||||||
vendor.name = "Custom";
|
vendor.name = PRESET_CUSTOM_VENDOR;
|
||||||
vendor.id = "Custom";
|
vendor.id = PRESET_CUSTOM_VENDOR;
|
||||||
for (auto &preset : printers.get_presets()) {
|
for (auto &preset : printers.get_presets()) {
|
||||||
if (preset.is_system) continue;
|
if (preset.is_system) continue;
|
||||||
if (printers.get_preset_base(preset) != &preset) continue;
|
if (printers.get_preset_base(preset) != &preset) continue;
|
||||||
|
@ -1336,7 +1336,9 @@ VendorProfile PresetBundle::get_custom_vendor_models() const
|
||||||
});
|
});
|
||||||
if (iter_model == vendor.models.end()) {
|
if (iter_model == vendor.models.end()) {
|
||||||
iter_model = vendor.models.emplace(vendor.models.end(), VendorProfile::PrinterModel{});
|
iter_model = vendor.models.emplace(vendor.models.end(), VendorProfile::PrinterModel{});
|
||||||
|
iter_model->id = model;
|
||||||
iter_model->name = model;
|
iter_model->name = model;
|
||||||
|
iter_model->variants = {VendorProfile::PrinterVariant(variant)};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return vendor;
|
return vendor;
|
||||||
|
|
|
@ -166,8 +166,9 @@ static wxArrayString get_exist_vendor_choices(VendorMap& vendors)
|
||||||
{
|
{
|
||||||
wxArrayString choices;
|
wxArrayString choices;
|
||||||
PresetBundle temp_preset_bundle;
|
PresetBundle temp_preset_bundle;
|
||||||
std::pair<PresetsConfigSubstitutions, std::string> system_models = temp_preset_bundle.load_system_models_from_json(ForwardCompatibilitySubstitutionRule::EnableSystemSilent);
|
temp_preset_bundle.load_system_models_from_json(ForwardCompatibilitySubstitutionRule::EnableSystemSilent);
|
||||||
PresetBundle * preset_bundle = wxGetApp().preset_bundle;
|
PresetBundle *preset_bundle = wxGetApp().preset_bundle;
|
||||||
|
|
||||||
VendorProfile users_models = preset_bundle->get_custom_vendor_models();
|
VendorProfile users_models = preset_bundle->get_custom_vendor_models();
|
||||||
|
|
||||||
vendors = temp_preset_bundle.vendors;
|
vendors = temp_preset_bundle.vendors;
|
||||||
|
@ -1115,12 +1116,16 @@ void CreatePrinterPresetDialog::create_printer_page1(wxWindow *parent)
|
||||||
m_page1_sizer->Add(create_type_item(parent), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5));
|
m_page1_sizer->Add(create_type_item(parent), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5));
|
||||||
m_page1_sizer->Add(create_printer_item(parent), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5));
|
m_page1_sizer->Add(create_printer_item(parent), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5));
|
||||||
m_page1_sizer->Add(create_nozzle_diameter_item(parent), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5));
|
m_page1_sizer->Add(create_nozzle_diameter_item(parent), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5));
|
||||||
m_page1_sizer->Add(create_bed_shape_item(parent), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5));
|
m_printer_info_panel = new wxPanel(parent);
|
||||||
m_page1_sizer->Add(create_bed_size_item(parent), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5));
|
m_printer_info_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
m_page1_sizer->Add(create_origin_item(parent), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5));
|
m_printer_info_sizer->Add(create_bed_shape_item(m_printer_info_panel), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5));
|
||||||
m_page1_sizer->Add(create_hot_bed_stl_item(parent), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5));
|
m_printer_info_sizer->Add(create_bed_size_item(m_printer_info_panel), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5));
|
||||||
m_page1_sizer->Add(create_hot_bed_svg_item(parent), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5));
|
m_printer_info_sizer->Add(create_origin_item(m_printer_info_panel), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5));
|
||||||
m_page1_sizer->Add(create_max_print_height_item(parent), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5));
|
m_printer_info_sizer->Add(create_hot_bed_stl_item(m_printer_info_panel), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5));
|
||||||
|
m_printer_info_sizer->Add(create_hot_bed_svg_item(m_printer_info_panel), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5));
|
||||||
|
m_printer_info_sizer->Add(create_max_print_height_item(m_printer_info_panel), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5));
|
||||||
|
m_printer_info_panel->SetSizer(m_printer_info_sizer);
|
||||||
|
m_page1_sizer->Add(m_printer_info_panel, 0, wxEXPAND, 0);
|
||||||
m_page1_sizer->Add(create_page1_btns_item(parent), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5));
|
m_page1_sizer->Add(create_page1_btns_item(parent), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5));
|
||||||
|
|
||||||
parent->SetSizerAndFit(m_page1_sizer);
|
parent->SetSizerAndFit(m_page1_sizer);
|
||||||
|
@ -1208,10 +1213,36 @@ wxBoxSizer *CreatePrinterPresetDialog::create_printer_item(wxWindow *parent)
|
||||||
m_select_printer->SetLabelColor(DEFAULT_PROMPT_TEXT_COLOUR);
|
m_select_printer->SetLabelColor(DEFAULT_PROMPT_TEXT_COLOUR);
|
||||||
m_select_printer->Bind(wxEVT_COMBOBOX, [this](wxCommandEvent e) {
|
m_select_printer->Bind(wxEVT_COMBOBOX, [this](wxCommandEvent e) {
|
||||||
m_select_printer->SetLabelColor(*wxBLACK);
|
m_select_printer->SetLabelColor(*wxBLACK);
|
||||||
|
|
||||||
e.Skip();
|
e.Skip();
|
||||||
});
|
});
|
||||||
m_select_printer->Hide();
|
m_select_printer->Hide();
|
||||||
|
|
||||||
|
m_custom_vendor_text_ctrl = new wxTextCtrl(parent, wxID_ANY, "", wxDefaultPosition, NAME_OPTION_COMBOBOX_SIZE);
|
||||||
|
m_custom_vendor_text_ctrl->SetHint(_L("Input custom vendor"));
|
||||||
|
m_custom_vendor_text_ctrl->Bind(wxEVT_CHAR, [this](wxKeyEvent &event) {
|
||||||
|
int key = event.GetKeyCode();
|
||||||
|
if (key == 64) { // "@" can not be inputed
|
||||||
|
event.Skip(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
event.Skip();
|
||||||
|
});
|
||||||
|
comboBoxSizer->Add(m_custom_vendor_text_ctrl, 0, wxEXPAND | wxALL, 0);
|
||||||
|
m_custom_vendor_text_ctrl->Hide();
|
||||||
|
m_custom_model_text_ctrl = new wxTextCtrl(parent, wxID_ANY, "", wxDefaultPosition, NAME_OPTION_COMBOBOX_SIZE);
|
||||||
|
m_custom_model_text_ctrl->SetHint(_L("Input custom model"));
|
||||||
|
m_custom_model_text_ctrl->Bind(wxEVT_CHAR, [this](wxKeyEvent &event) {
|
||||||
|
int key = event.GetKeyCode();
|
||||||
|
if (key == 64) { // "@" can not be inputed
|
||||||
|
event.Skip(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
event.Skip();
|
||||||
|
});
|
||||||
|
comboBoxSizer->Add(m_custom_model_text_ctrl, 0, wxEXPAND | wxLEFT, FromDIP(5));
|
||||||
|
m_custom_model_text_ctrl->Hide();
|
||||||
|
|
||||||
vertical_sizer->Add(comboBoxSizer, 0, wxEXPAND, 0);
|
vertical_sizer->Add(comboBoxSizer, 0, wxEXPAND, 0);
|
||||||
|
|
||||||
wxBoxSizer *checkbox_sizer = new wxBoxSizer(wxHORIZONTAL);
|
wxBoxSizer *checkbox_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
@ -1228,31 +1259,20 @@ wxBoxSizer *CreatePrinterPresetDialog::create_printer_item(wxWindow *parent)
|
||||||
m_can_not_find_vendor_text->Wrap(-1);
|
m_can_not_find_vendor_text->Wrap(-1);
|
||||||
checkbox_sizer->Add(m_can_not_find_vendor_text, 0, wxALIGN_CENTER, 0);
|
checkbox_sizer->Add(m_can_not_find_vendor_text, 0, wxALIGN_CENTER, 0);
|
||||||
|
|
||||||
m_custom_vendor_model = new wxTextCtrl(parent, wxID_ANY, "", wxDefaultPosition, NAME_OPTION_COMBOBOX_SIZE);
|
|
||||||
m_custom_vendor_model->SetHint(_L("Input Printer Vendor and Model"));
|
|
||||||
checkbox_sizer->Add(m_custom_vendor_model, 0, wxLEFT | wxALIGN_CENTER, FromDIP(13));
|
|
||||||
m_custom_vendor_model->Hide();
|
|
||||||
m_custom_vendor_model->Bind(wxEVT_CHAR, [this](wxKeyEvent &event) {
|
|
||||||
int key = event.GetKeyCode();
|
|
||||||
if (key == 64) { // "@" can not be inputed
|
|
||||||
event.Skip(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
event.Skip();
|
|
||||||
});
|
|
||||||
|
|
||||||
m_can_not_find_vendor_combox->Bind(wxEVT_TOGGLEBUTTON, [this](wxCommandEvent &e) {
|
m_can_not_find_vendor_combox->Bind(wxEVT_TOGGLEBUTTON, [this](wxCommandEvent &e) {
|
||||||
bool value = m_can_not_find_vendor_combox->GetValue();
|
bool value = m_can_not_find_vendor_combox->GetValue();
|
||||||
if (value) {
|
if (value) {
|
||||||
m_can_not_find_vendor_combox->SetValue(true);
|
m_can_not_find_vendor_combox->SetValue(true);
|
||||||
m_custom_vendor_model->Show();
|
m_custom_vendor_text_ctrl->Show();
|
||||||
m_select_vendor->Enable(false);
|
m_custom_model_text_ctrl->Show();
|
||||||
m_select_model->Enable(false);
|
m_select_vendor->Hide();
|
||||||
|
m_select_model->Hide();
|
||||||
} else {
|
} else {
|
||||||
m_can_not_find_vendor_combox->SetValue(false);
|
m_can_not_find_vendor_combox->SetValue(false);
|
||||||
m_custom_vendor_model->Hide();
|
m_custom_vendor_text_ctrl->Hide();
|
||||||
m_select_vendor->Enable(true);
|
m_custom_model_text_ctrl->Hide();
|
||||||
m_select_model->Enable(true);
|
m_select_vendor->Show();
|
||||||
|
m_select_model->Show();
|
||||||
}
|
}
|
||||||
Refresh();
|
Refresh();
|
||||||
Layout();
|
Layout();
|
||||||
|
@ -1553,6 +1573,12 @@ bool CreatePrinterPresetDialog::load_system_and_user_presets_with_curr_model(Pre
|
||||||
{
|
{
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " is load template: "<< just_template;
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " is load template: "<< just_template;
|
||||||
std::string selected_vendor_id;
|
std::string selected_vendor_id;
|
||||||
|
std::string preset_path;
|
||||||
|
if (m_printer_preset) {
|
||||||
|
delete m_printer_preset;
|
||||||
|
m_printer_preset = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
std::string curr_selected_model = into_u8(m_printer_model->GetStringSelection());
|
std::string curr_selected_model = into_u8(m_printer_model->GetStringSelection());
|
||||||
int nozzle_index = curr_selected_model.find_first_of("@");
|
int nozzle_index = curr_selected_model.find_first_of("@");
|
||||||
std::string select_model = curr_selected_model.substr(0, nozzle_index - 1);
|
std::string select_model = curr_selected_model.substr(0, nozzle_index - 1);
|
||||||
|
@ -1568,9 +1594,15 @@ bool CreatePrinterPresetDialog::load_system_and_user_presets_with_curr_model(Pre
|
||||||
dlg.ShowModal();
|
dlg.ShowModal();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool is_custom_vendor = false;
|
||||||
|
if (PRESET_CUSTOM_VENDOR == m_printer_preset_vendor_selected.name || PRESET_CUSTOM_VENDOR == m_printer_preset_vendor_selected.id) {
|
||||||
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " select custom vendor ";
|
||||||
|
is_custom_vendor = true;
|
||||||
|
temp_preset_bundle = *(wxGetApp().preset_bundle);
|
||||||
|
} else {
|
||||||
selected_vendor_id = m_printer_preset_vendor_selected.id;
|
selected_vendor_id = m_printer_preset_vendor_selected.id;
|
||||||
|
|
||||||
std::string preset_path;
|
|
||||||
if (boost::filesystem::exists(boost::filesystem::path(Slic3r::data_dir()) / PRESET_SYSTEM_DIR / selected_vendor_id)) {
|
if (boost::filesystem::exists(boost::filesystem::path(Slic3r::data_dir()) / PRESET_SYSTEM_DIR / selected_vendor_id)) {
|
||||||
preset_path = (boost::filesystem::path(Slic3r::data_dir()) / PRESET_SYSTEM_DIR).string();
|
preset_path = (boost::filesystem::path(Slic3r::data_dir()) / PRESET_SYSTEM_DIR).string();
|
||||||
} else if (boost::filesystem::exists(boost::filesystem::path(Slic3r::resources_dir()) / "profiles" / selected_vendor_id)) {
|
} else if (boost::filesystem::exists(boost::filesystem::path(Slic3r::resources_dir()) / "profiles" / selected_vendor_id)) {
|
||||||
|
@ -1579,7 +1611,8 @@ bool CreatePrinterPresetDialog::load_system_and_user_presets_with_curr_model(Pre
|
||||||
|
|
||||||
if (preset_path.empty()) {
|
if (preset_path.empty()) {
|
||||||
BOOST_LOG_TRIVIAL(info) << "Preset path is not find";
|
BOOST_LOG_TRIVIAL(info) << "Preset path is not find";
|
||||||
MessageDialog dlg(this, _L("Preset path is not find, please reselect vendor."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxYES_NO | wxYES_DEFAULT | wxCENTRE);
|
MessageDialog dlg(this, _L("Preset path is not find, please reselect vendor."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"),
|
||||||
|
wxYES_NO | wxYES_DEFAULT | wxCENTRE);
|
||||||
dlg.ShowModal();
|
dlg.ShowModal();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1589,7 +1622,8 @@ bool CreatePrinterPresetDialog::load_system_and_user_presets_with_curr_model(Pre
|
||||||
ForwardCompatibilitySubstitutionRule::EnableSilent);
|
ForwardCompatibilitySubstitutionRule::EnableSilent);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "load vendor fonfigs form json failed";
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "load vendor fonfigs form json failed";
|
||||||
MessageDialog dlg(this, _L("The printer model was not found, please reselect."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxYES_NO | wxYES_DEFAULT | wxCENTRE);
|
MessageDialog dlg(this, _L("The printer model was not found, please reselect."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"),
|
||||||
|
wxYES_NO | wxYES_DEFAULT | wxCENTRE);
|
||||||
dlg.ShowModal();
|
dlg.ShowModal();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1604,7 +1638,8 @@ bool CreatePrinterPresetDialog::load_system_and_user_presets_with_curr_model(Pre
|
||||||
temp_preset_bundle.load_user_presets(dir_user_presets, ForwardCompatibilitySubstitutionRule::EnableSilent);
|
temp_preset_bundle.load_user_presets(dir_user_presets, ForwardCompatibilitySubstitutionRule::EnableSilent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
//get model varient
|
||||||
std::string model_varient = into_u8(m_printer_model->GetStringSelection());
|
std::string model_varient = into_u8(m_printer_model->GetStringSelection());
|
||||||
size_t index_at = model_varient.find(" @ ");
|
size_t index_at = model_varient.find(" @ ");
|
||||||
size_t index_nozzle = model_varient.find("nozzle");
|
size_t index_nozzle = model_varient.find("nozzle");
|
||||||
|
@ -1618,7 +1653,8 @@ bool CreatePrinterPresetDialog::load_system_and_user_presets_with_curr_model(Pre
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Preset *temp_printer_preset = temp_preset_bundle.printers.find_system_preset_by_model_and_variant(m_printer_preset_model_selected.id, varient);
|
const Preset *temp_printer_preset = is_custom_vendor ? temp_preset_bundle.printers.find_custom_preset_by_model_and_variant(m_printer_preset_model_selected.id, varient) :
|
||||||
|
temp_preset_bundle.printers.find_system_preset_by_model_and_variant(m_printer_preset_model_selected.id, varient);
|
||||||
|
|
||||||
if (temp_printer_preset) {
|
if (temp_printer_preset) {
|
||||||
m_printer_preset = new Preset(*temp_printer_preset);
|
m_printer_preset = new Preset(*temp_printer_preset);
|
||||||
|
@ -1629,7 +1665,7 @@ bool CreatePrinterPresetDialog::load_system_and_user_presets_with_curr_model(Pre
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!just_template) {
|
if (!just_template) {
|
||||||
temp_preset_bundle.printers.select_preset_by_name(temp_printer_preset->name, true);
|
temp_preset_bundle.printers.select_preset_by_name(m_printer_preset->name, true);
|
||||||
temp_preset_bundle.update_compatible(PresetSelectCompatibleType::Always);
|
temp_preset_bundle.update_compatible(PresetSelectCompatibleType::Always);
|
||||||
} else {
|
} else {
|
||||||
selected_vendor_id = PRESET_TEMPLATE_DIR;
|
selected_vendor_id = PRESET_TEMPLATE_DIR;
|
||||||
|
@ -1712,20 +1748,28 @@ void CreatePrinterPresetDialog::select_curr_radiobox(std::vector<std::pair<Radio
|
||||||
m_page2->SetSizerAndFit(m_page2_sizer);
|
m_page2->SetSizerAndFit(m_page2_sizer);
|
||||||
} else if (curr_selected_type == m_create_type.create_printer) {
|
} else if (curr_selected_type == m_create_type.create_printer) {
|
||||||
m_select_printer->Hide();
|
m_select_printer->Hide();
|
||||||
m_select_vendor->Show();
|
|
||||||
m_select_model->Show();
|
|
||||||
m_can_not_find_vendor_combox->Show();
|
m_can_not_find_vendor_combox->Show();
|
||||||
m_can_not_find_vendor_text->Show();
|
m_can_not_find_vendor_text->Show();
|
||||||
|
m_printer_info_panel->Show();
|
||||||
if (m_can_not_find_vendor_combox->GetValue()) {
|
if (m_can_not_find_vendor_combox->GetValue()) {
|
||||||
m_custom_vendor_model->Show();
|
m_custom_vendor_text_ctrl->Show();
|
||||||
|
m_custom_model_text_ctrl->Show();
|
||||||
|
m_select_vendor->Hide();
|
||||||
|
m_select_model->Hide();
|
||||||
|
} else {
|
||||||
|
m_select_vendor->Show();
|
||||||
|
m_select_model->Show();
|
||||||
}
|
}
|
||||||
m_page1->SetSizerAndFit(m_page1_sizer);
|
m_page1->SetSizerAndFit(m_page1_sizer);
|
||||||
} else if (curr_selected_type == m_create_type.create_nozzle) {
|
} else if (curr_selected_type == m_create_type.create_nozzle) {
|
||||||
|
set_current_visible_printer();
|
||||||
m_select_vendor->Hide();
|
m_select_vendor->Hide();
|
||||||
m_select_model->Hide();
|
m_select_model->Hide();
|
||||||
m_can_not_find_vendor_combox->Hide();
|
m_can_not_find_vendor_combox->Hide();
|
||||||
m_can_not_find_vendor_text->Hide();
|
m_can_not_find_vendor_text->Hide();
|
||||||
m_custom_vendor_model->Hide();
|
m_custom_vendor_text_ctrl->Hide();
|
||||||
|
m_custom_model_text_ctrl->Hide();
|
||||||
|
m_printer_info_panel->Hide();
|
||||||
m_select_printer->Show();
|
m_select_printer->Show();
|
||||||
m_page1->SetSizerAndFit(m_page1_sizer);
|
m_page1->SetSizerAndFit(m_page1_sizer);
|
||||||
}
|
}
|
||||||
|
@ -1903,7 +1947,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_page2_btns_item(wxWindow *parent)
|
||||||
StateColor btn_bg_white(std::pair<wxColour, int>(wxColour(206, 206, 206), StateColor::Pressed), std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Hovered),
|
StateColor btn_bg_white(std::pair<wxColour, int>(wxColour(206, 206, 206), StateColor::Pressed), std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Hovered),
|
||||||
std::pair<wxColour, int>(*wxWHITE, StateColor::Normal));
|
std::pair<wxColour, int>(*wxWHITE, StateColor::Normal));
|
||||||
|
|
||||||
m_button_page2_back = new Button(parent, _L("Back"));
|
m_button_page2_back = new Button(parent, _L("Back Page 1"));
|
||||||
m_button_page2_back->SetBackgroundColor(btn_bg_white);
|
m_button_page2_back->SetBackgroundColor(btn_bg_white);
|
||||||
m_button_page2_back->SetBorderColor(wxColour(38, 46, 48));
|
m_button_page2_back->SetBorderColor(wxColour(38, 46, 48));
|
||||||
m_button_page2_back->SetFont(Label::Body_12);
|
m_button_page2_back->SetFont(Label::Body_12);
|
||||||
|
@ -1941,21 +1985,49 @@ wxBoxSizer *CreatePrinterPresetDialog::create_page2_btns_item(wxWindow *parent)
|
||||||
|
|
||||||
// create preset name
|
// create preset name
|
||||||
std::string printer_preset_name;
|
std::string printer_preset_name;
|
||||||
|
std::string printer_model_name;
|
||||||
|
std::string printer_nozzle_name;
|
||||||
std::string nozzle_diameter = into_u8(m_nozzle_diameter->GetStringSelection());
|
std::string nozzle_diameter = into_u8(m_nozzle_diameter->GetStringSelection());
|
||||||
|
if (curr_selected_printer_type == m_create_type.create_printer) {
|
||||||
if (m_can_not_find_vendor_combox->GetValue()) {
|
if (m_can_not_find_vendor_combox->GetValue()) {
|
||||||
std::string vendor_model = into_u8(m_custom_vendor_model->GetValue());
|
std::string custom_vendor = into_u8(m_custom_vendor_text_ctrl->GetValue());
|
||||||
if (vendor_model.empty()) {
|
std::string custom_model = into_u8(m_custom_vendor_text_ctrl->GetValue());
|
||||||
MessageDialog dlg(this, _L("The custom printer and model are not inputed, place return page 1 to input."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"),
|
if (custom_vendor.empty() || custom_model.empty()) {
|
||||||
|
MessageDialog dlg(this, _L("The custom printer or model is not inputed, place input."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"),
|
||||||
wxYES | wxYES_DEFAULT | wxCENTRE);
|
wxYES | wxYES_DEFAULT | wxCENTRE);
|
||||||
dlg.ShowModal();
|
dlg.ShowModal();
|
||||||
show_page1();
|
show_page1();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
printer_preset_name = vendor_model + " " + nozzle_diameter;
|
printer_preset_name = custom_vendor + " " + custom_model + " " + nozzle_diameter;
|
||||||
|
printer_model_name = custom_vendor + " " + custom_model;
|
||||||
|
printer_nozzle_name = nozzle_diameter.substr(0, nozzle_diameter.find("nozzle") - 1);
|
||||||
} else {
|
} else {
|
||||||
std::string vender_name = into_u8(m_select_vendor->GetStringSelection());
|
std::string vender_name = into_u8(m_select_vendor->GetStringSelection());
|
||||||
std::string model_name = into_u8(m_select_model->GetStringSelection());
|
std::string model_name = into_u8(m_select_model->GetStringSelection());
|
||||||
printer_preset_name = vender_name + " " + model_name + " " + nozzle_diameter;
|
printer_preset_name = vender_name + " " + model_name + " " + nozzle_diameter;
|
||||||
|
printer_model_name = vender_name + " " + model_name;
|
||||||
|
printer_nozzle_name = nozzle_diameter.substr(0, nozzle_diameter.find("nozzle") - 1);
|
||||||
|
}
|
||||||
|
} else if (curr_selected_printer_type == m_create_type.create_nozzle) {
|
||||||
|
std::string selected_printer_preset_name = into_u8(m_select_printer->GetStringSelection());
|
||||||
|
std::unordered_map<std::string, std::shared_ptr<Preset>>::iterator itor = m_printer_name_to_preset.find(selected_printer_preset_name);
|
||||||
|
assert(m_printer_name_to_preset.end() != itor);
|
||||||
|
if (m_printer_name_to_preset.end() != itor) {
|
||||||
|
std::shared_ptr<Preset> printer_preset = itor->second;
|
||||||
|
try{
|
||||||
|
printer_model_name = printer_preset->config.opt_string("printer_model", true);
|
||||||
|
printer_nozzle_name = printer_preset->config.opt_string("printer_variant", true);
|
||||||
|
printer_preset_name = printer_model_name + " " + nozzle_diameter;
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (...) {
|
||||||
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " get config printer_model or , and the name is: " << selected_printer_preset_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " don't get printer preset, and the name is: " << selected_printer_preset_name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Confirm if the printer preset has a duplicate name
|
// Confirm if the printer preset has a duplicate name
|
||||||
|
@ -2003,7 +2075,9 @@ wxBoxSizer *CreatePrinterPresetDialog::create_page2_btns_item(wxWindow *parent)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (curr_selected_printer_type == m_create_type.create_printer && curr_selected_preset_type == m_create_type.base_template) {
|
std::vector<std::string> successful_preset_names;
|
||||||
|
if (curr_selected_preset_type == m_create_type.base_template) {
|
||||||
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " base template";
|
||||||
/****************************** clone filament preset ********************************/
|
/****************************** clone filament preset ********************************/
|
||||||
std::vector<std::string> failures;
|
std::vector<std::string> failures;
|
||||||
if (!selected_filament_presets.empty()) {
|
if (!selected_filament_presets.empty()) {
|
||||||
|
@ -2011,11 +2085,22 @@ wxBoxSizer *CreatePrinterPresetDialog::create_page2_btns_item(wxWindow *parent)
|
||||||
if (!create_preset_result) {
|
if (!create_preset_result) {
|
||||||
std::string message;
|
std::string message;
|
||||||
for (const std::string &failure : failures) { message += "\t" + failure + "\n"; }
|
for (const std::string &failure : failures) { message += "\t" + failure + "\n"; }
|
||||||
MessageDialog dlg(this, _L("Create filament presets failed. As follows:\n") + message, wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"),
|
MessageDialog dlg(this, _L("Create filament presets failed. As follows:\n") + message + _L("\nDo you want to rewrite it?"),
|
||||||
|
wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"),
|
||||||
wxYES | wxYES_DEFAULT | wxCENTRE);
|
wxYES | wxYES_DEFAULT | wxCENTRE);
|
||||||
dlg.ShowModal();
|
int res = dlg.ShowModal();
|
||||||
|
if (wxID_YES == res) {
|
||||||
|
create_preset_result = preset_bundle->filaments.create_presets_from_template_for_printer(selected_filament_presets, failures, printer_preset_name,
|
||||||
|
get_filament_id, true);
|
||||||
|
} else {
|
||||||
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " printer preset no same preset but filament has same preset, user cancel create the printer preset";
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// save created successfully preset name
|
||||||
|
for (Preset const *sucessful_preset : selected_filament_presets)
|
||||||
|
successful_preset_names.push_back(sucessful_preset->name.substr(0, sucessful_preset->name.find(" @")) + " @" + printer_preset_name);
|
||||||
|
}
|
||||||
|
|
||||||
/****************************** clone process preset ********************************/
|
/****************************** clone process preset ********************************/
|
||||||
failures.clear();
|
failures.clear();
|
||||||
|
@ -2024,17 +2109,20 @@ wxBoxSizer *CreatePrinterPresetDialog::create_page2_btns_item(wxWindow *parent)
|
||||||
if (!create_preset_result) {
|
if (!create_preset_result) {
|
||||||
std::string message;
|
std::string message;
|
||||||
for (const std::string &failure : failures) { message += "\t" + failure + "\n"; }
|
for (const std::string &failure : failures) { message += "\t" + failure + "\n"; }
|
||||||
MessageDialog dlg(this, _L("Create process presets failed. As follows:\n") + message, wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"),
|
MessageDialog dlg(this, _L("Create process presets failed. As follows:\n") + message + _L("\nDo you want to rewrite it?"),
|
||||||
|
wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"),
|
||||||
wxYES | wxYES_DEFAULT | wxCENTRE);
|
wxYES | wxYES_DEFAULT | wxCENTRE);
|
||||||
dlg.ShowModal();
|
int res = dlg.ShowModal();
|
||||||
|
if (wxID_YES == res) {
|
||||||
|
create_preset_result = preset_bundle->prints.create_presets_from_template_for_printer(selected_process_presets, failures, printer_preset_name, get_filament_id, true);
|
||||||
|
} else {
|
||||||
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " printer preset no same preset but process has same preset, user cancel create the printer preset";
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
save_printable_area_config(m_printer_preset);
|
}
|
||||||
preset_bundle->printers.save_current_preset(printer_preset_name, true, false, m_printer_preset);
|
} else if (curr_selected_preset_type == m_create_type.base_curr_printer) { // create printer and based on printer
|
||||||
preset_bundle->update_compatible(PresetSelectCompatibleType::Always);
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " base curr printer";
|
||||||
|
|
||||||
} else if (curr_selected_printer_type == m_create_type.create_printer && curr_selected_preset_type == m_create_type.base_curr_printer) { // create printer and based on printer
|
|
||||||
|
|
||||||
/****************************** clone filament preset ********************************/
|
/****************************** clone filament preset ********************************/
|
||||||
std::vector<std::string> failures;
|
std::vector<std::string> failures;
|
||||||
if (!selected_filament_presets.empty()) {
|
if (!selected_filament_presets.empty()) {
|
||||||
|
@ -2044,9 +2132,16 @@ wxBoxSizer *CreatePrinterPresetDialog::create_page2_btns_item(wxWindow *parent)
|
||||||
for (const std::string& failure : failures) {
|
for (const std::string& failure : failures) {
|
||||||
message += "\t" + failure + "\n";
|
message += "\t" + failure + "\n";
|
||||||
}
|
}
|
||||||
MessageDialog dlg(this, _L("Create filament presets failed. As follows:\n") + message, wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"),
|
MessageDialog dlg(this, _L("Create filament presets failed. As follows:\n") + message + _L("\nDo you want to rewrite it?"),
|
||||||
|
wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"),
|
||||||
wxYES | wxYES_DEFAULT | wxCENTRE);
|
wxYES | wxYES_DEFAULT | wxCENTRE);
|
||||||
dlg.ShowModal();
|
int res = dlg.ShowModal();
|
||||||
|
if (wxID_YES == res) {
|
||||||
|
create_preset_result = preset_bundle->filaments.clone_presets_for_printer(selected_filament_presets, failures, printer_preset_name, true);
|
||||||
|
} else {
|
||||||
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " printer preset no same preset but filament has same preset, user cancel create the printer preset";
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2059,18 +2154,30 @@ wxBoxSizer *CreatePrinterPresetDialog::create_page2_btns_item(wxWindow *parent)
|
||||||
for (const std::string& failure : failures) {
|
for (const std::string& failure : failures) {
|
||||||
message += "\t" + failure + "\n";
|
message += "\t" + failure + "\n";
|
||||||
}
|
}
|
||||||
MessageDialog dlg(this, _L("Create process presets failed. As follows:\n") + message, wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxYES | wxYES_DEFAULT | wxCENTRE);
|
MessageDialog dlg(this, _L("Create process presets failed. As follows:\n") + message + _L("\nDo you want to rewrite it?"), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxYES | wxYES_DEFAULT | wxCENTRE);
|
||||||
dlg.ShowModal();
|
int res = dlg.ShowModal();
|
||||||
|
if (wxID_YES == res) {
|
||||||
|
create_preset_result = preset_bundle->prints.clone_presets_for_printer(selected_process_presets, failures, printer_preset_name, true);
|
||||||
|
} else {
|
||||||
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " printer preset no same preset but filament has same preset, user cancel create the printer preset";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// save created successfully preset name
|
||||||
|
for (Preset const *sucessful_preset : selected_filament_presets)
|
||||||
|
successful_preset_names.push_back(sucessful_preset->name.substr(0, sucessful_preset->name.find(" @")) + " @" + printer_preset_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************** clone printer preset ********************************/
|
/****************************** clone printer preset ********************************/
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ":creater printer ";
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ":creater printer ";
|
||||||
save_printable_area_config(m_printer_preset);
|
save_printable_area_config(m_printer_preset);
|
||||||
|
m_printer_preset->config.opt_string("printer_model", true) = printer_model_name;
|
||||||
|
m_printer_preset->config.opt_string("printer_variant") = printer_nozzle_name;
|
||||||
preset_bundle->printers.save_current_preset(printer_preset_name, true, false, m_printer_preset);
|
preset_bundle->printers.save_current_preset(printer_preset_name, true, false, m_printer_preset);
|
||||||
preset_bundle->update_compatible(PresetSelectCompatibleType::Always);
|
preset_bundle->update_compatible(PresetSelectCompatibleType::Always);
|
||||||
}
|
|
||||||
EndModal(wxID_OK);
|
EndModal(wxID_OK);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
m_button_page2_cancel = new Button(parent, _L("Cancel"));
|
m_button_page2_cancel = new Button(parent, _L("Cancel"));
|
||||||
|
@ -2155,6 +2262,20 @@ bool CreatePrinterPresetDialog::data_init()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CreatePrinterPresetDialog::set_current_visible_printer()
|
||||||
|
{
|
||||||
|
PresetBundle *preset_bundle = wxGetApp().preset_bundle;
|
||||||
|
const std::deque<Preset> &printer_presets = preset_bundle->printers.get_presets();
|
||||||
|
wxArrayString printer_choice;
|
||||||
|
m_printer_name_to_preset.clear();
|
||||||
|
for (const Preset &printer_preset : printer_presets) {
|
||||||
|
if (printer_preset.is_system || !printer_preset.is_visible) continue;
|
||||||
|
printer_choice.push_back(wxString::FromUTF8(printer_preset.name));
|
||||||
|
m_printer_name_to_preset[printer_preset.name] = std::make_shared<Preset>(printer_preset);
|
||||||
|
}
|
||||||
|
m_select_printer->Set(printer_choice);
|
||||||
|
}
|
||||||
|
|
||||||
wxArrayString CreatePrinterPresetDialog::printer_preset_sort_with_nozzle_diameter(const VendorProfile &vendor_profile, float nozzle_diameter)
|
wxArrayString CreatePrinterPresetDialog::printer_preset_sort_with_nozzle_diameter(const VendorProfile &vendor_profile, float nozzle_diameter)
|
||||||
{
|
{
|
||||||
std::vector<pair<float, std::string>> preset_sort;
|
std::vector<pair<float, std::string>> preset_sort;
|
||||||
|
@ -2167,6 +2288,7 @@ wxArrayString CreatePrinterPresetDialog::printer_preset_sort_with_nozzle_diamete
|
||||||
preset_sort.push_back(std::make_pair(variant_diameter, model_name + " @ " + variant.name + " nozzle"));
|
preset_sort.push_back(std::make_pair(variant_diameter, model_name + " @ " + variant.name + " nozzle"));
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " prase varient fialed and the model_name is: " << model_name;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2208,18 +2330,7 @@ wxArrayString CreatePrinterPresetDialog::printer_preset_sort_with_nozzle_diamete
|
||||||
}
|
}
|
||||||
return printer_preset_model_selection;
|
return printer_preset_model_selection;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
wxBoxSizer *CreatePrinterPresetDialog::create_checkbox(wxWindow *parent, Preset *preset, std::vector<std::pair<CheckBox *, Preset *>> &preset_checkbox)
|
|
||||||
{
|
|
||||||
wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
|
|
||||||
CheckBox* checkbox = new CheckBox(parent);
|
|
||||||
sizer->Add(checkbox, 0, 0, 0);
|
|
||||||
preset_checkbox.push_back(std::make_pair(checkbox, preset));
|
|
||||||
wxStaticText *preset_name = new wxStaticText(parent, wxID_ANY, preset->name);
|
|
||||||
sizer->Add(preset_name, 0, wxLEFT, 5);
|
|
||||||
return sizer;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
void CreatePrinterPresetDialog::select_all_preset_template(std::vector<std::pair<CheckBox *, Preset *>> &preset_templates)
|
void CreatePrinterPresetDialog::select_all_preset_template(std::vector<std::pair<CheckBox *, Preset *>> &preset_templates)
|
||||||
{
|
{
|
||||||
for (std::pair < CheckBox *, Preset const * > filament_preset : preset_templates) {
|
for (std::pair < CheckBox *, Preset const * > filament_preset : preset_templates) {
|
||||||
|
@ -2236,6 +2347,11 @@ void CreatePrinterPresetDialog::deselect_all_preset_template(std::vector<std::pa
|
||||||
|
|
||||||
void CreatePrinterPresetDialog::update_presets_list(bool just_template)
|
void CreatePrinterPresetDialog::update_presets_list(bool just_template)
|
||||||
{
|
{
|
||||||
|
if (PRESET_CUSTOM_VENDOR == m_printer_preset_vendor_selected.name || PRESET_CUSTOM_VENDOR == m_printer_preset_vendor_selected.id) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
PresetBundle temp_preset_bundle;
|
PresetBundle temp_preset_bundle;
|
||||||
if (!load_system_and_user_presets_with_curr_model(temp_preset_bundle, just_template)) return;
|
if (!load_system_and_user_presets_with_curr_model(temp_preset_bundle, just_template)) return;
|
||||||
|
|
||||||
|
@ -2361,39 +2477,47 @@ bool CreatePrinterPresetDialog::check_printable_area() {
|
||||||
|
|
||||||
bool CreatePrinterPresetDialog::validate_input_valid()
|
bool CreatePrinterPresetDialog::validate_input_valid()
|
||||||
{
|
{
|
||||||
std::string vendor_name = into_u8(m_select_vendor->GetStringSelection());
|
const wxString curr_selected_printer_type = curr_create_printer_type();
|
||||||
std::string model_name = into_u8(m_select_model->GetStringSelection());
|
if (curr_selected_printer_type == m_create_type.create_printer) {
|
||||||
std::string custom_vendor_model = into_u8(m_custom_vendor_model->GetValue());
|
std::string vendor_name, model_name;
|
||||||
if ((vendor_name.empty() || model_name.empty()) && custom_vendor_model.empty()) {
|
if (m_can_not_find_vendor_combox->GetValue()) {
|
||||||
|
vendor_name = into_u8(m_custom_vendor_text_ctrl->GetValue());
|
||||||
|
model_name = into_u8(m_custom_vendor_text_ctrl->GetValue());
|
||||||
|
} else {
|
||||||
|
vendor_name = into_u8(m_select_vendor->GetStringSelection());
|
||||||
|
model_name = into_u8(m_select_model->GetStringSelection());
|
||||||
|
}
|
||||||
|
if ((vendor_name.empty() || model_name.empty())) {
|
||||||
MessageDialog dlg(this, _L("You have not selected the vendor and model or inputed the custom vendor and model."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"),
|
MessageDialog dlg(this, _L("You have not selected the vendor and model or inputed the custom vendor and model."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"),
|
||||||
wxYES | wxYES_DEFAULT | wxCENTRE);
|
wxYES | wxYES_DEFAULT | wxCENTRE);
|
||||||
dlg.ShowModal();
|
dlg.ShowModal();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
/*if (m_custom_texture.empty()) {
|
|
||||||
MessageDialog dlg(this, _L("You have not upload bed texture."),
|
|
||||||
wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxYES | wxYES_DEFAULT | wxCENTRE);
|
|
||||||
dlg.ShowModal();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (m_custom_model.empty()) {
|
|
||||||
MessageDialog dlg(this, _L("You have not upload bed model."),
|
|
||||||
wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxYES | wxYES_DEFAULT | wxCENTRE);
|
|
||||||
dlg.ShowModal();
|
|
||||||
return false;
|
|
||||||
}*/
|
|
||||||
if (check_printable_area() == false) {
|
if (check_printable_area() == false) {
|
||||||
MessageDialog dlg(this, _L("Please check bed shape input."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxYES | wxYES_DEFAULT | wxCENTRE);
|
MessageDialog dlg(this, _L("Please check bed shape input."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"), wxYES | wxYES_DEFAULT | wxCENTRE);
|
||||||
dlg.ShowModal();
|
dlg.ShowModal();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
} else if (curr_selected_printer_type == m_create_type.create_nozzle) {
|
||||||
|
wxString printer_name = m_select_printer->GetStringSelection();
|
||||||
|
if (printer_name.empty()) {
|
||||||
|
MessageDialog dlg(this, _L("You have not yet selected the printer to replace the nozzle, please choose."), wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Info"),
|
||||||
|
wxYES | wxYES_DEFAULT | wxCENTRE);
|
||||||
|
dlg.ShowModal();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreatePrinterPresetDialog::on_preset_model_value_change(wxCommandEvent &e)
|
void CreatePrinterPresetDialog::on_preset_model_value_change(wxCommandEvent &e)
|
||||||
{
|
{
|
||||||
m_printer_model->SetLabelColor(*wxBLACK);
|
m_printer_model->SetLabelColor(*wxBLACK);
|
||||||
if (m_printer_preset_vendor_selected.models.empty()) return;
|
if (m_printer_preset_vendor_selected.models.empty()) {
|
||||||
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " selected vendor has no models, and the vendor is: " << m_printer_preset_vendor_selected.id;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
wxString curr_selected_preset_type = curr_create_preset_type();
|
wxString curr_selected_preset_type = curr_create_preset_type();
|
||||||
if (curr_selected_preset_type == m_create_type.base_curr_printer) {
|
if (curr_selected_preset_type == m_create_type.base_curr_printer) {
|
||||||
|
|
|
@ -120,6 +120,7 @@ protected:
|
||||||
|
|
||||||
/********************************************************** Data Interaction *******************************************************/
|
/********************************************************** Data Interaction *******************************************************/
|
||||||
bool data_init();
|
bool data_init();
|
||||||
|
void set_current_visible_printer();
|
||||||
void select_curr_radiobox(std::vector<std::pair<RadioBox *, wxString>> &radiobox_list, int btn_idx);
|
void select_curr_radiobox(std::vector<std::pair<RadioBox *, wxString>> &radiobox_list, int btn_idx);
|
||||||
void select_all_preset_template(std::vector<std::pair<CheckBox *, Preset *>> &preset_templates);
|
void select_all_preset_template(std::vector<std::pair<CheckBox *, Preset *>> &preset_templates);
|
||||||
void deselect_all_preset_template(std::vector<std::pair<CheckBox *, Preset *>> &preset_templates);
|
void deselect_all_preset_template(std::vector<std::pair<CheckBox *, Preset *>> &preset_templates);
|
||||||
|
@ -153,6 +154,7 @@ private:
|
||||||
std::vector<std::pair<RadioBox *, wxString>> m_create_presets_btns;
|
std::vector<std::pair<RadioBox *, wxString>> m_create_presets_btns;
|
||||||
std::vector<std::pair<CheckBox *, Preset *>> m_filament_preset;
|
std::vector<std::pair<CheckBox *, Preset *>> m_filament_preset;
|
||||||
std::vector<std::pair<CheckBox *, Preset *>> m_process_preset;
|
std::vector<std::pair<CheckBox *, Preset *>> m_process_preset;
|
||||||
|
std::unordered_map<std::string, std::shared_ptr<Preset>> m_printer_name_to_preset;
|
||||||
VendorProfile m_printer_preset_vendor_selected;
|
VendorProfile m_printer_preset_vendor_selected;
|
||||||
Slic3r::VendorProfile::PrinterModel m_printer_preset_model_selected;
|
Slic3r::VendorProfile::PrinterModel m_printer_preset_model_selected;
|
||||||
bool rewritten = false;
|
bool rewritten = false;
|
||||||
|
@ -173,7 +175,8 @@ private:
|
||||||
ComboBox * m_select_printer = nullptr;
|
ComboBox * m_select_printer = nullptr;
|
||||||
CheckBox * m_can_not_find_vendor_combox = nullptr;
|
CheckBox * m_can_not_find_vendor_combox = nullptr;
|
||||||
wxStaticText * m_can_not_find_vendor_text = nullptr;
|
wxStaticText * m_can_not_find_vendor_text = nullptr;
|
||||||
wxTextCtrl * m_custom_vendor_model = nullptr;
|
wxTextCtrl * m_custom_vendor_text_ctrl = nullptr;
|
||||||
|
wxTextCtrl * m_custom_model_text_ctrl = nullptr;
|
||||||
ComboBox * m_nozzle_diameter = nullptr;
|
ComboBox * m_nozzle_diameter = nullptr;
|
||||||
ComboBox * m_printer_vendor = nullptr;
|
ComboBox * m_printer_vendor = nullptr;
|
||||||
ComboBox * m_printer_model = nullptr;
|
ComboBox * m_printer_model = nullptr;
|
||||||
|
@ -187,7 +190,9 @@ private:
|
||||||
wxPanel * m_filament_preset_panel = nullptr;
|
wxPanel * m_filament_preset_panel = nullptr;
|
||||||
wxPanel * m_process_preset_panel = nullptr;
|
wxPanel * m_process_preset_panel = nullptr;
|
||||||
wxPanel * m_preset_template_panel = nullptr;
|
wxPanel * m_preset_template_panel = nullptr;
|
||||||
|
wxPanel * m_printer_info_panel = nullptr;
|
||||||
wxBoxSizer * m_page1_sizer = nullptr;
|
wxBoxSizer * m_page1_sizer = nullptr;
|
||||||
|
wxBoxSizer * m_printer_info_sizer = nullptr;
|
||||||
wxBoxSizer * m_page2_sizer = nullptr;
|
wxBoxSizer * m_page2_sizer = nullptr;
|
||||||
std::string m_custom_texture;
|
std::string m_custom_texture;
|
||||||
std::string m_custom_model;
|
std::string m_custom_model;
|
||||||
|
|
Loading…
Reference in New Issue