FIX: update message and translation

jira: [STUDIO-9580] [STUDIO-10092]
Change-Id: I133d23bef894d3784fa0e12c1d27a8a93448ebfa
(cherry picked from commit ea36ee5879b4b05b4d7ac98094697ce6e9eb1ba8)
This commit is contained in:
xin.zhang
2025-01-22 14:19:10 +08:00
committed by Noisyfox
parent 678538463f
commit 1b7f64ccd3
3 changed files with 42 additions and 22 deletions

View File

@@ -1471,7 +1471,7 @@ void SelectMachineDialog::auto_supply_with_ext(std::vector<AmsTray> slots) {
} }
} }
bool SelectMachineDialog::is_nozzle_type_match(ExtderData data) { bool SelectMachineDialog::is_nozzle_type_match(ExtderData data, wxString& error_message) const {
if (data.total_extder_count <= 1 || data.extders.size() <= 1 || !wxGetApp().preset_bundle) if (data.total_extder_count <= 1 || data.extders.size() <= 1 || !wxGetApp().preset_bundle)
return false; return false;
@@ -1516,6 +1516,24 @@ bool SelectMachineDialog::is_nozzle_type_match(ExtderData data) {
if (target_machine_nozzle_id < flow_type_of_machine.size()) { if (target_machine_nozzle_id < flow_type_of_machine.size()) {
if (flow_type_of_machine[target_machine_nozzle_id] != used_extruders_flow[it->first]) { if (flow_type_of_machine[target_machine_nozzle_id] != used_extruders_flow[it->first]) {
wxString pos;
if (target_machine_nozzle_id == DEPUTY_NOZZLE_ID)
{
pos = _L("left");
}
else if((target_machine_nozzle_id == MAIN_NOZZLE_ID))
{
pos = _L("right");
}
const wxString& tips = _L("Tips: If you changed your nozzle of your printer lately, Please go to 'Device -> Printer parts' to change your nozzle setting.");
error_message = wxString::Format(_L("The nozzle flow setting of %snozzle(%s) doesn't match with the slicing file(%s). "
"Please make sure the nozzle installed matches with settings in printer, "
"then set the corresponding printer preset while slicing."),
pos, flow_type_of_machine[target_machine_nozzle_id],
used_extruders_flow[it->first]);
error_message = error_message + "\n" + tips;
return false; return false;
} }
} }
@@ -1739,9 +1757,8 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vector<wxSt
update_print_status_msg(msg_text, true, true); update_print_status_msg(msg_text, true, true);
Enable_Send_Button(false); Enable_Send_Button(false);
Enable_Refresh_Button(true); Enable_Refresh_Button(true);
} else if (status == PrintDialogStatus::PrintStatusNozzleMatchInvalid) { } else if (status == PrintDialogStatus::PrintStatusNozzleMatchInvalid && !params.empty()) {
wxString msg_text = _L("Please check whether the nozzle type of the device is the same as the preset nozzle type."); update_print_status_msg(params[0], true, true);
update_print_status_msg(msg_text, true, false);
Enable_Send_Button(false); Enable_Send_Button(false);
Enable_Refresh_Button(true); Enable_Refresh_Button(true);
} else if (status == PrintStatusNozzleDiameterMismatch && !params.empty()) { } else if (status == PrintStatusNozzleDiameterMismatch && !params.empty()) {
@@ -3252,8 +3269,11 @@ void SelectMachineDialog::update_show_status()
return; return;
} }
if (!is_nozzle_type_match(obj_->m_extder_data)) { wxString error_message;
show_status(PrintDialogStatus::PrintStatusNozzleMatchInvalid); if (!is_nozzle_type_match(obj_->m_extder_data, error_message))
{
std::vector<wxString> params { error_message };
show_status(PrintDialogStatus::PrintStatusNozzleMatchInvalid, params);
return; return;
} }
} }

View File

@@ -491,7 +491,7 @@ public:
bool build_nozzles_info(std::string& nozzles_info); bool build_nozzles_info(std::string& nozzles_info);
bool can_hybrid_mapping(ExtderData data); bool can_hybrid_mapping(ExtderData data);
void auto_supply_with_ext(std::vector<AmsTray> slots); void auto_supply_with_ext(std::vector<AmsTray> slots);
bool is_nozzle_type_match(ExtderData data); bool is_nozzle_type_match(ExtderData data, wxString& error_message) const;
int convert_filament_map_nozzle_id_to_task_nozzle_id(int nozzle_id); int convert_filament_map_nozzle_id_to_task_nozzle_id(int nozzle_id);
std::string get_print_status_info(PrintDialogStatus status); std::string get_print_status_info(PrintDialogStatus status);