diff --git a/src/slic3r/GUI/BBLStatusBarSend.cpp b/src/slic3r/GUI/BBLStatusBarSend.cpp index f75376f4ed..4694d11e88 100644 --- a/src/slic3r/GUI/BBLStatusBarSend.cpp +++ b/src/slic3r/GUI/BBLStatusBarSend.cpp @@ -30,10 +30,6 @@ BBLStatusBarSend::BBLStatusBarSend(wxWindow *parent, int id) m_status_text->SetForegroundColour(wxColour(107, 107, 107)); m_status_text->SetFont(::Label::Body_13); m_status_text->Wrap(m_self->FromDIP(280)); - m_status_text->SetSize(wxSize(m_self->FromDIP(280), m_self->FromDIP(46))); - m_status_text->SetMaxSize(wxSize(m_self->FromDIP(280), m_self->FromDIP(46))); - - //m_status_text->SetSize() m_prog = new wxGauge(m_self, wxID_ANY, 100, wxDefaultPosition, wxSize(-1, m_self->FromDIP(6)), wxGA_HORIZONTAL); @@ -172,61 +168,15 @@ wxPanel* BBLStatusBarSend::get_panel() return m_self; } -bool BBLStatusBarSend::is_english_text(wxString str) -{ - std::regex reg("^[0-9a-zA-Z]+$"); - std::smatch matchResult; - - std::string pattern_Special = "{}[]<>~!@#$%^&*(),.?/ :"; - for (auto i = 0; i < str.Length(); i++) { - std::string regex_str = wxString(str[i]).ToStdString(); - if (std::regex_match(regex_str, matchResult, reg)) { - continue; - } - else { - int result = pattern_Special.find(regex_str.c_str()); - if (result < 0 || result > pattern_Special.length()) { - return false; - } - } - } - return true; -} - -wxString BBLStatusBarSend::format_text(wxStaticText* st, wxString str, int warp) -{ - int index = 0; - if (!str.empty()) { - while ((index = str.find('\n', index)) != string::npos) { - str.erase(index, 1); - } - } - - wxString out_txt = str; - wxString count_txt = ""; - int new_line_pos = 0; - - for (int i = 0; i < str.length(); i++) { - auto text_size = st->GetTextExtent(count_txt); - if (text_size.x < warp) { - count_txt += str[i]; - } - else { - out_txt.insert(i - 1, '\n'); - count_txt = ""; - } - } - return out_txt; -} - void BBLStatusBarSend::set_status_text(const wxString& txt) { //auto txtss = "Sending the printing task has timed out.\nPlease try again!"; //auto txtss = "The printing project is being uploaded... 25%%"; //m_status_text->SetLabelText(txtss); - wxString str = format_text(m_status_text,txt,280); - m_status_text->SetLabelText(str); - //if (is_english_text(str)) m_status_text->Wrap(m_self->FromDIP(280)); + m_status_text->SetLabelText(txt); + m_status_text->SetSize(wxSize(m_self->FromDIP(280), -1)); + m_status_text->SetMaxSize(wxSize(m_self->FromDIP(280), -1)); + m_status_text->Wrap(m_self->FromDIP(280)); } void BBLStatusBarSend::set_percent_text(const wxString &txt) @@ -256,7 +206,6 @@ wxString BBLStatusBarSend::get_status_text() const bool BBLStatusBarSend::update_status(wxString &msg, bool &was_cancel, int percent, bool yield) { - //auto test_txt = _L("Unkown Error.") + _L("status=150, body=Timeout was reached: Connection timed out after 10009 milliseconds [Error 28]"); set_status_text(msg); if (percent >= 0) diff --git a/src/slic3r/GUI/BBLStatusBarSend.hpp b/src/slic3r/GUI/BBLStatusBarSend.hpp index d1e24aa08f..e938308fcd 100644 --- a/src/slic3r/GUI/BBLStatusBarSend.hpp +++ b/src/slic3r/GUI/BBLStatusBarSend.hpp @@ -56,9 +56,7 @@ public: void set_cancel_callback(CancelFn = CancelFn()) override; inline void reset_cancel_callback() { set_cancel_callback(); } wxPanel * get_panel(); - bool is_english_text(wxString str); - wxString format_text(wxStaticText* st, wxString str, int warp); - void set_status_text(const wxString& txt); + void set_status_text(const wxString &txt); void set_percent_text(const wxString &txt); void msw_rescale(); void set_status_text(const std::string &txt); diff --git a/src/slic3r/GUI/Jobs/SendJob.cpp b/src/slic3r/GUI/Jobs/SendJob.cpp index 59d491dcd0..5d4cbc040b 100644 --- a/src/slic3r/GUI/Jobs/SendJob.cpp +++ b/src/slic3r/GUI/Jobs/SendJob.cpp @@ -12,7 +12,7 @@ namespace GUI { static wxString check_gcode_failed_str = _L("Abnormal print file data. Please slice again"); static wxString printjob_cancel_str = _L("Task canceled"); static wxString timeout_to_upload_str = _L("Upload task timed out. Please check the network problem and try again"); -static wxString failed_in_cloud_service_str = _L("Send to Printer failed. Please try again."); +static wxString failed_in_cloud_service_str = _L("Cloud service connection failed. Please try again."); static wxString file_is_not_exists_str = _L("Print file not found, please slice again"); static wxString file_over_size_str = _L("The print file exceeds the maximum allowable size (1GB). Please simplify the model and slice again"); static wxString print_canceled_str = _L("Task canceled"); @@ -151,7 +151,8 @@ void SendJob::process() BBL::PrintParams params; params.dev_id = m_dev_id; //params.project_name = wxGetApp().plater()->get_project_name().ToUTF8().data(); - params.project_name = wxGetApp().plater()->get_export_gcode_filename(".gcode.3mf", true).utf8_string(); + params.project_name = wxGetApp().plater()->get_project_name().utf8_string(); + params.preset_name = wxGetApp().preset_bundle->prints.get_selected_preset_name(); params.filename = job_data._3mf_path.string(); params.config_filename = job_data._3mf_config_path.string(); diff --git a/src/slic3r/GUI/ReleaseNote.cpp b/src/slic3r/GUI/ReleaseNote.cpp index ee0a1b771f..28ecd8fd21 100644 --- a/src/slic3r/GUI/ReleaseNote.cpp +++ b/src/slic3r/GUI/ReleaseNote.cpp @@ -13,7 +13,6 @@ #include "Widgets/StaticBox.hpp" #include "Widgets/WebView.hpp" -#include #include #include #include @@ -421,36 +420,16 @@ void SecondaryCheckDialog::update_text(wxString text) text = format_text(m_staticText_release_note, text, FromDIP(240)); m_staticText_release_note->SetLabelText(text); - if (is_english_text(text)) m_staticText_release_note->Wrap(FromDIP(240)); + m_staticText_release_note->Wrap(FromDIP(240)); sizer_text_release_note->Add(m_staticText_release_note, 0, wxALIGN_CENTER, 5); m_vebview_release_note->SetSizer(sizer_text_release_note); m_vebview_release_note->Layout(); -} - -bool SecondaryCheckDialog::is_english_text(wxString str) -{ - std::regex reg("^[0-9a-zA-Z]+$"); - std::smatch matchResult; - - std::string pattern_Special = "{}[]<>~!@#$%^&*(),.?/ :"; - for (auto i = 0; i < str.Length(); i++) { - std::string regex_str = wxString(str[i]).ToStdString(); - if(std::regex_match(regex_str, matchResult, reg)){ - continue; - } - else { - int result = pattern_Special.find(regex_str.c_str()); - if (result < 0 || result > pattern_Special.length()) { - return false; - } - } - } - return true; + //Fit(); } wxString SecondaryCheckDialog::format_text(wxStaticText* st, wxString str, int warp) { - if (is_english_text(str)) return str; + if (wxGetApp().app_config->get("language") != "zh_CN") { return str; } wxString out_txt = str; wxString count_txt = ""; diff --git a/src/slic3r/GUI/ReleaseNote.hpp b/src/slic3r/GUI/ReleaseNote.hpp index dd63e3f69c..36466c395b 100644 --- a/src/slic3r/GUI/ReleaseNote.hpp +++ b/src/slic3r/GUI/ReleaseNote.hpp @@ -83,7 +83,6 @@ class SecondaryCheckDialog : public DPIDialog public: SecondaryCheckDialog(wxWindow* parent); void update_text(wxString text); - bool is_english_text(wxString str); wxString format_text(wxStaticText* st, wxString str, int warp); ~SecondaryCheckDialog(); void on_dpi_changed(const wxRect& suggested_rect) override; diff --git a/src/slic3r/GUI/SendToPrinter.cpp b/src/slic3r/GUI/SendToPrinter.cpp index 9906671ed0..8f619058c3 100644 --- a/src/slic3r/GUI/SendToPrinter.cpp +++ b/src/slic3r/GUI/SendToPrinter.cpp @@ -71,7 +71,7 @@ wxString SendToPrinterDialog::format_text(wxString &m_msg) } SendToPrinterDialog::SendToPrinterDialog(Plater *plater) - : DPIDialog(static_cast(wxGetApp().mainframe), wxID_ANY, _L("Send to Printer SD card"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX) + : DPIDialog(static_cast(wxGetApp().mainframe), wxID_ANY, _L("Send to Printer"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX) , m_plater(plater), m_export_3mf_cancel(false) { #ifdef __WINDOWS__ @@ -135,7 +135,7 @@ SendToPrinterDialog::SendToPrinterDialog(Plater *plater) wxBoxSizer *m_sizer_printer = new wxBoxSizer(wxHORIZONTAL); - m_stext_printer_title = new wxStaticText(this, wxID_ANY, _L("Printer"), wxDefaultPosition, wxSize(-1, -1), 0); + m_stext_printer_title = new wxStaticText(this, wxID_ANY, L("Printer"), wxDefaultPosition, wxSize(-1, -1), 0); m_stext_printer_title->SetFont(::Label::Head_14); m_stext_printer_title->Wrap(-1); m_stext_printer_title->SetForegroundColour(m_colour_bold_color); @@ -237,17 +237,14 @@ SendToPrinterDialog::SendToPrinterDialog(Plater *plater) m_scrollable_region->SetSizer(m_sizer_scrollable_region); m_scrollable_region->Layout(); - //file name - m_file_name = new wxStaticText(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0); + m_sizer_main->Add(m_line_top, 0, wxEXPAND, 0); m_sizer_main->Add(0, 0, 0, wxTOP, FromDIP(22)); m_sizer_main->Add(m_scrollable_region, 0, wxALIGN_CENTER_HORIZONTAL, 0); m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(8)); m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(8)); - m_sizer_main->Add(m_file_name, 0, wxALIGN_CENTER_HORIZONTAL, 0); - m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(8)); m_sizer_main->Add(m_line_materia, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(30)); - m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(15)); + m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(14)); m_sizer_main->Add(m_sizer_printer, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(30)); m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(5)); m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(8)); @@ -899,9 +896,6 @@ void SendToPrinterDialog::on_dpi_changed(const wxRect &suggested_rect) void SendToPrinterDialog::set_default() { - wxString filename = m_plater->get_export_gcode_filename(".gcode.3mf", true); - m_file_name->SetLabelText(filename); - enable_prepare_mode = true; prepare_mode(); diff --git a/src/slic3r/GUI/SendToPrinter.hpp b/src/slic3r/GUI/SendToPrinter.hpp index ece3ca4326..9490d025f2 100644 --- a/src/slic3r/GUI/SendToPrinter.hpp +++ b/src/slic3r/GUI/SendToPrinter.hpp @@ -92,7 +92,6 @@ protected: wxBoxSizer* sizer_thumbnail; wxBoxSizer* m_sizer_main; wxBoxSizer* m_sizer_bottom; - wxStaticText* m_file_name; bool enable_prepare_mode{true}; bool m_need_adaptation_screen{ false };