mirror of
https://github.com/QIDITECH/QIDISlicer.git
synced 2026-01-30 23:48:44 +03:00
fix some bug
This commit is contained in:
@@ -159,13 +159,16 @@ 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);
|
||||||
m_print->process();
|
if (!m_print->finished()) {
|
||||||
wxCommandEvent evt(m_event_slicing_completed_id);
|
m_print->process();
|
||||||
// Post the Slicing Finished message for the G-code viewer to update.
|
wxCommandEvent evt(m_event_slicing_completed_id);
|
||||||
// Passing the timestamp
|
// Post the Slicing Finished message for the G-code viewer to update.
|
||||||
evt.SetInt((int)(m_fff_print->step_state_with_timestamp(PrintStep::psSlicingFinished).timestamp));
|
// Passing the timestamp
|
||||||
wxQueueEvent(GUI::wxGetApp().mainframe->m_plater, evt.Clone());
|
evt.SetInt((int)(m_fff_print->step_state_with_timestamp(PrintStep::psSlicingFinished).timestamp));
|
||||||
m_fff_print->export_gcode(m_temp_output_path, m_gcode_result, [this](const ThumbnailsParams& params) { return this->render_thumbnails(params); });
|
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); });
|
||||||
|
}
|
||||||
|
|
||||||
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));
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -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);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -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")),
|
||||||
@@ -171,56 +172,56 @@ std::string Moonraker::get_status(wxString &msg) const
|
|||||||
//B64 //y6
|
//B64 //y6
|
||||||
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.");
|
||||||
}
|
}
|
||||||
BOOST_LOG_TRIVIAL(error) << boost::format("%1%: Error getting version: %2%, HTTP %3%, body: `%4%`") % name % error % status %
|
BOOST_LOG_TRIVIAL(error) << boost::format("%1%: Error getting version: %2%, HTTP %3%, body: `%4%`") % name % error % status %
|
||||||
body;
|
body;
|
||||||
print_state = "offline";
|
print_state = "offline";
|
||||||
msg = format_error(body, error, status);
|
msg = format_error(body, error, status);
|
||||||
})
|
})
|
||||||
.on_complete([&](std::string body, unsigned) {
|
.on_complete([&](std::string body, unsigned) {
|
||||||
BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: Got print_stats: %2%") % name % body;
|
BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: Got print_stats: %2%") % name % body;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// All successful HTTP requests will return a json encoded object in the form of :
|
// All successful HTTP requests will return a json encoded object in the form of :
|
||||||
// {result: <response data>}
|
// {result: <response data>}
|
||||||
std::stringstream ss(body);
|
std::stringstream ss(body);
|
||||||
pt::ptree ptree;
|
pt::ptree ptree;
|
||||||
pt::read_json(ss, ptree);
|
pt::read_json(ss, ptree);
|
||||||
if (ptree.front().first != "result") {
|
if (ptree.front().first != "result") {
|
||||||
msg = "Could not parse server response";
|
msg = "Could not parse server response";
|
||||||
print_state = "offline";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!ptree.front().second.get_optional<std::string>("status")) {
|
|
||||||
msg = "Could not parse server response";
|
|
||||||
print_state = "offline";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
print_state = ptree.get<std::string>("result.status.print_stats.state");
|
|
||||||
BOOST_LOG_TRIVIAL(info) << boost::format("%1%: Got state: %2%") % name % print_state;
|
|
||||||
;
|
|
||||||
} catch (const std::exception &) {
|
|
||||||
print_state = "offline";
|
print_state = "offline";
|
||||||
msg = "Could not parse server response";
|
return;
|
||||||
}
|
}
|
||||||
})
|
if (!ptree.front().second.get_optional<std::string>("status")) {
|
||||||
|
msg = "Could not parse server response";
|
||||||
|
print_state = "offline";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
print_state = ptree.get<std::string>("result.status.print_stats.state");
|
||||||
|
BOOST_LOG_TRIVIAL(info) << boost::format("%1%: Got state: %2%") % name % print_state;
|
||||||
|
;
|
||||||
|
} catch (const std::exception &) {
|
||||||
|
print_state = "offline";
|
||||||
|
msg = "Could not parse server response";
|
||||||
|
}
|
||||||
|
})
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
.ssl_revoke_best_effort(m_ssl_revoke_best_effort)
|
.ssl_revoke_best_effort(m_ssl_revoke_best_effort)
|
||||||
.on_ip_resolve([&](std::string address) {
|
.on_ip_resolve([&](std::string address) {
|
||||||
// Workaround for Windows 10/11 mDNS resolve issue, where two mDNS resolves in succession fail.
|
// Workaround for Windows 10/11 mDNS resolve issue, where two mDNS resolves in succession fail.
|
||||||
// Remember resolved address to be reused at successive REST API call.
|
// Remember resolved address to be reused at successive REST API call.
|
||||||
msg = GUI::from_u8(address);
|
msg = GUI::from_u8(address);
|
||||||
})
|
})
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
.perform_sync();
|
.perform_sync();
|
||||||
|
|
||||||
return print_state;
|
return print_state;
|
||||||
}
|
}
|
||||||
@@ -241,55 +242,55 @@ float Moonraker::get_progress(wxString &msg) const
|
|||||||
auto http = Http::get(std::move(url));
|
auto http = Http::get(std::move(url));
|
||||||
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.");
|
||||||
}
|
}
|
||||||
BOOST_LOG_TRIVIAL(error) << boost::format("%1%: Error getting version: %2%, HTTP %3%, body: `%4%`") % name % error % status %
|
BOOST_LOG_TRIVIAL(error) << boost::format("%1%: Error getting version: %2%, HTTP %3%, body: `%4%`") % name % error % status %
|
||||||
body;
|
body;
|
||||||
res = false;
|
res = false;
|
||||||
msg = format_error(body, error, status);
|
msg = format_error(body, error, status);
|
||||||
})
|
})
|
||||||
.on_complete([&](std::string body, unsigned) {
|
.on_complete([&](std::string body, unsigned) {
|
||||||
BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: Got display_status: %2%") % name % body;
|
BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: Got display_status: %2%") % name % body;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// All successful HTTP requests will return a json encoded object in the form of :
|
// All successful HTTP requests will return a json encoded object in the form of :
|
||||||
// {result: <response data>}
|
// {result: <response data>}
|
||||||
std::stringstream ss(body);
|
std::stringstream ss(body);
|
||||||
pt::ptree ptree;
|
pt::ptree ptree;
|
||||||
pt::read_json(ss, ptree);
|
pt::read_json(ss, ptree);
|
||||||
if (ptree.front().first != "result") {
|
if (ptree.front().first != "result") {
|
||||||
msg = "Could not parse server response";
|
|
||||||
res = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!ptree.front().second.get_optional<std::string>("status")) {
|
|
||||||
msg = "Could not parse server response";
|
|
||||||
res = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
process = std::stof(ptree.get<std::string>("result.status.display_status.progress"));
|
|
||||||
BOOST_LOG_TRIVIAL(info) << boost::format("%1%: Got state: %2%") % name % process;
|
|
||||||
} catch (const std::exception &) {
|
|
||||||
res = false;
|
|
||||||
msg = "Could not parse server response";
|
msg = "Could not parse server response";
|
||||||
|
res = false;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
})
|
if (!ptree.front().second.get_optional<std::string>("status")) {
|
||||||
|
msg = "Could not parse server response";
|
||||||
|
res = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
process = std::stof(ptree.get<std::string>("result.status.display_status.progress"));
|
||||||
|
BOOST_LOG_TRIVIAL(info) << boost::format("%1%: Got state: %2%") % name % process;
|
||||||
|
} catch (const std::exception &) {
|
||||||
|
res = false;
|
||||||
|
msg = "Could not parse server response";
|
||||||
|
}
|
||||||
|
})
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
.ssl_revoke_best_effort(m_ssl_revoke_best_effort)
|
.ssl_revoke_best_effort(m_ssl_revoke_best_effort)
|
||||||
.on_ip_resolve([&](std::string address) {
|
.on_ip_resolve([&](std::string address) {
|
||||||
// Workaround for Windows 10/11 mDNS resolve issue, where two mDNS resolves in succession fail.
|
// Workaround for Windows 10/11 mDNS resolve issue, where two mDNS resolves in succession fail.
|
||||||
// Remember resolved address to be reused at successive REST API call.
|
// Remember resolved address to be reused at successive REST API call.
|
||||||
msg = GUI::from_u8(address);
|
msg = GUI::from_u8(address);
|
||||||
})
|
})
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
.perform_sync();
|
.perform_sync();
|
||||||
|
|
||||||
return process;
|
return process;
|
||||||
}
|
}
|
||||||
@@ -436,24 +437,26 @@ 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.");
|
{
|
||||||
if(body.find("AWS") != std::string::npos)
|
body = ("Network connection fails.");
|
||||||
body += ("Unable to get required resources from AWS server, please check your network settings.");
|
if (body.find("AWS") != std::string::npos)
|
||||||
else
|
body += ("Unable to get required resources from AWS server, please check your network settings.");
|
||||||
body += ("Unable to get required resources from Aliyun server, please check your network settings.");
|
else
|
||||||
|
body += ("Unable to get required resources from Aliyun server, please check your network settings.");
|
||||||
|
}
|
||||||
|
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));
|
||||||
|
res = false;
|
||||||
}
|
}
|
||||||
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));
|
|
||||||
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);
|
||||||
|
|||||||
@@ -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:
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user