From f63cdc30e47605dd040105d4d1f4f0dde1a69bab Mon Sep 17 00:00:00 2001 From: milk Date: Sat, 11 Oct 2025 15:42:31 +0800 Subject: [PATCH] FIX:change interface for send jira:[none] Change-Id: Ia59bb1bb606399541aa191991ff0fb3f106d75d1 (cherry picked from commit b22af6cfe0a589ae5fa2e95a01ebe47f6742ee99) --- resources/images/radio_ban.svg | 3 +++ src/slic3r/GUI/SendToPrinter.cpp | 17 ++++++++++++++--- src/slic3r/GUI/Widgets/RadioBox.cpp | 18 +++++++++++++++--- src/slic3r/GUI/Widgets/RadioBox.hpp | 11 ++++++----- 4 files changed, 38 insertions(+), 11 deletions(-) create mode 100644 resources/images/radio_ban.svg diff --git a/resources/images/radio_ban.svg b/resources/images/radio_ban.svg new file mode 100644 index 0000000000..91440c9620 --- /dev/null +++ b/resources/images/radio_ban.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/slic3r/GUI/SendToPrinter.cpp b/src/slic3r/GUI/SendToPrinter.cpp index 224623f24a..1c7af52358 100644 --- a/src/slic3r/GUI/SendToPrinter.cpp +++ b/src/slic3r/GUI/SendToPrinter.cpp @@ -631,13 +631,14 @@ void SendToPrinterDialog::update_storage_list(const std::vector &st if (storages[i] == "emmc") storage_text->SetLabel(_L("Internal Storage")); else - storage_text->SetLabel(_L("Enternal Storage")); + storage_text->SetLabel(_L("External Storage")); //radiobox->SetLabel(storages[i]); if (storages[i] != "emmc" && m_if_has_sdcard == false) { - storage_text->SetLabel(_L("No Enternal Storage")); + storage_text->SetLabel(_L("External Storage")); radiobox->Disable(); + storage_text->SetForegroundColour(wxColour("#CECECE")); } else { @@ -654,6 +655,7 @@ void SendToPrinterDialog::update_storage_list(const std::vector &st m_storage_sizer->Add(radiobox, 0, wxALIGN_CENTER, 0); m_storage_sizer->Add(0, 0, 0, wxEXPAND|wxLEFT, FromDIP(6)); m_storage_sizer->Add(storage_text, 0, wxALIGN_CENTER,0); + m_storage_sizer->AddSpacer(20); m_storage_radioBox.push_back(radiobox); } @@ -1874,8 +1876,17 @@ void SendToPrinterDialog::CreateMediaAbilityJob() auto media_set = nlohmann::json::parse(json_res); for (const auto &it : media_set) m_ability_list.push_back(it.get()); - update_storage_list(m_ability_list); + BOOST_LOG_TRIVIAL(info) << "CreateMediaAbilityJob::" << "request mediaability success." << json_res; + if (m_if_has_sdcard == false && m_ability_list.size() == 1) + { + show_status(PrintDialogStatus::PrintStatusNoSdcard); + return; + } + else + { + update_storage_list(m_ability_list); + } } catch (const nlohmann::json::exception &e) { diff --git a/src/slic3r/GUI/Widgets/RadioBox.cpp b/src/slic3r/GUI/Widgets/RadioBox.cpp index 2720542e07..88427b0304 100644 --- a/src/slic3r/GUI/Widgets/RadioBox.cpp +++ b/src/slic3r/GUI/Widgets/RadioBox.cpp @@ -2,10 +2,13 @@ #include "../wxExtensions.hpp" -namespace Slic3r { +namespace Slic3r { namespace GUI { RadioBox::RadioBox(wxWindow *parent) - : wxBitmapToggleButton(parent, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE), m_on(this, "radio_on", 18), m_off(this, "radio_off", 18) + : wxBitmapToggleButton(parent, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE) + , m_on(this, "radio_on", 18) + , m_off(this, "radio_off", 18) + , m_ban(this, "radio_ban", 18) { // SetBackgroundStyle(wxBG_STYLE_TRANSPARENT); if (parent) SetBackgroundColour(parent->GetBackgroundColour()); @@ -35,7 +38,16 @@ void RadioBox::Rescale() update(); } -void RadioBox::update() { SetBitmap((GetValue() ? m_on : m_off).bmp()); } +void RadioBox::update() { + if (IsEnabled()) + { + SetBitmap((GetValue() ? m_on : m_off).bmp()); + } else + { + SetBitmap(m_ban.bmp()); + } + +} } } diff --git a/src/slic3r/GUI/Widgets/RadioBox.hpp b/src/slic3r/GUI/Widgets/RadioBox.hpp index 8f30994bbc..b2c03aae15 100644 --- a/src/slic3r/GUI/Widgets/RadioBox.hpp +++ b/src/slic3r/GUI/Widgets/RadioBox.hpp @@ -5,7 +5,7 @@ #include -namespace Slic3r { +namespace Slic3r { namespace GUI { class RadioBox : public wxBitmapToggleButton @@ -17,11 +17,11 @@ public: void SetValue(bool value) override; bool GetValue(); void Rescale(); - bool Disable() { - return wxBitmapToggleButton::Disable(); + bool Disable() { + return wxBitmapToggleButton::Disable(); } - bool Enable() { - return wxBitmapToggleButton::Enable(); + bool Enable() { + return wxBitmapToggleButton::Enable(); } private: @@ -30,6 +30,7 @@ private: private: ScalableBitmap m_on; ScalableBitmap m_off; + ScalableBitmap m_ban; }; }}