fix: install a plugin printer agent once it registers for selected preset (#16708)

* fix: install a plugin printer agent once it registers for the selected preset

* fix: check for the pending printer agent after every plugin load
This commit is contained in:
Brandon Wees authored and GitHub committed 2026-10-20 20:48:02 -05:00
1 parent 283d40949c
commit 3d0cb36544
2 files changed
+25 -3

No files matched your search

+22 -3
View File
@@ -3002,7 +3002,8 @@ void GUI_App::init_plugin_gui_wiring()
};
// why: a newly loaded plugin only adds a selectable agent
// refresh the dropdown and leave the live agent alone
// refresh the dropdown and leave the live agent alone, unless the selected preset was
// waiting for this agent: plugins load after the startup preset is applied
auto refresh_printer_agent_dropdown_after_load = [](const std::string&)
{
if (!wxTheApp)
@@ -3014,8 +3015,11 @@ void GUI_App::init_plugin_gui_wiring()
app->CallAfter([app]
{
if (!app->is_closing())
app->refresh_printer_agent_dropdown();
if (app->is_closing())
return;
app->switch_printer_agent_if_pending();
app->refresh_printer_agent_dropdown();
});
};
@@ -4303,6 +4307,21 @@ void GUI_App::switch_printer_agent()
select_machine(effective_agent_id);
}
void GUI_App::switch_printer_agent_if_pending()
{
if (!m_agent || !preset_bundle)
return;
const std::string wanted_agent_id = resolve_printer_agent_id(preset_bundle->printers.get_edited_preset().config.opt_string("printer_agent"));
const auto live_agent = m_agent->get_printer_agent();
if (live_agent && live_agent->get_agent_info().id == wanted_agent_id)
return;
if (!NetworkAgentFactory::get_printer_agent_info(wanted_agent_id))
return;
switch_printer_agent();
}
void GUI_App::select_machine(const std::string& agent_id)
{
// Skip for BBL agent for now - uses its own device discovery/selection