Apply the print dialog's Box mapping on Qidi printers (#16723)

With printer agents on, the Qidi agent now uses the Box slot picked for each filament in the print dialog. After the upload it writes `SAVE_VARIABLE VARIABLE=value_t<n> VALUE="'slot<m>'"` for each mapped filament, which the firmware's T<n> macros read. Then it starts the print through `/printer/print/start`, because the Max 4, Q2, Q2C and Plus 5 only open prints from the copy that Moonraker's print start makes.

- `MoonrakerPrinterAgent::start_local_print` now ends with a virtual `print_uploaded_file()`. The default still sends `SDCARD_PRINT_FILE`, so other Moonraker agents are unchanged.
- Box units show as "Qidi Box 1", "Qidi Box 2". Agents can set an optional `display_name` on an AMS unit.
- New agent flag `native_device_tab`. Qidi sets it to false, so its native Device and Calibration tabs are hidden and the web page becomes the Device tab.
- The Moonraker agent retries its first connection with the status stream's backoff. A disconnect, a newer connection or closing the app stops the retries.
- The print dialog fetches filament data itself for agents that only send it when asked, so the slot picker shows the Box units without a sidebar sync.
- Agent printers show their address in the print dialog's printer list instead of "(LAN)". Bambu printers keep "(LAN)".
- A single nozzle whose size the printer hasn't reported shows no size instead of "Unknown".
This commit is contained in:
TheLegendTubaGuy authored and GitHub committed 2026-10-27 10:47:06 -05:00
1 parent af16875afb
commit b6ca378b23
19 files changed
+331 -44

No files matched your search

+33 -7
View File
@@ -1654,6 +1654,14 @@ void MainFrame::show_device(bool should_use_native) {
// get it — otherwise a Bambu user sees two Device tabs, one of them permanently empty.
const bool want_web_device_tab = use_printer_agents && wxGetApp().preset_bundle != nullptr &&
!wxGetApp().preset_bundle->use_bbl_device_tab();
// An agent whose printers have nothing for the native Device and Calibration tabs leaves the web page as the only Device tab
bool want_native_device_tabs = true;
if (want_web_device_tab) {
const std::string agent_id = wxGetApp().resolve_printer_agent_id(
wxGetApp().preset_bundle->printers.get_edited_preset().config.opt_string("printer_agent"));
const PrinterAgentInfo* agent_info = NetworkAgentFactory::get_printer_agent_info(agent_id);
want_native_device_tabs = agent_info == nullptr || agent_info->native_device_tab;
}
// Remove the extra page before switching to any layout that shouldn't have it.
if (!want_web_device_tab) {
@@ -1664,7 +1672,16 @@ void MainFrame::show_device(bool should_use_native) {
}
if (use_printer_agents) {
if (!m_monitor_page->in_book()) {
if (!want_native_device_tabs) {
if ((idx = m_tabpanel->FindPage(m_monitor_page)) != wxNOT_FOUND) {
m_monitor_page->Show(false);
m_tabpanel->RemovePage(idx);
}
if ((idx = m_tabpanel->FindPage(m_calibration_page)) != wxNOT_FOUND) {
m_calibration_page->Show(false);
m_tabpanel->RemovePage(idx);
}
} else if (!m_monitor_page->in_book()) {
if ((idx = m_tabpanel->FindPage(m_printer_view_page)) != wxNOT_FOUND) {
m_printer_view_page->Show(false);
m_tabpanel->RemovePage(idx);
@@ -1684,20 +1701,29 @@ void MainFrame::show_device(bool should_use_native) {
TAB_ID_MULTI_DEVICE, m_multi_machine_page, _L("Multi-device"), "tab_multi_active");
}
}
if (!m_calibration_page->in_book()) {
if (want_native_device_tabs && !m_calibration_page->in_book()) {
m_calibration_page->Show(false);
m_tabpanel->InsertPage(m_tabpanel->PositionAfter({TAB_ID_PROJECT}), TAB_ID_CALIBRATION, m_calibration_page,
_L("Calibration"), "tab_calibration_active");
}
if (want_web_device_tab) {
if ((idx = m_tabpanel->FindPage(m_printer_view_page)) == wxNOT_FOUND) {
// Without the native Device tab the web page takes its id, so every way to the Device tab leads here
const char* id = want_native_device_tabs ? TAB_ID_MONITOR_WEB : TAB_ID_MONITOR;
const wxString label = want_native_device_tabs ? _L("Device (Web)") : _L("Device");
idx = m_tabpanel->FindPage(m_printer_view_page);
if (idx != wxNOT_FOUND && m_tabpanel->FindPageByName(id) != idx) {
m_printer_view_page->Show(false);
// Immediately right of the native Device tab, not at the end of the tab bar.
m_tabpanel->InsertPage(m_tabpanel->PositionAfter({TAB_ID_MONITOR}), TAB_ID_MONITOR_WEB,
m_printer_view_page, _L("Device (Web)"), "tab_monitor_active");
m_tabpanel->RemovePage(idx);
idx = wxNOT_FOUND;
}
if (idx == wxNOT_FOUND) {
m_printer_view_page->Show(false);
// Immediately right of the native Device tab, or of Preview without it, not at the end of the tab bar.
m_tabpanel->InsertPage(m_tabpanel->PositionAfter({TAB_ID_MONITOR, TAB_ID_PREVIEW}), id, m_printer_view_page, label,
"tab_monitor_active");
} else {
m_tabpanel->SetPageText(idx, _L("Device (Web)"));
m_tabpanel->SetPageText(idx, label);
}
}