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,70 +751,75 @@ 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 (all_printers) { if (custom_shown) {
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 = 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"));
text = wxString::Format(
"<html>"
"<style>"
"table{border-spacing: 1px;}"
"</style>"
"<body bgcolor= %s>"
"<font color=%s>"
"<font size=\"3\">"
"%s<br />%s"
"</font>"
"</font>"
"</body>"
"</html>"
, bgr_clr_str
, text_clr_str
, first_line
, second_line
);
} else { } else {
wxString second_line; 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 (!printer_names.empty())
second_line = (materials->technology == T_FFF ? if (all_printers) {
_L("Only the following installed printers are compatible with the selected filaments") : wxString second_line = format_wxstr(_L("All installed printers are compatible with the selected %1%."), materials->technology == T_FFF ? _L("filament") : _L("SLA material"));
_L("Only the following installed printers are compatible with the selected SLA materials")) + ":"; text = wxString::Format(
text = wxString::Format( "<html>"
"<html>" "<style>"
"<style>" "table{border-spacing: 1px;}"
"table{border-spacing: 1px;}" "</style>"
"</style>" "<body bgcolor= %s>"
"<body bgcolor= %s>" "<font color=%s>"
"<font color=%s>" "<font size=\"3\">"
"<font size=\"3\">" "%s<br /><br />%s"
"%s<br />%s" "</font>"
"<table>" "</font>"
"<tr>" "</body>"
, bgr_clr_str "</html>"
, text_clr_str , bgr_clr_str
, first_line , text_clr_str
, second_line); , first_line
for (size_t i = 0; i < printer_names.size(); ++i) , second_line
{ );
text += wxString::Format("<td>%s</td>", boost::nowide::widen(printer_names[i])); }
if (i % 3 == 2) { else {
text += wxString::Format( wxString second_line;
"</tr>" if (!printer_names.empty())
"<tr>"); 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(
"<html>"
"<style>"
"table{border-spacing: 1px;}"
"</style>"
"<body bgcolor= %s>"
"<font color=%s>"
"<font size=\"3\">"
"%s<br /><br />%s"
"<table>"
"<tr>"
, bgr_clr_str
, text_clr_str
, first_line
, second_line);
for (size_t i = 0; i < printer_names.size(); ++i)
{
text += wxString::Format("<td>%s</td>", boost::nowide::widen(printer_names[i]));
if (i % 3 == 2) {
text += wxString::Format(
"</tr>"
"<tr>");
}
}
text += wxString::Format(
"</tr>"
"</table>"
"</font>"
"</font>"
"</body>"
"</html>"
);
} }
text += wxString::Format(
"</tr>"
"</table>"
"</font>"
"</font>"
"</body>"
"</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();
int size[] = { fs,fs,fs,fs,fs,fs,fs }; int size[] = { fs,fs,fs,fs,fs,fs,fs };
@ -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);