ENH:add no warnings option while loading 3mf with modified gcodes

JIRA: STUDIO-4628
Change-Id: I82e6e518de06873f34a4a65fea78d5f535a95dae
(cherry picked from commit 1de5dba55955836962307305b918cdbfe1a5a8d5)
This commit is contained in:
lane.wei 2023-10-16 21:19:00 +08:00 committed by Lane.Wei
parent 3d3e47a428
commit 00e9062e15
3 changed files with 42 additions and 26 deletions

View File

@ -55,12 +55,11 @@ MsgDialog::MsgDialog(wxWindow *parent, const wxString &title, const wxString &he
topsizer->Add(LOGO_GAP, 0, 0, wxEXPAND, 0);
topsizer->Add(rightsizer, 1, wxTOP | wxEXPAND, BORDER);
btn_sizer->AddStretchSpacer();
main_sizer->Add(topsizer, 1, wxEXPAND);
m_dsa_sizer = new wxBoxSizer(wxHORIZONTAL);
btn_sizer->Add(m_dsa_sizer,1,wxEXPAND,0);
btn_sizer->Add(0, 0, 0, wxLEFT, FromDIP(120));
btn_sizer->Add(m_dsa_sizer, 0, wxEXPAND,0);
btn_sizer->Add(0, 0, 1, wxEXPAND, 5);
main_sizer->Add(btn_sizer, 0, wxBOTTOM | wxRIGHT | wxEXPAND, BORDER);

View File

@ -794,7 +794,7 @@ Sidebar::Sidebar(Plater *parent)
wxPostEvent(parent, SimpleEvent(EVT_SCHEDULE_BACKGROUND_PROCESS, parent));
}
}));
bSizer39->Add(p->m_flushing_volume_btn, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(5));
bSizer39->Hide(p->m_flushing_volume_btn);
bSizer39->Add(FromDIP(10), 0, 0, 0, 0 );
@ -3474,25 +3474,40 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
if (!config.empty()) {
Preset::normalize(config);
PresetBundle *preset_bundle = wxGetApp().preset_bundle;
// BBS: first validate the printer
// validate the system profiles
std::set<std::string> modified_gcodes;
int validated = preset_bundle->validate_presets(filename.string(), config, modified_gcodes);
if (validated == VALIDATE_PRESETS_MODIFIED_GCODES) {
std::string warning_message;
warning_message += "\n";
for (std::set<std::string>::iterator it=modified_gcodes.begin(); it!=modified_gcodes.end(); ++it)
warning_message += "-" + *it + "\n";
warning_message += "\n";
show_info(q, _L("The 3mf has following modified G-codes in filament or printer presets:") + warning_message+ _L("Please confirm that these modified G-codes are safe to prevent any damage to the machine!"), _L("Modified G-codes"));
}
else if ((validated == VALIDATE_PRESETS_PRINTER_NOT_FOUND) || (validated == VALIDATE_PRESETS_FILAMENTS_NOT_FOUND)) {
std::string warning_message;
warning_message += "\n";
for (std::set<std::string>::iterator it=modified_gcodes.begin(); it!=modified_gcodes.end(); ++it)
warning_message += "-" + *it + "\n";
warning_message += "\n";
show_info(q, _L("The 3mf has following customized filament or printer presets:") + warning_message + _L("Please confirm that the G-codes within these presets are safe to prevent any damage to the machine!"), _L("Customized Preset"));
auto choise = wxGetApp().app_config->get("no_warn_when_modified_gcodes");
if (choise.empty() || choise != "true") {
// BBS: first validate the printer
// validate the system profiles
std::set<std::string> modified_gcodes;
int validated = preset_bundle->validate_presets(filename.string(), config, modified_gcodes);
if (validated == VALIDATE_PRESETS_MODIFIED_GCODES) {
std::string warning_message;
warning_message += "\n";
for (std::set<std::string>::iterator it=modified_gcodes.begin(); it!=modified_gcodes.end(); ++it)
warning_message += "-" + *it + "\n";
warning_message += "\n";
//show_info(q, _L("The 3mf has following modified G-codes in filament or printer presets:") + warning_message+ _L("Please confirm that these modified G-codes are safe to prevent any damage to the machine!"), _L("Modified G-codes"));
MessageDialog dlg(q, _L("The 3mf has following modified G-codes in filament or printer presets:") + warning_message+ _L("Please confirm that these modified G-codes are safe to prevent any damage to the machine!"), _L("Modified G-codes"));
dlg.show_dsa_button();
auto res = dlg.ShowModal();
if (dlg.get_checkbox_state())
wxGetApp().app_config->set("no_warn_when_modified_gcodes", "true");
}
else if ((validated == VALIDATE_PRESETS_PRINTER_NOT_FOUND) || (validated == VALIDATE_PRESETS_FILAMENTS_NOT_FOUND)) {
std::string warning_message;
warning_message += "\n";
for (std::set<std::string>::iterator it=modified_gcodes.begin(); it!=modified_gcodes.end(); ++it)
warning_message += "-" + *it + "\n";
warning_message += "\n";
//show_info(q, _L("The 3mf has following customized filament or printer presets:") + warning_message + _L("Please confirm that the G-codes within these presets are safe to prevent any damage to the machine!"), _L("Customized Preset"));
MessageDialog dlg(q, _L("The 3mf has following customized filament or printer presets:") + warning_message+ _L("Please confirm that the G-codes within these presets are safe to prevent any damage to the machine!"), _L("Customized Preset"));
dlg.show_dsa_button();
auto res = dlg.ShowModal();
if (dlg.get_checkbox_state())
wxGetApp().app_config->set("no_warn_when_modified_gcodes", "true");
}
}
//always load config

View File

@ -691,8 +691,8 @@ wxBoxSizer *PreferencesDialog::create_item_checkbox(wxString title, wxWindow *pa
#endif // __WXMSW__
if (param == "developer_mode")
{
if (param == "developer_mode")
{
m_developer_mode_def = app_config->get("developer_mode");
if (m_developer_mode_def == "true") {
Slic3r::GUI::wxGetApp().save_mode(comDevelop);
@ -701,7 +701,7 @@ wxBoxSizer *PreferencesDialog::create_item_checkbox(wxString title, wxWindow *pa
}
}
// webview dump_vedio
// webview dump_vedio
if (param == "internal_developer_mode") {
m_internal_developer_mode_def = app_config->get("internal_developer_mode");
if (m_internal_developer_mode_def == "true") {
@ -1026,6 +1026,7 @@ wxWindow* PreferencesDialog::create_general_page()
wxGetApp().app_config->set("save_project_choise", "");
});
// auto item_backup = create_item_switch(_L("Backup switch"), page, _L("Backup switch"), "units");
auto item_gcodes_warning = create_item_checkbox(_L("No warnings when loading 3MF with modified G-codes"), page,_L("No warnings when loading 3MF with modified G-codes"), 50, "no_warn_when_modified_gcodes");
auto item_backup = create_item_checkbox(_L("Auto-Backup"), page,_L("Backup your project periodically for restoring from the occasional crash."), 50, "backup_switch");
auto item_backup_interval = create_item_backup_input(_L("every"), page, _L("The peroid of backup in seconds."), "backup_interval");
@ -1075,6 +1076,7 @@ wxWindow* PreferencesDialog::create_general_page()
sizer_page->Add(title_project, 0, wxTOP| wxEXPAND, FromDIP(20));
sizer_page->Add(item_max_recent_count, 0, wxTOP, FromDIP(3));
sizer_page->Add(item_save_choise, 0, wxTOP, FromDIP(3));
sizer_page->Add(item_gcodes_warning, 0, wxTOP, FromDIP(3));
sizer_page->Add(item_backup, 0, wxTOP,FromDIP(3));
item_backup->Add(item_backup_interval, 0, wxLEFT, 0);