From 37bd6e432d5829a4e4fd2066f27bea8f3b9e6866 Mon Sep 17 00:00:00 2001 From: remi durand Date: Sat, 26 Jun 2021 02:13:15 +0200 Subject: More control over "tab/view" automatically switch. supermerill/SuperSlicer#1338 --- src/libslic3r/AppConfig.cpp | 2 +- src/slic3r/GUI/Plater.cpp | 38 +++++++++++++++++++++------- src/slic3r/GUI/Preferences.cpp | 56 ++++++++++++++++++++++++++++++++++-------- src/slic3r/GUI/Preferences.hpp | 3 +++ 4 files changed, 79 insertions(+), 20 deletions(-) diff --git a/src/libslic3r/AppConfig.cpp b/src/libslic3r/AppConfig.cpp index 8172f02e9..9504b13bb 100644 --- a/src/libslic3r/AppConfig.cpp +++ b/src/libslic3r/AppConfig.cpp @@ -165,7 +165,7 @@ void AppConfig::set_defaults() set("auto_toolbar_size", "100"); if (get("auto_switch_preview").empty()) - set("auto_switch_preview", "1"); + set("auto_switch_preview", "2"); #if ENABLE_ENVIRONMENT_MAP if (get("use_environment_map").empty()) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 3f01beaa6..26f930990 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -3093,14 +3093,23 @@ unsigned int Plater::priv::update_background_process(bool force_validation, bool } //update tab if needed - if (invalidated != Print::ApplyStatus::APPLY_STATUS_UNCHANGED && wxGetApp().app_config->get("auto_switch_preview") == "1") + // auto_switch_preview == 0 means "no force tab change" + if (invalidated != Print::ApplyStatus::APPLY_STATUS_UNCHANGED && wxGetApp().app_config->get("auto_switch_preview") != "0") { - if (this->preview->can_display_gcode()) - main_frame->select_tab(MainFrame::ETabType::PlaterGcode, true); - else if (this->preview->can_display_volume()) - main_frame->select_tab(MainFrame::ETabType::PlaterPreview, true); - else - main_frame->select_tab(MainFrame::ETabType::Plater3D, true); + // auto_switch_preview == 3 means "force tab change only if for gcode" + if(wxGetApp().app_config->get("auto_switch_preview") == "3") + if(this->preview->can_display_gcode()) + main_frame->select_tab(MainFrame::ETabType::PlaterGcode, true); + // auto_switch_preview == 1 means "force tab change" + // auto_switch_preview == 2 (the only other one) means "force tab change only if already on a plater one" + else if (wxGetApp().app_config->get("auto_switch_preview") == "1" || main_frame->selected_tab() < MainFrame::ETabType::LastPlater) { + if (this->preview->can_display_gcode()) + main_frame->select_tab(MainFrame::ETabType::PlaterGcode, true); + else if (this->preview->can_display_volume()) + main_frame->select_tab(MainFrame::ETabType::PlaterPreview, true); + else + main_frame->select_tab(MainFrame::ETabType::Plater3D, true); + } } return return_state; } @@ -3705,8 +3714,13 @@ void Plater::priv::on_slicing_update(SlicingStatusEvent &evt) void Plater::priv::on_slicing_completed(wxCommandEvent & evt) { + // auto_switch_preview == 0 means "no force tab change" + // auto_switch_preview == 1 means "force tab change" + // auto_switch_preview == 2 means "force tab change only if already on a plater one" + // auto_switch_preview == 3 means "force tab change only if for gcode" notification_manager->push_slicing_complete_notification(evt.GetInt(), is_sidebar_collapsed()); - if(wxGetApp().app_config->get("auto_switch_preview") == "1" && !this->preview->can_display_gcode()) + if( ( wxGetApp().app_config->get("auto_switch_preview") == "1" || (wxGetApp().app_config->get("auto_switch_preview") == "2" && main_frame->selected_tab() < MainFrame::ETabType::LastPlater) ) + && !this->preview->can_display_gcode()) main_frame->select_tab(MainFrame::ETabType::PlaterPreview); switch (this->printer_technology) { case ptFFF: @@ -3786,7 +3800,13 @@ void Plater::priv::on_process_completed(SlicingProcessCompletedEvent &evt) this->background_process.stop(); this->statusbar()->reset_cancel_callback(); this->statusbar()->stop_busy(); - if (wxGetApp().app_config->get("auto_switch_preview") == "1") + // auto_switch_preview == 0 means "no force tab change" + // auto_switch_preview == 1 means "force tab change" + // auto_switch_preview == 2 means "force tab change only if already on a plater one" + // auto_switch_preview == 3 means "force tab change only if for gcode" + if (wxGetApp().app_config->get("auto_switch_preview") == "1" + || (wxGetApp().app_config->get("auto_switch_preview") == "2" && main_frame->selected_tab() < MainFrame::ETabType::LastPlater) + || wxGetApp().app_config->get("auto_switch_preview") == "3") main_frame->select_tab(MainFrame::ETabType::PlaterGcode); // Reset the "export G-code path" name, so that the automatic background processing will be enabled again. diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index 48a2d39ec..1a11090ac 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -58,7 +58,7 @@ void PreferencesDialog::build() m_optgroup_general->m_on_change = [this](t_config_option_key opt_key, boost::any value) { if (opt_key == "default_action_on_close_application" || opt_key == "default_action_on_select_preset") m_values[opt_key] = boost::any_cast(value) ? "none" : "discard"; - else if (opt_key == "splash_screen_editor" || opt_key == "splash_screen_gcodeviewer") + else if (std::unordered_set{ "splash_screen_editor" ,"splash_screen_gcodeviewer" ,"auto_switch_preview" }.count(opt_key) > 0) m_values[opt_key] = boost::any_cast(value); else m_values[opt_key] = boost::any_cast(value) ? "1" : "0"; @@ -93,6 +93,30 @@ void PreferencesDialog::build() option = Option(def, "background_processing"); m_optgroup_general->append_single_option_line(option); + if (is_editor) { + def_combobox_auto_switch_preview.label = L("Switch to Preview when sliced"); + def_combobox_auto_switch_preview.type = coStrings; + def_combobox_auto_switch_preview.tooltip = L("Choose an option."); + def_combobox_auto_switch_preview.gui_type = "f_enum_open"; + def_combobox_auto_switch_preview.gui_flags = "show_value"; + def_combobox_auto_switch_preview.enum_values.push_back(_u8L("Don't switch")); + def_combobox_auto_switch_preview.enum_values.push_back(_u8L("Switch when possible")); + def_combobox_auto_switch_preview.enum_values.push_back(_u8L("Only if on plater")); + def_combobox_auto_switch_preview.enum_values.push_back(_u8L("Only when GCode is ready")); + if(app_config->get("auto_switch_preview") == "0") + def_combobox_auto_switch_preview.set_default_value(new ConfigOptionStrings{ def_combobox_auto_switch_preview.enum_values[0] }); + else if (app_config->get("auto_switch_preview") == "1") + def_combobox_auto_switch_preview.set_default_value(new ConfigOptionStrings{ def_combobox_auto_switch_preview.enum_values[1] }); + else if (app_config->get("auto_switch_preview") == "2") + def_combobox_auto_switch_preview.set_default_value(new ConfigOptionStrings{ def_combobox_auto_switch_preview.enum_values[2] }); + else if (app_config->get("auto_switch_preview") == "3") + def_combobox_auto_switch_preview.set_default_value(new ConfigOptionStrings{ def_combobox_auto_switch_preview.enum_values[3] }); + else + def_combobox_auto_switch_preview.set_default_value(new ConfigOptionStrings{ def_combobox_auto_switch_preview.enum_values[2] }); + option = Option(def_combobox_auto_switch_preview, "auto_switch_preview"); + m_optgroup_general->append_single_option_line(option); + } + // Please keep in sync with ConfigWizard def.label = L("Check for application updates"); def.type = coBool; @@ -449,15 +473,6 @@ void PreferencesDialog::build() option.opt.width = 6; m_optgroup_gui->append_single_option_line(option); - if (is_editor) { - def.label = L("Switch from 3D view to Preview when sliced"); - def.type = coBool; - def.tooltip = std::string(L("When an object is sliced, it will switch your view from the 3D view to the previewx (and then gcode-preview) automatically.")); - def.set_default_value(new ConfigOptionBool{ app_config->get("auto_switch_preview") == "1" }); - option = Option(def, "auto_switch_preview"); - m_optgroup_gui->append_single_option_line(option); - } - activate_options_tab(m_optgroup_gui); if (is_editor) { @@ -528,6 +543,27 @@ void PreferencesDialog::accept() m_values.erase(it); // we shouldn't change value, if some of those parameters was selected, and then deselected } + auto it_auto_switch_preview = m_values.find("auto_switch_preview"); + if (it_auto_switch_preview != m_values.end()) { + std::vector values = def_combobox_auto_switch_preview.enum_values; + for(size_t i=0; i< values.size(); i++) + if (values[i] == it_auto_switch_preview->second) + it_auto_switch_preview->second = std::to_string(i); + } + + auto it_background_processing = m_values.find("background_processing"); + if (it_background_processing != m_values.end() && it_background_processing->second == "1") { + bool warning = app_config->get("auto_switch_preview") != "0"; + if (it_auto_switch_preview != m_values.end()) + warning = it_auto_switch_preview->second == "1"; + if(warning) { + wxMessageDialog dialog(nullptr, "Using background processing with automatic tab switching may be combersome" + ", are-you sure to keep the automatic tab switching?", _L("Are you sure?"), wxOK | wxCANCEL | wxICON_QUESTION); + if (dialog.ShowModal() == wxID_CANCEL) + m_values["auto_switch_preview"] = "0"; + } + } + for (std::map::iterator it = m_values.begin(); it != m_values.end(); ++it) app_config->set(it->first, it->second); diff --git a/src/slic3r/GUI/Preferences.hpp b/src/slic3r/GUI/Preferences.hpp index ba911f365..1fc0961e1 100644 --- a/src/slic3r/GUI/Preferences.hpp +++ b/src/slic3r/GUI/Preferences.hpp @@ -24,6 +24,9 @@ class PreferencesDialog : public DPIDialog #if ENABLE_ENVIRONMENT_MAP std::shared_ptr m_optgroup_render; #endif // ENABLE_ENVIRONMENT_MAP + + ConfigOptionDef def_combobox_auto_switch_preview; + wxSizer* m_icon_size_sizer; wxRadioBox* m_layout_mode_box; bool isOSX {false}; -- cgit v1.2.3 From 86705d38f1192709a8eb73a96f094f2900f11c39 Mon Sep 17 00:00:00 2001 From: remi durand Date: Sat, 26 Jun 2021 13:16:46 +0200 Subject: fix crash when loading and a perimeter_loop_seam was set in a previous version. --- src/libslic3r/PrintConfig.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 0bc430fa2..64bd620c1 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -5298,6 +5298,10 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va value = "20%"; }else if ("near" == value || "nearest" == value ) value = "cost"; + } else if (opt_key == "perimeter_loop_seam") { + if (value == "hidden") { + value = "nearest"; + } } else if (opt_key == "overhangs") { opt_key = "overhangs_width_speed"; if (value == "1") -- cgit v1.2.3 From 96dec6cef71d1b59db2343f1fc20b69a2ec02ef6 Mon Sep 17 00:00:00 2001 From: remi durand Date: Sat, 26 Jun 2021 13:35:57 +0200 Subject: fix some localization strings --- resources/localization/fr/Slic3r.po | 68 ++++++++++++++++++++------------- src/slic3r/GUI/Preferences.cpp | 3 +- src/slic3r/GUI/UnsavedChangesDialog.cpp | 8 ++-- 3 files changed, 48 insertions(+), 31 deletions(-) diff --git a/resources/localization/fr/Slic3r.po b/resources/localization/fr/Slic3r.po index 70f4dfef1..6ca7d3ae8 100644 --- a/resources/localization/fr/Slic3r.po +++ b/resources/localization/fr/Slic3r.po @@ -5,14 +5,14 @@ msgid "" msgstr "" "Project-Id-Version: Slic3r\n" -"POT-Creation-Date: 2021-06-25 00:00\n" -"PO-Revision-Date: 2021-06-25 00:00\n" +"POT-Creation-Date: 2021-06-26 00:00\n" +"PO-Revision-Date: 2021-06-26 00:00\n" "Last-Translator: 5axes\n" "Language-Team:5axes, supermerill\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Language: fr\n" +"Language:fr\n" msgid "!! Can be unstable in some os distribution !!" msgstr "!! peut être instable avec certaines distributions de système d'exploitation." @@ -109,6 +109,9 @@ msgstr "%s n'a aucunes mises à jour de configuration disponibles." msgid "%s incompatibility" msgstr "Incompatibilité de %s" +msgid "%s is closing: Unsaved Changes" +msgstr "%s se ferme : Modifications non sauvegardées" + msgid "" "%s now uses an updated configuration structure.\n" "\n" @@ -169,6 +172,9 @@ msgstr "" "\n" "Lots de configuration mis à jour :" +msgid "%s will remember your action." +msgstr "%s se souviendra de votre action. " + msgid "%s will remember your choice." msgstr "%s se souviendra de votre choix." @@ -369,9 +375,6 @@ msgstr "4x10°" msgid "5x5°" msgstr "5x5°" -msgid ": Don't ask me again" -msgstr ": Ne me le redemande pas" - msgid ": Open hyperlink" msgstr "Ouvrir un lien hypertexte" @@ -1004,6 +1007,9 @@ msgstr "Voulez-vous vraiment supprimer l'imprimante \"%1%\" ?" msgid "Are you sure you want to do it?" msgstr "Êtes-vous certain de vouloir le faire ?" +msgid "Are you sure?" +msgstr "Etes-vous sûr?" + msgid "Area fill" msgstr "Remplissage de zone" @@ -2641,6 +2647,9 @@ msgstr "Ne plus afficher" msgid "Don't support bridges" msgstr "Ne pas supporter les ponts" +msgid "Don't switch" +msgstr "Ne pas changer" + msgid "Downgrade" msgstr "Rétrograder" @@ -5149,9 +5158,6 @@ msgstr "Type de lissage" msgid "Ironing width" msgstr "Largeur du lissage" -msgid " is closing: Unsaved Changes" -msgstr " se ferme : Modifications non sauvegardées" - msgid "is licensed under the" msgstr "est sous licence" @@ -6809,6 +6815,9 @@ msgstr "le côté extérieur" msgid "Only for overhangs" msgstr "Uniquement pour les surplombs" +msgid "Only if on plater" +msgstr "Si déjà sur le plateau" + msgid "Only infill where needed" msgstr "Remplissage seulement où cela est nécessaire" @@ -6844,6 +6853,9 @@ msgstr "" "Utilisé uniquement pour klipper, où vous pouvez nommer l'extrudeuse. S'il n'est pas défini, ce sera " "'extruderX' avec 'X' remplacé par le numéro de l'extrudeuse." +msgid "Only when GCode is ready" +msgstr "Quand le GCode est prêt" + msgid "Ooze prevention" msgstr "Prévention des coulures" @@ -9114,11 +9126,6 @@ msgstr "" "le mot de passe dans l'URL en respectant le format suivant : " "https://username:password@your-octopi-address/" -msgid "" -"Slic3r contains sizable contributions from Prusa Research. Original work by " -"Alessandro Ranellucci and the RepRap community." -msgstr "Slic3r contient une important contribution de Prusa Research. Code orignalement crée par Alessandro Ranellucci and the RepRap community." - msgid "Slic3r logo designed by Corey Daniels." msgstr "Logo Slic3r conçu par Corey Daniels." @@ -9648,6 +9655,13 @@ msgstr "" "Démonté avec succès. Le périphérique %s(% s) peut maintenant être retiré en " "toute sécurité de l'ordinateur." +msgid "" +"SuperSlicer is a skinned version of Slic3r, based on PrusaSlicer by Prusa " +"and the original Slic3r by Alessandro Ranellucci & the RepRap community." +msgstr "" +"SuperSlicer est une version modifiée de Slic3r, basée sur PrusaSlicer de Prusa " +"et sur la version Slic3r originale d'Alessandro Ranellucci et de la communauté RepRap." + msgid "support" msgstr "support" @@ -9796,18 +9810,21 @@ msgstr "Code de changement pour Changer l'extrudeuse" msgid "Switch code to Color change (%1%) for:" msgstr "Code de changement pour Changer de couleur (%1%) pour :" -msgid "Switch from 3D view to Preview when sliced" -msgstr "Passage de la vue 3D à la prévisualisation lors du découpage en couches" - msgid "Switch to editing mode" msgstr "Basculer vers le mode édition" +msgid "Switch to Preview when sliced" +msgstr "Changer l'onglet sur l'aperçu dès que possible" + msgid "Switch to Settings" msgstr "Basculer dans le Réglages" msgid "Switch to the %s mode" msgstr "Basculer vers le mode %s" +msgid "Switch when possible" +msgstr "Dès que possible" + msgid "Switching Presets: Unsaved Changes" msgstr "Changement de préréglages : modifications non enregistrées" @@ -12053,11 +12070,13 @@ msgstr "" "l'enregistrement ?" msgid "" -"When an object is sliced, it will switch your view from the 3D view to the " -"previewx (and then gcode-preview) automatically." +"When an object is sliced, it will switch your view from the curent view to " +"the preview (and then gcode-preview) automatically, depending on the option " +"choosen." msgstr "" -"Lorsqu'un objet est découpé en couches, cela fera passer votre vue de la vue 3D à la " -"pré-visualisation (et ensuite prévisualisation G-Code) automatiquement." +"Lorsqu'un objet est découpé en couches, cela fera passer votre vue de la vue " +"3D à la pré-visualisation (et ensuite prévisualisation G-Code) automatiquement, " +"selon l'option choisie." msgid "" "When checked, the print and filament presets are shown in the preset editor " @@ -12282,9 +12301,6 @@ msgstr "Va augmenter ou diminuer les polygones 2D découpés en fonction du sign msgid "Will only take into account the delay for the cooling of overhangs." msgstr "Ne tiendra compte que du délai pour le refroidissement des surplombs." -msgid " will remember your action." -msgstr " se souviendra de votre action. " - msgid "will run at %1%%% by default" msgstr "s'exécutera à %1%%% par défaut" @@ -12539,8 +12555,8 @@ msgid "You will not be asked about it again on label hovering." msgstr "Vous ne serez plus interrogé sur ce sujet lors du survol de l'étiquette." msgid "" -"You will not be asked about the unsaved changes the next time you close " -msgstr "Vous ne serez pas interrogé sur les modifications non sauvegardées lors de la prochaine fermeture de l'application. " +"You will not be asked about the unsaved changes the next time you close %s." +msgstr "Vous ne serez pas interrogé sur les modifications non sauvegardées lors de la prochaine fermeture de %s." msgid "" "You will not be asked about the unsaved changes the next time you switch a " diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index 1a11090ac..258eaf0ee 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -96,7 +96,8 @@ void PreferencesDialog::build() if (is_editor) { def_combobox_auto_switch_preview.label = L("Switch to Preview when sliced"); def_combobox_auto_switch_preview.type = coStrings; - def_combobox_auto_switch_preview.tooltip = L("Choose an option."); + def_combobox_auto_switch_preview.tooltip = L("When an object is sliced, it will switch your view from the curent view to the " + "preview (and then gcode-preview) automatically, depending on the option choosen."); def_combobox_auto_switch_preview.gui_type = "f_enum_open"; def_combobox_auto_switch_preview.gui_flags = "show_value"; def_combobox_auto_switch_preview.enum_values.push_back(_u8L("Don't switch")); diff --git a/src/slic3r/GUI/UnsavedChangesDialog.cpp b/src/slic3r/GUI/UnsavedChangesDialog.cpp index fa1e09d6f..fc1395545 100644 --- a/src/slic3r/GUI/UnsavedChangesDialog.cpp +++ b/src/slic3r/GUI/UnsavedChangesDialog.cpp @@ -534,7 +534,7 @@ void UnsavedChangesModel::Rescale() //------------------------------------------ UnsavedChangesDialog::UnsavedChangesDialog(const wxString& header) - : DPIDialog(static_cast(wxGetApp().mainframe), wxID_ANY, _L(SLIC3R_APP_NAME " is closing: Unsaved Changes"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) + : DPIDialog(static_cast(wxGetApp().mainframe), wxID_ANY, wxString::Format(_L("%s is closing: Unsaved Changes"), SLIC3R_APP_NAME), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) { m_app_config_key = "default_action_on_close_application"; @@ -671,13 +671,13 @@ void UnsavedChangesDialog::build(Preset::Type type, PresetCollection* dependent_ wxString preferences_item = type == Preset::TYPE_INVALID ? _L("Ask for unsaved changes when closing application") : _L("Ask for unsaved changes when selecting new preset"); wxString msg = - _L(SLIC3R_APP_NAME " will remember your action.") + "\n\n" + + wxString::Format(_L("%s will remember your action."), SLIC3R_APP_NAME) + "\n\n" + (type == Preset::TYPE_INVALID ? - _L("You will not be asked about the unsaved changes the next time you close " SLIC3R_APP_NAME ".") : + wxString::Format(_L("You will not be asked about the unsaved changes the next time you close %s."), SLIC3R_APP_NAME) : _L("You will not be asked about the unsaved changes the next time you switch a preset.")) + "\n\n" + format_wxstr(_L("Visit \"Preferences\" and check \"%1%\"\nto be asked about unsaved changes again."), preferences_item); - wxMessageDialog dialog(nullptr, msg, _L(SLIC3R_APP_NAME ": Don't ask me again"), wxOK | wxCANCEL | wxICON_INFORMATION); + wxMessageDialog dialog(nullptr, msg, wxString::Format(_L("%s: Don't ask me again"), SLIC3R_APP_NAME), wxOK | wxCANCEL | wxICON_INFORMATION); if (dialog.ShowModal() == wxID_CANCEL) m_remember_choice->SetValue(false); }); -- cgit v1.2.3