Disable "Slice now" and "Export G-code" buttons during BGP

This commit is contained in:
YuSanka 2018-12-04 10:28:05 +01:00
parent 6c69d0e922
commit 3c86203655
3 changed files with 9 additions and 10 deletions

View File

@ -520,7 +520,7 @@ void GUI_App::update_mode()
obj_list()->get_sizer()->Show(mode == ConfigMenuModeExpert); obj_list()->get_sizer()->Show(mode == ConfigMenuModeExpert);
sidebar().set_mode_value(mode); sidebar().set_mode_value(mode);
sidebar().show_buttons(mode == ConfigMenuModeExpert); // sidebar().show_buttons(mode == ConfigMenuModeExpert);
obj_list()->update_selections(); obj_list()->update_selections();
sidebar().Layout(); sidebar().Layout();

View File

@ -263,6 +263,7 @@ void ObjectList::selection_changed()
event.SetEventObject(this); event.SetEventObject(this);
wxPostEvent(this, event); wxPostEvent(this, event);
} }
wxGetApp().sidebar().enable_buttons(!m_objects_model->IsEmpty());
part_selection_changed(); part_selection_changed();

View File

@ -565,6 +565,7 @@ Sidebar::Sidebar(Plater *parent)
p->btn_export_gcode->SetFont(wxGetApp().bold_font()); p->btn_export_gcode->SetFont(wxGetApp().bold_font());
p->btn_reslice = new wxButton(this, wxID_ANY, _(L("Slice now"))); p->btn_reslice = new wxButton(this, wxID_ANY, _(L("Slice now")));
p->btn_reslice->SetFont(wxGetApp().bold_font()); p->btn_reslice->SetFont(wxGetApp().bold_font());
enable_buttons(false);
auto *btns_sizer = new wxBoxSizer(wxVERTICAL); auto *btns_sizer = new wxBoxSizer(wxVERTICAL);
btns_sizer->Add(p->btn_reslice, 0, wxEXPAND | wxTOP, 5); btns_sizer->Add(p->btn_reslice, 0, wxEXPAND | wxTOP, 5);
@ -820,16 +821,10 @@ void Sidebar::show_sliced_info_sizer(const bool show)
void Sidebar::show_buttons(const bool show) void Sidebar::show_buttons(const bool show)
{ {
p->btn_reslice->Show(show); p->btn_reslice->Show(show);
for (size_t i = 0; i < wxGetApp().tab_panel()->GetPageCount(); ++i) { TabPrinter *tab = dynamic_cast<TabPrinter*>(wxGetApp().get_tab(Preset::TYPE_PRINTER));
TabPrinter *tab = dynamic_cast<TabPrinter*>(wxGetApp().tab_panel()->GetPage(i)); if (tab && p->plater->printer_technology() == ptFFF)
if (!tab)
continue;
if (p->plater->printer_technology() == ptFFF) {
p->btn_send_gcode->Show(show && !tab->m_config->opt_string("print_host").empty()); p->btn_send_gcode->Show(show && !tab->m_config->opt_string("print_host").empty());
} }
break;
}
}
void Sidebar::enable_buttons(bool enable) void Sidebar::enable_buttons(bool enable)
{ {
@ -1821,6 +1816,8 @@ unsigned int Plater::priv::update_background_process()
// Some previously calculated data on the Print was invalidated. // Some previously calculated data on the Print was invalidated.
// Hide the slicing results, as the current slicing status is no more valid. // Hide the slicing results, as the current slicing status is no more valid.
this->sidebar->show_sliced_info_sizer(false); this->sidebar->show_sliced_info_sizer(false);
// Disable buttons during background process.
this->sidebar->enable_buttons(false);
// Reset preview canvases. If the print has been invalidated, the preview canvases will be cleared. // Reset preview canvases. If the print has been invalidated, the preview canvases will be cleared.
// Otherwise they will be just refreshed. // Otherwise they will be just refreshed.
this->gcode_preview_data.reset(); this->gcode_preview_data.reset();
@ -2056,6 +2053,7 @@ void Plater::priv::on_process_completed(wxCommandEvent &evt)
this->statusbar()->set_status_text(L("Cancelled")); this->statusbar()->set_status_text(L("Cancelled"));
this->sidebar->show_sliced_info_sizer(success); this->sidebar->show_sliced_info_sizer(success);
this->sidebar->enable_buttons(success);
// this updates buttons status // this updates buttons status
//$self->object_list_changed; //$self->object_list_changed;