ENH: use icon when can not connect printer

jira: [STUDIO-11973]
Change-Id: I17e927c4b5f061cd66ed0b6015f43358e673ef9b
This commit is contained in:
xin.zhang 2025-05-07 10:19:32 +08:00 committed by lane.wei
parent 039d11ca88
commit 1bc83e42a7
3 changed files with 19 additions and 19 deletions

View File

@ -0,0 +1,3 @@
<svg width="15" height="15" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M13.5938 7.5C13.5937 5.88384 12.9517 4.33387 11.8089 3.19107C10.6661 2.04827 9.11616 1.40625 7.5 1.40625C5.88384 1.40625 4.33387 2.04827 3.19107 3.19107C2.04827 4.33387 1.40625 5.88384 1.40625 7.5C1.40625 9.11616 2.04827 10.6661 3.19107 11.8089C4.33387 12.9517 5.88384 13.5938 7.5 13.5938C9.11616 13.5938 10.6661 12.9517 11.8089 11.8089C12.9517 10.6661 13.5938 9.11616 13.5938 7.5ZM0 7.5C0 5.51088 0.790176 3.60322 2.1967 2.1967C3.60322 0.790176 5.51088 0 7.5 0C9.48912 0 11.3968 0.790176 12.8033 2.1967C14.2098 3.60322 15 5.51088 15 7.5C15 9.48912 14.2098 11.3968 12.8033 12.8033C11.3968 14.2098 9.48912 15 7.5 15C5.51088 15 3.60322 14.2098 2.1967 12.8033C0.790176 11.3968 0 9.48912 0 7.5ZM4.97461 4.84277C5.20605 4.18945 5.82715 3.75 6.52148 3.75H8.22949C9.25195 3.75 10.0781 4.5791 10.0781 5.59863C10.0781 6.26074 9.72363 6.87305 9.14941 7.2041L8.20312 7.74609C8.19727 8.12695 7.88379 8.4375 7.5 8.4375C7.11035 8.4375 6.79688 8.12402 6.79688 7.73438V7.33887C6.79688 7.08691 6.93164 6.85547 7.15137 6.72949L8.44922 5.98535C8.58691 5.90625 8.67188 5.75977 8.67188 5.60156C8.67188 5.35547 8.47266 5.15918 8.22949 5.15918H6.52148C6.42188 5.15918 6.33398 5.2207 6.30176 5.31445L6.29004 5.34961C6.16113 5.71582 5.75684 5.90625 5.39355 5.77734C5.03027 5.64844 4.83691 5.24414 4.96582 4.88086L4.97754 4.8457L4.97461 4.84277ZM6.5625 10.3125C6.5625 10.0639 6.66127 9.8254 6.83709 9.64959C7.0129 9.47377 7.25136 9.375 7.5 9.375C7.74864 9.375 7.9871 9.47377 8.16291 9.64959C8.33873 9.8254 8.4375 10.0639 8.4375 10.3125C8.4375 10.5611 8.33873 10.7996 8.16291 10.9754C7.9871 11.1512 7.74864 11.25 7.5 11.25C7.25136 11.25 7.0129 11.1512 6.83709 10.9754C6.66127 10.7996 6.5625 10.5611 6.5625 10.3125Z" fill="#1F8EEA"/>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -475,19 +475,6 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
sizer_split_options->Add(0, 0, 0, wxEXPAND, 0); sizer_split_options->Add(0, 0, 0, wxEXPAND, 0);
sizer_split_options->Add(m_split_options_line, 1, wxALIGN_CENTER, 0); sizer_split_options->Add(m_split_options_line, 1, wxALIGN_CENTER, 0);
wxBoxSizer *sizer_advanced_options_title = new wxBoxSizer(wxHORIZONTAL);
m_connect_printer_help_hyperlink = new Label(m_scroll_area, _L("Click here if you can't connect to the printer ->"));
m_connect_printer_help_hyperlink->SetForegroundColour(0x00ae42);
m_connect_printer_help_hyperlink->SetBackgroundColour(*wxWHITE);
m_connect_printer_help_hyperlink->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) { SetCursor(wxCURSOR_HAND); });
m_connect_printer_help_hyperlink->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) { SetCursor(wxCURSOR_ARROW); });
m_connect_printer_help_hyperlink->Bind(wxEVT_LEFT_DOWN, [this](auto& e) { wxLaunchDefaultBrowser(wxT("https://wiki.bambulab.com/en/software/bambu-studio/failed-to-connect-printer"));});
m_connect_printer_help_hyperlink->SetFont(::Label::Body_13);
sizer_advanced_options_title->Add(m_connect_printer_help_hyperlink, 0, wxALIGN_CENTER, 0);
sizer_advanced_options_title->Add(0, 0, 1, wxEXPAND, 0);
m_options_other = new wxPanel(m_scroll_area); m_options_other = new wxPanel(m_scroll_area);
@ -697,7 +684,6 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
m_scroll_sizer->Add(m_change_filament_times_sizer, 0,wxLEFT|wxRIGHT, FromDIP(18)); m_scroll_sizer->Add(m_change_filament_times_sizer, 0,wxLEFT|wxRIGHT, FromDIP(18));
m_scroll_sizer->Add(m_link_edit_nozzle, 0, wxLEFT|wxRIGHT, FromDIP(18)); m_scroll_sizer->Add(m_link_edit_nozzle, 0, wxLEFT|wxRIGHT, FromDIP(18));
m_scroll_sizer->Add(sizer_split_options, 1, wxEXPAND|wxLEFT|wxRIGHT, FromDIP(15)); m_scroll_sizer->Add(sizer_split_options, 1, wxEXPAND|wxLEFT|wxRIGHT, FromDIP(15));
m_scroll_sizer->Add(sizer_advanced_options_title, 1, wxEXPAND|wxLEFT|wxRIGHT, FromDIP(15));
m_scroll_sizer->Add(0, 0, 0, wxTOP, FromDIP(10)); m_scroll_sizer->Add(0, 0, 0, wxTOP, FromDIP(10));
m_scroll_sizer->Add(m_options_other, 0, wxEXPAND|wxLEFT|wxRIGHT, FromDIP(15)); m_scroll_sizer->Add(m_options_other, 0, wxEXPAND|wxLEFT|wxRIGHT, FromDIP(15));
m_scroll_sizer->Add(0, 0, 0, wxTOP, FromDIP(30)); m_scroll_sizer->Add(0, 0, 0, wxTOP, FromDIP(30));
@ -3678,12 +3664,10 @@ void SelectMachineDialog::set_default()
if (m_print_type == PrintFromType::FROM_NORMAL) { if (m_print_type == PrintFromType::FROM_NORMAL) {
m_printer_box->SetDefault(false); m_printer_box->SetDefault(false);
m_rename_normal_panel->Show(true); m_rename_normal_panel->Show(true);
m_connect_printer_help_hyperlink->Show(true);
} }
else if (m_print_type == PrintFromType::FROM_SDCARD_VIEW) { else if (m_print_type == PrintFromType::FROM_SDCARD_VIEW) {
m_printer_box->SetDefault(true); m_printer_box->SetDefault(true);
m_rename_normal_panel->Show(false); m_rename_normal_panel->Show(false);
m_connect_printer_help_hyperlink->Show(false);
} }
//project name //project name
@ -5099,18 +5083,24 @@ void PrinterInfoBox::Create()
m_comboBox_printer = new ComboBox(printer_staticbox, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_READONLY); m_comboBox_printer = new ComboBox(printer_staticbox, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_READONLY);
m_comboBox_printer->SetBorderWidth(0); m_comboBox_printer->SetBorderWidth(0);
m_comboBox_printer->SetMinSize(wxSize(FromDIP(250), FromDIP(60))); m_comboBox_printer->SetMinSize(wxSize(FromDIP(225), FromDIP(60)));
m_comboBox_printer->SetMaxSize(wxSize(FromDIP(250), FromDIP(60))); m_comboBox_printer->SetMaxSize(wxSize(FromDIP(225), FromDIP(60)));
m_comboBox_printer->SetBackgroundColor(*wxWHITE); m_comboBox_printer->SetBackgroundColor(*wxWHITE);
m_comboBox_printer->Bind(wxEVT_COMBOBOX, &SelectMachineDialog::on_selection_changed, m_select_dialog); m_comboBox_printer->Bind(wxEVT_COMBOBOX, &SelectMachineDialog::on_selection_changed, m_select_dialog);
m_button_refresh = new ScalableButton(printer_staticbox, wxID_ANY, "refresh_printer", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, true); m_button_refresh = new ScalableButton(printer_staticbox, wxID_ANY, "refresh_printer", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, true);
m_button_refresh->Bind(wxEVT_BUTTON, &SelectMachineDialog::on_refresh, m_select_dialog); m_button_refresh->Bind(wxEVT_BUTTON, &SelectMachineDialog::on_refresh, m_select_dialog);
m_button_question = new ScalableButton(printer_staticbox, wxID_ANY, "icon_qusetion", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, true);
m_button_question->Bind(wxEVT_BUTTON, &PrinterInfoBox::OnBtnQuestionClicked, this);
m_button_question->SetToolTip(_L("Click here if you can't connect to the printer"));
sizer_printer_staticbox->Add(0, 0, 0, wxLEFT, FromDIP(7)); sizer_printer_staticbox->Add(0, 0, 0, wxLEFT, FromDIP(7));
sizer_printer_staticbox->Add(m_printer_image, 0, wxALIGN_CENTER, 0); sizer_printer_staticbox->Add(m_printer_image, 0, wxALIGN_CENTER, 0);
sizer_printer_staticbox->Add(m_comboBox_printer, 0, wxALIGN_CENTER, 0); sizer_printer_staticbox->Add(m_comboBox_printer, 0, wxALIGN_CENTER, 0);
sizer_printer_staticbox->Add(m_button_refresh, 0, wxALIGN_CENTER, 0); sizer_printer_staticbox->Add(m_button_refresh, 0, wxALIGN_CENTER, 0);
sizer_printer_staticbox->AddSpacer(FromDIP(10));
sizer_printer_staticbox->Add(m_button_question, 0, wxALIGN_CENTER, 0);
printer_staticbox->SetSizer(sizer_printer_staticbox); printer_staticbox->SetSizer(sizer_printer_staticbox);
printer_staticbox->Layout(); printer_staticbox->Layout();
@ -5153,5 +5143,10 @@ void PrinterInfoBox::Create()
SetSizer(main_sizer); SetSizer(main_sizer);
} }
void PrinterInfoBox::OnBtnQuestionClicked(wxCommandEvent& event)
{
wxLaunchDefaultBrowser(wxT("https://wiki.bambulab.com/en/software/bambu-studio/failed-to-connect-printer"));
}
} }
} // namespace Slic3r::GUI } // namespace Slic3r::GUI

