From 5ca4760f2d95b8b450e85b0eb6cde2b5c41040e4 Mon Sep 17 00:00:00 2001 From: David Kocik Date: Mon, 7 Feb 2022 15:30:31 +0100 Subject: [PATCH] wizard text and pop window at first common selected --- src/slic3r/GUI/ConfigWizard.cpp | 136 +++++++++++++----------- src/slic3r/GUI/ConfigWizard_private.hpp | 3 + 2 files changed, 78 insertions(+), 61 deletions(-) diff --git a/src/slic3r/GUI/ConfigWizard.cpp b/src/slic3r/GUI/ConfigWizard.cpp index 68b2d52658..e2228101f3 100644 --- a/src/slic3r/GUI/ConfigWizard.cpp +++ b/src/slic3r/GUI/ConfigWizard.cpp @@ -751,69 +751,74 @@ void PageMaterials::set_compatible_printers_html_window(const std::vectortechnology == T_FFF ? _L("Filaments") : _L("SLA materials"), _L("Custom")); - wxString first_line = format_wxstr(_L("%1% marked with * are not compatible with some installed printers."), materials->technology == T_FFF ? _L("Filaments") : _L("SLA materials")); - first_line = wxString::Format("%s

%s", common_line, first_line); wxString text; - if (all_printers) { - wxString second_line = format_wxstr(_L("All installed printers are compatible with the selected %1%."), materials->technology == T_FFF ? _L("filament") : _L("SLA material")); - text = wxString::Format( - "" - "" - "" - "" - "" - "%s
%s" - "
" - "
" - "" - "" - , bgr_clr_str - , text_clr_str - , first_line - , second_line - ); + if (custom_shown) { + text = format_wxstr(_L("%1% visible for (%2%) printer are universal profiles available for all printers. These might not be compatible with your printer."), materials->technology == T_FFF ? _L("Filaments") : _L("SLA materials"), _L("Custom")); } else { - wxString second_line; - if (!printer_names.empty()) - second_line = (materials->technology == T_FFF ? - _L("Only the following installed printers are compatible with the selected filaments") : - _L("Only the following installed printers are compatible with the selected SLA materials")) + ":"; - text = wxString::Format( - "" - "" - "" - "" - "" - "%s
%s" - "" - "" - , bgr_clr_str - , text_clr_str - , first_line - , second_line); - for (size_t i = 0; i < printer_names.size(); ++i) - { - text += wxString::Format("", boost::nowide::widen(printer_names[i])); - if (i % 3 == 2) { - text += wxString::Format( - "" - ""); - } + wxString first_line = format_wxstr(_L("%1% marked with * are not compatible with some installed printers."), materials->technology == T_FFF ? _L("Filaments") : _L("SLA materials")); + + if (all_printers) { + wxString second_line = format_wxstr(_L("All installed printers are compatible with the selected %1%."), materials->technology == T_FFF ? _L("filament") : _L("SLA material")); + text = wxString::Format( + "" + "" + "" + "" + "" + "%s

%s" + "
" + "
" + "" + "" + , bgr_clr_str + , text_clr_str + , first_line + , second_line + ); + } + else { + wxString second_line; + if (!printer_names.empty()) + second_line = (materials->technology == T_FFF ? + _L("Only the following installed printers are compatible with the selected filaments") : + _L("Only the following installed printers are compatible with the selected SLA materials")) + ":"; + text = wxString::Format( + "" + "" + "" + "" + "" + "%s

%s" + "
%s
" + "" + , bgr_clr_str + , text_clr_str + , first_line + , second_line); + for (size_t i = 0; i < printer_names.size(); ++i) + { + text += wxString::Format("", boost::nowide::widen(printer_names[i])); + if (i % 3 == 2) { + text += wxString::Format( + "" + ""); + } + } + text += wxString::Format( + "" + "
%s
" + "" + "" + "" + "" + ); } - text += wxString::Format( - "" - "" - "
" - "
" - "" - "" - ); } + wxFont font = get_default_font_for_dpi(this, get_dpi_for_window(this)); const int fs = font.GetPointSize(); @@ -890,7 +895,7 @@ void PageMaterials::update_lists(int sel_type, int sel_vendor, int last_selected }; if (!are_equal(sel_printers, sel_printers_prev)) { #endif - + custom_shown = false; // Refresh type list list_type->Clear(); list_type->append(_L("(All)"), &EMPTY); @@ -954,7 +959,7 @@ void PageMaterials::update_lists(int sel_type, int sel_vendor, int last_selected list_printer->SetSelection(wxNOT_FOUND); list_printer->SetSelection(1); sel_printers_count = list_printer->GetSelections(sel_printers); - + custom_shown = true; materials->filter_presets(nullptr, CUSTOM, EMPTY, EMPTY, [this](const Preset* p) { const std::string& type = this->materials->get_type(p); if (list_type->find(type) == wxNOT_FOUND) { @@ -1168,6 +1173,15 @@ void PageMaterials::select_material(int i) const bool checked = list_profile->IsChecked(i); const std::string& alias_key = list_profile->get_data(i); + if (checked && custom_shown && !notification_shown) { + notification_shown = true; + wxString message = _L("You have selelected universal filament. Please note that these filaments are available for all printers but are NOT certain to be compatible with your printer. Do you still wish to have this filament selected?\n(This message won't be displayed again.)"); + MessageDialog msg(this, message, _L("Notice"), wxYES_NO); + if (msg.ShowModal() == wxID_NO) { + list_profile->Check(i, false); + return; + } + } wizard_p()->update_presets_in_config(materials->appconfig_section(), alias_key, checked); } diff --git a/src/slic3r/GUI/ConfigWizard_private.hpp b/src/slic3r/GUI/ConfigWizard_private.hpp index 5bbaa87ec7..bf35d024a8 100644 --- a/src/slic3r/GUI/ConfigWizard_private.hpp +++ b/src/slic3r/GUI/ConfigWizard_private.hpp @@ -349,6 +349,9 @@ struct PageMaterials: ConfigWizardPage bool first_paint = { false }; static const std::string EMPTY; static const std::string CUSTOM; + // notify user first time they choose common profile + bool custom_shown = { false }; + bool notification_shown = { false }; int last_hovered_item = { -1 } ; PageMaterials(ConfigWizard *parent, Materials *materials, wxString title, wxString shortname, wxString list1name);