From ffb1f706d89a3f348c1171e485412aac6e279a1c Mon Sep 17 00:00:00 2001 From: tao wang Date: Tue, 23 Aug 2022 18:47:41 +0800 Subject: [PATCH] NEW:update the new print progress layout Change-Id: I4390c9ef5de3d050178bebe5d1dc60213a400280 --- resources/images/print_control_pause.svg | 4 + .../images/print_control_pause_disable.svg | 4 + .../images/print_control_pause_hover.svg | 4 + resources/images/print_control_resume.svg | 3 + .../images/print_control_resume_disable.svg | 3 + .../images/print_control_resume_hover.svg | 10 + resources/images/print_control_stop.svg | 3 + .../images/print_control_stop_disable.svg | 3 + resources/images/print_control_stop_hover.svg | 3 + resources/images/print_info_time.svg | 4 + resources/images/print_info_weight.svg | 13 + src/slic3r/GUI/StatusPanel.cpp | 301 +++++++++++++----- src/slic3r/GUI/StatusPanel.hpp | 12 +- src/slic3r/GUI/Widgets/Label.cpp | 1 + src/slic3r/GUI/Widgets/Label.hpp | 1 + 15 files changed, 279 insertions(+), 90 deletions(-) create mode 100644 resources/images/print_control_pause.svg create mode 100644 resources/images/print_control_pause_disable.svg create mode 100644 resources/images/print_control_pause_hover.svg create mode 100644 resources/images/print_control_resume.svg create mode 100644 resources/images/print_control_resume_disable.svg create mode 100644 resources/images/print_control_resume_hover.svg create mode 100644 resources/images/print_control_stop.svg create mode 100644 resources/images/print_control_stop_disable.svg create mode 100644 resources/images/print_control_stop_hover.svg create mode 100644 resources/images/print_info_time.svg create mode 100644 resources/images/print_info_weight.svg diff --git a/resources/images/print_control_pause.svg b/resources/images/print_control_pause.svg new file mode 100644 index 000000000..7625ec802 --- /dev/null +++ b/resources/images/print_control_pause.svg @@ -0,0 +1,4 @@ + + + + diff --git a/resources/images/print_control_pause_disable.svg b/resources/images/print_control_pause_disable.svg new file mode 100644 index 000000000..2e1d51176 --- /dev/null +++ b/resources/images/print_control_pause_disable.svg @@ -0,0 +1,4 @@ + + + + diff --git a/resources/images/print_control_pause_hover.svg b/resources/images/print_control_pause_hover.svg new file mode 100644 index 000000000..27be647cc --- /dev/null +++ b/resources/images/print_control_pause_hover.svg @@ -0,0 +1,4 @@ + + + + diff --git a/resources/images/print_control_resume.svg b/resources/images/print_control_resume.svg new file mode 100644 index 000000000..292da3d3b --- /dev/null +++ b/resources/images/print_control_resume.svg @@ -0,0 +1,3 @@ + + + diff --git a/resources/images/print_control_resume_disable.svg b/resources/images/print_control_resume_disable.svg new file mode 100644 index 000000000..fb1ad8adb --- /dev/null +++ b/resources/images/print_control_resume_disable.svg @@ -0,0 +1,3 @@ + + + diff --git a/resources/images/print_control_resume_hover.svg b/resources/images/print_control_resume_hover.svg new file mode 100644 index 000000000..bd25d224d --- /dev/null +++ b/resources/images/print_control_resume_hover.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/resources/images/print_control_stop.svg b/resources/images/print_control_stop.svg new file mode 100644 index 000000000..8fd730fc6 --- /dev/null +++ b/resources/images/print_control_stop.svg @@ -0,0 +1,3 @@ + + + diff --git a/resources/images/print_control_stop_disable.svg b/resources/images/print_control_stop_disable.svg new file mode 100644 index 000000000..3d2a99afa --- /dev/null +++ b/resources/images/print_control_stop_disable.svg @@ -0,0 +1,3 @@ + + + diff --git a/resources/images/print_control_stop_hover.svg b/resources/images/print_control_stop_hover.svg new file mode 100644 index 000000000..b75770370 --- /dev/null +++ b/resources/images/print_control_stop_hover.svg @@ -0,0 +1,3 @@ + + + diff --git a/resources/images/print_info_time.svg b/resources/images/print_info_time.svg new file mode 100644 index 000000000..63af49a7f --- /dev/null +++ b/resources/images/print_info_time.svg @@ -0,0 +1,4 @@ + + + + diff --git a/resources/images/print_info_weight.svg b/resources/images/print_info_weight.svg new file mode 100644 index 000000000..e4deb77c3 --- /dev/null +++ b/resources/images/print_info_weight.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/slic3r/GUI/StatusPanel.cpp b/src/slic3r/GUI/StatusPanel.cpp index 711d2d162..eb06f7973 100644 --- a/src/slic3r/GUI/StatusPanel.cpp +++ b/src/slic3r/GUI/StatusPanel.cpp @@ -60,7 +60,7 @@ static wxColour TEXT_LIGHT_FONT_COL = wxColour(107, 107, 107); #define NORMAL_SPACING FromDIP(5) #define PAGE_SPACING FromDIP(10) #define PAGE_MIN_WIDTH FromDIP(574) -#define PROGRESSBAR_HEIGHT FromDIP(14) +#define PROGRESSBAR_HEIGHT FromDIP(8) #define SWITCH_BUTTON_SIZE (wxSize(FromDIP(40), -1)) #define TASK_THUMBNAIL_SIZE (wxSize(FromDIP(120), FromDIP(120))) @@ -170,6 +170,8 @@ void StatusBasePanel::init_bitmaps() m_bitmap_fan_off = ScalableBitmap(this, "monitor_fan_off", 24); m_bitmap_speed = ScalableBitmap(this, "monitor_speed", 24); m_bitmap_speed_active = ScalableBitmap(this, "monitor_speed_active", 24); + m_bitmap_use_time = ScalableBitmap(this, "print_info_time", 16); + m_bitmap_use_weight = ScalableBitmap(this, "print_info_weight", 16); m_thumbnail_placeholder = ScalableBitmap(this, "monitor_placeholder", 120); m_thumbnail_sdcard = ScalableBitmap(this, "monitor_sdcard_thumbnail", 120); //m_bitmap_camera = create_scaled_bitmap("monitor_camera", nullptr, 18); @@ -272,6 +274,8 @@ wxBoxSizer *StatusBasePanel::create_project_task_page(wxWindow *parent) m_staticText_printing->SetForegroundColour(PAGE_TITLE_FONT_COL); bSizer_printing_title->Add(m_staticText_printing, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, PAGE_TITLE_LEFT_MARGIN); + bSizer_printing_title->Add(0, 0, 1, wxEXPAND, 0); + m_panel_printing_title->SetSizer(bSizer_printing_title); m_panel_printing_title->Layout(); bSizer_printing_title->Fit(m_panel_printing_title); @@ -292,93 +296,135 @@ wxBoxSizer *StatusBasePanel::create_project_task_page(wxWindow *parent) wxBoxSizer *bSizer_task_name = new wxBoxSizer(wxVERTICAL); - bSizer_task_name->Add(0, 0, 1, wxEXPAND, FromDIP(5)); + wxBoxSizer *bSizer_task_name_hor = new wxBoxSizer(wxHORIZONTAL); + wxPanel* task_name_panel = new wxPanel(parent); - m_staticText_subtask_value = new wxStaticText(parent, wxID_ANY, _L("N/A"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT | wxST_ELLIPSIZE_END); + m_staticText_subtask_value = new wxStaticText(task_name_panel, wxID_ANY, _L("N/A"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT | wxST_ELLIPSIZE_END); m_staticText_subtask_value->Wrap(-1); - m_staticText_subtask_value->SetFont(wxFont(13, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxT("HarmonyOS Sans SC"))); + #ifdef __WXOSX_MAC__ + m_staticText_subtask_value->SetFont(::Label::Body_13); + #else + m_staticText_subtask_value->SetFont(wxFont(13, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("HarmonyOS Sans SC"))); + #endif m_staticText_subtask_value->SetForegroundColour(wxColour(44, 44, 46)); - m_printing_stage_value = new wxStaticText(parent, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT | wxST_ELLIPSIZE_END); - m_printing_stage_value->Wrap(-1); - m_printing_stage_value->SetFont(wxFont(12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("HarmonyOS Sans SC"))); - m_printing_stage_value->SetForegroundColour(STAGE_TEXT_COL); + m_bitmap_static_use_time = new wxStaticBitmap(task_name_panel, wxID_ANY, m_bitmap_use_time.bmp(), wxDefaultPosition, wxSize(FromDIP(16), FromDIP(16))); - bSizer_task_name->Add(m_staticText_subtask_value, 1, wxALL | wxEXPAND, 0); - bSizer_task_name->Add(m_printing_stage_value, 1, wxALL | wxEXPAND, 0); - bSizer_subtask_info->Add(bSizer_task_name, 1, wxEXPAND, FromDIP(5)); + m_staticText_consumption_of_time = new wxStaticText(task_name_panel, wxID_ANY, "0m", wxDefaultPosition, wxDefaultSize, 0); + m_staticText_consumption_of_time->SetFont(::Label::Body_12); + m_staticText_consumption_of_time->SetForegroundColour(wxColour(0x68, 0x68, 0x68)); + m_staticText_consumption_of_time->Wrap(-1); + + + m_bitmap_static_use_weight = new wxStaticBitmap(task_name_panel, wxID_ANY, m_bitmap_use_weight.bmp(), wxDefaultPosition, wxSize(FromDIP(16), FromDIP(16))); + + + m_staticText_consumption_of_weight = new wxStaticText(task_name_panel, wxID_ANY, "0g", wxDefaultPosition, wxDefaultSize, 0); + m_staticText_consumption_of_weight->SetFont(::Label::Body_12); + m_staticText_consumption_of_weight->SetForegroundColour(wxColour(0x68, 0x68, 0x68)); + m_staticText_consumption_of_weight->Wrap(-1); + + bSizer_task_name_hor->Add(m_staticText_subtask_value, 1, wxALL | wxEXPAND, 0); + bSizer_task_name_hor->Add(0, 0, 1, wxEXPAND, 0); + bSizer_task_name_hor->Add(m_bitmap_static_use_time, 0, wxALIGN_CENTER_VERTICAL, 0); + bSizer_task_name_hor->Add(m_staticText_consumption_of_time, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, FromDIP(3)); + bSizer_task_name_hor->Add(0, 0, 0, wxLEFT, FromDIP(20)); + bSizer_task_name_hor->Add(m_bitmap_static_use_weight, 0, wxALIGN_CENTER_VERTICAL, 0); + bSizer_task_name_hor->Add(m_staticText_consumption_of_weight, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(3)); + bSizer_task_name_hor->Add(0, 0, 0, wxRIGHT, FromDIP(10)); + + + task_name_panel->SetSizer(bSizer_task_name_hor); + task_name_panel->Layout(); + task_name_panel->Fit(); + + bSizer_task_name->Add(task_name_panel, 0, wxEXPAND, FromDIP(5)); + /* wxFlexGridSizer *fgSizer_task = new wxFlexGridSizer(2, 2, 0, 0); fgSizer_task->AddGrowableCol(0); fgSizer_task->SetFlexibleDirection(wxVERTICAL); fgSizer_task->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);*/ + m_printing_stage_value = new wxStaticText(parent, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT | wxST_ELLIPSIZE_END); + m_printing_stage_value->Wrap(-1); + #ifdef __WXOSX_MAC__ + m_printing_stage_value->SetFont(::Label::Body_11); + #else + m_printing_stage_value->SetFont(wxFont(11, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("HarmonyOS Sans SC"))); + #endif + + m_printing_stage_value->SetForegroundColour(STAGE_TEXT_COL); + + auto m_panel_progress = new wxPanel(parent, wxID_ANY); m_panel_progress->SetBackgroundColour(*wxWHITE); auto m_sizer_progressbar = new wxBoxSizer(wxHORIZONTAL); m_gauge_progress = new ProgressBar(m_panel_progress, wxID_ANY, 100, wxDefaultPosition, wxDefaultSize); m_gauge_progress->SetValue(0); m_gauge_progress->SetHeight(PROGRESSBAR_HEIGHT); - //m_gauge_progress->SetMinSize(wxSize(FromDIP(238), 16)); - m_gauge_progress->SetMaxSize(wxSize(FromDIP(600), 16)); - - - //fgSizer_task->Add(m_gauge_progress, 0, wxALIGN_CENTER_VERTICAL | wxALL | wxEXPAND, 0); - + m_gauge_progress->SetMaxSize(wxSize(FromDIP(600), -1)); m_panel_progress->SetSizer(m_sizer_progressbar); m_panel_progress->Layout(); - //m_panel_progress->SetMinSize(wxSize(FromDIP(574), -1)); - //m_panel_progress->SetMaxSize(wxSize(FromDIP(600), -1)); - - m_sizer_progressbar->Add(m_gauge_progress, 1, wxALIGN_CENTER_VERTICAL, 0); - //fgSizer_task->Add(m_panel_progress, 0, wxALIGN_CENTER_VERTICAL | wxEXPAND, 0); + m_panel_progress->SetSize(wxSize(-1, FromDIP(24))); + m_panel_progress->SetMaxSize(wxSize(-1, FromDIP(24))); wxBoxSizer *bSizer_task_btn = new wxBoxSizer(wxHORIZONTAL); bSizer_task_btn->Add(FromDIP(10), 0, 0); - m_button_report = new Button(m_panel_progress, _L("Report")); - StateColor report_bg(std::pair(wxColour(255, 255, 255), StateColor::Disabled), std::pair(wxColour(206, 206, 206), StateColor::Pressed), - std::pair(wxColour(238, 238, 238), StateColor::Hovered), std::pair(wxColour(255, 255, 255), StateColor::Enabled), - std::pair(wxColour(255, 255, 255), StateColor::Normal)); - m_button_report->SetBackgroundColor(report_bg); - m_button_report->SetMinSize(TASK_BUTTON_SIZE2); - StateColor report_bd(std::pair(wxColour(144, 144, 144), StateColor::Disabled), std::pair(wxColour(38, 46, 48), StateColor::Enabled)); - m_button_report->SetBorderColor(report_bd); - StateColor report_text(std::pair(wxColour(144, 144, 144), StateColor::Disabled), std::pair(wxColour(38, 46, 48), StateColor::Enabled)); - m_button_report->SetTextColor(report_text); - m_button_report->SetFont(Label::Body_10); - m_button_report->Hide(); - m_sizer_progressbar->Add(m_button_report, 0, wxALL, FromDIP(5)); + /* m_button_report = new Button(m_panel_progress, _L("Report")); + StateColor report_bg(std::pair(wxColour(255, 255, 255), StateColor::Disabled), std::pair(wxColour(206, 206, 206), StateColor::Pressed), + std::pair(wxColour(238, 238, 238), StateColor::Hovered), std::pair(wxColour(255, 255, 255), StateColor::Enabled), + std::pair(wxColour(255, 255, 255), StateColor::Normal)); + m_button_report->SetBackgroundColor(report_bg); + m_button_report->SetMinSize(TASK_BUTTON_SIZE2); + StateColor report_bd(std::pair(wxColour(144, 144, 144), StateColor::Disabled), std::pair(wxColour(38, 46, 48), StateColor::Enabled)); + m_button_report->SetBorderColor(report_bd); + StateColor report_text(std::pair(wxColour(144, 144, 144), StateColor::Disabled), std::pair(wxColour(38, 46, 48), StateColor::Enabled)); + m_button_report->SetTextColor(report_text); + m_button_report->SetFont(Label::Body_10); + m_button_report->Hide(); + m_sizer_progressbar->Add(m_button_report, 0, wxALL, FromDIP(5));*/ - m_button_pause_resume = new Button(m_panel_progress, _L("Pause")); + m_button_pause_resume = new ScalableButton(m_panel_progress, wxID_ANY, "print_control_pause", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER,true); - StateColor pause_resume_bg(std::pair(wxColour(255, 255, 255), StateColor::Disabled), std::pair(wxColour(27, 136, 68), StateColor::Pressed), - std::pair(wxColour(61, 203, 115), StateColor::Hovered), std::pair(wxColour(0, 174, 66), StateColor::Enabled), - std::pair(wxColour(0, 174, 66), StateColor::Normal)); - m_button_pause_resume->SetBackgroundColor(pause_resume_bg); - StateColor pause_resume_bd(std::pair(wxColour(144, 144, 144), StateColor::Disabled), std::pair(wxColour(0, 174, 66), StateColor::Enabled)); - m_button_pause_resume->SetBorderColor(pause_resume_bd); - StateColor pause_resume_text(std::pair(wxColour(144, 144, 144), StateColor::Disabled), std::pair(wxColour(255, 255, 255), StateColor::Enabled)); - m_button_pause_resume->SetTextColor(pause_resume_text); - m_button_pause_resume->SetFont(Label::Body_10); - m_button_pause_resume->SetMinSize(TASK_BUTTON_SIZE2); - //bSizer_task_btn->Add(m_button_pause_resume, 0, wxALIGN_RIGHT | wxALL, FromDIP(5)); + m_button_pause_resume->Bind(wxEVT_ENTER_WINDOW, [this](auto &e) { + if (m_button_pause_resume->GetToolTipText() == _L("Pause")) { + m_button_pause_resume->SetBitmap_("print_control_pause_hover"); + } + + if (m_button_pause_resume->GetToolTipText() == _L("Resume")) { + m_button_pause_resume->SetBitmap_("print_control_resume_hover"); + } + }); + + m_button_pause_resume->Bind(wxEVT_LEAVE_WINDOW, [this](auto &e) { + auto buf = m_button_pause_resume->GetClientData(); + if (m_button_pause_resume->GetToolTipText() == _L("Pause")) { + m_button_pause_resume->SetBitmap_("print_control_pause"); + } + + if (m_button_pause_resume->GetToolTipText() == _L("Resume")) { + m_button_pause_resume->SetBitmap_("print_control_resume"); + } + }); + + m_button_abort = new ScalableButton(m_panel_progress, wxID_ANY, "print_control_stop", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, true); + m_button_abort->SetToolTip(_L("Abort")); + + m_button_abort->Bind(wxEVT_ENTER_WINDOW, [this](auto &e) { + m_button_abort->SetBitmap_("print_control_stop_hover"); + }); + + m_button_abort->Bind(wxEVT_LEAVE_WINDOW, [this](auto &e) { + m_button_abort->SetBitmap_("print_control_stop"); } + ); + + m_sizer_progressbar->Add(m_gauge_progress, 1, wxALIGN_CENTER_VERTICAL, 0); + m_sizer_progressbar->Add(0, 0, 0, wxEXPAND|wxLEFT, FromDIP(18)); m_sizer_progressbar->Add(m_button_pause_resume, 0, wxALL, FromDIP(5)); - - m_button_abort = new Button(m_panel_progress, _L("Stop")); - - StateColor abort_bg(std::pair(wxColour(255, 255, 255), StateColor::Disabled), std::pair(wxColour(206, 206, 206), StateColor::Pressed), - std::pair(wxColour(238, 238, 238), StateColor::Hovered), std::pair(wxColour(255, 255, 255), StateColor::Enabled), - std::pair(wxColour(255, 255, 255), StateColor::Normal)); - m_button_abort->SetBackgroundColor(abort_bg); - StateColor abort_bd(std::pair(wxColour(144, 144, 144), StateColor::Disabled), std::pair(wxColour(38, 46, 48), StateColor::Enabled)); - m_button_abort->SetBorderColor(abort_bd); - StateColor abort_text(std::pair(wxColour(144, 144, 144), StateColor::Disabled), std::pair(wxColour(38, 46, 48), StateColor::Enabled)); - m_button_abort->SetTextColor(abort_text); - m_button_abort->SetFont(Label::Body_10); - m_button_abort->SetMinSize(TASK_BUTTON_SIZE2); - //bSizer_task_btn->Add(m_button_abort, 0, wxALIGN_RIGHT | wxALL, FromDIP(5)); + m_sizer_progressbar->Add(0, 0, 0, wxEXPAND|wxLEFT, FromDIP(18)); m_sizer_progressbar->Add(m_button_abort, 0, wxALL, FromDIP(5)); //fgSizer_task->Add(bSizer_task_btn, 0, wxEXPAND, 0); @@ -391,14 +437,35 @@ wxBoxSizer *StatusBasePanel::create_project_task_page(wxWindow *parent) penel_text->SetBackgroundColour(*wxWHITE); penel_bottons->SetBackgroundColour(*wxWHITE); - m_staticText_progress_percent = new wxStaticText(penel_text, wxID_ANY, _L("0%"), wxDefaultPosition, wxDefaultSize, 0); - m_staticText_progress_percent->Wrap(-1); - m_staticText_progress_percent->SetFont(::Label::Head_13); + wxBoxSizer *sizer_percent = new wxBoxSizer(wxVERTICAL); + sizer_percent->Add(0, 0, 1, wxEXPAND, 0); + + wxBoxSizer *sizer_percent_icon = new wxBoxSizer(wxVERTICAL); + sizer_percent_icon->Add(0, 0, 1, wxEXPAND, 0); + + + m_staticText_progress_percent = new wxStaticText(penel_text, wxID_ANY, L("0"), wxDefaultPosition, wxDefaultSize, 0); + m_staticText_progress_percent->SetFont(::Label::Head_18); + m_staticText_progress_percent->SetMaxSize(wxSize(-1, FromDIP(20))); m_staticText_progress_percent->SetForegroundColour(wxColour(0, 174, 66)); + + m_staticText_progress_percent_icon = new wxStaticText(penel_text, wxID_ANY, L("%"), wxDefaultPosition, wxDefaultSize, 0); + m_staticText_progress_percent_icon->SetFont(::Label::Body_11); + m_staticText_progress_percent_icon->SetMaxSize(wxSize(-1, FromDIP(13))); + m_staticText_progress_percent_icon->SetForegroundColour(wxColour(0, 174, 66)); + + sizer_percent->Add(m_staticText_progress_percent, 0, 0, 0); + + #ifdef __WXOSX_MAC__ + sizer_percent_icon->Add(m_staticText_progress_percent_icon, 0, wxBOTTOM, FromDIP(2)); + #else + sizer_percent_icon->Add(m_staticText_progress_percent_icon, 0, 0, 0); + #endif + - m_staticText_progress_left = new wxStaticText(penel_text, wxID_ANY, _L("N/A"), wxDefaultPosition, wxDefaultSize, 0); + m_staticText_progress_left = new wxStaticText(penel_text, wxID_ANY, L("N/A"), wxDefaultPosition, wxDefaultSize, 0); m_staticText_progress_left->Wrap(-1); - m_staticText_progress_left->SetFont(wxFont(10, 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)); //fgSizer_task->Add(bSizer_buttons, 0, wxEXPAND, 0); @@ -410,7 +477,9 @@ wxBoxSizer *StatusBasePanel::create_project_task_page(wxWindow *parent) panel_button_block->SetSize(wxSize(TASK_BUTTON_SIZE.x * 2 + FromDIP(5) * 2, -1)); panel_button_block->SetBackgroundColour(*wxWHITE); - bSizer_text->Add(m_staticText_progress_percent, 0, wxALIGN_CENTER | wxALL, 0); + //bSizer_text->Add(m_staticText_progress_percent, 0, wxALL, 0); + bSizer_text->Add(sizer_percent, 0, wxEXPAND, 0); + bSizer_text->Add(sizer_percent_icon, 0, wxEXPAND, 0); bSizer_text->Add(0, 0, 1, wxEXPAND, 0); bSizer_text->Add(m_staticText_progress_left, 0, wxALIGN_CENTER | wxALL, 0); @@ -424,8 +493,11 @@ wxBoxSizer *StatusBasePanel::create_project_task_page(wxWindow *parent) penel_bottons->SetSizer(bSizer_buttons); penel_bottons->Layout(); - bSizer_subtask_info->Add(m_panel_progress, 0, wxEXPAND, FromDIP(5)); - bSizer_subtask_info->Add(penel_bottons, 0, wxEXPAND, FromDIP(5)); + bSizer_subtask_info->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(14)); + bSizer_subtask_info->Add(bSizer_task_name, 0, wxEXPAND|wxRIGHT, FromDIP(18)); + bSizer_subtask_info->Add(m_printing_stage_value, 0, wxEXPAND | wxTOP, FromDIP(5)); + bSizer_subtask_info->Add(penel_bottons, 0, wxEXPAND | wxTOP, FromDIP(10)); + bSizer_subtask_info->Add(m_panel_progress, 0, wxEXPAND|wxRIGHT, FromDIP(25)); m_printing_sizer->Add(bSizer_subtask_info, 1, wxALL | wxEXPAND, 0); @@ -448,10 +520,18 @@ wxBoxSizer *StatusBasePanel::create_project_task_page(wxWindow *parent) m_error_text = new wxStaticText2(m_panel_error_txt); m_error_text->SetForegroundColour(PAGE_TITLE_FONT_COL); text_sizer->Add(m_error_text, 1, wxEXPAND|wxLEFT, FromDIP(17)); + m_button_clean = new Button(m_panel_error_txt, _L("Clean")); - m_button_clean->SetBackgroundColor(abort_bg); - m_button_clean->SetBorderColor(abort_bd); - m_button_clean->SetTextColor(abort_text); + StateColor clean_bg(std::pair(wxColour(255, 255, 255), StateColor::Disabled), std::pair(wxColour(206, 206, 206), StateColor::Pressed), + std::pair(wxColour(238, 238, 238), StateColor::Hovered), std::pair(wxColour(255, 255, 255), StateColor::Enabled), + std::pair(wxColour(255, 255, 255), StateColor::Normal)); + StateColor clean_bd(std::pair(wxColour(144, 144, 144), StateColor::Disabled), std::pair(wxColour(38, 46, 48), StateColor::Enabled)); + StateColor clean_text(std::pair(wxColour(144, 144, 144), StateColor::Disabled), std::pair(wxColour(38, 46, 48), StateColor::Enabled)); + + + m_button_clean->SetBackgroundColor(clean_bg); + m_button_clean->SetBorderColor(clean_bd); + m_button_clean->SetTextColor(clean_text); m_button_clean->SetFont(Label::Body_10); m_button_clean->SetMinSize(TASK_BUTTON_SIZE2); @@ -955,9 +1035,9 @@ StatusPanel::StatusPanel(wxWindow *parent, wxWindowID id, const wxPoint &pos, co init_scaled_buttons(); - m_buttons.push_back(m_button_report); - m_buttons.push_back(m_button_pause_resume); - m_buttons.push_back(m_button_abort); + //m_buttons.push_back(m_button_report); + //m_buttons.push_back(m_button_pause_resume); + //m_buttons.push_back(m_button_abort); m_buttons.push_back(m_button_unload); m_buttons.push_back(m_button_clean); m_buttons.push_back(m_bpButton_z_10); @@ -975,7 +1055,10 @@ StatusPanel::StatusPanel(wxWindow *parent, wxWindowID id, const wxPoint &pos, co /* set default enable state */ m_button_pause_resume->Enable(false); + m_button_pause_resume->SetBitmap_("print_control_resume_disable"); + m_button_abort->Enable(false); + m_button_abort->SetBitmap_("print_control_stop_disable"); Bind(wxEVT_WEBREQUEST_STATE, &StatusPanel::on_webrequest_state, this); @@ -1056,12 +1139,12 @@ StatusPanel::~StatusPanel() void StatusPanel::init_scaled_buttons() { - m_button_report->SetMinSize(wxSize(FromDIP(48), FromDIP(24))); - m_button_report->SetCornerRadius(FromDIP(12)); - m_button_pause_resume->SetMinSize(wxSize(FromDIP(48), FromDIP(24))); - m_button_pause_resume->SetCornerRadius(FromDIP(12)); - m_button_abort->SetMinSize(wxSize(FromDIP(48), FromDIP(24))); - m_button_abort->SetCornerRadius(FromDIP(12)); + // m_button_report->SetMinSize(wxSize(FromDIP(48), FromDIP(24))); + // m_button_report->SetCornerRadius(FromDIP(12)); + //m_button_pause_resume->SetMinSize(wxSize(FromDIP(48), FromDIP(24))); + //m_button_pause_resume->SetCornerRadius(FromDIP(12)); + //m_button_abort->SetMinSize(wxSize(FromDIP(48), FromDIP(24))); + //m_button_abort->SetCornerRadius(FromDIP(12)); m_button_clean->SetMinSize(wxSize(FromDIP(48), FromDIP(24))); m_button_clean->SetCornerRadius(FromDIP(12)); m_button_unload->SetMinSize(wxSize(-1, FromDIP(24))); @@ -1639,6 +1722,27 @@ void StatusPanel::update_left_time(int mc_left_time) m_staticText_progress_left->SetLabelText(left_time_text); } +void StatusPanel::update_basic_print_data(bool def) +{ + if (def) { + auto aprint_stats = wxGetApp().plater()->get_partplate_list().get_current_fff_print().print_statistics(); + wxString time; + PartPlate *plate = wxGetApp().plater()->get_partplate_list().get_curr_plate(); + if (plate) { + if (plate->get_slice_result()) { time = wxString::Format("%s", get_bbl_monitor_time_dhm(plate->get_slice_result()->print_statistics.modes[0].time)); } + } + + char weight[64]; + ::sprintf(weight, " %.2f g", aprint_stats.total_weight); + + m_staticText_consumption_of_time->SetLabelText(time); + m_staticText_consumption_of_weight->SetLabelText(weight); + } else { + m_staticText_consumption_of_time->SetLabelText("0m"); + m_staticText_consumption_of_weight->SetLabelText("0g"); + } +} + void StatusPanel::update_subtask(MachineObject *obj) { if (!obj) return; @@ -1648,28 +1752,41 @@ void StatusPanel::update_subtask(MachineObject *obj) } else if (obj->is_in_printing() || obj->print_status == "FINISH") { if (obj->is_in_prepare()) { m_button_abort->Enable(false); + m_button_abort->SetBitmap_("print_control_stop_disable"); + m_button_pause_resume->Enable(false); - m_button_pause_resume->SetLabel(_L("Pause")); + m_button_pause_resume->SetBitmap_("print_control_pause_disable"); + wxString prepare_text = wxString::Format(_L("Downloading...")); if (obj->gcode_file_prepare_percent >= 0 && obj->gcode_file_prepare_percent <= 100) prepare_text += wxString::Format("(%d%%)", obj->gcode_file_prepare_percent); m_printing_stage_value->SetLabelText(prepare_text); m_gauge_progress->SetValue(0); m_staticText_progress_percent->SetLabelText(NA_STR); + m_staticText_progress_percent_icon->SetLabelText(wxEmptyString); m_staticText_progress_left->SetLabel(NA_STR); m_staticText_progress_left->SetLabelText(NA_STR); wxString subtask_text = wxString::Format("%s", GUI::from_u8(obj->subtask_name)); m_staticText_subtask_value->SetLabelText(subtask_text); + update_basic_print_data(true); } else { - if (obj->can_resume()) - m_button_pause_resume->SetLabel(_L("Resume")); - else - m_button_pause_resume->SetLabel(_L("Pause")); + if (obj->can_resume()) { + m_button_pause_resume->SetBitmap_("print_control_resume"); + if (m_button_pause_resume->GetToolTipText() != _L("Resume")) { m_button_pause_resume->SetToolTip(_L("Resume")); } + } else { + m_button_pause_resume->SetBitmap_("print_control_pause"); + if (m_button_pause_resume->GetToolTipText() != _L("Pause")) { m_button_pause_resume->SetToolTip(_L("Pause")); } + } + + if (obj->print_status == "FINISH") { m_button_abort->Enable(false); + m_button_abort->SetBitmap_("print_control_stop_disable"); m_button_pause_resume->Enable(false); + m_button_pause_resume->SetBitmap_("print_control_resume_disable"); } else { m_button_abort->Enable(true); + m_button_abort->SetBitmap_("print_control_stop"); m_button_pause_resume->Enable(true); } // update printing stage @@ -1677,14 +1794,17 @@ void StatusPanel::update_subtask(MachineObject *obj) update_left_time(obj->mc_left_time); if (obj->subtask_) { m_gauge_progress->SetValue(obj->subtask_->task_progress); - m_staticText_progress_percent->SetLabelText(wxString::Format("%d%%", obj->subtask_->task_progress)); + m_staticText_progress_percent->SetLabelText(wxString::Format("%d", obj->subtask_->task_progress)); + m_staticText_progress_percent_icon->SetLabelText("%"); } else { m_gauge_progress->SetValue(0); m_staticText_progress_percent->SetLabelText(NA_STR); + m_staticText_progress_percent_icon->SetLabelText(wxEmptyString); } } wxString subtask_text = wxString::Format("%s", GUI::from_u8(obj->subtask_name)); m_staticText_subtask_value->SetLabelText(subtask_text); + update_basic_print_data(true); //update thumbnail if (obj->is_sdcard_printing()) { update_sdcard_subtask(obj); @@ -1744,13 +1864,18 @@ void StatusPanel::update_sdcard_subtask(MachineObject *obj) void StatusPanel::reset_printing_values() { m_button_pause_resume->Enable(false); - m_button_pause_resume->SetLabel(_L("Pause")); + m_button_pause_resume->SetBitmap_("print_control_pause_disable"); + m_button_abort->Enable(false); + m_button_abort->SetBitmap_("print_control_stop_disable"); + m_gauge_progress->SetValue(0); m_staticText_subtask_value->SetLabelText(NA_STR); + update_basic_print_data(false); m_printing_stage_value->SetLabelText(""); m_staticText_progress_left->SetLabelText(NA_STR); m_staticText_progress_percent->SetLabelText(NA_STR); + m_staticText_progress_percent_icon->SetLabelText(wxEmptyString); m_bitmap_thumbnail->SetBitmap(m_thumbnail_placeholder.bmp()); m_start_loading_thumbnail = false; m_load_sdcard_thumbnail = false; diff --git a/src/slic3r/GUI/StatusPanel.hpp b/src/slic3r/GUI/StatusPanel.hpp index 202902d9f..4d95d1c9a 100644 --- a/src/slic3r/GUI/StatusPanel.hpp +++ b/src/slic3r/GUI/StatusPanel.hpp @@ -78,6 +78,8 @@ protected: ScalableBitmap m_bitmap_lamp_off; ScalableBitmap m_bitmap_fan_on; ScalableBitmap m_bitmap_fan_off; + ScalableBitmap m_bitmap_use_time; + ScalableBitmap m_bitmap_use_weight; wxBitmap m_bitmap_extruder; CameraRecordingStatus m_state_recording{CameraRecordingStatus::RECORDING_NONE}; @@ -97,6 +99,8 @@ protected: wxPanel * m_panel_printing_title; wxPanel * m_panel_control_title; + wxStaticText* m_staticText_consumption_of_time; + wxStaticText * m_staticText_consumption_of_weight; wxStaticText * m_staticText_monitoring; wxStaticText * m_staticText_timelapse; SwitchButton * m_bmToggleBtn_timelapse; @@ -105,6 +109,8 @@ protected: wxStaticBitmap *m_bitmap_recording_img; wxStaticBitmap *m_bitmap_sdcard_on_img; wxStaticBitmap *m_bitmap_sdcard_off_img; + wxStaticBitmap *m_bitmap_static_use_time; + wxStaticBitmap *m_bitmap_static_use_weight; wxMediaCtrl2 * m_media_ctrl; @@ -116,10 +122,11 @@ protected: wxStaticText * m_printing_stage_value; ProgressBar* m_gauge_progress; wxStaticText * m_staticText_progress_percent; + wxStaticText * m_staticText_progress_percent_icon; wxStaticText * m_staticText_progress_left; Button * m_button_report; - Button * m_button_pause_resume; - Button * m_button_abort; + ScalableButton *m_button_pause_resume; + ScalableButton *m_button_abort; Button * m_button_clean; wxStaticText * m_text_tasklist_caption; @@ -320,6 +327,7 @@ protected: void update(MachineObject* obj); void show_printing_status(bool ctrl_area = true, bool temp_area = true); void update_left_time(int mc_left_time); + void update_basic_print_data(bool def = false); void update_subtask(MachineObject *obj); void update_cloud_subtask(MachineObject *obj); void update_sdcard_subtask(MachineObject *obj); diff --git a/src/slic3r/GUI/Widgets/Label.cpp b/src/slic3r/GUI/Widgets/Label.cpp index 93ec8c2a9..709332af6 100644 --- a/src/slic3r/GUI/Widgets/Label.cpp +++ b/src/slic3r/GUI/Widgets/Label.cpp @@ -34,6 +34,7 @@ wxFont Label::Body_15 = Label::sysFont(15, false); wxFont Label::Body_14 = Label::sysFont(14, false); wxFont Label::Body_13 = Label::sysFont(13, false); wxFont Label::Body_12 = Label::sysFont(12, false); +wxFont Label::Body_11 = Label::sysFont(11, false); wxFont Label::Body_10 = Label::sysFont(10, false); wxFont Label::Body_9 = Label::sysFont(9, false); diff --git a/src/slic3r/GUI/Widgets/Label.hpp b/src/slic3r/GUI/Widgets/Label.hpp index d82451ee8..0a3ada825 100644 --- a/src/slic3r/GUI/Widgets/Label.hpp +++ b/src/slic3r/GUI/Widgets/Label.hpp @@ -27,6 +27,7 @@ public: static wxFont Body_13; static wxFont Body_12; static wxFont Body_10; + static wxFont Body_11; static wxFont Body_9; static wxFont sysFont(int size, bool bold = false);