View File

@ -370,7 +370,6 @@ protected:
wxTimer* m_refresh_timer{ nullptr }; wxTimer* m_refresh_timer{ nullptr };
std::shared_ptr<PrintJob> m_print_job; std::shared_ptr<PrintJob> m_print_job;
wxScrolledWindow* m_sw_print_failed_info{nullptr}; wxScrolledWindow* m_sw_print_failed_info{nullptr};
Label* m_connect_printer_help_hyperlink{nullptr};
ScalableBitmap * rename_editable{nullptr}; ScalableBitmap * rename_editable{nullptr};
ScalableBitmap * rename_editable_light{nullptr}; ScalableBitmap * rename_editable_light{nullptr};
wxStaticBitmap * timeimg{nullptr}; wxStaticBitmap * timeimg{nullptr};
@ -528,6 +527,8 @@ public:
private: private:
void Create(); void Create();
void OnBtnQuestionClicked(wxCommandEvent& event);
private: private:
// owner // owner
SelectMachineDialog* m_select_dialog; SelectMachineDialog* m_select_dialog;
@ -536,6 +537,7 @@ private:
Label* m_stext_printer_title{ nullptr }; Label* m_stext_printer_title{ nullptr };
ComboBox* m_comboBox_printer{ nullptr }; ComboBox* m_comboBox_printer{ nullptr };
ScalableButton* m_button_refresh{ nullptr }; ScalableButton* m_button_refresh{ nullptr };
ScalableButton* m_button_question { nullptr };
wxStaticBitmap* m_bed_image{ nullptr }; wxStaticBitmap* m_bed_image{ nullptr };
Label* m_text_bed_type; Label* m_text_bed_type;