Display print end time for in BL device page (#1568)

Show progress increase end time
Supplementary translation

Co-authored-by: ZdDroid <601865048@qq.com>
This commit is contained in:
ZdDroid 2023-07-22 10:40:15 +08:00 committed by GitHub
parent 224e1ea2de
commit 87f6c43784
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 305 additions and 214 deletions

File diff suppressed because it is too large Load diff

Binary file not shown.

View file

@ -10,6 +10,9 @@
#include <boost/system/error_code.hpp> #include <boost/system/error_code.hpp>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <boost/filesystem/path.hpp> #include <boost/filesystem/path.hpp>
#include <boost/date_time.hpp>
#include "boost/date_time/posix_time/ptime.hpp"
#include <openssl/md5.h> #include <openssl/md5.h>
#include "libslic3r.h" #include "libslic3r.h"
@ -548,6 +551,21 @@ inline std::string get_bbl_monitor_time_dhm(float time_in_secs)
return buffer; return buffer;
} }
inline std::string get_bbl_monitor_end_time_dhm(float time_in_secs)
{
if (time_in_secs == 0.0f)
return {};
std::stringstream stream;
boost::posix_time::ptime now = boost::posix_time::second_clock::local_time();
auto endTime = now + boost::posix_time::seconds(static_cast<int>(time_in_secs));
auto facet = new boost::posix_time::time_facet("%H:%M");//%Y-%m-%d %H:%M:%S
stream.imbue(std::locale(std::locale::classic(), facet));
stream << endTime;
return stream.str();
}
inline std::string get_bbl_remain_time_dhms(float time_in_secs) inline std::string get_bbl_remain_time_dhms(float time_in_secs)
{ {
int days = (int) (time_in_secs / 86400.0f); int days = (int) (time_in_secs / 86400.0f);

View file

@ -500,6 +500,11 @@ wxBoxSizer *StatusBasePanel::create_project_task_page(wxWindow *parent)
m_staticText_progress_left->SetFont(wxFont(12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("HarmonyOS Sans SC"))); m_staticText_progress_left->SetFont(wxFont(12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("HarmonyOS Sans SC")));
m_staticText_progress_left->SetForegroundColour(wxColour(146, 146, 146)); m_staticText_progress_left->SetForegroundColour(wxColour(146, 146, 146));
m_staticText_progress_end = new wxStaticText(penel_text, wxID_ANY, NA_STR, wxDefaultPosition, wxDefaultSize, 0);
m_staticText_progress_end->Wrap(-1);
m_staticText_progress_end->SetFont(
wxFont(12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("HarmonyOS Sans SC")));
m_staticText_progress_end->SetForegroundColour(wxColour(146, 146, 146));
//fgSizer_task->Add(bSizer_buttons, 0, wxEXPAND, 0); //fgSizer_task->Add(bSizer_buttons, 0, wxEXPAND, 0);
//fgSizer_task->Add(0, 0, 0, wxEXPAND, FromDIP(5)); //fgSizer_task->Add(0, 0, 0, wxEXPAND, FromDIP(5));
@ -521,6 +526,8 @@ wxBoxSizer *StatusBasePanel::create_project_task_page(wxWindow *parent)
bSizer_text->Add(m_staticText_layers, 0, wxALIGN_CENTER | wxALL, 0); bSizer_text->Add(m_staticText_layers, 0, wxALIGN_CENTER | wxALL, 0);
bSizer_text->Add(0, 0, 0, wxLEFT, FromDIP(20)); bSizer_text->Add(0, 0, 0, wxLEFT, FromDIP(20));
bSizer_text->Add(m_staticText_progress_left, 0, wxALIGN_CENTER | wxALL, 0); bSizer_text->Add(m_staticText_progress_left, 0, wxALIGN_CENTER | wxALL, 0);
bSizer_text->Add(0, 0, 0, wxLEFT, FromDIP(8));
bSizer_text->Add(m_staticText_progress_end, 0, wxALIGN_CENTER | wxALL, 0);
penel_text->SetMaxSize(wxSize(FromDIP(600), -1)); penel_text->SetMaxSize(wxSize(FromDIP(600), -1));
penel_text->SetSizer(bSizer_text); penel_text->SetSizer(bSizer_text);
@ -2226,6 +2233,19 @@ void StatusPanel::update_left_time(int mc_left_time)
// update current subtask progress // update current subtask progress
m_staticText_progress_left->SetLabelText(left_time_text); m_staticText_progress_left->SetLabelText(left_time_text);
//Update end time
try {
left_time = get_bbl_monitor_end_time_dhm(mc_left_time);
} catch (...) {
;
}
if (!left_time.empty())
left_time_text = wxString::Format("%s", left_time);
else
left_time_text = NA_STR;
m_staticText_progress_end->SetLabelText(left_time_text);
} }
void StatusPanel::update_basic_print_data(bool def) void StatusPanel::update_basic_print_data(bool def)
@ -2304,6 +2324,7 @@ void StatusPanel::update_subtask(MachineObject *obj)
m_staticText_progress_percent->SetLabelText(NA_STR); m_staticText_progress_percent->SetLabelText(NA_STR);
m_staticText_progress_percent_icon->SetLabelText(wxEmptyString); m_staticText_progress_percent_icon->SetLabelText(wxEmptyString);
m_staticText_progress_left->SetLabel(NA_STR); m_staticText_progress_left->SetLabel(NA_STR);
m_staticText_progress_end->SetLabel(NA_STR);
m_staticText_layers->SetLabelText(wxString::Format(_L("Layer: %s"), NA_STR)); m_staticText_layers->SetLabelText(wxString::Format(_L("Layer: %s"), NA_STR));
wxString subtask_text = wxString::Format("%s", GUI::from_u8(obj->subtask_name)); wxString subtask_text = wxString::Format("%s", GUI::from_u8(obj->subtask_name));
m_staticText_subtask_value->SetLabelText(subtask_text); m_staticText_subtask_value->SetLabelText(subtask_text);
@ -2421,6 +2442,7 @@ void StatusPanel::reset_printing_values()
update_basic_print_data(false); update_basic_print_data(false);
m_printing_stage_value->SetLabelText(""); m_printing_stage_value->SetLabelText("");
m_staticText_progress_left->SetLabelText(NA_STR); m_staticText_progress_left->SetLabelText(NA_STR);
m_staticText_progress_end->SetLabel(NA_STR);
m_staticText_layers->SetLabelText(wxString::Format(_L("Layer: %s"), NA_STR)); m_staticText_layers->SetLabelText(wxString::Format(_L("Layer: %s"), NA_STR));
m_staticText_progress_percent->SetLabelText(NA_STR); m_staticText_progress_percent->SetLabelText(NA_STR);
m_staticText_progress_percent_icon->SetLabelText(wxEmptyString); m_staticText_progress_percent_icon->SetLabelText(wxEmptyString);

View file

@ -138,6 +138,7 @@ protected:
wxStaticText * m_staticText_progress_percent; wxStaticText * m_staticText_progress_percent;
wxStaticText * m_staticText_progress_percent_icon; wxStaticText * m_staticText_progress_percent_icon;
wxStaticText * m_staticText_progress_left; wxStaticText * m_staticText_progress_left;
wxStaticText * m_staticText_progress_end;
wxStaticText * m_staticText_layers; wxStaticText * m_staticText_layers;
Button * m_button_report; Button * m_button_report;
ScalableButton *m_button_pause_resume; ScalableButton *m_button_pause_resume;