mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-18 11:02:08 +00:00
Fix an issue that sync ams btn is not show/hide after printer agent changes
This commit is contained in:
@@ -3500,9 +3500,10 @@ void GUI_App::switch_printer_agent()
|
|||||||
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,13 +3512,15 @@ 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)
|
||||||
{
|
{
|
||||||
// Skip for BBL agent for now - uses its own device discovery/selection
|
// Skip for BBL agent for now - uses its own device discovery/selection
|
||||||
|
|||||||
@@ -822,6 +822,11 @@ 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