mirror of
https://github.com/QIDITECH/QIDISlicer.git
synced 2026-01-30 23:48:44 +03:00
Continues to push notification when export gcode
This commit is contained in:
@@ -696,11 +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) {
|
} 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;
|
int64_t up_time = now - m_notification_start;
|
||||||
if (up_time >= get_duration() * 1000) {
|
if (up_time >= get_duration() * 1000) {
|
||||||
if (get_duration_level() == NotificationLevel::ExportingNotificationLevel) {
|
//Y9
|
||||||
m_state = EState::Finished;
|
if (get_type() == NotificationType::ExportOngoing)
|
||||||
} else {
|
m_state = EState::Exporting;
|
||||||
m_state = EState::FadingOut;
|
else
|
||||||
}
|
m_state = EState::FadingOut;
|
||||||
m_fading_start = now;
|
m_fading_start = now;
|
||||||
} else {
|
} else {
|
||||||
m_next_render = get_duration() * 1000 - up_time;
|
m_next_render = get_duration() * 1000 - up_time;
|
||||||
@@ -2847,41 +2847,31 @@ bool NotificationManager::update_notifications(GLCanvas3D& canvas)
|
|||||||
// update state of all notif and erase finished
|
// update state of all notif and erase finished
|
||||||
//Y9
|
//Y9
|
||||||
bool export_on_going = false;
|
bool export_on_going = false;
|
||||||
bool export_finished = false;
|
std::string message = _u8L("Exporting.");
|
||||||
std::string message = "12";
|
|
||||||
for (auto it = m_pop_notifications.begin(); it != m_pop_notifications.end();) {
|
for (auto it = m_pop_notifications.begin(); it != m_pop_notifications.end();) {
|
||||||
std::unique_ptr<PopNotification>& notification = *it;
|
std::unique_ptr<PopNotification>& notification = *it;
|
||||||
request_render |= notification->update_state(hover, time_since_render);
|
request_render |= notification->update_state(hover, time_since_render);
|
||||||
next_render = std::min<int64_t>(next_render, notification->next_render());
|
next_render = std::min<int64_t>(next_render, notification->next_render());
|
||||||
//Y9
|
//Y9
|
||||||
if (notification->get_data().type == NotificationType::ExportFinished)
|
if (notification->get_state() == PopNotification::EState::Exporting)
|
||||||
{
|
{
|
||||||
export_finished = true;
|
message = notification->get_data().text1;
|
||||||
export_on_going = false;
|
export_on_going = true;
|
||||||
}
|
|
||||||
if (notification->get_state() == PopNotification::EState::Finished)
|
|
||||||
{
|
|
||||||
if (!export_finished)
|
|
||||||
{
|
|
||||||
if (notification->get_data().type == NotificationType::ExportOngoing)
|
|
||||||
{
|
|
||||||
message = notification->get_data().text1;
|
|
||||||
export_on_going = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
it = m_pop_notifications.erase(it);
|
it = m_pop_notifications.erase(it);
|
||||||
}
|
}
|
||||||
|
else if (notification->get_state() == PopNotification::EState::Finished)
|
||||||
|
it = m_pop_notifications.erase(it);
|
||||||
else
|
else
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
//Y9
|
//Y9
|
||||||
if (export_on_going)
|
if (export_on_going)
|
||||||
{
|
{
|
||||||
if (message == "Exporting...")
|
if (message == _u8L("Exporting.") + " . . .")
|
||||||
message = "Exporting";
|
message = _u8L("Exporting.");
|
||||||
else
|
else
|
||||||
message = message + ".";
|
message = message + " .";
|
||||||
push_notification(NotificationType::ExportOngoing, NotificationManager::NotificationLevel::ExportingNotificationLevel, message);
|
push_notification(NotificationType::ExportOngoing, NotificationManager::NotificationLevel::ProgressBarNotificationLevel, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
// delayed notifications
|
// delayed notifications
|
||||||
|
|||||||
@@ -148,8 +148,6 @@ public:
|
|||||||
WarningNotificationLevel,
|
WarningNotificationLevel,
|
||||||
// Error, no fade-out. Top most position.
|
// Error, no fade-out. Top most position.
|
||||||
ErrorNotificationLevel,
|
ErrorNotificationLevel,
|
||||||
// test
|
|
||||||
ExportingNotificationLevel,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
NotificationManager(wxEvtHandler* evt_handler);
|
NotificationManager(wxEvtHandler* evt_handler);
|
||||||
@@ -322,7 +320,8 @@ private:
|
|||||||
ClosePending, // Requesting Render
|
ClosePending, // Requesting Render
|
||||||
Finished, // Requesting Render
|
Finished, // Requesting Render
|
||||||
Hovered, // Followed by Shown
|
Hovered, // Followed by Shown
|
||||||
Paused
|
Paused,
|
||||||
|
Exporting
|
||||||
};
|
};
|
||||||
|
|
||||||
PopNotification(const NotificationData &n, NotificationIDProvider &id_provider, wxEvtHandler* evt_handler);
|
PopNotification(const NotificationData &n, NotificationIDProvider &id_provider, wxEvtHandler* evt_handler);
|
||||||
@@ -383,7 +382,6 @@ private:
|
|||||||
virtual bool push_background_color();
|
virtual bool push_background_color();
|
||||||
// used this function instead of reading directly m_data.duration. Some notifications might need to return changing value.
|
// 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 int get_duration() { return m_data.duration; }
|
||||||
virtual NotificationLevel get_duration_level() { return m_data.level; }
|
|
||||||
|
|
||||||
const NotificationData m_data;
|
const NotificationData m_data;
|
||||||
// For reusing ImGUI windows.
|
// For reusing ImGUI windows.
|
||||||
@@ -866,7 +864,6 @@ private:
|
|||||||
case NotificationLevel::RegularNotificationLevel: return 10;
|
case NotificationLevel::RegularNotificationLevel: return 10;
|
||||||
case NotificationLevel::PrintInfoNotificationLevel: return 10;
|
case NotificationLevel::PrintInfoNotificationLevel: return 10;
|
||||||
case NotificationLevel::HintNotificationLevel: return 300;
|
case NotificationLevel::HintNotificationLevel: return 300;
|
||||||
case NotificationLevel::ExportingNotificationLevel: return 1;
|
|
||||||
default: return 10;
|
default: return 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
background_process.schedule_export(output_path.string(), output_path_on_removable_media);
|
||||||
//Y9
|
//Y9
|
||||||
//notification_manager->push_delayed_notification(NotificationType::ExportOngoing, []() {return true; }, 1000, 0);
|
//notification_manager->push_delayed_notification(NotificationType::ExportOngoing, []() {return true; }, 1000, 0);
|
||||||
notification_manager->push_notification(NotificationType::ExportOngoing, NotificationManager::NotificationLevel::ProgressBarNotificationLevel, "Exporting");
|
notification_manager->push_notification(NotificationType::ExportOngoing, NotificationManager::NotificationLevel::ProgressBarNotificationLevel, _u8L("Exporting."));
|
||||||
} else {
|
} else {
|
||||||
background_process.schedule_upload(std::move(upload_job));
|
background_process.schedule_upload(std::move(upload_job));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user