保留总时间,新增结束时间
This commit is contained in:
parent
61bedc9610
commit
882acc9696
|
@ -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<double>(std::mktime(&local_tm)) + time_mode.time;
|
||||
// 将总秒数转换回time_t对象
|
||||
std::time_t new_time_t = static_cast<std::time_t>(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)) {
|
||||
|
|
Loading…
Reference in New Issue