wizard text and pop window at first common selected

This commit is contained in:
David Kocik 2022-02-07 15:30:31 +01:00
parent 16d42b20f0
commit 5ca4760f2d
2 changed files with 78 additions and 61 deletions

View File

@ -751,10 +751,12 @@ void PageMaterials::set_compatible_printers_html_window(const std::vector<std::s
const auto bgr_clr_str = wxString::Format(wxT("#%02X%02X%02X"), bgr_clr.Red(), bgr_clr.Green(), bgr_clr.Blue()); const auto bgr_clr_str = wxString::Format(wxT("#%02X%02X%02X"), bgr_clr.Red(), bgr_clr.Green(), bgr_clr.Blue());
const auto text_clr = wxGetApp().get_label_clr_default(); const auto text_clr = wxGetApp().get_label_clr_default();
const auto text_clr_str = wxString::Format(wxT("#%02X%02X%02X"), text_clr.Red(), text_clr.Green(), text_clr.Blue()); const auto text_clr_str = wxString::Format(wxT("#%02X%02X%02X"), text_clr.Red(), text_clr.Green(), text_clr.Blue());
wxString common_line = format_wxstr(_L("%1% visible for (%2%) printer are universal profiles available for all printers. These might not be calibrated for your printer."), materials->technology == T_FFF ? _L("Filaments") : _L("SLA materials"), _L("Custom"));
wxString first_line = format_wxstr(_L("%1% marked with <b>*</b> are <b>not</b> compatible with some installed printers."), materials->technology == T_FFF ? _L("Filaments") : _L("SLA materials"));
first_line = wxString::Format("%s<br /><br />%s", common_line, first_line);
wxString text; wxString text;
if (custom_shown) {
text = format_wxstr(_L("%1% visible for <b>(%2%)</b> 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 first_line = format_wxstr(_L("%1% marked with <b>*</b> are <b>not</b> compatible with some installed printers."), materials->technology == T_FFF ? _L("Filaments") : _L("SLA materials"));
if (all_printers) { 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")); 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( text = wxString::Format(
@ -765,7 +767,7 @@ void PageMaterials::set_compatible_printers_html_window(const std::vector<std::s
"<body bgcolor= %s>" "<body bgcolor= %s>"
"<font color=%s>" "<font color=%s>"
"<font size=\"3\">" "<font size=\"3\">"
"%s<br />%s" "%s<br /><br />%s"
"</font>" "</font>"
"</font>" "</font>"
"</body>" "</body>"
@ -775,7 +777,8 @@ void PageMaterials::set_compatible_printers_html_window(const std::vector<std::s
, first_line , first_line
, second_line , second_line
); );
} else { }
else {
wxString second_line; wxString second_line;
if (!printer_names.empty()) if (!printer_names.empty())
second_line = (materials->technology == T_FFF ? second_line = (materials->technology == T_FFF ?
@ -789,7 +792,7 @@ void PageMaterials::set_compatible_printers_html_window(const std::vector<std::s
"<body bgcolor= %s>" "<body bgcolor= %s>"
"<font color=%s>" "<font color=%s>"
"<font size=\"3\">" "<font size=\"3\">"
"%s<br />%s" "%s<br /><br />%s"
"<table>" "<table>"
"<tr>" "<tr>"
, bgr_clr_str , bgr_clr_str
@ -814,6 +817,8 @@ void PageMaterials::set_compatible_printers_html_window(const std::vector<std::s
"</html>" "</html>"
); );
} }
}
wxFont font = get_default_font_for_dpi(this, get_dpi_for_window(this)); wxFont font = get_default_font_for_dpi(this, get_dpi_for_window(this));
const int fs = font.GetPointSize(); 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)) { if (!are_equal(sel_printers, sel_printers_prev)) {
#endif #endif
custom_shown = false;
// Refresh type list // Refresh type list
list_type->Clear(); list_type->Clear();
list_type->append(_L("(All)"), &EMPTY); 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(wxNOT_FOUND);
list_printer->SetSelection(1); list_printer->SetSelection(1);
sel_printers_count = list_printer->GetSelections(sel_printers); sel_printers_count = list_printer->GetSelections(sel_printers);
custom_shown = true;
materials->filter_presets(nullptr, CUSTOM, EMPTY, EMPTY, [this](const Preset* p) { materials->filter_presets(nullptr, CUSTOM, EMPTY, EMPTY, [this](const Preset* p) {
const std::string& type = this->materials->get_type(p); const std::string& type = this->materials->get_type(p);
if (list_type->find(type) == wxNOT_FOUND) { 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 bool checked = list_profile->IsChecked(i);
const std::string& alias_key = list_profile->get_data(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); wizard_p()->update_presets_in_config(materials->appconfig_section(), alias_key, checked);
} }

View File

@ -349,6 +349,9 @@ struct PageMaterials: ConfigWizardPage
bool first_paint = { false }; bool first_paint = { false };
static const std::string EMPTY; static const std::string EMPTY;
static const std::string CUSTOM; 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 } ; int last_hovered_item = { -1 } ;
PageMaterials(ConfigWizard *parent, Materials *materials, wxString title, wxString shortname, wxString list1name); PageMaterials(ConfigWizard *parent, Materials *materials, wxString title, wxString shortname, wxString list1name);