diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index be1a43b42..8cbfc7efc 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -2368,6 +2368,19 @@ int MachineObject::parse_json(std::string payload) if (jj.contains("subtask_name")) { subtask_name = jj["subtask_name"].get(); } + if (jj.contains("layer_num")) { + curr_layer = jj["layer_num"].get(); + } + if (jj.contains("total_layer_num")) { + total_layers = jj["total_layer_num"].get(); + if (total_layers == 0) + is_support_layer_num = false; + else + is_support_layer_num = true; + } else { + is_support_layer_num = false; + } + if (jj.contains("gcode_state")) { this->set_print_state(jj["gcode_state"].get()); } diff --git a/src/slic3r/GUI/DeviceManager.hpp b/src/slic3r/GUI/DeviceManager.hpp index c3366910a..695f8be9d 100644 --- a/src/slic3r/GUI/DeviceManager.hpp +++ b/src/slic3r/GUI/DeviceManager.hpp @@ -561,6 +561,9 @@ public: int hw_switch_state; bool is_system_printing(); int print_error; + int curr_layer = 0; + int total_layers = 0; + bool is_support_layer_num { false }; std::vector stage_list_info; int stage_curr = 0; diff --git a/src/slic3r/GUI/StatusPanel.cpp b/src/slic3r/GUI/StatusPanel.cpp index cfe13571f..3efd3fa8d 100644 --- a/src/slic3r/GUI/StatusPanel.cpp +++ b/src/slic3r/GUI/StatusPanel.cpp @@ -507,10 +507,17 @@ 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); + m_staticText_layers = new wxStaticText(penel_text, wxID_ANY, _L("Layers: N/A")); + m_staticText_layers->SetFont(wxFont(12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("HarmonyOS Sans SC"))); + m_staticText_layers->SetForegroundColour(wxColour(146, 146, 146)); + m_staticText_layers->Hide(); + //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_layers, 0, wxALIGN_CENTER | wxALL, 0); + bSizer_text->Add(0, 0, 0, wxLEFT, FromDIP(20)); bSizer_text->Add(m_staticText_progress_left, 0, wxALIGN_CENTER | wxALL, 0); penel_text->SetMaxSize(wxSize(FromDIP(600), -1)); @@ -2156,6 +2163,13 @@ void StatusPanel::update_subtask(MachineObject *obj) { if (!obj) return; + if (obj->is_support_layer_num) { + m_staticText_layers->Show(); + } + else { + m_staticText_layers->Hide(); + } + if (obj->is_system_printing() || obj->is_in_calibration()) { reset_printing_values(); @@ -2181,7 +2195,7 @@ void StatusPanel::update_subtask(MachineObject *obj) 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); + m_staticText_layers->SetLabelText(wxString::Format(_L("Layers: %s"), 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(false); @@ -2210,10 +2224,13 @@ void StatusPanel::update_subtask(MachineObject *obj) m_gauge_progress->SetValue(obj->subtask_->task_progress); m_staticText_progress_percent->SetLabelText(wxString::Format("%d", obj->subtask_->task_progress)); m_staticText_progress_percent_icon->SetLabelText("%"); + m_staticText_layers->SetLabelText(wxString::Format(_L("Layers: %d/%d"), obj->curr_layer, obj->total_layers)); + } else { m_gauge_progress->SetValue(0); m_staticText_progress_percent->SetLabelText(NA_STR); m_staticText_progress_percent_icon->SetLabelText(wxEmptyString); + m_staticText_layers->SetLabelText(wxString::Format(_L("Layers: %s"), NA_STR)); } } wxString subtask_text = wxString::Format("%s", GUI::from_u8(obj->subtask_name)); @@ -2291,6 +2308,7 @@ void StatusPanel::reset_printing_values() update_basic_print_data(false); m_printing_stage_value->SetLabelText(""); m_staticText_progress_left->SetLabelText(NA_STR); + m_staticText_layers->SetLabelText(wxString::Format(_L("Layers: %s"), NA_STR)); m_staticText_progress_percent->SetLabelText(NA_STR); m_staticText_progress_percent_icon->SetLabelText(wxEmptyString); m_bitmap_thumbnail->SetBitmap(m_thumbnail_placeholder.bmp()); diff --git a/src/slic3r/GUI/StatusPanel.hpp b/src/slic3r/GUI/StatusPanel.hpp index 311659530..550501416 100644 --- a/src/slic3r/GUI/StatusPanel.hpp +++ b/src/slic3r/GUI/StatusPanel.hpp @@ -138,6 +138,7 @@ protected: wxStaticText * m_staticText_progress_percent; wxStaticText * m_staticText_progress_percent_icon; wxStaticText * m_staticText_progress_left; + wxStaticText * m_staticText_layers; Button * m_button_report; ScalableButton *m_button_pause_resume; ScalableButton *m_button_abort;