feat: add drying-while-printing warning in SelectMachine dialog

Port from BambuStudio commit c8f70c6ca. Shows a warning when AMS
is actively drying during print job preparation, alerting users that
the drying temperature will be lowered during printing.
This commit is contained in:
Noisyfox
2026-07-07 17:45:08 +08:00
parent 922af972c7
commit f58a1f350a
2 changed files with 35 additions and 0 deletions

View File

@@ -506,6 +506,14 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
//m_change_filament_times_sizer->Add(m_img_change_filament_times, 0, wxTOP, FromDIP(2));
m_change_filament_times_sizer->Add(m_txt_change_filament_times, 0, wxTOP, 0);
m_warn_when_drying_sizer = new wxBoxSizer(wxHORIZONTAL);
m_txt_warn_when_drying = new Label(m_scroll_area, wxEmptyString);
m_txt_warn_when_drying->SetFont(::Label::Body_13);
m_txt_warn_when_drying->SetForegroundColour(wxColour("#F09A17"));
m_txt_warn_when_drying->SetBackgroundColour(*wxWHITE);
m_txt_warn_when_drying->SetLabel(_L("To ensure print quality, the drying temperature will be lowered during printing."));
m_warn_when_drying_sizer->Add(m_txt_warn_when_drying, 0, wxTOP, FromDIP(2));
/*Advanced Options*/
wxBoxSizer* sizer_split_options = new wxBoxSizer(wxHORIZONTAL);
auto m_split_options_line = new wxPanel(m_scroll_area, wxID_ANY);
@@ -716,6 +724,8 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
m_scroll_sizer->Add(m_change_filament_times_sizer, 0,wxLEFT|wxRIGHT, FromDIP(15));
// m_scroll_sizer->Add(m_link_edit_nozzle, 0, wxLEFT|wxRIGHT, FromDIP(15));
m_scroll_sizer->Add(suggestion_sizer, 0, wxLEFT|wxRIGHT|wxEXPAND, FromDIP(15));
m_scroll_sizer->Add(0, 0, 0, wxTOP, FromDIP(10));
m_scroll_sizer->Add(m_warn_when_drying_sizer, 0, wxLEFT|wxRIGHT, FromDIP(15));
m_scroll_sizer->Add(sizer_split_options, 1, wxEXPAND|wxLEFT|wxRIGHT, FromDIP(15));
m_scroll_sizer->Add(0, 0, 0, wxTOP, FromDIP(10));
m_scroll_sizer->Add(m_options_other, 0, wxEXPAND|wxLEFT|wxRIGHT, FromDIP(15));
@@ -1443,6 +1453,18 @@ int SelectMachineDialog::convert_filament_map_nozzle_id_to_task_nozzle_id(int no
}
}
bool SelectMachineDialog::is_ams_drying(MachineObject* obj)
{
const auto& ams_list = obj->GetFilaSystem()->GetAmsList();
for (auto ams = ams_list.begin(); ams != ams_list.end(); ams++) {
if (ams->second->AmsIsDrying()) {
return true;
}
}
return false;
}
void SelectMachineDialog::prepare(int print_plate_idx)
{
m_print_plate_idx = print_plate_idx;
@@ -3285,6 +3307,12 @@ void SelectMachineDialog::update_show_status(MachineObject* obj_)
m_check_ext_change_assist->Enable(false);
}
if (is_ams_drying(obj_)) {
m_warn_when_drying_sizer->Show(true);
} else {
m_warn_when_drying_sizer->Show(false);
}
/*reading done*/
if (wxGetApp().app_config) {
if (obj_->upgrade_force_upgrade) {
@@ -3774,6 +3802,7 @@ void SelectMachineDialog::set_default()
m_mapping_sugs_sizer->Show(false);
m_change_filament_times_sizer->Show(false);
m_txt_change_filament_times->Show(false);
m_warn_when_drying_sizer->Show(false);
// rset status bar
m_status_bar->reset();

View File

@@ -28,6 +28,7 @@
#include "boost/bimap/bimap.hpp"
#include "AmsMappingPopup.hpp"
#include "GUI_ObjectLayers.hpp"
#include "ReleaseNote.hpp"
#include "GUI_Utils.hpp"
#include "wxExtensions.hpp"
@@ -354,6 +355,7 @@ protected:
wxBoxSizer* m_sizer_autorefill{ nullptr };
wxBoxSizer* m_mapping_sugs_sizer{ nullptr };
wxBoxSizer* m_change_filament_times_sizer{ nullptr };
wxBoxSizer* m_warn_when_drying_sizer{ nullptr };
Button* m_button_ensure{ nullptr };
wxStaticBitmap * m_rename_button{nullptr};
wxStaticBitmap* m_staticbitmap{ nullptr };
@@ -387,6 +389,8 @@ protected:
CheckBox* m_check_ext_change_assist{ nullptr };
Label* m_label_ext_change_assist{ nullptr };
Label* m_txt_warn_when_drying{ nullptr };
PrinterInfoBox* m_printer_box { nullptr};
PrinterMsgPanel * m_text_printer_msg{nullptr};
Label* m_text_printer_msg_tips{ nullptr };
@@ -511,6 +515,8 @@ public:
bool is_nozzle_type_match(DevExtderSystem data, wxString& error_message) const;
int convert_filament_map_nozzle_id_to_task_nozzle_id(int nozzle_id) const;
bool is_ams_drying(MachineObject* obj);
PrintFromType get_print_type() {return m_print_type;};
wxString format_steel_name(NozzleType type);
PrintDialogStatus get_status() { return m_print_status; }