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

View File

@@ -45,8 +45,8 @@ namespace Slic3r { namespace GUI {
SideToolsPanel::~SideToolsPanel() { delete m_intetval_timer; } SideToolsPanel::~SideToolsPanel() { delete m_intetval_timer; }
void SideToolsPanel::set_none_printer_mode() void SideToolsPanel::set_none_printer_mode()
{ {
m_none_printer = true; m_none_printer = true;
Refresh(); Refresh();
} }
@@ -55,26 +55,26 @@ void SideToolsPanel::on_timer(wxTimerEvent &event)
{ {
} }
void SideToolsPanel::set_current_printer_name(std::string dev_name) void SideToolsPanel::set_current_printer_name(std::string dev_name)
{ {
m_none_printer = false; m_none_printer = false;
m_dev_name = from_u8(dev_name); m_dev_name = from_u8(dev_name);
Refresh(); Refresh();
} }
void SideToolsPanel::set_current_printer_signal(WifiSignal sign) void SideToolsPanel::set_current_printer_signal(WifiSignal sign)
{ {
if (last_printer_signal == sign) return; if (last_printer_signal == sign) return;
last_printer_signal = sign; last_printer_signal = sign;
m_none_printer = false; m_none_printer = false;
m_wifi_type = sign; m_wifi_type = sign;
Refresh(); Refresh();
} }
void SideToolsPanel::start_interval() void SideToolsPanel::start_interval()
{ {
m_intetval_timer->Start(SIDE_TOOL_CLICK_INTERVAL); m_intetval_timer->Start(SIDE_TOOL_CLICK_INTERVAL);
m_is_in_interval = true; m_is_in_interval = true;
} }
@@ -85,13 +85,13 @@ void SideToolsPanel::stop_interval(wxTimerEvent& event)
} }
bool SideToolsPanel::is_in_interval() bool SideToolsPanel::is_in_interval()
{ {
return m_is_in_interval; return m_is_in_interval;
} }
void SideToolsPanel::msw_rescale() void SideToolsPanel::msw_rescale()
{ {
m_printing_img.msw_rescale(); m_printing_img.msw_rescale();
m_arrow_img.msw_rescale(); m_arrow_img.msw_rescale();
@@ -138,7 +138,7 @@ void SideToolsPanel::doRender(wxDC &dc)
{ {
auto left = FromDIP(15); auto left = FromDIP(15);
wxSize size = GetSize(); wxSize size = GetSize();
//if (m_none_printer) { //if (m_none_printer) {
// dc.SetPen(SIDE_TOOLS_LIGHT_GREEN); // dc.SetPen(SIDE_TOOLS_LIGHT_GREEN);
// dc.SetBrush(SIDE_TOOLS_LIGHT_GREEN); // dc.SetBrush(SIDE_TOOLS_LIGHT_GREEN);
@@ -196,7 +196,7 @@ void SideToolsPanel::doRender(wxDC &dc)
auto sizet = dc.GetTextExtent(m_dev_name); auto sizet = dc.GetTextExtent(m_dev_name);
auto text_end = size.x - m_wifi_none_img.GetBmpSize().x - 20; auto text_end = size.x - m_wifi_none_img.GetBmpSize().x - 20;
std::string finally_name = m_dev_name.ToStdString(); std::string finally_name = m_dev_name.ToStdString();
if (sizet.x > (text_end - left)) { if (sizet.x > (text_end - left)) {
auto limit_width = text_end - left - dc.GetTextExtent("...").x - 20; auto limit_width = text_end - left - dc.GetTextExtent("...").x - 20;
@@ -233,7 +233,7 @@ void SideToolsPanel::on_mouse_left_down(wxMouseEvent &evt)
Refresh(); Refresh();
} }
void SideToolsPanel::on_mouse_left_up(wxMouseEvent &evt) void SideToolsPanel::on_mouse_left_up(wxMouseEvent &evt)
{ {
m_click = false; m_click = false;
Refresh(); Refresh();
@@ -404,7 +404,7 @@ SideTools::SideTools(wxWindow *parent, wxWindowID id, const wxPoint &pos, const
Fit(); Fit();
} }
void SideTools::msw_rescale() void SideTools::msw_rescale()
{ {
m_side_tools->msw_rescale(); m_side_tools->msw_rescale();
m_connection_info->SetCornerRadius(0); m_connection_info->SetCornerRadius(0);