From 8914dfa1f654c663ef14635725ab3f8b82c686b4 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Tue, 1 Nov 2022 14:55:19 +0100 Subject: [PATCH] Next fix, related to #8800 * PrintApply: Suppress to apply print when just a physical printer was changed, but printer preset stays the same * Tab: Layout the buttons bar when switch from the physical printer to printer preset and vice versa --- src/libslic3r/PrintApply.cpp | 5 ++++ src/slic3r/GUI/PresetComboBoxes.cpp | 9 ++++--- src/slic3r/GUI/Tab.cpp | 41 ++++++++++++++++------------- src/slic3r/GUI/Tab.hpp | 1 + 4 files changed, 34 insertions(+), 22 deletions(-) diff --git a/src/libslic3r/PrintApply.cpp b/src/libslic3r/PrintApply.cpp index c3792779c..330ad533c 100644 --- a/src/libslic3r/PrintApply.cpp +++ b/src/libslic3r/PrintApply.cpp @@ -988,6 +988,11 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_ DynamicPrintConfig filament_overrides; t_config_option_keys print_diff = print_config_diffs(m_config, new_full_config, filament_overrides); t_config_option_keys full_config_diff = full_print_config_diffs(m_full_print_config, new_full_config); + // If just a physical printer was changed, but printer preset is the same, then there is no need to apply whole print + // see https://github.com/prusa3d/PrusaSlicer/issues/8800 + if (full_config_diff.size() == 1 && full_config_diff[0] == "physical_printer_settings_id") + full_config_diff.clear(); + // Collect changes to object and region configs. t_config_option_keys object_diff = m_default_object_config.diff(new_full_config); t_config_option_keys region_diff = m_default_region_config.diff(new_full_config); diff --git a/src/slic3r/GUI/PresetComboBoxes.cpp b/src/slic3r/GUI/PresetComboBoxes.cpp index c63c20685..200cd8a30 100644 --- a/src/slic3r/GUI/PresetComboBoxes.cpp +++ b/src/slic3r/GUI/PresetComboBoxes.cpp @@ -527,10 +527,9 @@ bool PresetComboBox::selection_is_changed_according_to_physical_printers() return false; const bool is_changed = selected_string == physical_printers.get_selected_printer_preset_name(); + physical_printers.unselect_printer(); if (is_changed) tab->select_preset(selected_string); - physical_printers.unselect_printer(); - return is_changed; } @@ -547,16 +546,18 @@ bool PresetComboBox::selection_is_changed_according_to_physical_printers() // if new preset wasn't selected, there is no need to call update preset selection if (old_printer_preset == preset_name) { + tab->update_preset_choice(); + wxGetApp().plater()->show_action_buttons(false); + // we need just to update according Plater<->Tab PresetComboBox if (dynamic_cast(this)!=nullptr) { - wxGetApp().get_tab(m_type)->update_preset_choice(); // Synchronize config.ini with the current selections. m_preset_bundle->export_selections(*wxGetApp().app_config); + this->update(); } else if (dynamic_cast(this)!=nullptr) wxGetApp().sidebar().update_presets(m_type); - this->update(); return true; } diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 8f38a1525..7e441342f 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -215,26 +215,30 @@ void Tab::create_preset_tab() sizer->Add(m_hsizer, 0, wxEXPAND | wxBOTTOM, 3); m_hsizer->Add(m_presets_choice, 0, wxLEFT | wxRIGHT | wxTOP | wxALIGN_CENTER_VERTICAL, 3); m_hsizer->AddSpacer(int(4*scale_factor)); - m_hsizer->Add(m_btn_save_preset, 0, wxALIGN_CENTER_VERTICAL); - m_hsizer->AddSpacer(int(4*scale_factor)); - m_hsizer->Add(m_btn_rename_preset, 0, wxALIGN_CENTER_VERTICAL); - m_hsizer->AddSpacer(int(4 * scale_factor)); - m_hsizer->Add(m_btn_delete_preset, 0, wxALIGN_CENTER_VERTICAL); + + m_h_buttons_sizer = new wxBoxSizer(wxHORIZONTAL); + m_h_buttons_sizer->Add(m_btn_save_preset, 0, wxALIGN_CENTER_VERTICAL); + m_h_buttons_sizer->AddSpacer(int(4*scale_factor)); + m_h_buttons_sizer->Add(m_btn_rename_preset, 0, wxALIGN_CENTER_VERTICAL); + m_h_buttons_sizer->AddSpacer(int(4 * scale_factor)); + m_h_buttons_sizer->Add(m_btn_delete_preset, 0, wxALIGN_CENTER_VERTICAL); if (m_btn_edit_ph_printer) { - m_hsizer->AddSpacer(int(4 * scale_factor)); - m_hsizer->Add(m_btn_edit_ph_printer, 0, wxALIGN_CENTER_VERTICAL); + m_h_buttons_sizer->AddSpacer(int(4 * scale_factor)); + m_h_buttons_sizer->Add(m_btn_edit_ph_printer, 0, wxALIGN_CENTER_VERTICAL); } - m_hsizer->AddSpacer(int(/*16*/8 * scale_factor)); - m_hsizer->Add(m_btn_hide_incompatible_presets, 0, wxALIGN_CENTER_VERTICAL); - m_hsizer->AddSpacer(int(8 * scale_factor)); - m_hsizer->Add(m_question_btn, 0, wxALIGN_CENTER_VERTICAL); - m_hsizer->AddSpacer(int(32 * scale_factor)); - m_hsizer->Add(m_undo_to_sys_btn, 0, wxALIGN_CENTER_VERTICAL); - m_hsizer->Add(m_undo_btn, 0, wxALIGN_CENTER_VERTICAL); - m_hsizer->AddSpacer(int(32 * scale_factor)); - m_hsizer->Add(m_search_btn, 0, wxALIGN_CENTER_VERTICAL); - m_hsizer->AddSpacer(int(8*scale_factor)); - m_hsizer->Add(m_btn_compare_preset, 0, wxALIGN_CENTER_VERTICAL); + m_h_buttons_sizer->AddSpacer(int(/*16*/8 * scale_factor)); + m_h_buttons_sizer->Add(m_btn_hide_incompatible_presets, 0, wxALIGN_CENTER_VERTICAL); + m_h_buttons_sizer->AddSpacer(int(8 * scale_factor)); + m_h_buttons_sizer->Add(m_question_btn, 0, wxALIGN_CENTER_VERTICAL); + m_h_buttons_sizer->AddSpacer(int(32 * scale_factor)); + m_h_buttons_sizer->Add(m_undo_to_sys_btn, 0, wxALIGN_CENTER_VERTICAL); + m_h_buttons_sizer->Add(m_undo_btn, 0, wxALIGN_CENTER_VERTICAL); + m_h_buttons_sizer->AddSpacer(int(32 * scale_factor)); + m_h_buttons_sizer->Add(m_search_btn, 0, wxALIGN_CENTER_VERTICAL); + m_h_buttons_sizer->AddSpacer(int(8*scale_factor)); + m_h_buttons_sizer->Add(m_btn_compare_preset, 0, wxALIGN_CENTER_VERTICAL); + + m_hsizer->Add(m_h_buttons_sizer, 1, wxEXPAND); m_hsizer->AddSpacer(int(16*scale_factor)); // m_hsizer->AddStretchSpacer(32); // StretchSpacer has a strange behavior under OSX, so @@ -3192,6 +3196,7 @@ void Tab::update_btns_enabling() if (m_btn_edit_ph_printer) m_btn_edit_ph_printer->SetToolTip( m_preset_bundle->physical_printers.has_selection() ? _L("Edit physical printer") : _L("Add physical printer")); + m_h_buttons_sizer->Layout(); } void Tab::update_preset_choice() diff --git a/src/slic3r/GUI/Tab.hpp b/src/slic3r/GUI/Tab.hpp index 448e4be05..5adeb278a 100644 --- a/src/slic3r/GUI/Tab.hpp +++ b/src/slic3r/GUI/Tab.hpp @@ -173,6 +173,7 @@ protected: ScalableButton* m_btn_edit_ph_printer {nullptr}; ScalableButton* m_btn_hide_incompatible_presets; wxBoxSizer* m_hsizer; + wxBoxSizer* m_h_buttons_sizer; wxBoxSizer* m_left_sizer; wxTreeCtrl* m_treectrl;