Skip to content

Commit 2a1709e

Browse files
Refactor Reload Presets based on PR review
- Remove auto-select of newly found presets (don't change user's selection) - Add toast notification showing reload stats (new process/filament counts) - Remove reload button from Tab toolbar (was confusing next to profile-specific buttons) - Move File menu entry below Batch Preset Management - Make menu entry cross-platform (was Mac-only, now shows on all platforms) - Change shortcut to Cmd+Shift+R / Ctrl+Shift+R (Cmd+R conflicts with slice)
1 parent d9b947c commit 2a1709e

4 files changed

Lines changed: 27 additions & 25 deletions

File tree

src/slic3r/GUI/GUI_App.cpp

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5707,25 +5707,32 @@ void GUI_App::reload_user_presets_from_disk()
57075707
preset_bundle->load_user_presets(user_id, ForwardCompatibilitySubstitutionRule::Enable);
57085708
mainframe->update_side_preset_ui();
57095709

5710-
// Find new presets and select the last one found
5711-
std::string new_print, new_filament;
5710+
// Count new and modified presets for notification
5711+
int new_prints = 0, new_filaments = 0;
57125712
for (const auto& p : preset_bundle->prints)
57135713
if (p.is_user() && old_prints.find(p.name) == old_prints.end())
5714-
new_print = p.name;
5714+
new_prints++;
57155715
for (const auto& p : preset_bundle->filaments)
57165716
if (p.is_user() && old_filaments.find(p.name) == old_filaments.end())
5717-
new_filament = p.name;
5718-
5719-
if (!new_print.empty()) {
5720-
BOOST_LOG_TRIVIAL(info) << "New process preset found, selecting: " << new_print;
5721-
auto tab = get_tab(Preset::TYPE_PRINT);
5722-
if (tab) tab->select_preset(new_print);
5723-
}
5724-
if (!new_filament.empty()) {
5725-
BOOST_LOG_TRIVIAL(info) << "New filament preset found, selecting: " << new_filament;
5726-
auto tab = get_tab(Preset::TYPE_FILAMENT);
5727-
if (tab) tab->select_preset(new_filament);
5728-
}
5717+
new_filaments++;
5718+
5719+
// Show toast notification with reload stats
5720+
std::string msg = "Presets reloaded";
5721+
if (new_prints > 0 || new_filaments > 0) {
5722+
msg += ": ";
5723+
std::vector<std::string> parts;
5724+
if (new_prints > 0)
5725+
parts.push_back(std::to_string(new_prints) + " new process");
5726+
if (new_filaments > 0)
5727+
parts.push_back(std::to_string(new_filaments) + " new filament");
5728+
for (size_t i = 0; i < parts.size(); i++) {
5729+
if (i > 0) msg += ", ";
5730+
msg += parts[i];
5731+
}
5732+
}
5733+
BOOST_LOG_TRIVIAL(info) << msg;
5734+
if (plater())
5735+
plater()->get_notification_manager()->push_notification(msg);
57295736
}
57305737

57315738
//BBS reload when logout

src/slic3r/GUI/MainFrame.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2658,11 +2658,6 @@ void MainFrame::init_menubar_as_editor()
26582658
append_menu_item(fileMenu, wxID_ANY, _L("Save Project") + "\t" + ctrl + "S", _L("Save current project to file"),
26592659
[this](wxCommandEvent&) { if (m_plater) m_plater->save_project(); }, "", nullptr,
26602660
[this](){return m_plater != nullptr && can_save(); }, this);
2661-
2662-
// Reload user presets from disk
2663-
append_menu_item(fileMenu, wxID_ANY, _L("Reload Presets") + "\t" + ctrl + "R", _L("Reload user presets from disk"),
2664-
[](wxCommandEvent&) { wxGetApp().reload_user_presets_from_disk(); }, "", nullptr,
2665-
[]() { return true; }, this);
26662661
#endif
26672662

26682663

@@ -2758,6 +2753,11 @@ void MainFrame::init_menubar_as_editor()
27582753
},
27592754
"", nullptr);
27602755

2756+
// Reload user presets from disk
2757+
append_menu_item(fileMenu, wxID_ANY, _L("Reload Presets") + "\t" + ctrl + _L("Shift+") + "R", _L("Reload user presets from disk"),
2758+
[](wxCommandEvent&) { wxGetApp().reload_user_presets_from_disk(); }, "", nullptr,
2759+
[]() { return true; }, this);
2760+
27612761
fileMenu->AppendSeparator();
27622762

27632763
#ifndef __APPLE__

src/slic3r/GUI/Tab.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,6 @@ void Tab::create_preset_tab()
234234
});
235235

236236
//add_scaled_button(panel, &m_btn_compare_preset, "compare");
237-
add_scaled_button(m_top_panel, &m_btn_reload_presets, "reload_preset");
238237
add_scaled_button(m_top_panel, &m_btn_save_preset, "save");
239238
add_scaled_button(m_top_panel, &m_btn_delete_preset, "cross");
240239
//if (m_type == Preset::Type::TYPE_PRINTER)
@@ -373,7 +372,6 @@ void Tab::create_preset_tab()
373372
m_top_sizer->Add( m_undo_to_sys_btn, 0, wxALIGN_CENTER_VERTICAL);
374373
m_top_sizer->AddSpacer(8);
375374
#endif
376-
m_top_sizer->Add( m_btn_reload_presets, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(12));
377375
m_top_sizer->Add( m_btn_save_preset, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(12));
378376
m_top_sizer->Add( m_btn_delete_preset, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(12) );
379377
m_top_sizer->Add( m_btn_search, 0, wxALIGN_CENTER_VERTICAL | wxLEFT , FromDIP(12) );
@@ -612,8 +610,6 @@ void Tab::create_preset_tab()
612610

613611
//m_btn_compare_preset->Bind(wxEVT_BUTTON, ([this](wxCommandEvent e) { compare_preset(); }));
614612
m_btn_save_preset->Bind(wxEVT_BUTTON, ([this](wxCommandEvent e) { save_preset(); }));
615-
m_btn_reload_presets->Bind(wxEVT_BUTTON, ([this](wxCommandEvent e) { wxGetApp().reload_user_presets_from_disk(); }));
616-
m_btn_reload_presets->SetToolTip(_L("Reload presets from disk"));
617613
m_btn_delete_preset->Bind(wxEVT_BUTTON, ([this](wxCommandEvent e) { delete_preset(); }));
618614
/*m_btn_hide_incompatible_presets->Bind(wxEVT_BUTTON, ([this](wxCommandEvent e) {
619615
toggle_show_hide_incompatible();

src/slic3r/GUI/Tab.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ class Tab: public wxPanel
156156

157157
ScalableButton* m_btn_compare_preset;
158158
ScalableButton* m_btn_save_preset;
159-
ScalableButton* m_btn_reload_presets;
160159
ScalableButton* m_btn_delete_preset;
161160
//ScalableButton* m_btn_edit_ph_printer {nullptr};
162161
//ScalableButton* m_btn_hide_incompatible_presets;

0 commit comments

Comments
 (0)