This commit is contained in:
enricoturri1966 2020-10-15 10:25:22 +02:00
commit 3fc12fdaaa
19 changed files with 374 additions and 262 deletions

View file

@ -1714,7 +1714,8 @@ struct Plater::priv
void clear_warnings();
void add_warning(const Slic3r::PrintStateBase::Warning &warning, size_t oid);
void actualizate_warnings(const Model& model, size_t print_oid);
// Update notification manager with the current state of warnings produced by the background process (slicing).
void actualize_slicing_warnings(const PrintBase &print);
// Displays dialog window with list of warnings.
// Returns true if user clicks OK.
// Returns true if current_warnings vector is empty without showning the dialog
@ -2023,7 +2024,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
#endif // ENABLE_GCODE_VIEWER
this->q->Bind(EVT_EJECT_DRIVE_NOTIFICAION_CLICKED, [this](EjectDriveNotificationClickedEvent&) { this->q->eject_drive(); });
this->q->Bind(EVT_EXPORT_GCODE_NOTIFICAION_CLICKED, [this](ExportGcodeNotificationClickedEvent&) { this->q->export_gcode(true); });
this->q->Bind(EVT_PRESET_UPDATE_AVIABLE_CLICKED, [this](PresetUpdateAviableClickedEvent&) { wxGetApp().get_preset_updater()->on_update_notification_confirm(); });
this->q->Bind(EVT_PRESET_UPDATE_AVAILABLE_CLICKED, [this](PresetUpdateAvailableClickedEvent&) { wxGetApp().get_preset_updater()->on_update_notification_confirm(); });
this->q->Bind(EVT_REMOVABLE_DRIVE_EJECTED, [this, q](RemovableDriveEjectEvent &evt) {
if (evt.data.second) {
this->show_action_buttons(this->ready_to_slice);
@ -2885,8 +2886,7 @@ unsigned int Plater::priv::update_background_process(bool force_validation, bool
//actualizate warnings
if (invalidated != Print::APPLY_STATUS_UNCHANGED) {
actualizate_warnings(this->q->model(), this->background_process.current_print()->id().id);
notification_manager->set_all_slicing_warnings_gray(true);
actualize_slicing_warnings(*this->background_process.current_print());
show_warning_dialog = false;
process_completed_with_error = false;
}
@ -3474,7 +3474,7 @@ void Plater::priv::on_slicing_update(SlicingStatusEvent &evt)
// Now process state.warnings.
for (auto const& warning : state.warnings) {
if (warning.current) {
notification_manager->push_slicing_warning_notification(warning.message, false, *q->get_current_canvas3D(), object_id.id, warning_step);
notification_manager->push_slicing_warning_notification(warning.message, false, *q->get_current_canvas3D(), object_id, warning_step);
add_warning(warning, object_id.id);
}
}
@ -3483,7 +3483,6 @@ void Plater::priv::on_slicing_update(SlicingStatusEvent &evt)
void Plater::priv::on_slicing_completed(wxCommandEvent & evt)
{
//notification_manager->push_notification(NotificationType::SlicingComplete, *q->get_current_canvas3D(), evt.GetInt());
notification_manager->push_slicing_complete_notification(*q->get_current_canvas3D(), evt.GetInt(), is_sidebar_collapsed());
switch (this->printer_technology) {
@ -3520,19 +3519,17 @@ void Plater::priv::add_warning(const Slic3r::PrintStateBase::Warning& warning, s
}
current_warnings.emplace_back(std::pair<Slic3r::PrintStateBase::Warning, size_t>(warning, oid));
}
void Plater::priv::actualizate_warnings(const Model& model, size_t print_oid)
void Plater::priv::actualize_slicing_warnings(const PrintBase &print)
{
if (model.objects.size() == 0) {
std::vector<ObjectID> ids = print.print_object_ids();
if (ids.empty()) {
clear_warnings();
return;
}
std::vector<size_t> living_oids;
living_oids.push_back(model.id().id);
living_oids.push_back(print_oid);
for (auto it = model.objects.begin(); it != model.objects.end(); ++it) {
living_oids.push_back((*it)->id().id);
}
notification_manager->compare_warning_oids(living_oids);
ids.emplace_back(print.id());
std::sort(ids.begin(), ids.end());
notification_manager->remove_slicing_warnings_of_released_objects(ids);
notification_manager->set_all_slicing_warnings_gray(true);
}
void Plater::priv::clear_warnings()
{