Merge branch 'dk_validate'

This commit is contained in:
David Kocik 2021-07-29 13:59:41 +02:00
commit ee96282ffc
3 changed files with 18 additions and 9 deletions

View file

@ -1096,6 +1096,11 @@ void NotificationManager::push_notification(NotificationType type,
} }
push_notification_data({ type, level, duration, text, hypertext, callback }, timestamp); push_notification_data({ type, level, duration, text, hypertext, callback }, timestamp);
} }
void NotificationManager::push_validate_error_notification(const std::string& text)
{
push_notification_data({ NotificationType::ValidateError, NotificationLevel::ErrorNotification, 0, _u8L("ERROR:") + "\n" + text }, 0);
}
void NotificationManager::push_slicing_error_notification(const std::string& text) void NotificationManager::push_slicing_error_notification(const std::string& text)
{ {
set_all_slicing_errors_gray(false); set_all_slicing_errors_gray(false);

View file

@ -55,8 +55,11 @@ enum class NotificationType
// Contains a hyperlink to execute installation of the new system profiles. // Contains a hyperlink to execute installation of the new system profiles.
PresetUpdateAvailable, PresetUpdateAvailable,
// LoadingFailed, // LoadingFailed,
// Not used - instead Slicing error is used for both slicing and validate errors. // Errors emmited by Print::validate
// ValidateError, // difference from Slicing error is that they disappear not grey out at update_background_process
ValidateError,
// Notification emitted by Print::validate
ValidateWarning,
// Slicing error produced by BackgroundSlicingProcess::validate() or by the BackgroundSlicingProcess background // Slicing error produced by BackgroundSlicingProcess::validate() or by the BackgroundSlicingProcess background
// thread thowing a SlicingError exception. // thread thowing a SlicingError exception.
SlicingError, SlicingError,
@ -79,8 +82,6 @@ enum class NotificationType
EmptyAutoColorChange, EmptyAutoColorChange,
// Notification about detected sign // Notification about detected sign
SignDetected, SignDetected,
// Notification emitted by Print::validate
PrintValidateWarning,
// Notification telling user to quit SLA supports manual editing // Notification telling user to quit SLA supports manual editing
QuitSLAManualMode, QuitSLAManualMode,
// Desktop integration basic info // Desktop integration basic info
@ -123,6 +124,8 @@ public:
// ErrorNotification and ImportantNotification are never faded out. // ErrorNotification and ImportantNotification are never faded out.
void push_notification(NotificationType type, NotificationLevel level, const std::string& text, const std::string& hypertext = "", void push_notification(NotificationType type, NotificationLevel level, const std::string& text, const std::string& hypertext = "",
std::function<bool(wxEvtHandler*)> callback = std::function<bool(wxEvtHandler*)>(), int timestamp = 0); std::function<bool(wxEvtHandler*)> callback = std::function<bool(wxEvtHandler*)>(), int timestamp = 0);
// Creates Validate Error notification with a custom text and no fade out.
void push_validate_error_notification(const std::string& text);
// Creates Slicing Error notification with a custom text and no fade out. // Creates Slicing Error notification with a custom text and no fade out.
void push_slicing_error_notification(const std::string& text); void push_slicing_error_notification(const std::string& text);
// Creates Slicing Warning notification with a custom text and no fade out. // Creates Slicing Warning notification with a custom text and no fade out.

View file

@ -2897,7 +2897,7 @@ void Plater::priv::update_print_volume_state()
void Plater::priv::process_validation_warning(const std::string& warning) const void Plater::priv::process_validation_warning(const std::string& warning) const
{ {
if (warning.empty()) if (warning.empty())
notification_manager->close_notification_of_type(NotificationType::PrintValidateWarning); notification_manager->close_notification_of_type(NotificationType::ValidateWarning);
else { else {
std::string text = warning; std::string text = warning;
std::string hypertext = ""; std::string hypertext = "";
@ -2920,9 +2920,9 @@ void Plater::priv::process_validation_warning(const std::string& warning) const
} }
notification_manager->push_notification( notification_manager->push_notification(
NotificationType::PrintValidateWarning, NotificationType::ValidateWarning,
NotificationManager::NotificationLevel::ImportantNotification, NotificationManager::NotificationLevel::WarningNotification,
text, hypertext, action_fn _u8L("WARNING:") + "\n" + text, hypertext, action_fn
); );
} }
} }
@ -2974,6 +2974,7 @@ unsigned int Plater::priv::update_background_process(bool force_validation, bool
std::string err = background_process.validate(&warning); std::string err = background_process.validate(&warning);
if (err.empty()) { if (err.empty()) {
notification_manager->set_all_slicing_errors_gray(true); notification_manager->set_all_slicing_errors_gray(true);
notification_manager->close_notification_of_type(NotificationType::ValidateError);
if (invalidated != Print::APPLY_STATUS_UNCHANGED && background_processing_enabled()) if (invalidated != Print::APPLY_STATUS_UNCHANGED && background_processing_enabled())
return_state |= UPDATE_BACKGROUND_PROCESS_RESTART; return_state |= UPDATE_BACKGROUND_PROCESS_RESTART;
@ -2989,7 +2990,7 @@ unsigned int Plater::priv::update_background_process(bool force_validation, bool
else { else {
// The print is not valid. // The print is not valid.
// Show error as notification. // Show error as notification.
notification_manager->push_slicing_error_notification(err); notification_manager->push_validate_error_notification(err);
return_state |= UPDATE_BACKGROUND_PROCESS_INVALID; return_state |= UPDATE_BACKGROUND_PROCESS_INVALID;
if (printer_technology == ptFFF) { if (printer_technology == ptFFF) {
const Print* print = background_process.fff_print(); const Print* print = background_process.fff_print();