mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-19 04:37:52 -06:00
Trigger task progress update on paint event as well (#3237)
This commit is contained in:
parent
1a2d127276
commit
e034af7050
1 changed files with 6 additions and 12 deletions
|
@ -118,26 +118,20 @@ class PlaterWorker: public Worker {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void on_idle(wxIdleEvent &evt)
|
EventGuard on_idle_evt;
|
||||||
{
|
EventGuard on_paint_evt;
|
||||||
process_events();
|
|
||||||
evt.Skip();
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
template<class... WorkerArgs>
|
template<class... WorkerArgs>
|
||||||
PlaterWorker(wxWindow *plater, WorkerArgs &&...args)
|
PlaterWorker(wxWindow *plater, WorkerArgs &&...args)
|
||||||
: m_w{std::forward<WorkerArgs>(args)...}, m_plater{plater}
|
: m_w{std::forward<WorkerArgs>(args)...}
|
||||||
{
|
, m_plater{plater}
|
||||||
// Ensure that messages from the worker thread to the UI thread are
|
// Ensure that messages from the worker thread to the UI thread are
|
||||||
// processed continuously.
|
// processed continuously.
|
||||||
plater->Bind(wxEVT_IDLE, &PlaterWorker::on_idle, this);
|
, on_idle_evt(plater, wxEVT_IDLE, [this](wxIdleEvent&) { process_events(); })
|
||||||
}
|
, on_paint_evt(plater, wxEVT_PAINT, [this](wxPaintEvent&) { process_events(); })
|
||||||
|
|
||||||
~PlaterWorker()
|
|
||||||
{
|
{
|
||||||
m_plater->Unbind(wxEVT_IDLE, &PlaterWorker::on_idle, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Always package the job argument into a PlaterJob
|
// Always package the job argument into a PlaterJob
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue