notifications not showing slicing finished when error

This commit is contained in:
David Kocik 2020-08-25 17:59:51 +02:00
parent bca60821d8
commit a81afce1b8
2 changed files with 14 additions and 4 deletions

View file

@ -730,16 +730,16 @@ void NotificationManager::push_slicing_complete_notification(GLCanvas3D& canvas,
{ {
std::string hypertext; std::string hypertext;
int time = 10; int time = 10;
if(large) if (has_error_notification())
{ return;
if (large) {
hypertext = _u8L("Export G-Code."); hypertext = _u8L("Export G-Code.");
time = 0; time = 0;
} }
NotificationData data{ NotificationType::SlicingComplete, NotificationLevel::RegularNotification, time, _u8L("Slicing finished."), hypertext }; NotificationData data{ NotificationType::SlicingComplete, NotificationLevel::RegularNotification, time, _u8L("Slicing finished."), hypertext };
NotificationManager::SlicingCompleteLargeNotification* notification = new NotificationManager::SlicingCompleteLargeNotification(data, m_next_id++, m_evt_handler, large); NotificationManager::SlicingCompleteLargeNotification* notification = new NotificationManager::SlicingCompleteLargeNotification(data, m_next_id++, m_evt_handler, large);
if (push_notification_data(notification, canvas, timestamp)) { if (!push_notification_data(notification, canvas, timestamp)) {
} else {
delete notification; delete notification;
} }
} }
@ -917,6 +917,15 @@ void NotificationManager::set_in_preview(bool preview)
notification->hide(preview); notification->hide(preview);
} }
} }
bool NotificationManager::has_error_notification()
{
for (PopNotification* notification : m_pop_notifications) {
if (notification->get_data().level == NotificationLevel::ErrorNotification)
return true;
}
return false;
}
void NotificationManager::dpi_changed() void NotificationManager::dpi_changed()
{ {

View file

@ -240,6 +240,7 @@ private:
//finds older notification of same type and moves it to the end of queue. returns true if found //finds older notification of same type and moves it to the end of queue. returns true if found
bool find_older(NotificationManager::PopNotification* notification); bool find_older(NotificationManager::PopNotification* notification);
void sort_notifications(); void sort_notifications();
bool has_error_notification();
wxEvtHandler* m_evt_handler; wxEvtHandler* m_evt_handler;
std::deque<PopNotification*> m_pop_notifications; std::deque<PopNotification*> m_pop_notifications;