This commit is contained in:
QIDI TECH
2023-08-19 13:55:19 +08:00
3 changed files with 15 additions and 4 deletions

View File

@@ -696,7 +696,11 @@ bool NotificationManager::PopNotification::update_state(bool paused, const int64
} else if (m_state != EState::NotFading && m_state != EState::FadingOut && m_state != EState::ClosePending && m_state != EState::Finished && get_duration() != 0 && !paused) {
int64_t up_time = now - m_notification_start;
if (up_time >= get_duration() * 1000) {
m_state = EState::FadingOut;
if (get_duration_level() == NotificationLevel::ExportingNotificationLevel) {
m_state = EState::Finished;
} else {
m_state = EState::FadingOut;
}
m_fading_start = now;
} else {
m_next_render = get_duration() * 1000 - up_time;
@@ -2873,8 +2877,11 @@ bool NotificationManager::update_notifications(GLCanvas3D& canvas)
//Y9
if (export_on_going)
{
message = message + ".";
push_notification(NotificationType::ExportOngoing, NotificationManager::NotificationLevel::ProgressBarNotificationLevel, message);
if (message == "Exporting...")
message = "Exporting";
else
message = message + ".";
push_notification(NotificationType::ExportOngoing, NotificationManager::NotificationLevel::ExportingNotificationLevel, message);
}
// delayed notifications

View File

@@ -148,6 +148,8 @@ public:
WarningNotificationLevel,
// Error, no fade-out. Top most position.
ErrorNotificationLevel,
// test
ExportingNotificationLevel,
};
NotificationManager(wxEvtHandler* evt_handler);
@@ -381,6 +383,7 @@ private:
virtual bool push_background_color();
// used this function instead of reading directly m_data.duration. Some notifications might need to return changing value.
virtual int get_duration() { return m_data.duration; }
virtual NotificationLevel get_duration_level() { return m_data.level; }
const NotificationData m_data;
// For reusing ImGUI windows.
@@ -863,6 +866,7 @@ private:
case NotificationLevel::RegularNotificationLevel: return 10;
case NotificationLevel::PrintInfoNotificationLevel: return 10;
case NotificationLevel::HintNotificationLevel: return 300;
case NotificationLevel::ExportingNotificationLevel: return 1;
default: return 10;
}
}

View File

@@ -3463,7 +3463,7 @@ void Plater::priv::export_gcode(fs::path output_path, bool output_path_on_remova
background_process.schedule_export(output_path.string(), output_path_on_removable_media);
//Y9
//notification_manager->push_delayed_notification(NotificationType::ExportOngoing, []() {return true; }, 1000, 0);
notification_manager->push_notification(NotificationType::ExportOngoing, NotificationManager::NotificationLevel::ProgressBarNotificationLevel, "aaa");
notification_manager->push_notification(NotificationType::ExportOngoing, NotificationManager::NotificationLevel::ProgressBarNotificationLevel, "Exporting");
} else {
background_process.schedule_upload(std::move(upload_job));
}