Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbubnikv <bubnikv@gmail.com>2020-03-13 18:01:30 +0300
committerbubnikv <bubnikv@gmail.com>2020-03-13 18:01:30 +0300
commitc8b177966d713936cfbdbae4a22129f1ab953623 (patch)
treeaa511dbbc0dd63ed77be76f210a715163ef93fa7 /src/slic3r/GUI/Plater.cpp
parent2e6a5e77839a02701037dba44c22309b2330fbb6 (diff)
parent56c6193ff424e66230a68006c1a8b7bef83a66b0 (diff)
Merge remote-tracking branch 'remotes/origin/ys_improvements'
Diffstat (limited to 'src/slic3r/GUI/Plater.cpp')
-rw-r--r--src/slic3r/GUI/Plater.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp
index 218677931..fb61c4f24 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());