Merge branch 'dk_notifications'
This commit is contained in:
commit
410b5e610b
@ -1250,6 +1250,14 @@ void NotificationManager::close_slicing_error_notification(const std::string& te
|
||||
}
|
||||
}
|
||||
}
|
||||
void NotificationManager::push_object_warning_notification(const std::string& text, ObjectID object_id, const std::string& hypertext/* = ""*/, std::function<bool(wxEvtHandler*)> callback/* = std::function<bool(wxEvtHandler*)>()*/)
|
||||
{
|
||||
NotificationData data{ NotificationType::ObjectWarning, NotificationLevel::WarningNotification, 0, text, hypertext, callback };
|
||||
auto notification = std::make_unique<NotificationManager::SlicingWarningNotification>(data, m_id_provider, m_evt_handler);
|
||||
notification->object_id = object_id;
|
||||
notification->warning_step = 0;
|
||||
push_notification_data(std::move(notification), 0);
|
||||
}
|
||||
void NotificationManager::push_slicing_complete_notification(int timestamp, bool large)
|
||||
{
|
||||
std::string hypertext;
|
||||
@ -1304,6 +1312,15 @@ void NotificationManager::remove_slicing_warnings_of_released_objects(const std:
|
||||
notification->close();
|
||||
}
|
||||
}
|
||||
void NotificationManager::remove_object_warnings_of_released_objects(const std::vector<ObjectID>& living_oids)
|
||||
{
|
||||
for (std::unique_ptr<PopNotification>& notification : m_pop_notifications)
|
||||
if (notification->get_type() == NotificationType::ObjectWarning) {
|
||||
if (!std::binary_search(living_oids.begin(), living_oids.end(),
|
||||
static_cast<SlicingWarningNotification*>(notification.get())->object_id))
|
||||
notification->close();
|
||||
}
|
||||
}
|
||||
void NotificationManager::push_exporting_finished_notification(const std::string& path, const std::string& dir_path, bool on_removable)
|
||||
{
|
||||
close_notification_of_type(NotificationType::ExportFinished);
|
||||
|
@ -71,6 +71,9 @@ enum class NotificationType
|
||||
PlaterError,
|
||||
// Object fully outside the print volume, or extrusion outside the print volume. Slicing is not disabled.
|
||||
PlaterWarning,
|
||||
// Warning connected to single object id, appears at loading object, disapears at deletition.
|
||||
// Example: advice to simplify object with big amount of triangles.
|
||||
ObjectWarning,
|
||||
// Progress bar instead of text.
|
||||
ProgressBar,
|
||||
// Progress bar with info from Print Host Upload Queue dialog.
|
||||
@ -97,8 +100,6 @@ enum class NotificationType
|
||||
// Shows when ObjectList::update_info_items finds information that should be stressed to the user
|
||||
// Might contain logo taken from gizmos
|
||||
UpdatedItemsInfo,
|
||||
// Give user advice to simplify object with big amount of triangles
|
||||
SimplifySuggestion
|
||||
};
|
||||
|
||||
class NotificationManager
|
||||
@ -155,6 +156,12 @@ public:
|
||||
// Closes error or warning of the same text
|
||||
void close_plater_error_notification(const std::string& text);
|
||||
void close_plater_warning_notification(const std::string& text);
|
||||
// Object warning with ObjectID, closes when object is deleted. ID used is of object not print like in slicing warning.
|
||||
void push_object_warning_notification(const std::string& text, ObjectID object_id, const std::string& hypertext = "",
|
||||
std::function<bool(wxEvtHandler*)> callback = std::function<bool(wxEvtHandler*)>());
|
||||
// Close object warnings, whose ObjectID is not in the list.
|
||||
// living_oids is expected to be sorted.
|
||||
void remove_object_warnings_of_released_objects(const std::vector<ObjectID>& living_oids);
|
||||
// Creates special notification slicing complete.
|
||||
// If large = true (Plater side bar is closed), then printing time and export button is shown
|
||||
// at the notification and fade-out is disabled. Otherwise the fade out time is set to 10s.
|
||||
@ -576,7 +583,7 @@ private:
|
||||
NotificationType::PlaterWarning,
|
||||
NotificationType::ProgressBar,
|
||||
NotificationType::PrintHostUpload,
|
||||
NotificationType::SimplifySuggestion
|
||||
NotificationType::ObjectWarning
|
||||
};
|
||||
//prepared (basic) notifications
|
||||
static const NotificationData basic_notifications[];
|
||||
|
@ -1736,6 +1736,7 @@ struct Plater::priv
|
||||
void add_warning(const Slic3r::PrintStateBase::Warning &warning, size_t oid);
|
||||
// Update notification manager with the current state of warnings produced by the background process (slicing).
|
||||
void actualize_slicing_warnings(const PrintBase &print);
|
||||
void actualize_object_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
|
||||
@ -3048,6 +3049,7 @@ unsigned int Plater::priv::update_background_process(bool force_validation, bool
|
||||
//actualizate warnings
|
||||
if (invalidated != Print::APPLY_STATUS_UNCHANGED) {
|
||||
actualize_slicing_warnings(*this->background_process.current_print());
|
||||
actualize_object_warnings(*this->background_process.current_print());
|
||||
show_warning_dialog = false;
|
||||
process_completed_with_error = false;
|
||||
}
|
||||
@ -3587,10 +3589,7 @@ void Plater::priv::create_simplify_notification(const std::vector<size_t>& obj_i
|
||||
manager.open_gizmo(GLGizmosManager::EType::Simplify);
|
||||
return true;
|
||||
};
|
||||
notification_manager->push_notification(
|
||||
NotificationType::SimplifySuggestion,
|
||||
NotificationManager::NotificationLevel::WarningNotification,
|
||||
text.str(), hypertext, open_simplify);
|
||||
notification_manager->push_object_warning_notification(text.str(), model.objects[object_id]->id(), hypertext, open_simplify);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3855,6 +3854,16 @@ void Plater::priv::actualize_slicing_warnings(const PrintBase &print)
|
||||
notification_manager->remove_slicing_warnings_of_released_objects(ids);
|
||||
notification_manager->set_all_slicing_warnings_gray(true);
|
||||
}
|
||||
void Plater::priv::actualize_object_warnings(const PrintBase& print)
|
||||
{
|
||||
std::vector<ObjectID> ids;
|
||||
for (const ModelObject* object : print.model().objects )
|
||||
{
|
||||
ids.push_back(object->id());
|
||||
}
|
||||
std::sort(ids.begin(), ids.end());
|
||||
notification_manager->remove_object_warnings_of_released_objects(ids);
|
||||
}
|
||||
void Plater::priv::clear_warnings()
|
||||
{
|
||||
notification_manager->close_slicing_errors_and_warnings();
|
||||
|
Loading…
Reference in New Issue
Block a user