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
This commit is contained in:
YuSanka 2022-11-01 14:55:19 +01:00
parent f5e782233e
commit 8914dfa1f6
4 changed files with 34 additions and 22 deletions

View File

@ -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);

View File

@ -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<PlaterPresetComboBox*>(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<TabPresetComboBox*>(this)!=nullptr)
wxGetApp().sidebar().update_presets(m_type);
this->update();
return true;
}

View File

@ -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()

View File

@ -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;