diff options
author | YuSanka <yusanka@gmail.com> | 2020-03-13 13:49:51 +0300 |
---|---|---|
committer | YuSanka <yusanka@gmail.com> | 2020-03-13 13:49:51 +0300 |
commit | 56c6193ff424e66230a68006c1a8b7bef83a66b0 (patch) | |
tree | ffd4d65c031fe540d8e4f3153e1cb84f6a997caf /src/slic3r/GUI/Plater.cpp | |
parent | 6a6790b8e76848a1cebf6fcb4db250948b448b7a (diff) | |
parent | 7fd9c736b339a46f3a94e80c017ea05288524c5a (diff) |
Merge remote-tracking branch 'origin/ys_add_new_options' into ys_improvements
Diffstat (limited to 'src/slic3r/GUI/Plater.cpp')
-rw-r--r-- | src/slic3r/GUI/Plater.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 224eb42fd..f1928d14e 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -207,9 +207,11 @@ class SlicedInfo : public wxStaticBoxSizer public: SlicedInfo(wxWindow *parent); void SetTextAndShow(SlicedInfoIdx idx, const wxString& text, const wxString& new_label=""); + void SetNoteAndShow(const wxString& text); private: std::vector<std::pair<wxStaticText*, wxStaticText*>> info_vec; + wxStaticText* m_notes {nullptr}; }; SlicedInfo::SlicedInfo(wxWindow *parent) : @@ -241,6 +243,10 @@ SlicedInfo::SlicedInfo(wxWindow *parent) : init_info_label(_(L("Number of tool changes"))); Add(grid_sizer, 0, wxEXPAND); + + m_notes = new wxStaticText(parent, wxID_ANY, "N/A"); + Add(m_notes, 0, wxEXPAND); + this->Show(false); } @@ -255,6 +261,14 @@ void SlicedInfo::SetTextAndShow(SlicedInfoIdx idx, const wxString& text, const w info_vec[idx].second->Show(show); } +void SlicedInfo::SetNoteAndShow(const wxString& text) +{ + const bool show = text != "N/A"; + if (show) + m_notes->SetLabelText(text); + m_notes->Show(show); +} + PresetComboBox::PresetComboBox(wxWindow *parent, Preset::Type preset_type) : PresetBitmapComboBox(parent, wxSize(15 * wxGetApp().em_unit(), -1)), preset_type(preset_type), @@ -1245,6 +1259,18 @@ void Sidebar::update_sliced_info_sizer() p->sliced_info->SetTextAndShow(siFilament_mm3, wxString::Format("%.2f", ps.total_extruded_volume)); p->sliced_info->SetTextAndShow(siFilament_g, ps.total_weight == 0.0 ? "N/A" : wxString::Format("%.2f", ps.total_weight)); + // Show a note information, if there is not enough filaments to complete a print + wxString note = "N/A"; + DynamicPrintConfig* cfg = wxGetApp().get_tab(Preset::TYPE_FILAMENT)->get_config(); + auto filament_spool_weights = dynamic_cast<const ConfigOptionFloats*>(cfg->option("filament_spool_weight"))->values; + if (ps.total_weight > 0.0 && !filament_spool_weights.empty() && filament_spool_weights[0] > 0.0 && + ps.total_weight > filament_spool_weights[0]) + note = "\n" + _(L("WARNING")) + ":\n " + + _(L("There is not enough filaments to complete a print")) + ".\n " + + from_u8((boost::format(_utf8(L("You only have %.2f g of the required %.2f g."))) % + filament_spool_weights[0] % ps.total_weight).str()); + p->sliced_info->SetNoteAndShow(note); + new_label = _(L("Cost")); if (is_wipe_tower) new_label += from_u8((boost::format(":\n - %1%\n - %2%") % _utf8(L("objects")) % _utf8(L("wipe tower"))).str()); |