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:
parent
3d3e47a428
commit
00e9062e15
|
@ -55,12 +55,11 @@ MsgDialog::MsgDialog(wxWindow *parent, const wxString &title, const wxString &he
|
||||||
topsizer->Add(LOGO_GAP, 0, 0, wxEXPAND, 0);
|
topsizer->Add(LOGO_GAP, 0, 0, wxEXPAND, 0);
|
||||||
topsizer->Add(rightsizer, 1, wxTOP | wxEXPAND, BORDER);
|
topsizer->Add(rightsizer, 1, wxTOP | wxEXPAND, BORDER);
|
||||||
|
|
||||||
btn_sizer->AddStretchSpacer();
|
|
||||||
|
|
||||||
main_sizer->Add(topsizer, 1, wxEXPAND);
|
main_sizer->Add(topsizer, 1, wxEXPAND);
|
||||||
|
|
||||||
m_dsa_sizer = new wxBoxSizer(wxHORIZONTAL);
|
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);
|
btn_sizer->Add(0, 0, 1, wxEXPAND, 5);
|
||||||
main_sizer->Add(btn_sizer, 0, wxBOTTOM | wxRIGHT | wxEXPAND, BORDER);
|
main_sizer->Add(btn_sizer, 0, wxBOTTOM | wxRIGHT | wxEXPAND, BORDER);
|
||||||
|
|
||||||
|
|
|
@ -3474,25 +3474,40 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
|
||||||
if (!config.empty()) {
|
if (!config.empty()) {
|
||||||
Preset::normalize(config);
|
Preset::normalize(config);
|
||||||
PresetBundle *preset_bundle = wxGetApp().preset_bundle;
|
PresetBundle *preset_bundle = wxGetApp().preset_bundle;
|
||||||
// BBS: first validate the printer
|
|
||||||
// validate the system profiles
|
auto choise = wxGetApp().app_config->get("no_warn_when_modified_gcodes");
|
||||||
std::set<std::string> modified_gcodes;
|
if (choise.empty() || choise != "true") {
|
||||||
int validated = preset_bundle->validate_presets(filename.string(), config, modified_gcodes);
|
// BBS: first validate the printer
|
||||||
if (validated == VALIDATE_PRESETS_MODIFIED_GCODES) {
|
// validate the system profiles
|
||||||
std::string warning_message;
|
std::set<std::string> modified_gcodes;
|
||||||
warning_message += "\n";
|
int validated = preset_bundle->validate_presets(filename.string(), config, modified_gcodes);
|
||||||
for (std::set<std::string>::iterator it=modified_gcodes.begin(); it!=modified_gcodes.end(); ++it)
|
if (validated == VALIDATE_PRESETS_MODIFIED_GCODES) {
|
||||||
warning_message += "-" + *it + "\n";
|
std::string warning_message;
|
||||||
warning_message += "\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"));
|
for (std::set<std::string>::iterator it=modified_gcodes.begin(); it!=modified_gcodes.end(); ++it)
|
||||||
}
|
warning_message += "-" + *it + "\n";
|
||||||
else if ((validated == VALIDATE_PRESETS_PRINTER_NOT_FOUND) || (validated == VALIDATE_PRESETS_FILAMENTS_NOT_FOUND)) {
|
warning_message += "\n";
|
||||||
std::string warning_message;
|
//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"));
|
||||||
warning_message += "\n";
|
|
||||||
for (std::set<std::string>::iterator it=modified_gcodes.begin(); it!=modified_gcodes.end(); ++it)
|
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"));
|
||||||
warning_message += "-" + *it + "\n";
|
dlg.show_dsa_button();
|
||||||
warning_message += "\n";
|
auto res = dlg.ShowModal();
|
||||||
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"));
|
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
|
//always load config
|
||||||
|
|
|
@ -1026,6 +1026,7 @@ wxWindow* PreferencesDialog::create_general_page()
|
||||||
wxGetApp().app_config->set("save_project_choise", "");
|
wxGetApp().app_config->set("save_project_choise", "");
|
||||||
});
|
});
|
||||||
// auto item_backup = create_item_switch(_L("Backup switch"), page, _L("Backup switch"), "units");
|
// 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 = 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");
|
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(title_project, 0, wxTOP| wxEXPAND, FromDIP(20));
|
||||||
sizer_page->Add(item_max_recent_count, 0, wxTOP, FromDIP(3));
|
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_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));
|
sizer_page->Add(item_backup, 0, wxTOP,FromDIP(3));
|
||||||
item_backup->Add(item_backup_interval, 0, wxLEFT, 0);
|
item_backup->Add(item_backup_interval, 0, wxLEFT, 0);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue