Merge branch 'dk_template_war'

This commit is contained in:
David Kocik 2023-06-13 15:17:35 +02:00
commit 43f3093e66
2 changed files with 37 additions and 14 deletions

View File

@ -4082,11 +4082,37 @@ void Plater::priv::on_slicing_update(SlicingStatusEvent &evt)
// Avoid a race condition // Avoid a race condition
return; return;
} }
// this->statusbar()->set_progress(evt.status.percent);
// this->statusbar()->set_status_text(_(evt.status.text) + wxString::FromUTF8("…"));
notification_manager->set_slicing_progress_percentage(evt.status.text, (float)evt.status.percent / 100.0f); notification_manager->set_slicing_progress_percentage(evt.status.text, (float)evt.status.percent / 100.0f);
} }
// Check template filaments and add warning
// This is more convinient to do here than in slicing backend, so it happens on "Slicing complete".
if (evt.status.percent >= 100 && this->printer_technology == ptFFF) {
size_t templ_cnt = 0;
const auto& preset_bundle = wxGetApp().preset_bundle;
std::string names;
for (const auto& extruder_filaments : preset_bundle->extruders_filaments) {
const Preset* preset = extruder_filaments.get_selected_preset();
if (preset && preset->vendor && preset->vendor->templates_profile) {
names += "\n" + preset->name;
templ_cnt++;
}
}
if (templ_cnt > 0) {
const std::string message_notif = GUI::format("%1%\n%2%\n%3%"
, _L_PLURAL("You are using template filament preset.", "You are using template filament presets.", templ_cnt)
, _u8L("Please note that template presets are not customized for specific printer and should only be used as a starting point for creating your own user presets.")
, names);
// warning dialog proccessing cuts text at first '/n' - pass the text without new lines (and without filament names).
const std::string message_dial = GUI::format("%1% %2%"
, _L_PLURAL("You are using template filament preset.", "You are using template filament presets.", templ_cnt)
, _u8L("Please note that template presets are not customized for specific printer and should only be used as a starting point for creating your own user presets."));
BOOST_LOG_TRIVIAL(warning) << message_notif;
notification_manager->push_slicing_warning_notification(message_notif, false, 0, 0);
add_warning({ PrintStateBase::WarningLevel::CRITICAL, true, message_dial, 0}, 0);
}
}
if (evt.status.flags & (PrintBase::SlicingStatus::RELOAD_SCENE | PrintBase::SlicingStatus::RELOAD_SLA_SUPPORT_POINTS)) { if (evt.status.flags & (PrintBase::SlicingStatus::RELOAD_SCENE | PrintBase::SlicingStatus::RELOAD_SLA_SUPPORT_POINTS)) {
switch (this->printer_technology) { switch (this->printer_technology) {
case ptFFF: case ptFFF:

View File

@ -644,13 +644,7 @@ PlaterPresetComboBox::PlaterPresetComboBox(wxWindow *parent, Preset::Type preset
edit_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent) edit_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent)
{ {
// In a case of a physical printer, for its editing open PhysicalPrinterDialog if (m_type == Preset::TYPE_PRINTER || m_type == Preset::TYPE_FILAMENT)
if (m_type == Preset::TYPE_PRINTER
#ifdef __linux__
// To edit extruder color from the sidebar
|| m_type == Preset::TYPE_FILAMENT
#endif //__linux__
)
show_edit_menu(); show_edit_menu();
else else
switch_to_tab(); switch_to_tab();
@ -784,15 +778,18 @@ void PlaterPresetComboBox::show_edit_menu()
append_menu_item(menu, wxID_ANY, _L("Edit preset"), "", append_menu_item(menu, wxID_ANY, _L("Edit preset"), "",
[this](wxCommandEvent&) { this->switch_to_tab(); }, "cog", menu, []() { return true; }, wxGetApp().plater()); [this](wxCommandEvent&) { this->switch_to_tab(); }, "cog", menu, []() { return true; }, wxGetApp().plater());
#ifdef __linux__
// To edit extruder color from the sidebar
if (m_type == Preset::TYPE_FILAMENT) { if (m_type == Preset::TYPE_FILAMENT) {
#ifdef __linux__
// To edit extruder color from the sidebar
append_menu_item(menu, wxID_ANY, _L("Change extruder color"), "", append_menu_item(menu, wxID_ANY, _L("Change extruder color"), "",
[this](wxCommandEvent&) { this->change_extruder_color(); }, "funnel", menu, []() { return true; }, wxGetApp().plater()); [this](wxCommandEvent&) { this->change_extruder_color(); }, "funnel", menu, []() { return true; }, wxGetApp().plater());
#endif //__linux__
append_menu_item(menu, wxID_ANY, _L("Show/Hide template presets"), "",
[this](wxCommandEvent&) { wxGetApp().open_preferences("no_templates", "General"); }, "spool", menu, []() { return true; }, wxGetApp().plater());
wxGetApp().plater()->PopupMenu(menu); wxGetApp().plater()->PopupMenu(menu);
return; return;
} }
#endif //__linux__
if (this->is_selected_physical_printer()) { if (this->is_selected_physical_printer()) {
append_menu_item(menu, wxID_ANY, _L("Edit physical printer"), "", append_menu_item(menu, wxID_ANY, _L("Edit physical printer"), "",