ENH: increase the warning level of which blocking cloud slice

Jira: STUDIO-4457

Change-Id: I9a3be983cd5c585ed498829482e6b2202f4d5717
This commit is contained in:
liz.li 2023-09-14 17:33:27 +08:00 committed by Lane.Wei
parent 4d5fbb03f0
commit 8f5a2bb229
3 changed files with 8 additions and 4 deletions

View File

@ -1906,7 +1906,7 @@ void NotificationManager::push_slicing_error_notification(const std::string &tex
push_notification_data({ NotificationType::SlicingError, NotificationLevel::ErrorNotificationLevel, 0, _u8L("Error:") + "\n" + text, link, callback }, 0);
set_slicing_progress_hidden();
}
void NotificationManager::push_slicing_warning_notification(const std::string& text, bool gray, ModelObject const * obj, ObjectID oid, int warning_step, int warning_msg_id)
void NotificationManager::push_slicing_warning_notification(const std::string& text, bool gray, ModelObject const * obj, ObjectID oid, int warning_step, int warning_msg_id, NotificationLevel level/* = NotificationLevel::WarningNotificationLevel*/)
{
auto callback = obj ? [id = obj->id()](wxEvtHandler *) {
auto & objects = wxGetApp().model().objects;
@ -1919,7 +1919,7 @@ void NotificationManager::push_slicing_warning_notification(const std::string& t
} : std::function<bool(wxEvtHandler *)>();
auto link = callback ? _u8L("Jump to") : "";
if (obj) link += std::string(" [") + obj->name + "]";
NotificationData data { NotificationType::SlicingWarning, NotificationLevel::WarningNotificationLevel, 0, _u8L("Warning:") + "\n" + text, link, callback };
NotificationData data { NotificationType::SlicingWarning, level, 0, _u8L("Warning:") + "\n" + text, link, callback };
data.sub_msg_id = warning_msg_id;
data.ori_text = text;

View File

@ -203,7 +203,7 @@ public:
// Creates Slicing Error notification with a custom text and no fade out.
void push_slicing_error_notification(const std::string &text, std::vector<ModelObject const *> objs);
// Creates Slicing Warning notification with a custom text and no fade out.
void push_slicing_warning_notification(const std::string &text, bool gray, ModelObject const *obj, ObjectID oid, int warning_step, int warning_msg_id);
void push_slicing_warning_notification(const std::string &text, bool gray, ModelObject const *obj, ObjectID oid, int warning_step, int warning_msg_id, NotificationLevel level = NotificationLevel::WarningNotificationLevel);
// marks slicing errors as gray
void set_all_slicing_errors_gray(bool g);
// marks slicing warings as gray

View File

@ -6017,7 +6017,11 @@ 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, model_object, object_id, warning_step, warning.message_id);
NotificationManager::NotificationLevel notif_level = NotificationManager::NotificationLevel::WarningNotificationLevel;
if (evt.status.message_type == PrintStateBase::SlicingNotificationType::SlicingReplaceInitEmptyLayers | PrintStateBase::SlicingNotificationType::SlicingEmptyGcodeLayers) {
notif_level = NotificationManager::NotificationLevel::SeriousWarningNotificationLevel;
}
notification_manager->push_slicing_warning_notification(warning.message, false, model_object, object_id, warning_step, warning.message_id, notif_level);
add_warning(warning, object_id.id);
}
}