refactor: centralize printer compatibility checks

This commit is contained in:
peachismomo
2026-09-23 03:06:15 +08:00
parent 99a1cd1b74
commit c492436228
11 changed files with 30 additions and 87 deletions
+6 -12
View File
@@ -1863,19 +1863,13 @@ void SyncAmsInfoDialog::on_cancel(wxCloseEvent &event)
bool SyncAmsInfoDialog::is_blocking_printing(MachineObject *obj_)
{
DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
if (!dev) return true;
std::string source_model = "";
if (m_print_type == PrintFromType::FROM_NORMAL)
return wxGetApp().is_blocking_printing(obj_);
if (m_print_type == PrintFromType::FROM_NORMAL) {
PresetBundle *preset_bundle = wxGetApp().preset_bundle;
source_model = preset_bundle->printers.get_edited_preset().get_printer_type(preset_bundle);
} else if (m_print_type == PrintFromType::FROM_SDCARD_VIEW) {
if (m_required_data_plate_data_list.size() > 0) { source_model = m_required_data_plate_data_list[m_print_plate_idx]->printer_model_id; }
}
return !DevPrinterConfigUtil::is_printer_model_compatible(source_model, *obj_);
std::string source_model;
if (m_print_type == PrintFromType::FROM_SDCARD_VIEW && !m_required_data_plate_data_list.empty())
source_model = m_required_data_plate_data_list[m_print_plate_idx]->printer_model_id;
return wxGetApp().is_blocking_printing(obj_, source_model);
}
bool SyncAmsInfoDialog::is_same_nozzle_type(std::string &filament_type, NozzleType &tag_nozzle_type)