mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-11-02 20:51:23 -07: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);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -408,6 +408,7 @@ public:
 | 
			
		|||
 | 
			
		||||
    void            handle_http_error(unsigned int status, std::string body);
 | 
			
		||||
    void            on_http_error(wxCommandEvent &evt);
 | 
			
		||||
    void            on_set_selected_machine(wxCommandEvent& evt);
 | 
			
		||||
    void            on_user_login(wxCommandEvent &evt);
 | 
			
		||||
    void            enable_user_preset_folder(bool enable);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -72,8 +72,11 @@ wxDEFINE_EVENT(EVT_SELECT_TAB, wxCommandEvent);
 | 
			
		|||
wxDEFINE_EVENT(EVT_HTTP_ERROR, wxCommandEvent);
 | 
			
		||||
wxDEFINE_EVENT(EVT_USER_LOGIN, wxCommandEvent);
 | 
			
		||||
wxDEFINE_EVENT(EVT_SHOW_IP_DIALOG, wxCommandEvent);
 | 
			
		||||
wxDEFINE_EVENT(EVT_SET_SELECTED_MACHINE, wxCommandEvent);
 | 
			
		||||
wxDEFINE_EVENT(EVT_UPDATE_PRESET_CB, SimpleEvent);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// BBS: backup
 | 
			
		||||
wxDEFINE_EVENT(EVT_BACKUP_POST, wxCommandEvent);
 | 
			
		||||
wxDEFINE_EVENT(EVT_LOAD_URL, wxCommandEvent);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -374,8 +374,11 @@ public:
 | 
			
		|||
wxDECLARE_EVENT(EVT_HTTP_ERROR, wxCommandEvent);
 | 
			
		||||
wxDECLARE_EVENT(EVT_USER_LOGIN, wxCommandEvent);
 | 
			
		||||
wxDECLARE_EVENT(EVT_SHOW_IP_DIALOG, wxCommandEvent);
 | 
			
		||||
wxDECLARE_EVENT(EVT_SET_SELECTED_MACHINE, wxCommandEvent);
 | 
			
		||||
wxDECLARE_EVENT(EVT_UPDATE_PRESET_CB, SimpleEvent);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
} // GUI
 | 
			
		||||
} //Slic3r
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue