ENH: Optimization finish time display
Jira: 8369 Change-Id: I33e5efbb5af2a35cd20ba009c14441c5bc2ccf48
This commit is contained in:
parent
d749e7dc6a
commit
f4b00d1d34
|
@ -609,8 +609,10 @@ inline std::string get_bbl_finish_time_dhm(float time_in_secs)
|
|||
diff_day = finish_day - current_day;
|
||||
}
|
||||
|
||||
std::string finish_time_str = std::to_string(finish_hour) + ":" + std::to_string(finish_minute);
|
||||
if (diff_day != 0) finish_time_str += " +" + std::to_string(diff_day);
|
||||
std::ostringstream formattedTime;
|
||||
formattedTime << std::setw(2) << std::setfill('0') << finish_hour << ":" << std::setw(2) << std::setfill('0') << finish_minute;
|
||||
std::string finish_time_str = formattedTime.str();
|
||||
if (diff_day != 0) finish_time_str += "+" + std::to_string(diff_day);
|
||||
|
||||
return finish_time_str;
|
||||
}
|
||||
|
|
|
@ -390,9 +390,13 @@ void PrintingTaskPanel::create_panel(wxWindow* parent)
|
|||
m_staticText_finish_time->SetFont(wxFont(12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("HarmonyOS Sans SC")));
|
||||
m_staticText_finish_time->SetForegroundColour(wxColour(146, 146, 146));
|
||||
m_staticText_finish_time->SetToolTip(_L("The estimated printing time for \nmulti-color models may be inaccurate."));
|
||||
m_staticText_finish_day = new RectTextPanel(penel_finish_time);
|
||||
m_staticText_finish_day->Hide();
|
||||
bSizer_finish_time->Add(0, 0, 1, wxEXPAND, 0);
|
||||
bSizer_finish_time->Add(0, 0, 0, wxLEFT, FromDIP(20));
|
||||
bSizer_finish_time->Add(m_staticText_finish_time, 0, wxALIGN_CENTER | wxALL, 0);
|
||||
bSizer_finish_time->Add(m_staticText_finish_day, 0,wxLEFT | wxRIGHT , FromDIP(10));
|
||||
bSizer_finish_time->Add(0, 0, 0, wxLEFT, FromDIP(20));
|
||||
bSizer_finish_time->Add(panel_button_block, 0, wxALIGN_CENTER | wxALL, 0);
|
||||
penel_finish_time->SetMaxSize(wxSize(FromDIP(600), -1));
|
||||
penel_finish_time->SetSizer(bSizer_finish_time);
|
||||
|
@ -703,10 +707,27 @@ void PrintingTaskPanel::update_left_time(wxString time)
|
|||
|
||||
void PrintingTaskPanel::update_finish_time(wxString finish_time)
|
||||
{
|
||||
if (finish_time == "Finished")
|
||||
static wxString finish_day = "";
|
||||
if (finish_time == "Finished") {
|
||||
m_staticText_finish_time->SetLabelText(_L("Finished"));
|
||||
else
|
||||
finish_day = "";
|
||||
if (m_staticText_finish_day->IsShown()) m_staticText_finish_day->Hide();
|
||||
}
|
||||
else {
|
||||
if (!finish_time.Contains('+')) {
|
||||
if (m_staticText_finish_day->IsShown()) m_staticText_finish_day->Hide();
|
||||
} else {
|
||||
int index = finish_time.find_last_of('+');
|
||||
wxString day = finish_time.Mid(index);
|
||||
finish_time = finish_time.Mid(0, index);
|
||||
if (finish_day != day) {
|
||||
m_staticText_finish_day->setText(day);
|
||||
finish_day = day;
|
||||
if (!m_staticText_finish_day->IsShown()) m_staticText_finish_day->Show();
|
||||
}
|
||||
}
|
||||
m_staticText_finish_time->SetLabelText(_L("Finish Time: ") + finish_time);
|
||||
}
|
||||
}
|
||||
|
||||
void PrintingTaskPanel::update_left_time(int mc_left_time)
|
||||
|
@ -3229,6 +3250,7 @@ void StatusPanel::reset_printing_values()
|
|||
m_project_task_panel->get_request_failed_panel()->Hide();
|
||||
update_basic_print_data(false);
|
||||
m_project_task_panel->update_left_time(NA_STR);
|
||||
m_project_task_panel->update_finish_time(NA_STR);
|
||||
m_project_task_panel->update_layers_num(true, wxString::Format(_L("Layer: %s"), NA_STR));
|
||||
update_calib_bitmap();
|
||||
|
||||
|
@ -5032,5 +5054,29 @@ void ScoreDialog::set_cloud_bitmap(std::vector<std::string> cloud_bitmaps)
|
|||
Fit();
|
||||
}
|
||||
|
||||
} // namespace GUI
|
||||
} // namespace Slic3r
|
||||
RectTextPanel::RectTextPanel(wxWindow *parent) : wxPanel(parent)
|
||||
{
|
||||
Bind(wxEVT_PAINT, &RectTextPanel::OnPaint, this);
|
||||
}
|
||||
|
||||
void RectTextPanel::setText(const wxString text)
|
||||
{
|
||||
this->text = text;
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void RectTextPanel::OnPaint(wxPaintEvent &event) {
|
||||
wxPaintDC dc(this);
|
||||
dc.SetFont(::Label::Body_12);
|
||||
wxSize textSize = dc.GetTextExtent(text);
|
||||
|
||||
dc.SetBrush(wxBrush(wxColour("#00AE42")));
|
||||
dc.SetPen(wxPen(wxColour("#00AE42")));
|
||||
wxRect rect(0, 0, textSize.GetWidth() + 4, textSize.GetHeight() + 4);
|
||||
SetSize(rect.GetSize());
|
||||
dc.DrawRoundedRectangle(rect, 4);
|
||||
dc.SetTextForeground(wxColour(255, 255, 255));
|
||||
dc.DrawText(text, wxPoint(2, 2));
|
||||
}
|
||||
|
||||
}} // namespace Slic3r
|
||||
|
|
|
@ -150,6 +150,18 @@ protected:
|
|||
|
||||
};
|
||||
|
||||
class RectTextPanel : public wxPanel
|
||||
{
|
||||
public:
|
||||
RectTextPanel(wxWindow *parent);
|
||||
|
||||
void setText(const wxString text);
|
||||
|
||||
void OnPaint(wxPaintEvent &event);
|
||||
private:
|
||||
wxString text;
|
||||
};
|
||||
|
||||
class PrintingTaskPanel : public wxPanel
|
||||
{
|
||||
public:
|
||||
|
@ -181,6 +193,7 @@ private:
|
|||
wxStaticText* m_staticText_progress_percent_icon;
|
||||
wxStaticText* m_staticText_progress_left;
|
||||
wxStaticText* m_staticText_finish_time;
|
||||
RectTextPanel* m_staticText_finish_day;
|
||||
wxStaticText* m_staticText_layers;
|
||||
wxStaticText * m_has_rated_prompt;
|
||||
wxStaticText * m_request_failed_info;
|
||||
|
|
Loading…
Reference in New Issue