mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 16:57:53 -06:00
Fix of #3660 : Background processing restart and error messages
are suppressed while tracking a pop-up menu.
This commit is contained in:
parent
6866c2bdd4
commit
1d5249f9b0
2 changed files with 35 additions and 1 deletions
|
@ -3725,7 +3725,12 @@ void Plater::priv::on_process_completed(wxCommandEvent &evt)
|
|||
wxString message = evt.GetString();
|
||||
if (message.IsEmpty())
|
||||
message = _(L("Export failed"));
|
||||
show_error(q, message);
|
||||
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;
|
||||
else
|
||||
show_error(q, message);
|
||||
this->statusbar()->set_status_text(message);
|
||||
}
|
||||
if (canceled)
|
||||
|
@ -5729,6 +5734,25 @@ const UndoRedo::Stack& Plater::undo_redo_stack_main() const { return p->undo_red
|
|||
void Plater::enter_gizmos_stack() { p->enter_gizmos_stack(); }
|
||||
void Plater::leave_gizmos_stack() { p->leave_gizmos_stack(); }
|
||||
|
||||
// Wrapper around wxWindow::PopupMenu to suppress error messages popping out while tracking the popup menu.
|
||||
bool Plater::PopupMenu(wxMenu *menu, const wxPoint& pos)
|
||||
{
|
||||
// Don't want to wake up and trigger reslicing while tracking the pop-up menu.
|
||||
SuppressBackgroundProcessingUpdate sbpu;
|
||||
// When tracking a pop-up menu, postpone error messages from the slicing result.
|
||||
m_tracking_popup_menu = true;
|
||||
bool out = this->wxPanel::PopupMenu(menu, pos);
|
||||
m_tracking_popup_menu = false;
|
||||
if (! m_tracking_popup_menu_error_message.empty()) {
|
||||
// Don't know whether the CallAfter is necessary, but it should not hurt.
|
||||
// The menus likely sends out some commands, so we may be safer if the dialog is shown after the menu command is processed.
|
||||
wxString message = std::move(m_tracking_popup_menu_error_message);
|
||||
wxTheApp->CallAfter([message, this]() { show_error(this, message); });
|
||||
m_tracking_popup_menu_error_message.clear();
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
SuppressBackgroundProcessingUpdate::SuppressBackgroundProcessingUpdate() :
|
||||
m_was_running(wxGetApp().plater()->is_background_process_running())
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue