mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-18 04:08:02 -06:00
FIX: fix sending gcode to octoprint
Change-Id: Id541b18d8e3522854d83f57dd4f3b02863a6aae7 Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
parent
32afff46fc
commit
67d4e2148f
6 changed files with 33 additions and 63 deletions
|
@ -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();
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
|
|
@ -292,14 +292,11 @@ void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgr
|
|||
}
|
||||
|
||||
#ifdef WIN32
|
||||
/*
|
||||
option = m_optgroup->get_option("printhost_ssl_ignore_revoke");
|
||||
option.opt.width = Field::def_width_wider();
|
||||
m_optgroup->append_single_option_line(option);
|
||||
*/
|
||||
//option = m_optgroup->get_option("printhost_ssl_ignore_revoke");
|
||||
//option.opt.width = Field::def_width_wider();
|
||||
//m_optgroup->append_single_option_line(option);
|
||||
#endif
|
||||
|
||||
|
||||
m_optgroup->activate();
|
||||
|
||||
Field* printhost_field = m_optgroup->get_field("print_host");
|
||||
|
@ -447,6 +444,7 @@ void PhysicalPrinterDialog::update(bool printer_change)
|
|||
m_optgroup->hide_field(opt_key);
|
||||
supports_multiple_printers = opt && opt->value == htRepetier;
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
m_optgroup->set_value("host_type", int(PrintHostType::htOctoPrint), false);
|
||||
|
|
|
@ -1774,6 +1774,7 @@ struct Plater::priv
|
|||
priv(Plater *q, MainFrame *main_frame);
|
||||
~priv();
|
||||
|
||||
|
||||
bool need_update() const { return m_need_update; }
|
||||
void set_need_update(bool need_update) { m_need_update = need_update; }
|
||||
|
||||
|
@ -2028,7 +2029,6 @@ struct Plater::priv
|
|||
void on_action_print_all(SimpleEvent&);
|
||||
void on_action_export_gcode(SimpleEvent&);
|
||||
void on_action_send_gcode(SimpleEvent&);
|
||||
void on_action_upload_gcode(SimpleEvent&);
|
||||
void on_action_export_sliced_file(SimpleEvent&);
|
||||
void on_action_export_all_sliced_file(SimpleEvent&);
|
||||
void on_action_select_sliced_plate(wxCommandEvent& evt);
|
||||
|
@ -2439,7 +2439,6 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
|||
q->Bind(EVT_GLTOOLBAR_PRINT_ALL, &priv::on_action_print_all, this);
|
||||
q->Bind(EVT_GLTOOLBAR_EXPORT_GCODE, &priv::on_action_export_gcode, this);
|
||||
q->Bind(EVT_GLTOOLBAR_SEND_GCODE, &priv::on_action_send_gcode, this);
|
||||
q->Bind(EVT_GLTOOLBAR_UPLOAD_GCODE, &priv::on_action_upload_gcode, this);
|
||||
q->Bind(EVT_GLTOOLBAR_EXPORT_SLICED_FILE, &priv::on_action_export_sliced_file, this);
|
||||
q->Bind(EVT_GLTOOLBAR_EXPORT_ALL_SLICED_FILE, &priv::on_action_export_all_sliced_file, this);
|
||||
q->Bind(EVT_GLTOOLBAR_SEND_TO_PRINTER, &priv::on_action_export_to_sdcard, this);
|
||||
|
@ -6084,19 +6083,11 @@ void Plater::priv::on_action_export_gcode(SimpleEvent&)
|
|||
}
|
||||
}
|
||||
|
||||
void Plater::priv::on_action_upload_gcode(SimpleEvent&)
|
||||
{
|
||||
if (q != nullptr) {
|
||||
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << ":received export gcode event\n";
|
||||
q->send_gcode_legacy(-1, nullptr, true);
|
||||
}
|
||||
}
|
||||
|
||||
void Plater::priv::on_action_send_gcode(SimpleEvent&)
|
||||
{
|
||||
if (q != nullptr) {
|
||||
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << ":received export gcode event\n" ;
|
||||
q->send_gcode_legacy(-1, nullptr, false);
|
||||
q->send_gcode_legacy();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9765,7 +9756,7 @@ void Plater::reslice_SLA_until_step(SLAPrintObjectStep step, const ModelObject &
|
|||
// and let the background processing start.
|
||||
this->p->restart_background_process(state | priv::UPDATE_BACKGROUND_PROCESS_FORCE_RESTART);
|
||||
}
|
||||
void Plater::send_gcode_legacy(int plate_idx, Export3mfProgressFn proFn, bool upload_only)
|
||||
void Plater::send_gcode_legacy(int plate_idx, Export3mfProgressFn proFn)
|
||||
{
|
||||
// if physical_printer is selected, send gcode for this printer
|
||||
// DynamicPrintConfig* physical_printer_config = wxGetApp().preset_bundle->physical_printers.get_selected_printer_config();
|
||||
|
@ -9803,7 +9794,7 @@ void Plater::send_gcode_legacy(int plate_idx, Export3mfProgressFn proFn, bool up
|
|||
upload_job.printhost->get_groups(groups);
|
||||
}
|
||||
|
||||
PrintHostSendDialog dlg(default_output_file, upload_job.printhost->get_post_upload_actions(), groups, upload_only);
|
||||
PrintHostSendDialog dlg(default_output_file, upload_job.printhost->get_post_upload_actions(), groups);
|
||||
if (dlg.ShowModal() == wxID_OK) {
|
||||
upload_job.upload_data.upload_path = dlg.filename();
|
||||
upload_job.upload_data.post_action = dlg.post_action();
|
||||
|
|
|
@ -348,7 +348,7 @@ public:
|
|||
/* -1: send current gcode if not specified
|
||||
* -2: send all gcode to target machine */
|
||||
int send_gcode(int plate_idx = -1, Export3mfProgressFn proFn = nullptr);
|
||||
void send_gcode_legacy(int plate_idx = -1, Export3mfProgressFn proFn = nullptr, bool upload_only = false);
|
||||
void send_gcode_legacy(int plate_idx = -1, Export3mfProgressFn proFn = nullptr);
|
||||
int export_config_3mf(int plate_idx = -1, Export3mfProgressFn proFn = nullptr);
|
||||
//BBS jump to nonitor after print job finished
|
||||
void print_job_finished(wxCommandEvent &evt);
|
||||
|
|
|
@ -36,8 +36,8 @@ namespace GUI {
|
|||
static const char *CONFIG_KEY_PATH = "printhost_path";
|
||||
static const char *CONFIG_KEY_GROUP = "printhost_group";
|
||||
|
||||
PrintHostSendDialog::PrintHostSendDialog(const fs::path &path, PrintHostPostUploadActions post_actions, const wxArrayString &groups, bool upload_only)
|
||||
: MsgDialog(static_cast<wxWindow*>(wxGetApp().mainframe), _L("Upload and Print"), _L("Upload to Printer Host with the following filename:"),0)
|
||||
PrintHostSendDialog::PrintHostSendDialog(const fs::path &path, PrintHostPostUploadActions post_actions, const wxArrayString &groups)
|
||||
: MsgDialog(static_cast<wxWindow*>(wxGetApp().mainframe), _L("Send to print"), _L("Upload to Printer Host with the following filename:"),0)
|
||||
, txt_filename(new wxTextCtrl(this, wxID_ANY))
|
||||
, combo_groups(!groups.IsEmpty() ? new wxComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, groups, wxCB_READONLY) : nullptr)
|
||||
, post_upload_action(PrintHostPostUploadAction::None)
|
||||
|
@ -88,19 +88,7 @@ PrintHostSendDialog::PrintHostSendDialog(const fs::path &path, PrintHostPostUplo
|
|||
return true;
|
||||
};
|
||||
|
||||
auto* btn_confirm = add_button(wxID_YES, false, _L("Confirm"));
|
||||
btn_confirm->Bind(wxEVT_BUTTON, [this, upload_only, validate_path](wxCommandEvent&) {
|
||||
if (validate_path(txt_filename->GetValue())) {
|
||||
if (upload_only) {
|
||||
post_upload_action = PrintHostPostUploadAction::None;
|
||||
} else {
|
||||
post_upload_action = PrintHostPostUploadAction::StartPrint;
|
||||
}
|
||||
EndDialog(wxID_OK);
|
||||
}
|
||||
});
|
||||
|
||||
/*auto* btn_upload = add_button(wxID_YES, false, _L("Upload"));
|
||||
auto* btn_upload = add_button(wxID_YES, false, _L("Upload"));
|
||||
btn_upload->Bind(wxEVT_BUTTON, [this, validate_path](wxCommandEvent&) {
|
||||
if (validate_path(txt_filename->GetValue())) {
|
||||
post_upload_action = PrintHostPostUploadAction::None;
|
||||
|
@ -108,8 +96,8 @@ PrintHostSendDialog::PrintHostSendDialog(const fs::path &path, PrintHostPostUplo
|
|||
}
|
||||
});
|
||||
|
||||
if (post_actions.has(PrintHostPostUploadAction::StartPrint) && !upload_only) {
|
||||
auto* btn_print = add_button(wxID_YES, false, _L("Upload and Print"));
|
||||
if (post_actions.has(PrintHostPostUploadAction::StartPrint)) {
|
||||
auto* btn_print = add_button(wxID_YES, false, _L("Print"));
|
||||
btn_print->Bind(wxEVT_BUTTON, [this, validate_path](wxCommandEvent&) {
|
||||
if (validate_path(txt_filename->GetValue())) {
|
||||
post_upload_action = PrintHostPostUploadAction::StartPrint;
|
||||
|
@ -120,7 +108,7 @@ PrintHostSendDialog::PrintHostSendDialog(const fs::path &path, PrintHostPostUplo
|
|||
|
||||
if (post_actions.has(PrintHostPostUploadAction::StartSimulation)) {
|
||||
// Using wxID_MORE as a button identifier to be different from the other buttons, wxID_MORE has no other meaning here.
|
||||
auto* btn_simulate = add_button(wxID_MORE, false, _L("Upload and Simulate"));
|
||||
auto* btn_simulate = add_button(wxID_MORE, false, _L("Simulate"));
|
||||
btn_simulate->Bind(wxEVT_BUTTON, [this, validate_path](wxCommandEvent&) {
|
||||
if (validate_path(txt_filename->GetValue())) {
|
||||
post_upload_action = PrintHostPostUploadAction::StartSimulation;
|
||||
|
@ -128,7 +116,6 @@ PrintHostSendDialog::PrintHostSendDialog(const fs::path &path, PrintHostPostUplo
|
|||
}
|
||||
});
|
||||
}
|
||||
*/
|
||||
|
||||
add_button(wxID_CANCEL,false,"Cancel");
|
||||
finalize();
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace GUI {
|
|||
class PrintHostSendDialog : public GUI::MsgDialog
|
||||
{
|
||||
public:
|
||||
PrintHostSendDialog(const boost::filesystem::path &path, PrintHostPostUploadActions post_actions, const wxArrayString& groups, bool upload_only);
|
||||
PrintHostSendDialog(const boost::filesystem::path &path, PrintHostPostUploadActions post_actions, const wxArrayString& groups);
|
||||
boost::filesystem::path filename() const;
|
||||
PrintHostPostUploadAction post_action() const;
|
||||
std::string group() const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue