FIX: fix sending gcode to octoprint

Change-Id: Id541b18d8e3522854d83f57dd4f3b02863a6aae7
Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
Stone Li 2023-01-12 16:34:16 +08:00 committed by Lane.Wei
parent 32afff46fc
commit 67d4e2148f
6 changed files with 33 additions and 63 deletions

View file

@ -193,8 +193,6 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, BORDERLESS_FRAME_
panel_topbar->Layout();
#endif
//wxAuiToolBar* toolbar = new wxAuiToolBar();
/*
#ifndef __WXOSX__ // Don't call SetFont under OSX to avoid name cutting in ObjectList
@ -1228,10 +1226,6 @@ bool MainFrame::can_send_gcode() const
{
if (m_plater && !m_plater->model().objects.empty())
{
// BBL printer presets
if (!wxGetApp().preset_bundle->printers.get_edited_preset().is_custom_defined())
return false;
auto cfg = wxGetApp().preset_bundle->printers.get_edited_preset().config;
if (const auto *print_host_opt = cfg.option<ConfigOptionString>("print_host"); print_host_opt)
return !print_host_opt->value.empty();
@ -1416,7 +1410,7 @@ wxBoxSizer* MainFrame::create_side_tools()
m_print_option_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent& event)
{
SidePopup* p = new SidePopup(this);
if (wxGetApp().preset_bundle
&& !wxGetApp().preset_bundle->printers.get_edited_preset().is_bbl_vendor_preset(wxGetApp().preset_bundle)) {
// ThirdParty Buttons
@ -1444,7 +1438,7 @@ wxBoxSizer* MainFrame::create_side_tools()
});
// upload only
SideButton* upload_gcode_btn = new SideButton(p, _L("Send"), "");
/*SideButton* upload_gcode_btn = new SideButton(p, _L("Send"), "");
upload_gcode_btn->SetCornerRadius(0);
upload_gcode_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent&) {
m_print_btn->SetLabel(_L("Send"));
@ -1453,10 +1447,10 @@ wxBoxSizer* MainFrame::create_side_tools()
m_print_btn->Enable(m_print_enable);
this->Layout();
p->Dismiss();
});
});*/
p->append_button(send_gcode_btn);
p->append_button(upload_gcode_btn);
//p->append_button(upload_gcode_btn);
p->append_button(export_gcode_btn);
}
else {
@ -1503,15 +1497,15 @@ wxBoxSizer* MainFrame::create_side_tools()
});
SideButton* send_to_printer_all_btn = new SideButton(p, _L("Send all"), "");
send_to_printer_all_btn->SetCornerRadius(0);
send_to_printer_all_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent&) {
m_print_btn->SetLabel(_L("Send all"));
m_print_select = eSendToPrinterAll;
m_print_enable = get_enable_print_status();
m_print_btn->Enable(m_print_enable);
this->Layout();
p->Dismiss();
});
send_to_printer_all_btn->SetCornerRadius(0);
send_to_printer_all_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent&) {
m_print_btn->SetLabel(_L("Send all"));
m_print_select = eSendToPrinterAll;
m_print_enable = get_enable_print_status();
m_print_btn->Enable(m_print_enable);
this->Layout();
p->Dismiss();
});
export_sliced_file_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent&) {
m_print_btn->SetLabel(_L("Export plate sliced file"));
@ -2918,7 +2912,7 @@ void MainFrame::set_print_button_to_default(PrintSelectType select_type)
m_print_btn->SetLabel(_L("Print"));
m_print_select = eSendGcode;
if (m_print_enable)
m_print_enable = get_enable_print_status();
m_print_enable = get_enable_print_status() && can_send_gcode();
m_print_btn->Enable(m_print_enable);
this->Layout();
} else {