From 203f02361ef740825b477e1eb0efb2acc04188cd Mon Sep 17 00:00:00 2001 From: Hanif Koh Date: Sun, 18 Oct 2026 15:01:47 +0800 Subject: [PATCH] Show "No Available Printers" Instead of an Empty Printer Dropdown A ComboBox with no items opened a one-row-high popup that DropDown never paints, leaving a blank strip with stale pixels under the box. Don't open the list when it is empty, and label the printer box in the print and send-to-printer dialogs when no printer is available. --- src/slic3r/GUI/SelectMachine.cpp | 2 +- src/slic3r/GUI/SendToPrinter.cpp | 2 +- src/slic3r/GUI/Widgets/ComboBox.cpp | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index c6e1ea312e..3f5bf126a2 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -4087,7 +4087,7 @@ void SelectMachineDialog::update_user_printer() { m_printer_last_select = ""; update_select_layout(nullptr); - m_printer_box->GetPrinterComboBox()->SetTextLabel(""); + m_printer_box->GetPrinterComboBox()->SetValue(_L("No available printers")); } BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "for send task, current printer id = " << m_printer_last_select << std::endl; diff --git a/src/slic3r/GUI/SendToPrinter.cpp b/src/slic3r/GUI/SendToPrinter.cpp index a2a705b8a2..031c5847f4 100644 --- a/src/slic3r/GUI/SendToPrinter.cpp +++ b/src/slic3r/GUI/SendToPrinter.cpp @@ -1229,7 +1229,7 @@ void SendToPrinterDialog::update_user_printer() } else { m_printer_last_select = ""; - m_comboBox_printer->SetTextLabel(""); + m_comboBox_printer->SetValue(_L("No available printers")); } BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "for send task, current printer id = " << m_printer_last_select << std::endl; diff --git a/src/slic3r/GUI/Widgets/ComboBox.cpp b/src/slic3r/GUI/Widgets/ComboBox.cpp index 55e261d04d..d58c677205 100644 --- a/src/slic3r/GUI/Widgets/ComboBox.cpp +++ b/src/slic3r/GUI/Widgets/ComboBox.cpp @@ -287,7 +287,7 @@ void ComboBox::DoDeleteOneItem(unsigned int pos) void ComboBox::ForceDropdownOpen() { - if (!IsEnabled()) + if (!IsEnabled() || items.empty()) return; if (!drop_down) { @@ -398,7 +398,7 @@ void ComboBox::mouseDown(wxMouseEvent &event) SetFocus(); if (drop_down) { drop.Hide(); - } else if (drop.HasDismissLongTime()) { + } else if (!items.empty() && drop.HasDismissLongTime()) { // DropDown paints nothing for an empty list drop.autoPosition(); drop_down = true; drop.Popup(&drop); @@ -426,7 +426,7 @@ void ComboBox::keyDown(wxKeyEvent& event) case WXK_SPACE: if (drop_down) { drop.DismissAndNotify(); - } else if (drop.HasDismissLongTime()) { + } else if (!items.empty() && drop.HasDismissLongTime()) { drop.autoPosition(); drop_down = true; drop.Popup();