fix some bug

This commit is contained in:
QIDI TECH
2025-02-12 14:33:14 +08:00
parent 2c26a369bf
commit 89ea2eb722
9 changed files with 131 additions and 119 deletions

View File

@@ -159,6 +159,7 @@ std::string BackgroundSlicingProcess::output_filepath_for_project(const boost::f
void BackgroundSlicingProcess::process_fff() void BackgroundSlicingProcess::process_fff()
{ {
assert(m_print == m_fff_print); assert(m_print == m_fff_print);
if (!m_print->finished()) {
m_print->process(); m_print->process();
wxCommandEvent evt(m_event_slicing_completed_id); wxCommandEvent evt(m_event_slicing_completed_id);
// Post the Slicing Finished message for the G-code viewer to update. // Post the Slicing Finished message for the G-code viewer to update.
@@ -166,6 +167,8 @@ void BackgroundSlicingProcess::process_fff()
evt.SetInt((int)(m_fff_print->step_state_with_timestamp(PrintStep::psSlicingFinished).timestamp)); evt.SetInt((int)(m_fff_print->step_state_with_timestamp(PrintStep::psSlicingFinished).timestamp));
wxQueueEvent(GUI::wxGetApp().mainframe->m_plater, evt.Clone()); wxQueueEvent(GUI::wxGetApp().mainframe->m_plater, evt.Clone());
m_fff_print->export_gcode(m_temp_output_path, m_gcode_result, [this](const ThumbnailsParams& params) { return this->render_thumbnails(params); }); m_fff_print->export_gcode(m_temp_output_path, m_gcode_result, [this](const ThumbnailsParams& params) { return this->render_thumbnails(params); });
}
if (this->set_step_started(bspsGCodeFinalize)) { if (this->set_step_started(bspsGCodeFinalize)) {
if (! m_export_path.empty()) { if (! m_export_path.empty()) {
wxQueueEvent(GUI::wxGetApp().mainframe->m_plater, new wxCommandEvent(m_event_export_began_id)); wxQueueEvent(GUI::wxGetApp().mainframe->m_plater, new wxCommandEvent(m_event_export_began_id));

View File

@@ -1980,7 +1980,7 @@ float project_overview_table(float scale) {
} }
} }
ImGui::PushStyleColor(ImGuiCol_Text, ImGuiPureWrap::COL_ORANGE_LIGHT); ImGui::PushStyleColor(ImGuiCol_Text, ImGuiPureWrap::COL_BLUE_LIGHT);
const StatisticsSum statistics_sum{get_statistics_sum()}; const StatisticsSum statistics_sum{get_statistics_sum()};
ImGui::TableNextRow(); ImGui::TableNextRow();
@@ -2087,7 +2087,7 @@ void extruder_usage_table(const PerExtruderStatistics &extruder_statistics, cons
ImGui::Text("%.2f", statistics.filament_length); ImGui::Text("%.2f", statistics.filament_length);
} }
ImGui::PushStyleColor(ImGuiCol_Text, ImGuiPureWrap::COL_ORANGE_LIGHT); ImGui::PushStyleColor(ImGuiCol_Text, ImGuiPureWrap::COL_BLUE_LIGHT);
const ExtruderStatistics extruder_statistics_sum{sum_extruder_statistics(extruder_statistics)}; const ExtruderStatistics extruder_statistics_sum{sum_extruder_statistics(extruder_statistics)};
ImGui::TableNextRow(); ImGui::TableNextRow();

View File

@@ -120,7 +120,7 @@ void GLGizmoFuzzySkin::on_render_input_window(float x, float y, float bottom_lim
window_width = std::max(window_width, 2.f * buttons_width + m_imgui->scaled(1.f)); window_width = std::max(window_width, 2.f * buttons_width + m_imgui->scaled(1.f));
auto draw_text_with_caption = [&caption_max](const std::string &caption, const std::string &text) { auto draw_text_with_caption = [&caption_max](const std::string &caption, const std::string &text) {
ImGuiPureWrap::text_colored(ImGuiPureWrap::COL_ORANGE_LIGHT, caption); ImGuiPureWrap::text_colored(ImGuiPureWrap::COL_BLUE_LIGHT, caption);
ImGui::SameLine(caption_max); ImGui::SameLine(caption_max);
ImGuiPureWrap::text(text); ImGuiPureWrap::text(text);
}; };

View File

@@ -1900,7 +1900,7 @@ void Plater::priv::object_list_changed()
(it != s_multiple_beds.get_inst_map().end() (it != s_multiple_beds.get_inst_map().end()
&& it->second == bed_index && it->second == bed_index
&& instance->printable && instance->printable
&& instance->print_volume_state == ModelInstancePVS_Partly_Outside) || (object->in_exclude) && instance->print_volume_state == ModelInstancePVS_Partly_Outside) || (it->second == bed_index && object->in_exclude)
) { ) {
s_print_statuses[bed_index] = PrintStatus::outside; s_print_statuses[bed_index] = PrintStatus::outside;
break; break;

View File

@@ -969,6 +969,8 @@ void PrintHostQueueDialog::on_progress(Event &evt)
const std::string& nm_str = into_u8(nm.GetString()); const std::string& nm_str = into_u8(nm.GetString());
const std::string& hst_str = into_u8(hst.GetString()); const std::string& hst_str = into_u8(hst.GetString());
wxGetApp().notification_manager()->set_upload_job_notification_percentage(evt.job_id + 1, nm_str, hst_str, evt.progress / 100.f); wxGetApp().notification_manager()->set_upload_job_notification_percentage(evt.job_id + 1, nm_str, hst_str, evt.progress / 100.f);
//y21
Moonraker::progress_percentage = evt.progress / 100.f;
} }
} }

