mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-17 10:32:20 +00:00
Fix an issue that sync ams btn is not show/hide after printer agent changes
This commit is contained in:
@@ -3498,11 +3498,12 @@ void GUI_App::switch_printer_agent()
|
|||||||
current_agent_id = m_agent->get_printer_agent()->get_agent_info().id;
|
current_agent_id = m_agent->get_printer_agent()->get_agent_info().id;
|
||||||
|
|
||||||
if (current_agent_id != effective_agent_id) {
|
if (current_agent_id != effective_agent_id) {
|
||||||
std::string log_dir = data_dir();
|
std::string log_dir = data_dir();
|
||||||
std::shared_ptr<ICloudServiceAgent> cloud_agent = m_agent->get_cloud_agent();
|
std::shared_ptr<ICloudServiceAgent> cloud_agent = m_agent->get_cloud_agent();
|
||||||
|
|
||||||
// Create new printer agent via registry
|
// Create new printer agent via registry
|
||||||
std::shared_ptr<IPrinterAgent> new_printer_agent = NetworkAgentFactory::create_printer_agent_by_id(effective_agent_id, cloud_agent,
|
std::shared_ptr<IPrinterAgent> new_printer_agent =
|
||||||
log_dir);
|
NetworkAgentFactory::create_printer_agent_by_id(effective_agent_id, cloud_agent, log_dir);
|
||||||
|
|
||||||
if (!new_printer_agent) {
|
if (!new_printer_agent) {
|
||||||
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << ": failed to create agent '" << effective_agent_id << "', keeping current agent";
|
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << ": failed to create agent '" << effective_agent_id << "', keeping current agent";
|
||||||
@@ -3511,11 +3512,13 @@ void GUI_App::switch_printer_agent()
|
|||||||
|
|
||||||
// Swap the agent
|
// Swap the agent
|
||||||
m_agent->set_printer_agent(new_printer_agent);
|
m_agent->set_printer_agent(new_printer_agent);
|
||||||
}
|
sidebar().update_all_preset_comboboxes();
|
||||||
// Auto-switch MachineObject
|
|
||||||
select_machine(effective_agent_id);
|
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": printer agent switched to " << effective_agent_id;
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": printer agent switched to " << effective_agent_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Auto-switch MachineObject (runs even if agent IDs match)
|
||||||
|
select_machine(effective_agent_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI_App::select_machine(const std::string& agent_id)
|
void GUI_App::select_machine(const std::string& agent_id)
|
||||||
|
|||||||
@@ -820,8 +820,13 @@ void PhysicalPrinterDialog::check_host_key_valid()
|
|||||||
|
|
||||||
void PhysicalPrinterDialog::OnOK(wxEvent& event)
|
void PhysicalPrinterDialog::OnOK(wxEvent& event)
|
||||||
{
|
{
|
||||||
wxGetApp().get_tab(Preset::TYPE_PRINTER)->save_preset("", false, false, true, m_preset_name );
|
wxGetApp().get_tab(Preset::TYPE_PRINTER)->save_preset("", false, false, true, m_preset_name);
|
||||||
event.Skip();
|
event.Skip();
|
||||||
|
|
||||||
|
// Defer printer agent switch to ensure preset save completes first
|
||||||
|
wxGetApp().CallAfter([] {
|
||||||
|
wxGetApp().switch_printer_agent();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}} // namespace Slic3r::GUI
|
}} // namespace Slic3r::GUI
|
||||||
|
|||||||
Reference in New Issue
Block a user