From 55453af6890fbc28f640966de5d5295c0d86e94e Mon Sep 17 00:00:00 2001 From: "hu.wang" Date: Thu, 20 Jul 2023 11:17:25 +0800 Subject: [PATCH] FIX:displayed error file name If the file name sent to the printer is changed to be too long, the final display format is incorrect Jira:STUDIO-3137 Change-Id: Ia2a542a559ae8ff0343b159cff9e0317397e866f --- src/slic3r/GUI/SelectMachine.cpp | 12 ++++++++++++ src/slic3r/GUI/SendToPrinter.cpp | 14 ++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index dfd4a98ed0..f2f160bc75 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -2868,6 +2868,18 @@ void SelectMachineDialog::on_rename_enter() } auto new_file_name = m_rename_input->GetTextCtrl()->GetValue(); + wxString temp; + int num = 0; + for (auto t : new_file_name) { + if (t == wxString::FromUTF8("\x20")) { + num++; + if (num == 1) temp += t; + } else { + num = 0; + temp += t; + } + } + new_file_name = temp; auto m_valid_type = Valid; wxString info_line; diff --git a/src/slic3r/GUI/SendToPrinter.cpp b/src/slic3r/GUI/SendToPrinter.cpp index c564cb6f1e..ebe312d9dd 100644 --- a/src/slic3r/GUI/SendToPrinter.cpp +++ b/src/slic3r/GUI/SendToPrinter.cpp @@ -107,6 +107,20 @@ void SendToPrinterDialog::on_rename_enter() } auto new_file_name = m_rename_input->GetTextCtrl()->GetValue(); + + wxString temp; + int num = 0; + for (auto t : new_file_name) { + if (t == wxString::FromUTF8("\x20")) { + num++; + if (num == 1) temp += t; + } else { + num = 0; + temp += t; + } + } + new_file_name = temp; + auto m_valid_type = Valid; wxString info_line;