View File

@@ -1152,11 +1152,13 @@ void PrinterWebView::RunScript(const wxString &javascript)
{ {
wxString m_link_url = from_u8(link_url); wxString m_link_url = from_u8(link_url);
wxString url; wxString url;
if (!m_link_url.Lower().starts_with("http")) if (link_url.find(":") == wxString::npos)
url = wxString::Format("http://%s", m_link_url); url = wxString::Format("%s:10088", link_url);
else
url = link_url;
if (!url.Lower().ends_with("10088")) if (!m_link_url.Lower().starts_with("http"))
url = wxString::Format("%s:10088", url); url = wxString::Format("http://%s", url);
load_url(url); load_url(url);
} }

View File

@@ -107,7 +107,8 @@ struct Http::priv
{ {
enum { enum {
DEFAULT_TIMEOUT_CONNECT = 10, DEFAULT_TIMEOUT_CONNECT = 10,
DEFAULT_TIMEOUT_MAX = 0, //y21
DEFAULT_TIMEOUT_MAX = 10,
DEFAULT_SIZE_LIMIT = 5 * 1024 * 1024, DEFAULT_SIZE_LIMIT = 5 * 1024 * 1024,
}; };

View File

@@ -21,8 +21,9 @@ namespace fs = boost::filesystem;
namespace pt = boost::property_tree; namespace pt = boost::property_tree;
namespace Slic3r { namespace Slic3r {
//y6 //y21
bool Moonraker::m_isStop = false; bool Moonraker::m_isStop = false;
double Moonraker::progress_percentage = 0;
namespace { namespace {
#ifdef WIN32 #ifdef WIN32
@@ -68,7 +69,7 @@ std::string substitute_host(const std::string& orig_addr, std::string sub_addr)
} }
//B55 //B55
Moonraker::Moonraker(DynamicPrintConfig *config, bool add_port) : Moonraker::Moonraker(DynamicPrintConfig *config, bool add_port) :
m_host(add_port ? config->opt_string("print_host").find(":10088") == std::string::npos ? config->opt_string("print_host") + ":10088" : m_host(add_port ? config->opt_string("print_host").find(":") == std::string::npos ? config->opt_string("print_host") + ":10088" :
config->opt_string("print_host") : config->opt_string("print_host") :
config->opt_string("print_host")), config->opt_string("print_host")),
m_apikey(config->opt_string("printhost_apikey")), m_apikey(config->opt_string("printhost_apikey")),
@@ -172,10 +173,10 @@ std::string Moonraker::get_status(wxString &msg) const
http.timeout_connect(4) http.timeout_connect(4)
.on_error([&](std::string body, std::string error, unsigned status) { .on_error([&](std::string body, std::string error, unsigned status) {
// y1 // y1
if(status == 404) if (status == 404)
{ {
body = ("Network connection fails."); body = ("Network connection fails.");
if(body.find("AWS") != std::string::npos) if (body.find("AWS") != std::string::npos)
body += ("Unable to get required resources from AWS server, please check your network settings."); body += ("Unable to get required resources from AWS server, please check your network settings.");
else else
body += ("Unable to get required resources from Aliyun server, please check your network settings."); body += ("Unable to get required resources from Aliyun server, please check your network settings.");
@@ -242,10 +243,10 @@ float Moonraker::get_progress(wxString &msg) const
set_auth(http); set_auth(http);
http.on_error([&](std::string body, std::string error, unsigned status) { http.on_error([&](std::string body, std::string error, unsigned status) {
// y1 // y1
if(status == 404) if (status == 404)
{ {
body = ("Network connection fails."); body = ("Network connection fails.");
if(body.find("AWS") != std::string::npos) if (body.find("AWS") != std::string::npos)
body += ("Unable to get required resources from AWS server, please check your network settings."); body += ("Unable to get required resources from AWS server, please check your network settings.");
else else
body += ("Unable to get required resources from Aliyun server, please check your network settings."); body += ("Unable to get required resources from Aliyun server, please check your network settings.");
@@ -436,17 +437,18 @@ bool Moonraker::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, Erro
http.form_add("path", upload_parent_path.string()); http.form_add("path", upload_parent_path.string());
if (upload_data.post_action == PrintHostPostUploadAction::StartPrint) if (upload_data.post_action == PrintHostPostUploadAction::StartPrint)
http.form_add("print", "true"); http.form_add("print", "true");
progress_percentage = 0;
http.form_add_file("file", upload_data.source_path.string(), upload_filename.string()) http.form_add_file("file", upload_data.source_path.string(), upload_filename.string())
.on_complete([&](std::string body, unsigned status) { .on_complete([&](std::string body, unsigned status) {
BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: File uploaded: HTTP %2%: %3%") % name % status % body; BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: File uploaded: HTTP %2%: %3%") % name % status % body;
}) })
.on_error([&](std::string body, std::string error, unsigned status) { .on_error([&](std::string body, std::string error, unsigned status) {
// y1 // y21
if(status == 404) if (progress_percentage < 0.99) {
if (status == 404)
{ {
body = ("Network connection fails."); body = ("Network connection fails.");
if(body.find("AWS") != std::string::npos) if (body.find("AWS") != std::string::npos)
body += ("Unable to get required resources from AWS server, please check your network settings."); body += ("Unable to get required resources from AWS server, please check your network settings.");
else else
body += ("Unable to get required resources from Aliyun server, please check your network settings."); body += ("Unable to get required resources from Aliyun server, please check your network settings.");
@@ -454,6 +456,7 @@ bool Moonraker::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, Erro
BOOST_LOG_TRIVIAL(error) << boost::format("%1%: Error uploading file: %2%, HTTP %3%, body: `%4%`") % name % error % status % body; BOOST_LOG_TRIVIAL(error) << boost::format("%1%: Error uploading file: %2%, HTTP %3%, body: `%4%`") % name % error % status % body;
error_fn(format_error(body, error, status)); error_fn(format_error(body, error, status));
res = false; res = false;
}
}) })
.on_progress([&](Http::Progress progress, bool& cancel) { .on_progress([&](Http::Progress progress, bool& cancel) {
prorgess_fn(std::move(progress), cancel); prorgess_fn(std::move(progress), cancel);

View File

@@ -48,6 +48,7 @@ public:
static void SetStop(bool isStop) { m_isStop = isStop; }; static void SetStop(bool isStop) { m_isStop = isStop; };
static bool GetStop() { return m_isStop; }; static bool GetStop() { return m_isStop; };
static bool m_isStop; static bool m_isStop;
static double progress_percentage;
protected: protected:
/* /*