From 07c1c3d1dc9aade0b95fa570314205ee8ee35481 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Wed, 8 Jan 2020 15:23:46 +0100 Subject: [PATCH] Fixed update of "Cost" field in "Sliced Info" box after a change of any material's options ("bottle_cost", "bottle_volume", "bottle_weight", "material_density") --- src/slic3r/GUI/Plater.cpp | 4 ++-- src/slic3r/GUI/Tab.cpp | 10 ++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index b0fb3f0e6..2c0742559 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -1192,9 +1192,9 @@ void Sidebar::update_sliced_info_sizer() { double material_cost = cfg->option("bottle_cost")->getFloat() / cfg->option("bottle_volume")->getFloat(); - str_total_cost = wxString::Format("%.2f", material_cost*(ps.objects_used_material + ps.support_used_material) / 1000); + str_total_cost = wxString::Format("%.3f", material_cost*(ps.objects_used_material + ps.support_used_material) / 1000); } - p->sliced_info->SetTextAndShow(siCost, str_total_cost); + p->sliced_info->SetTextAndShow(siCost, str_total_cost, "Cost"); wxString t_est = std::isnan(ps.estimated_print_time) ? "N/A" : get_time_dhms(float(ps.estimated_print_time)); p->sliced_info->SetTextAndShow(siEstimatedTime, t_est, _(L("Estimated printing time")) + " :"); diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 353e822e3..c518ede80 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -3448,7 +3448,7 @@ void TabSLAMaterial::build() new_conf.set_key_value("bottle_weight", new ConfigOptionFloat(new_bottle_weight)); } if (opt_key == "bottle_weight") { - double new_bottle_volume = boost::any_cast(value)/(new_conf.option("material_density")->getFloat() * 1000); + double new_bottle_volume = boost::any_cast(value)/new_conf.option("material_density")->getFloat() * 1000; new_conf.set_key_value("bottle_volume", new ConfigOptionFloat(new_bottle_volume)); } if (opt_key == "material_density") { @@ -3459,12 +3459,10 @@ void TabSLAMaterial::build() load_config(new_conf); update_dirty(); - on_value_change(opt_key, value); - if (opt_key == "bottle_volume" || opt_key == "bottle_cost") { - wxGetApp().sidebar().update_sliced_info_sizer(); - wxGetApp().sidebar().Layout(); - } + // Change of any from those options influences for an update of "Sliced Info" + wxGetApp().sidebar().update_sliced_info_sizer(); + wxGetApp().sidebar().Layout(); }; optgroup = page->new_optgroup(_(L("Layers")));