FIX: dailytips should not change content frequently when slicing all
jira: STUDIO-5234 Change-Id: Icb7e9c28404d9db8ebed58d937e13f89c5403b5c
This commit is contained in:
parent
6d3572270c
commit
1cfdf4ae5f
|
@ -1943,6 +1943,22 @@ void NotificationManager::init_slicing_progress_notification(std::function<bool(
|
|||
};
|
||||
push_notification_data(std::make_unique<NotificationManager::SlicingProgressNotification>(data, m_id_provider, m_evt_handler, cancel_callback), 0);
|
||||
}
|
||||
void NotificationManager::update_slicing_notif_dailytips(bool need_change)
|
||||
{
|
||||
for (std::unique_ptr<PopNotification>& notification : m_pop_notifications) {
|
||||
if (notification->get_type() == NotificationType::SlicingProgress) {
|
||||
SlicingProgressNotification* spn = dynamic_cast<SlicingProgressNotification*>(notification.get());
|
||||
if (need_change) {
|
||||
wxGetApp().plater()->get_dailytips()->close();
|
||||
spn->get_dailytips_panel()->retrieve_data_from_hint_database(HintDataNavigation::Random);
|
||||
wxGetApp().plater()->get_current_canvas3D()->schedule_extra_frame(0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Slicing progress notification was not found - init it thru plater so correct cancel callback function is appended
|
||||
wxGetApp().plater()->init_notification_manager();
|
||||
}
|
||||
void NotificationManager::set_slicing_progress_began()
|
||||
{
|
||||
for (std::unique_ptr<PopNotification> & notification : m_pop_notifications) {
|
||||
|
|
|
@ -244,6 +244,7 @@ public:
|
|||
// notifications with progress bar
|
||||
// slicing progress
|
||||
void init_slicing_progress_notification(std::function<bool()> cancel_callback);
|
||||
void update_slicing_notif_dailytips(bool need_change);
|
||||
void set_slicing_progress_began();
|
||||
// percentage negative = canceled, <0-1) = progress, 1 = completed
|
||||
void set_slicing_progress_percentage(const std::string& text, float percentage);
|
||||
|
|
|
@ -6186,7 +6186,11 @@ void Plater::priv::on_slicing_began()
|
|||
clear_warnings();
|
||||
notification_manager->close_notification_of_type(NotificationType::SignDetected);
|
||||
notification_manager->close_notification_of_type(NotificationType::ExportFinished);
|
||||
bool is_first_plate = m_cur_slice_plate == 0;
|
||||
bool slice_all = q->m_only_gcode ? m_slice_all_only_has_gcode : m_slice_all;
|
||||
bool need_change_dailytips = !(slice_all && !is_first_plate);
|
||||
notification_manager->set_slicing_progress_began();
|
||||
notification_manager->update_slicing_notif_dailytips(need_change_dailytips);
|
||||
}
|
||||
void Plater::priv::add_warning(const Slic3r::PrintStateBase::Warning& warning, size_t oid)
|
||||
{
|
||||
|
|
|
@ -85,10 +85,6 @@ bool NotificationManager::SlicingProgressNotification::set_progress_state(Notifi
|
|||
if ((m_sp_state != SlicingProgressState::SP_BEGAN && m_sp_state != SlicingProgressState::SP_PROGRESS) || percent < m_percentage)
|
||||
return false;
|
||||
set_percentage(percent);
|
||||
if (m_sp_state == SlicingProgressState::SP_BEGAN) {
|
||||
wxGetApp().plater()->get_dailytips()->close();
|
||||
m_dailytips_panel->retrieve_data_from_hint_database(HintDataNavigation::Random);
|
||||
}
|
||||
m_sp_state = state;
|
||||
m_current_fade_opacity = 1;
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue