mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-07 23:17:35 -06:00
ENH: move get_user_machine_info to new thread
Change-Id: Id034346550e356c958aa35f0b12e7a2730078e4a Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
parent
6fee9bcca1
commit
6faecbf718
4 changed files with 22 additions and 2 deletions
|
@ -2342,6 +2342,7 @@ bool GUI_App::on_init_inner()
|
|||
// Suppress the '- default -' presets.
|
||||
preset_bundle->set_default_suppressed(true);
|
||||
|
||||
Bind(EVT_SET_SELECTED_MACHINE, &GUI_App::on_set_selected_machine, this);
|
||||
Bind(EVT_USER_LOGIN, &GUI_App::on_user_login, this);
|
||||
|
||||
Bind(EVT_SHOW_IP_DIALOG, &GUI_App::show_ip_address_enter_dialog_handler, this);
|
||||
|
@ -3709,6 +3710,14 @@ void GUI_App::enable_user_preset_folder(bool enable)
|
|||
}
|
||||
}
|
||||
|
||||
void GUI_App::on_set_selected_machine(wxCommandEvent &evt)
|
||||
{
|
||||
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||
if (!dev || m_agent) return;
|
||||
|
||||
dev->set_selected_machine(m_agent->get_user_selected_machine());
|
||||
}
|
||||
|
||||
void GUI_App::on_user_login(wxCommandEvent &evt)
|
||||
{
|
||||
if (!m_agent) { return; }
|
||||
|
@ -3719,8 +3728,12 @@ void GUI_App::on_user_login(wxCommandEvent &evt)
|
|||
// get machine list
|
||||
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||
if (!dev) return;
|
||||
dev->update_user_machine_list_info();
|
||||
dev->set_selected_machine(m_agent->get_user_selected_machine());
|
||||
|
||||
boost::thread update_thread = boost::thread([this, dev] {
|
||||
dev->update_user_machine_list_info();
|
||||
auto evt = new wxCommandEvent(EVT_SET_SELECTED_MACHINE);
|
||||
wxQueueEvent(this, evt);
|
||||
});
|
||||
|
||||
if (app_config->get("sync_user_preset") == "true") {
|
||||
enable_user_preset_folder(true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue