mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-22 14:50:59 +00:00
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:
1 parent
283d40949c
commit
3d0cb36544
2 files changed
+25
-3
No files matched your search
@@ -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
|
||||
|
||||
@@ -412,6 +412,9 @@ public:
|
||||
|
||||
// Reconcile the live printer agent with the stored preset selection.
|
||||
void switch_printer_agent();
|
||||
// Install the selected preset's agent if it is registered but not live, e.g. when its plugin
|
||||
// finishes loading after the startup preset was applied. Otherwise leave the live agent alone.
|
||||
void switch_printer_agent_if_pending();
|
||||
|
||||
std::string resolve_printer_agent_id(const std::string& stored_id) const;
|
||||
// ORCA TODO: in the future, bbl presets should specify "bbl" printer agent id
|
||||
|
||||
Reference in new issue
Block a user