From 882acc969626040c2553032ebbc94131a80ab593 Mon Sep 17 00:00:00 2001 From: cjw Date: Wed, 18 Dec 2024 09:45:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E7=95=99=E6=80=BB=E6=97=B6=E9=97=B4?= =?UTF-8?q?=EF=BC=8C=E6=96=B0=E5=A2=9E=E7=BB=93=E6=9D=9F=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- slic3r/GUI/GCodeViewer.cpp | 46 +++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/slic3r/GUI/GCodeViewer.cpp b/slic3r/GUI/GCodeViewer.cpp index 0d5b357a2..acfdf6c17 100644 --- a/slic3r/GUI/GCodeViewer.cpp +++ b/slic3r/GUI/GCodeViewer.cpp @@ -5717,6 +5717,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv std::string prepare_str = _u8L("Prepare time"); std::string print_str = _u8L("Model printing time"); std::string total_str = _u8L("Total time"); + std::string end_str = _u8L("End time"); float max_len = window_padding + 2 * ImGui::GetStyle().ItemSpacing.x; if (time_mode.layers_times.empty()) @@ -5746,8 +5747,8 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv ImGui::SameLine(); ::sprintf(buf, imperial_units ? " %.2f oz" : " %.2f g", ps.total_weight / unit_conver); imgui.text(buf); - - ImGui::Dummy({ window_padding, window_padding }); + //xiamian- + /*ImGui::Dummy({ window_padding, window_padding }); ImGui::SameLine(); imgui.text(model_filament_str + ":"); ImGui::SameLine(max_len); @@ -5757,15 +5758,16 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv imgui.text(buf); ImGui::SameLine(); ::sprintf(buf, imperial_units ? " %.2f oz" : " %.2f g", (ps.total_weight - exlude_g) / unit_conver); - imgui.text(buf); + imgui.text(buf);*/ //BBS: display cost of filaments - ImGui::Dummy({ window_padding, window_padding }); + //xiamian- + /*ImGui::Dummy({ window_padding, window_padding }); ImGui::SameLine(); imgui.text(cost_str + ":"); ImGui::SameLine(max_len); ::sprintf(buf, "%.2f", ps.total_cost); - imgui.text(buf); + imgui.text(buf);*/ } auto role_time = [time_mode](ExtrusionRole role) { @@ -5773,24 +5775,48 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv return (it != time_mode.roles_times.end()) ? it->second : 0.0f; }; //BBS: start gcode is mostly same with prepeare time - if (time_mode.prepare_time != 0.0f) { + //xiamian- + /*if (time_mode.prepare_time != 0.0f) { ImGui::Dummy({ window_padding, window_padding }); ImGui::SameLine(); imgui.text(prepare_str + ":"); ImGui::SameLine(max_len); imgui.text(short_time(get_time_dhms(time_mode.prepare_time))); - } - ImGui::Dummy({ window_padding, window_padding }); + }*/ + //xiamian- + /*ImGui::Dummy({ window_padding, window_padding }); ImGui::SameLine(); imgui.text(print_str + ":"); ImGui::SameLine(max_len); - imgui.text(short_time(get_time_dhms(time_mode.time - time_mode.prepare_time))); + imgui.text(short_time(get_time_dhms(time_mode.time - time_mode.prepare_time)));*/ ImGui::Dummy({ window_padding, window_padding }); ImGui::SameLine(); imgui.text(total_str + ":"); ImGui::SameLine(max_len); imgui.text(short_time(get_time_dhms(time_mode.time))); - + //xiamian+ + ImGui::Dummy({ window_padding, window_padding }); + ImGui::SameLine(); + imgui.text(end_str + ":"); + ImGui::SameLine(max_len); + // 获取当前时间点 + auto now = std::chrono::system_clock::now(); + // 将当前时间点转换为time_t对象 + std::time_t now_time_t = std::chrono::system_clock::to_time_t(now); + // 创建tm结构体用于存储本地时间信息 + std::tm local_tm = *std::localtime(&now_time_t); + // 计算总秒数(包括小数部分) + double total_seconds = static_cast(std::mktime(&local_tm)) + time_mode.time; + // 将总秒数转换回time_t对象 + std::time_t new_time_t = static_cast(total_seconds); + // 更新tm结构体以反映新的时间 + std::tm* new_local_tm = std::localtime(&new_time_t); + // 格式化输出新的时间字符串 + std::ostringstream oss; + //oss << std::put_time(new_local_tm, "%Y-%m-%d %H:%M:%S"); + oss << std::put_time(new_local_tm, "%Y-%m-%d %H:%M"); + imgui.text(oss.str()); + //shangmian+ auto show_mode_button = [this, &imgui, can_show_mode_button](const wxString& label, PrintEstimatedStatistics::ETimeMode mode) { if (can_show_mode_button(mode)) { if (imgui.button(label)) {