A part of code related to loads after App::OnInit() call is moved from PrusaSlicer.cpp to GUI_App.cpp

Splash Screen under OSX requires a call of wxYeild() for update.
But wxYield() furthers a case, when CallAfter() in CLI::run() was called at the wrong time, before some of the GUI was created.
So, there is workaround:
Parameters needed for later loads are encapsulated to GUI_App::AFTER_INIT_LOADS structure
and are used in GUI_App::AFTER_INIT_LOADS::on_loads which is called just ones after wxEVT_IDLE
This commit is contained in:
YuSanka 2020-10-02 22:27:20 +02:00
parent 1fb400a091
commit 48f775decb
3 changed files with 83 additions and 1 deletions

View file

@ -577,6 +577,12 @@ int CLI::run(int argc, char **argv)
// gui->autosave = m_config.opt_string("autosave");
GUI::GUI_App::SetInstance(gui);
#if ENABLE_GCODE_VIEWER
gui->m_after_init_loads.set_params(load_configs, m_extra_config, m_input_files, start_as_gcodeviewer);
#else
gui->m_after_init_loads.set_params(load_configs, m_extra_config, m_input_files);
#endif // ENABLE_GCODE_VIEWER
/*
#if ENABLE_GCODE_VIEWER
gui->CallAfter([gui, this, &load_configs, start_as_gcodeviewer] {
#else
@ -614,6 +620,7 @@ int CLI::run(int argc, char **argv)
}
#endif // ENABLE_GCODE_VIEWER
});
*/
int result = wxEntry(argc, argv);
return result;
#else /* SLIC3R_GUI */