Added info notification, when Color Change G-code is empty and user try to add color change on DoubleSlider.

This commit is contained in:
YuSanka 2020-12-09 11:36:25 +01:00
parent 489c750451
commit 3cbb19bd73
2 changed files with 10 additions and 1 deletions

View File

@ -24,6 +24,7 @@
#include <boost/algorithm/string/replace.hpp>
#include "Field.hpp"
#include "format.hpp"
#include "NotificationManager.hpp"
namespace Slic3r {
@ -2006,6 +2007,9 @@ void Control::add_code_as_tick(Type type, int selected_extruder/* = -1*/)
if ( !check_ticks_changed_event(type) )
return;
if (type == ColorChange && gcode(ColorChange).empty())
GUI::wxGetApp().plater()->get_notification_manager()->push_notification(GUI::NotificationType::EmptyColorChangeCode);
const int extruder = selected_extruder > 0 ? selected_extruder : std::max<int>(1, m_only_extruder);
const auto it = m_ticks.ticks.find(TickCode{ tick });

View File

@ -65,7 +65,9 @@ enum class NotificationType
// Object fully outside the print volume, or extrusion outside the print volume. Slicing is not disabled.
PlaterWarning,
// Progress bar instead of text.
ProgressBar
ProgressBar,
// Notification, when Color Change G-code is empty and user try to add color change on DoubleSlider.
EmptyColorChangeCode
};
class NotificationManager
@ -453,6 +455,9 @@ private:
if (evnthndlr != nullptr) wxPostEvent(evnthndlr, PresetUpdateAvailableClickedEvent(EVT_PRESET_UPDATE_AVAILABLE_CLICKED)); return true; }},
{NotificationType::NewAppAvailable, NotificationLevel::ImportantNotification, 20, _u8L("New version is available."), _u8L("See Releases page."), [](wxEvtHandler* evnthndlr){
wxLaunchDefaultBrowser("https://github.com/prusa3d/PrusaSlicer/releases"); return true; }},
{NotificationType::EmptyColorChangeCode, NotificationLevel::RegularNotification, 10,
_u8L("You have just added a G-code for color change, but its value is empty.\n"
"To export the G-code correctly, check the \"Color Change G-code\" in \"Printer Settings > Custom G-code\"") },
//{NotificationType::NewAppAvailable, NotificationLevel::ImportantNotification, 20, _u8L("New vesion of PrusaSlicer is available.", _u8L("Download page.") },
//{NotificationType::LoadingFailed, NotificationLevel::RegularNotification, 20, _u8L("Loading of model has Failed") },
//{NotificationType::DeviceEjected, NotificationLevel::RegularNotification, 10, _u8L("Removable device has been safely ejected")} // if we want changeble text (like here name of device), we need to do it as CustomNotification