remove: "FIX:fixed some issues with sending prints"

This reverts commit d1036a86604da5d5f72bb9531618d959036caf42.

Change-Id: I17ad13d477ece20638c9c1a2f72aea7401d335ca
This commit is contained in:
养乐多 2022-10-19 21:00:59 +08:00 committed by Lane.Wei
parent 4a52147443
commit 9abe0ad9f6
7 changed files with 15 additions and 96 deletions

View file

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

View file

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

View file

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

View file

@ -13,7 +13,6 @@
#include "Widgets/StaticBox.hpp"
#include "Widgets/WebView.hpp"
#include <wx/regex.h>
#include <wx/progdlg.h>
#include <wx/clipbrd.h>
#include <wx/dcgraph.h>
@ -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 = "";

View file

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

View file

@ -71,7 +71,7 @@ wxString SendToPrinterDialog::format_text(wxString &m_msg)
}
SendToPrinterDialog::SendToPrinterDialog(Plater *plater)
: DPIDialog(static_cast<wxWindow *>(wxGetApp().mainframe), wxID_ANY, _L("Send to Printer SD card"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX)
: DPIDialog(static_cast<wxWindow *>(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();

View file

@ -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 };