Skip to content

Commit

Permalink
Add preference option to shsow pop-up on export about he current mate…
Browse files Browse the repository at this point in the history
…rial.

#2970
  • Loading branch information
supermerill committed Jul 24, 2022
1 parent fbd05d8 commit d9ee503
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/libslic3r/AppConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,9 @@ void AppConfig::set_defaults()
set("date_in_config_file", "1");
set_header_generate_with_date(get("date_in_config_file") == "1");

if (get("check_material_export").empty())
set("check_material_export", "0");

if (get("use_custom_toolbar_size").empty())
set("use_custom_toolbar_size", "0");

Expand Down
20 changes: 20 additions & 0 deletions src/slic3r/GUI/Plater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5850,6 +5850,26 @@ void Plater::export_gcode(bool prefer_removable)
if (p->process_completed_with_error)
return;

//check if the material is okay
if (p->get_config("check_material_export") == "1") {
std::string str_material = "";
if (printer_technology() == ptFFF) {
const ConfigOptionStrings* filaments = fff_print().full_print_config().opt<ConfigOptionStrings>("filament_settings_id");
assert(filaments->values.size() == fff_print().config().filament_type.values.size());
for (int i = 0; i < filaments->values.size(); i++) {
str_material += "\n" + format(_L("'%1%' of type %2%"), filaments->values[i], fff_print().config().filament_type.values[i]);
}
} else if (printer_technology() == ptSLA) {
str_material = format(_L(" resin '%1%'"), sla_print().full_print_config().opt_string("sla_material_settings_id"));
}
MessageDialog dlg(this,
format_wxstr(_L("You will export the file with the material profile(s): %1%"), str_material),
_L("Checking your material"),
wxOK | wxOK_DEFAULT | wxCANCEL | wxICON_WARNING);
if (dlg.ShowModal() != wxID_OK)
return;
}

// If possible, remove accents from accented latin characters.
// This function is useful for generating file names to be processed by legacy firmwares.
fs::path default_output_file;
Expand Down
7 changes: 7 additions & 0 deletions src/slic3r/GUI/Preferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,13 @@ void PreferencesDialog::build(size_t selected_tab)
option = Option(def, "date_in_config_file");
m_optgroups_general.back()->append_single_option_line(option);

def.label = L("Show a Pop-up with the current material when exporting");
def.type = coBool;
def.tooltip = L("If you constantly forgot to select the right filament/materail, check this option to have a really obtrusive reminder on each export.");
def.set_default_value(new ConfigOptionBool{ app_config->has("check_material_export") ? app_config->get("check_material_export") == "1" : false });
option = Option(def, "check_material_export");
m_optgroups_general.back()->append_single_option_line(option);

activate_options_tab(m_optgroups_general.back(), 3);
m_optgroups_general.emplace_back(create_options_group(_L("Dialogs"), tabs, 0));

Expand Down

0 comments on commit d9ee503

Please sign in to comment.