Improvements for printer selection: Revert to the previously selected physical printer instead of related system preset,

when we had selected FFF physical printer and can't to switch to the SLA preset.
This commit is contained in:
YuSanka 2023-01-02 17:27:19 +01:00
parent 6657369db2
commit d39768fc9c
4 changed files with 18 additions and 2 deletions

View File

@ -4188,6 +4188,8 @@ void Plater::priv::on_select_preset(wxCommandEvent &evt)
wxGetApp().preset_bundle->set_filament_preset(idx, preset_name);
}
std::string last_selected_ph_printer_name = combo->get_selected_ph_printer_name();
bool select_preset = !combo->selection_is_changed_according_to_physical_printers();
// TODO: ?
if (preset_type == Preset::TYPE_FILAMENT && sidebar->is_multifilament()) {
@ -4196,7 +4198,7 @@ void Plater::priv::on_select_preset(wxCommandEvent &evt)
}
else if (select_preset) {
wxWindowUpdateLocker noUpdates(sidebar->presets_panel());
wxGetApp().get_tab(preset_type)->select_preset(preset_name);
wxGetApp().get_tab(preset_type)->select_preset(preset_name, false, last_selected_ph_printer_name);
}
if (preset_type != Preset::TYPE_PRINTER || select_preset) {

View File

@ -666,6 +666,18 @@ void PlaterPresetComboBox::OnSelect(wxCommandEvent &evt)
evt.Skip();
}
std::string PlaterPresetComboBox::get_selected_ph_printer_name() const
{
if (m_type != Preset::TYPE_PRINTER)
return {};
const PhysicalPrinterCollection& physical_printers = m_preset_bundle->physical_printers;
if (physical_printers.has_selection())
return physical_printers.get_selected_full_printer_name();
return {};
}
void PlaterPresetComboBox::switch_to_tab()
{
Tab* tab = wxGetApp().get_tab(m_type);

View File

@ -164,6 +164,8 @@ public:
void sys_color_changed() override;
void OnSelect(wxCommandEvent& evt) override;
std::string get_selected_ph_printer_name() const;
private:
int m_extruder_idx = -1;
};

View File

@ -3406,7 +3406,7 @@ void Tab::select_preset(std::string preset_name, bool delete_current /*=false*/,
// If preset selection was canceled and previously was selected physical printer, we should select it back
m_preset_bundle->physical_printers.select_printer(last_selected_ph_printer_name);
}
if (m_preset_bundle->physical_printers.has_selection()) {
else if (m_preset_bundle->physical_printers.has_selection()) {
// If preset selection was canceled and physical printer was selected
// we must disable selection marker for the physical printers
m_preset_bundle->physical_printers.unselect_printer();