Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Kocik <kocikdav@gmail.com>2021-03-26 11:18:07 +0300
committerDavid Kocik <kocikdav@gmail.com>2021-04-20 10:18:50 +0300
commitc140974bf40b34345191a79d85410ea62898c2b7 (patch)
treee4216cd6b8c28b63f2fa46c5285e7e9de4e3f41c /src
parent9118de4e3ce0d14451eadf816117ddc333a4327c (diff)
Changed ToolpathOuside error notification from plater to slicing error notification type so it is grayed out correctly
Diffstat (limited to 'src')
-rw-r--r--src/slic3r/GUI/GLCanvas3D.cpp38
-rw-r--r--src/slic3r/GUI/NotificationManager.cpp8
-rw-r--r--src/slic3r/GUI/NotificationManager.hpp1
3 files changed, 36 insertions, 11 deletions
diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp
index 2149f21e7..fa3d96420 100644
--- a/src/slic3r/GUI/GLCanvas3D.cpp
+++ b/src/slic3r/GUI/GLCanvas3D.cpp
@@ -6314,31 +6314,47 @@ std::vector<float> GLCanvas3D::_parse_colors(const std::vector<std::string>& col
#if ENABLE_WARNING_TEXTURE_REMOVAL
void GLCanvas3D::_set_warning_notification(EWarning warning, bool state)
{
+ enum ErrorType{
+ PLATER_WARNING,
+ PLATER_ERROR,
+ SLICING_ERROR
+ };
std::string text;
- bool error = false;
+ ErrorType error = ErrorType::PLATER_WARNING;
switch (warning) {
case EWarning::ObjectOutside: text = _u8L("An object outside the print area was detected."); break;
- case EWarning::ToolpathOutside: text = _u8L("A toolpath outside the print area was detected."); error = true; break;
- case EWarning::SlaSupportsOutside: text = _u8L("SLA supports outside the print area were detected."); error = true; break;
+ case EWarning::ToolpathOutside: text = _u8L("A toolpath outside the print area was detected."); error = ErrorType::SLICING_ERROR; break;
+ case EWarning::SlaSupportsOutside: text = _u8L("SLA supports outside the print area were detected."); error = ErrorType::PLATER_ERROR; break;
case EWarning::SomethingNotShown: text = _u8L("Some objects are not visible."); break;
case EWarning::ObjectClashed:
text = _u8L("An object outside the print area was detected.\n"
"Resolve the current problem to continue slicing.");
- error = true;
+ error = ErrorType::PLATER_ERROR;
break;
}
auto& notification_manager = *wxGetApp().plater()->get_notification_manager();
- if (state) {
- if (error)
+ switch (error)
+ {
+ case PLATER_WARNING:
+ if (state)
+ notification_manager.push_plater_warning_notification(text);
+ else
+ notification_manager.close_plater_warning_notification(text);
+ break;
+ case PLATER_ERROR:
+ if (state)
notification_manager.push_plater_error_notification(text);
else
- notification_manager.push_plater_warning_notification(text);
- }
- else {
- if (error)
notification_manager.close_plater_error_notification(text);
+ break;
+ case SLICING_ERROR:
+ if (state)
+ notification_manager.push_slicing_error_notification(text);
else
- notification_manager.close_plater_warning_notification(text);
+ notification_manager.close_slicing_error_notification(text);
+ break;
+ default:
+ break;
}
}
#else
diff --git a/src/slic3r/GUI/NotificationManager.cpp b/src/slic3r/GUI/NotificationManager.cpp
index 6c5918fde..144c89a1e 100644
--- a/src/slic3r/GUI/NotificationManager.cpp
+++ b/src/slic3r/GUI/NotificationManager.cpp
@@ -1072,6 +1072,14 @@ void NotificationManager::close_slicing_errors_and_warnings()
}
}
}
+void NotificationManager::close_slicing_error_notification(const std::string& text)
+{
+ for (std::unique_ptr<PopNotification>& notification : m_pop_notifications) {
+ if (notification->get_type() == NotificationType::SlicingError && notification->compare_text(_u8L("ERROR:") + "\n" + text)) {
+ notification->close();
+ }
+ }
+}
void NotificationManager::push_slicing_complete_notification(int timestamp, bool large)
{
std::string hypertext;
diff --git a/src/slic3r/GUI/NotificationManager.hpp b/src/slic3r/GUI/NotificationManager.hpp
index 95532c94e..74ebedde2 100644
--- a/src/slic3r/GUI/NotificationManager.hpp
+++ b/src/slic3r/GUI/NotificationManager.hpp
@@ -125,6 +125,7 @@ public:
// void set_slicing_warning_gray(const std::string& text, bool g);
// immediately stops showing slicing errors
void close_slicing_errors_and_warnings();
+ void close_slicing_error_notification(const std::string& text);
// Release those slicing warnings, which refer to an ObjectID, which is not in the list.
// living_oids is expected to be sorted.
void remove_slicing_warnings_of_released_objects(const std::vector<ObjectID>& living_oids);