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();