GCodeViewer -> Estimated printing time dialog hidden by defaul
This commit is contained in:
parent
51f0fd8912
commit
4700579589
4 changed files with 36 additions and 22 deletions
|
@ -495,6 +495,14 @@ void GCodeViewer::set_layers_z_range(const std::array<double, 2>& layers_z_range
|
|||
wxGetApp().plater()->update_preview_moves_slider();
|
||||
}
|
||||
|
||||
void GCodeViewer::enable_time_estimate(bool enable)
|
||||
{
|
||||
m_time_estimate_enabled = enable;
|
||||
wxGetApp().update_ui_from_settings();
|
||||
wxGetApp().plater()->get_current_canvas3D()->set_as_dirty();
|
||||
wxGetApp().plater()->get_current_canvas3D()->request_extra_frame();
|
||||
}
|
||||
|
||||
void GCodeViewer::export_toolpaths_to_obj(const char* filename) const
|
||||
{
|
||||
if (filename == nullptr)
|
||||
|
|
|
@ -341,7 +341,7 @@ private:
|
|||
Shells m_shells;
|
||||
EViewType m_view_type{ EViewType::FeatureType };
|
||||
bool m_legend_enabled{ true };
|
||||
bool m_time_estimate_enabled{ true };
|
||||
bool m_time_estimate_enabled{ false };
|
||||
#if ENABLE_GCODE_VIEWER_STATISTICS
|
||||
mutable Statistics m_statistics;
|
||||
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
||||
|
@ -398,7 +398,7 @@ public:
|
|||
void enable_legend(bool enable) { m_legend_enabled = enable; }
|
||||
|
||||
bool is_time_estimate_enabled() const { return m_time_estimate_enabled; }
|
||||
void enable_time_estimate(bool enable) { m_time_estimate_enabled = enable; }
|
||||
void enable_time_estimate(bool enable);
|
||||
|
||||
void export_toolpaths_to_obj(const char* filename) const;
|
||||
|
||||
|
|
|
@ -558,6 +558,7 @@ public:
|
|||
void reset_gcode_toolpaths() { m_gcode_viewer.reset(); }
|
||||
const GCodeViewer::SequentialView& get_gcode_sequential_view() const { return m_gcode_viewer.get_sequential_view(); }
|
||||
void update_gcode_sequential_view_current(unsigned int first, unsigned int last) { m_gcode_viewer.update_sequential_view_current(first, last); }
|
||||
bool is_time_estimate_enabled() const { return m_gcode_viewer.is_time_estimate_enabled(); }
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
|
||||
void toggle_sla_auxiliaries_visibility(bool visible, const ModelObject* mo = nullptr, int instance_idx = -1);
|
||||
|
|
|
@ -1323,13 +1323,14 @@ void Sidebar::update_sliced_info_sizer()
|
|||
p->sliced_info->SetTextAndShow(siCost, info_text, new_label);
|
||||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
if (ps.estimated_normal_print_time_str == "N/A" && ps.estimated_silent_print_time_str == "N/A")
|
||||
if (p->plater->get_current_canvas3D()->is_time_estimate_enabled() || (ps.estimated_normal_print_time_str == "N/A" && ps.estimated_silent_print_time_str == "N/A"))
|
||||
#else
|
||||
|
||||
if (ps.estimated_normal_print_time == "N/A" && ps.estimated_silent_print_time == "N/A")
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
p->sliced_info->SetTextAndShow(siEstimatedTime, "N/A");
|
||||
else {
|
||||
new_label = _L("Estimated printing time") +":";
|
||||
new_label = _L("Estimated printing time") + ":";
|
||||
info_text = "";
|
||||
wxString str_color = _L("Color");
|
||||
wxString str_pause = _L("Pause");
|
||||
|
@ -1340,29 +1341,29 @@ void Sidebar::update_sliced_info_sizer()
|
|||
auto fill_labels = [str_color, str_pause](const std::vector<std::pair<CustomGCode::Type, std::string>>& times,
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
wxString& new_label, wxString& info_text)
|
||||
{
|
||||
int color_change_count = 0;
|
||||
for (auto time : times)
|
||||
if (time.first == CustomGCode::ColorChange)
|
||||
color_change_count++;
|
||||
|
||||
for (int i = (int)times.size() - 1; i >= 0; --i)
|
||||
{
|
||||
if (i == 0 || times[i - 1].first == CustomGCode::PausePrint)
|
||||
new_label += format_wxstr("\n - %1%%2%", str_color + " ", color_change_count);
|
||||
else if (times[i - 1].first == CustomGCode::ColorChange)
|
||||
new_label += format_wxstr("\n - %1%%2%", str_color + " ", color_change_count--);
|
||||
int color_change_count = 0;
|
||||
for (auto time : times)
|
||||
if (time.first == CustomGCode::ColorChange)
|
||||
color_change_count++;
|
||||
|
||||
if (i != (int)times.size() - 1 && times[i].first == CustomGCode::PausePrint)
|
||||
new_label += format_wxstr(" -> %1%", str_pause);
|
||||
for (int i = (int)times.size() - 1; i >= 0; --i)
|
||||
{
|
||||
if (i == 0 || times[i - 1].first == CustomGCode::PausePrint)
|
||||
new_label += format_wxstr("\n - %1%%2%", str_color + " ", color_change_count);
|
||||
else if (times[i - 1].first == CustomGCode::ColorChange)
|
||||
new_label += format_wxstr("\n - %1%%2%", str_color + " ", color_change_count--);
|
||||
|
||||
if (i != (int)times.size() - 1 && times[i].first == CustomGCode::PausePrint)
|
||||
new_label += format_wxstr(" -> %1%", str_pause);
|
||||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
info_text += format_wxstr("\n%1% (%2%)", times[i].second.first, times[i].second.second);
|
||||
info_text += format_wxstr("\n%1% (%2%)", times[i].second.first, times[i].second.second);
|
||||
#else
|
||||
info_text += format_wxstr("\n%1%", times[i].second);
|
||||
info_text += format_wxstr("\n%1%", times[i].second);
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
if (ps.estimated_normal_print_time_str != "N/A") {
|
||||
|
@ -1386,7 +1387,7 @@ void Sidebar::update_sliced_info_sizer()
|
|||
fill_labels(ps.estimated_silent_custom_gcode_print_times, new_label, info_text);
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
}
|
||||
p->sliced_info->SetTextAndShow(siEstimatedTime, info_text, new_label);
|
||||
p->sliced_info->SetTextAndShow(siEstimatedTime, info_text, new_label);
|
||||
}
|
||||
|
||||
// if there is a wipe tower, insert number of toolchanges info into the array:
|
||||
|
@ -2180,6 +2181,10 @@ void Plater::priv::select_view_3D(const std::string& name)
|
|||
set_current_panel(view3D);
|
||||
else if (name == "Preview")
|
||||
set_current_panel(preview);
|
||||
|
||||
#if ENABLE_GCODE_VIEWER
|
||||
wxGetApp().update_ui_from_settings();
|
||||
#endif // ENABLE_GCODE_VIEWER
|
||||
}
|
||||
|
||||
void Plater::priv::select_next_view_3D()
|
||||
|
|
Loading…
Reference in a new issue