Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_sinking_objects_collision
This commit is contained in:
commit
35579252b8
@ -1176,7 +1176,9 @@ void NotificationManager::SlicingProgressNotification::set_sidebar_collapsed(boo
|
||||
void NotificationManager::SlicingProgressNotification::on_cancel_button()
|
||||
{
|
||||
if (m_cancel_callback){
|
||||
m_cancel_callback();
|
||||
if (!m_cancel_callback()) {
|
||||
set_progress_state(SlicingProgressState::SP_NO_SLICING);
|
||||
}
|
||||
}
|
||||
}
|
||||
int NotificationManager::SlicingProgressNotification::get_duration()
|
||||
@ -1681,7 +1683,7 @@ void NotificationManager::upload_job_notification_show_error(int id, const std::
|
||||
}
|
||||
}
|
||||
|
||||
void NotificationManager::init_slicing_progress_notification(std::function<void()> cancel_callback)
|
||||
void NotificationManager::init_slicing_progress_notification(std::function<bool()> cancel_callback)
|
||||
{
|
||||
for (std::unique_ptr<PopNotification>& notification : m_pop_notifications) {
|
||||
if (notification->get_type() == NotificationType::SlicingProgress) {
|
||||
|
@ -188,7 +188,7 @@ public:
|
||||
void upload_job_notification_show_canceled(int id, const std::string& filename, const std::string& host);
|
||||
void upload_job_notification_show_error(int id, const std::string& filename, const std::string& host);
|
||||
// slicing progress
|
||||
void init_slicing_progress_notification(std::function<void()> cancel_callback);
|
||||
void init_slicing_progress_notification(std::function<bool()> cancel_callback);
|
||||
// percentage negative = canceled, <0-1) = progress, 1 = completed
|
||||
void set_slicing_progress_percentage(const std::string& text, float percentage);
|
||||
// hides slicing progress notification imidietly
|
||||
@ -496,7 +496,7 @@ private:
|
||||
SP_CANCELLED, // fades after 10 seconds, simple message
|
||||
SP_COMPLETED // Has export hyperlink and print info, fades after 20 sec if sidebar is shown, otherwise no fade out
|
||||
};
|
||||
SlicingProgressNotification(const NotificationData& n, NotificationIDProvider& id_provider, wxEvtHandler* evt_handler, std::function<void()> callback)
|
||||
SlicingProgressNotification(const NotificationData& n, NotificationIDProvider& id_provider, wxEvtHandler* evt_handler, std::function<bool()> callback)
|
||||
: ProgressBarNotification(n, id_provider, evt_handler)
|
||||
, m_cancel_callback(callback)
|
||||
{
|
||||
@ -507,7 +507,7 @@ private:
|
||||
// sets text of notification - call after setting progress state
|
||||
void set_status_text(const std::string& text);
|
||||
// sets cancel button callback
|
||||
void set_cancel_callback(std::function<void()> callback) { m_cancel_callback = callback; }
|
||||
void set_cancel_callback(std::function<bool()> callback) { m_cancel_callback = callback; }
|
||||
bool has_cancel_callback() const { return m_cancel_callback != nullptr; }
|
||||
// sets SlicingProgressState, negative percent means canceled
|
||||
void set_progress_state(float percent);
|
||||
@ -545,7 +545,8 @@ private:
|
||||
const float win_pos_x, const float win_pos_y) override;
|
||||
void on_cancel_button();
|
||||
int get_duration() override;
|
||||
std::function<void()> m_cancel_callback;
|
||||
// if returns false, process was already canceled
|
||||
std::function<bool()> m_cancel_callback;
|
||||
SlicingProgressState m_sp_state { SlicingProgressState::SP_PROGRESS };
|
||||
bool m_has_print_info { false };
|
||||
std::string m_print_info;
|
||||
|
@ -4019,12 +4019,14 @@ void Plater::priv::on_process_completed(SlicingProcessCompletedEvent &evt)
|
||||
if (evt.error()) {
|
||||
std::pair<std::string, bool> message = evt.format_error_message();
|
||||
if (evt.critical_error()) {
|
||||
if (q->m_tracking_popup_menu)
|
||||
if (q->m_tracking_popup_menu) {
|
||||
// We don't want to pop-up a message box when tracking a pop-up menu.
|
||||
// We postpone the error message instead.
|
||||
q->m_tracking_popup_menu_error_message = message.first;
|
||||
else
|
||||
} else {
|
||||
show_error(q, message.first, message.second);
|
||||
notification_manager->set_slicing_progress_hidden();
|
||||
}
|
||||
} else
|
||||
notification_manager->push_slicing_error_notification(message.first);
|
||||
// this->statusbar()->set_status_text(from_u8(message.first));
|
||||
@ -4252,7 +4254,10 @@ void Plater::priv::init_notification_manager()
|
||||
notification_manager->init();
|
||||
|
||||
auto cancel_callback = [this]() {
|
||||
if (this->background_process.idle())
|
||||
return false;
|
||||
this->background_process.stop();
|
||||
return true;
|
||||
};
|
||||
notification_manager->init_slicing_progress_notification(cancel_callback);
|
||||
notification_manager->set_fff(printer_technology == ptFFF);
|
||||
|
Loading…
Reference in New Issue
Block a user