This commit is contained in:
bubnikv 2019-03-27 10:27:01 +01:00
commit 84ff7f4221
5 changed files with 59 additions and 11 deletions

View file

@ -60,12 +60,14 @@ const std::array<std::string, slaposCount> OBJ_STEP_LABELS =
// Should also add up to 100 (%) // Should also add up to 100 (%)
const std::array<unsigned, slapsCount> PRINT_STEP_LEVELS = const std::array<unsigned, slapsCount> PRINT_STEP_LEVELS =
{ {
80, // slapsRasterize 5, // slapsStats
20, // slapsValidate 94, // slapsRasterize
1, // slapsValidate
}; };
const std::array<std::string, slapsCount> PRINT_STEP_LABELS = const std::array<std::string, slapsCount> PRINT_STEP_LABELS =
{ {
L("Calculating statistics"), // slapsStats
L("Rasterizing layers"), // slapsRasterize L("Rasterizing layers"), // slapsRasterize
L("Validating"), // slapsValidate L("Validating"), // slapsValidate
}; };
@ -913,6 +915,16 @@ void SLAPrint::process()
report_status(*this, -2, "", SlicingStatus::RELOAD_SLA_PREVIEW); report_status(*this, -2, "", SlicingStatus::RELOAD_SLA_PREVIEW);
}; };
auto fillstats = [this]() {
m_print_statistics.clear();
// Fill statistics
fill_statistics();
report_status(*this, -2, "", SlicingStatus::RELOAD_SLA_PREVIEW);
};
// Rasterizing the model objects, and their supports // Rasterizing the model objects, and their supports
auto rasterize = [this, max_objstatus, ilhs]() { auto rasterize = [this, max_objstatus, ilhs]() {
if(canceled()) return; if(canceled()) return;
@ -1050,8 +1062,6 @@ void SLAPrint::process()
// Print all the layers in parallel // Print all the layers in parallel
tbb::parallel_for<unsigned, decltype(lvlfn)>(0, lvlcnt, lvlfn); tbb::parallel_for<unsigned, decltype(lvlfn)>(0, lvlcnt, lvlfn);
// Fill statistics
this->fill_statistics();
// Set statistics values to the printer // Set statistics values to the printer
m_printer->set_statistics({(m_print_statistics.objects_used_material + m_print_statistics.support_used_material)/1000, m_printer->set_statistics({(m_print_statistics.objects_used_material + m_print_statistics.support_used_material)/1000,
double(m_default_object_config.faded_layers.getInt()), double(m_default_object_config.faded_layers.getInt()),
@ -1075,6 +1085,7 @@ void SLAPrint::process()
std::array<slapsFn, slapsCount> print_program = std::array<slapsFn, slapsCount> print_program =
{ {
fillstats,
rasterize, rasterize,
[](){} // validate [](){} // validate
}; };
@ -1116,7 +1127,7 @@ void SLAPrint::process()
} }
std::array<SLAPrintStep, slapsCount> printsteps = { std::array<SLAPrintStep, slapsCount> printsteps = {
slapsRasterize, slapsValidate slapsStats, slapsRasterize, slapsValidate
}; };
// this would disable the rasterization step // this would disable the rasterization step

View file

@ -11,6 +11,7 @@
namespace Slic3r { namespace Slic3r {
enum SLAPrintStep : unsigned int { enum SLAPrintStep : unsigned int {
slapsStats,
slapsRasterize, slapsRasterize,
slapsValidate, slapsValidate,
slapsCount slapsCount

View file

@ -3767,8 +3767,8 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
// of the scene with the background processing data should be performed. // of the scene with the background processing data should be performed.
post_event(SimpleEvent(EVT_GLCANVAS_MOUSE_DRAGGING_FINISHED)); post_event(SimpleEvent(EVT_GLCANVAS_MOUSE_DRAGGING_FINISHED));
} }
else if (evt.LeftUp() && !m_mouse.dragging && (m_hover_volume_id == -1) && !gizmos_overlay_contains_mouse && !m_gizmos.is_dragging() else if (evt.LeftUp() && !m_mouse.dragging && (m_hover_volume_id == -1) && !gizmos_overlay_contains_mouse && !m_gizmos.grabber_contains_mouse() && !m_gizmos.is_dragging()
&& !is_layers_editing_enabled()) && !is_layers_editing_enabled())
{ {
// deselect and propagate event through callback // deselect and propagate event through callback
if (!evt.ShiftDown() && m_picking_enabled && !m_mouse.ignore_up_event) if (!evt.ShiftDown() && m_picking_enabled && !m_mouse.ignore_up_event)

View file

@ -203,7 +203,16 @@ bool GUI_App::OnInit()
load_current_presets(); load_current_presets();
mainframe->Show(true); mainframe->Show(true);
/* Temporary workaround for the correct behavior of the Scrolled sidebar panel:
* change min hight of object list to the normal min value (15 * wxGetApp().em_unit())
* after first whole Mainframe updating/layouting
*/
if (obj_list()->GetMinSize().GetY() > 15 * em_unit())
obj_list()->SetMinSize(wxSize(-1, 15 * em_unit()));
update_mode(); // update view mode after fix of the object_list size update_mode(); // update view mode after fix of the object_list size
m_initialized = true; m_initialized = true;
return true; return true;
} }
@ -317,6 +326,13 @@ void GUI_App::recreate_GUI()
dlg.Update(90, _(L("Loading of a mode view")) + dots); dlg.Update(90, _(L("Loading of a mode view")) + dots);
/* Temporary workaround for the correct behavior of the Scrolled sidebar panel:
* change min hight of object list to the normal min value (15 * wxGetApp().em_unit())
* after first whole Mainframe updating/layouting
*/
if (obj_list()->GetMinSize().GetY() > 15 * em_unit())
obj_list()->SetMinSize(wxSize(-1, 15 * em_unit()));
update_mode(); update_mode();
// #ys_FIXME_delete_after_testing Do we still need this ? // #ys_FIXME_delete_after_testing Do we still need this ?
@ -633,12 +649,28 @@ void GUI_App::add_config_menu(wxMenuBar *menu)
} }
case ConfigMenuLanguage: case ConfigMenuLanguage:
{ {
/* Before change application language, let's check unsaved changes
* and draw user's attention to the application restarting after a language change
*/
wxMessageDialog dialog(nullptr,
_(L("Application will be restarted after language change, "
"and 3D-Scene will be cleaned.")) + "\n" +
_(L("Please, check your changes before.")) + "\n\n" +
_(L("Continue anyway?")),
_(L("Attention!")),
wxICON_QUESTION | wxYES_NO | wxNO_DEFAULT);
if ( dialog.ShowModal() != wxID_YES)
return;
if (!wxGetApp().check_unsaved_changes())
return;
wxArrayString names; wxArrayString names;
wxArrayLong identifiers; wxArrayLong identifiers;
get_installed_languages(names, identifiers); get_installed_languages(names, identifiers);
if (select_language(names, identifiers)) { if (select_language(names, identifiers)) {
save_language(); save_language();
show_info(mainframe->m_tabpanel, _(L("Application will be restarted")), _(L("Attention!"))); // show_info(mainframe->m_tabpanel, _(L("Application will be restarted")), _(L("Attention!")));
_3DScene::remove_all_canvases();// remove all canvas before recreate GUI _3DScene::remove_all_canvases();// remove all canvas before recreate GUI
recreate_GUI(); recreate_GUI();
} }
@ -674,11 +706,11 @@ bool GUI_App::check_unsaved_changes()
// No changes, the application may close or reload presets. // No changes, the application may close or reload presets.
return true; return true;
// Ask the user. // Ask the user.
auto dialog = new wxMessageDialog(mainframe, wxMessageDialog dialog(mainframe,
_(L("You have unsaved changes ")) + dirty + _(L(". Discard changes and continue anyway?")), _(L("You have unsaved changes ")) + dirty + _(L(". Discard changes and continue anyway?")),
_(L("Unsaved Presets")), _(L("Unsaved Presets")),
wxICON_QUESTION | wxYES_NO | wxNO_DEFAULT); wxICON_QUESTION | wxYES_NO | wxNO_DEFAULT);
return dialog->ShowModal() == wxID_YES; return dialog.ShowModal() == wxID_YES;
} }
bool GUI_App::checked_tab(Tab* tab) bool GUI_App::checked_tab(Tab* tab)

View file

@ -127,7 +127,11 @@ ObjectList::~ObjectList()
void ObjectList::create_objects_ctrl() void ObjectList::create_objects_ctrl()
{ {
SetMinSize(wxSize(-1, 15 * wxGetApp().em_unit())); /* Temporary workaround for the correct behavior of the Scrolled sidebar panel:
* 1. set a height of the list to some big value
* 2. change it to the normal min value (15 * wxGetApp().em_unit()) after first whole Mainframe updating/layouting
*/
SetMinSize(wxSize(-1, 3000));
m_sizer = new wxBoxSizer(wxVERTICAL); m_sizer = new wxBoxSizer(wxVERTICAL);
m_sizer->Add(this, 1, wxGROW); m_sizer->Add(this, 1, wxGROW);