Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support bambulab's new security functions #8103

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
ENH: add send to bambu connect
verified on 1/19 night
  • Loading branch information
lanewei120 committed Jan 19, 2025
commit 375839610c2c86579888e7810afa0cd8a1976b15
1 change: 1 addition & 0 deletions src/slic3r/GUI/GLToolbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ wxDEFINE_EVENT(EVT_GLTOOLBAR_PRINT_SELECT, SimpleEvent);
wxDEFINE_EVENT(EVT_GLTOOLBAR_SEND_TO_PRINTER, SimpleEvent);
wxDEFINE_EVENT(EVT_GLTOOLBAR_SEND_TO_PRINTER_ALL, SimpleEvent);
wxDEFINE_EVENT(EVT_GLTOOLBAR_PRINT_MULTI_MACHINE, SimpleEvent);
wxDEFINE_EVENT(EVT_GLTOOLBAR_SEND_BAMBU_CONNECT, SimpleEvent);


wxDEFINE_EVENT(EVT_GLTOOLBAR_ADD, SimpleEvent);
Expand Down
1 change: 1 addition & 0 deletions src/slic3r/GUI/GLToolbar.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ wxDECLARE_EVENT(EVT_GLTOOLBAR_PRINT_SELECT, SimpleEvent);
wxDECLARE_EVENT(EVT_GLTOOLBAR_SEND_TO_PRINTER, SimpleEvent);
wxDECLARE_EVENT(EVT_GLTOOLBAR_SEND_TO_PRINTER_ALL, SimpleEvent);
wxDECLARE_EVENT(EVT_GLTOOLBAR_PRINT_MULTI_MACHINE, SimpleEvent);
wxDECLARE_EVENT(EVT_GLTOOLBAR_SEND_BAMBU_CONNECT, SimpleEvent);


wxDECLARE_EVENT(EVT_GLTOOLBAR_ADD, SimpleEvent);
Expand Down
56 changes: 38 additions & 18 deletions src/slic3r/GUI/MainFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
//#include <wx/glcanvas.h>
#include <wx/filename.h>
#include <wx/debug.h>
#include <wx/utils.h>
#include <wx/utils.h>

#include <boost/algorithm/string/predicate.hpp>
#include <boost/log/trivial.hpp>
Expand Down Expand Up @@ -183,7 +183,7 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, BORDERLESS_FRAME_
set_miniaturizable(GetHandle());
#endif

if (!wxGetApp().app_config->has("user_mode")) {
if (!wxGetApp().app_config->has("user_mode")) {
wxGetApp().app_config->set("user_mode", "simple");
wxGetApp().app_config->set_bool("developer_mode", false);
wxGetApp().app_config->save();
Expand Down Expand Up @@ -495,7 +495,7 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, BORDERLESS_FRAME_
wxGetApp().plater()->get_current_canvas3D()->request_extra_frame();
event.Skip();
});
#endif
#endif

update_ui_from_settings(); // FIXME (?)

Expand Down Expand Up @@ -561,12 +561,12 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, BORDERLESS_FRAME_
return;
}
else if (evt.CmdDown() && evt.GetKeyCode() == 'G') { if (can_export_gcode()) { wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_EXPORT_SLICED_FILE)); } evt.Skip(); return; }
if (evt.CmdDown() && evt.GetKeyCode() == 'J') { m_printhost_queue_dlg->Show(); return; }
if (evt.CmdDown() && evt.GetKeyCode() == 'J') { m_printhost_queue_dlg->Show(); return; }
if (evt.CmdDown() && evt.GetKeyCode() == 'N') { m_plater->new_project(); return;}
if (evt.CmdDown() && evt.GetKeyCode() == 'O') { m_plater->load_project(); return;}
if (evt.CmdDown() && evt.ShiftDown() && evt.GetKeyCode() == 'S') { if (can_save_as()) m_plater->save_project(true); return;}
else if (evt.CmdDown() && evt.GetKeyCode() == 'S') { if (can_save()) m_plater->save_project(); return;}
if (evt.CmdDown() && evt.GetKeyCode() == 'F') {
if (evt.CmdDown() && evt.GetKeyCode() == 'F') {
if (m_plater && (m_tabpanel->GetSelection() == TabPosition::tp3DEditor || m_tabpanel->GetSelection() == TabPosition::tpPreview)) {
m_plater->sidebar().can_search();
}
Expand Down Expand Up @@ -1576,6 +1576,8 @@ wxBoxSizer* MainFrame::create_side_tools()
wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_SEND_TO_PRINTER));
else if (m_print_select == eSendToPrinterAll)
wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_SEND_TO_PRINTER_ALL));
else if (m_print_select == eSendBambuConnect)
wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_SEND_BAMBU_CONNECT));
/* else if (m_print_select == ePrintMultiMachine)
wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_PRINT_MULTI_MACHINE));*/
});
Expand Down Expand Up @@ -1755,6 +1757,7 @@ wxBoxSizer* MainFrame::create_side_tools()
});
p->append_button(print_multi_machine_btn);
}

p->append_button(export_sliced_file_btn);
p->append_button(export_all_sliced_file_btn);
SideButton* export_gcode_btn = new SideButton(p, _L("Export G-code file"), "");
Expand All @@ -1768,6 +1771,18 @@ wxBoxSizer* MainFrame::create_side_tools()
p->Dismiss();
});
p->append_button(export_gcode_btn);

SideButton *send_to_bambu_connect_btn = new SideButton(p, _L("Send to Bambu Connect"), "");
send_to_bambu_connect_btn->SetCornerRadius(0);
send_to_bambu_connect_btn->Bind(wxEVT_BUTTON, [this, p](wxCommandEvent &) {
m_print_btn->SetLabel(_L("Send to BC"));
m_print_select = eSendBambuConnect;
m_print_enable = get_enable_print_status();
m_print_btn->Enable(m_print_enable);
this->Layout();
p->Dismiss();
});
p->append_button(send_to_bambu_connect_btn);
}

p->Popup(m_print_btn);
Expand Down Expand Up @@ -1916,6 +1931,11 @@ bool MainFrame::get_enable_print_status()
enable = false;
}
enable = enable && !is_all_plates;
}else if (m_print_select == eSendBambuConnect) {
if (!current_plate->is_slice_result_ready_for_print()) {
enable = false;
}
enable = enable && !is_all_plates;
}

BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": m_print_select %1%, enable= %2% ")%m_print_select %enable;
Expand All @@ -1935,7 +1955,7 @@ void MainFrame::update_side_button_style()
m_slice_btn->SetExtraSize(wxSize(FromDIP(38), FromDIP(10)));
m_slice_btn->SetBottomColour(wxColour(0x3B4446));*/
StateColor m_btn_bg_enable = StateColor(
std::pair<wxColour, int>(wxColour(0, 137, 123), StateColor::Pressed),
std::pair<wxColour, int>(wxColour(0, 137, 123), StateColor::Pressed),
std::pair<wxColour, int>(wxColour(48, 221, 112), StateColor::Hovered),
std::pair<wxColour, int>(wxColour(0, 150, 136), StateColor::Normal)
);
Expand Down Expand Up @@ -2503,7 +2523,7 @@ void MainFrame::init_menubar_as_editor()
#if 0
// BBS Delete selected
append_menu_item(editMenu, wxID_ANY, _L("Delete selected") + "\tBackSpace",
_L("Deletes the current selection"),[this](wxCommandEvent&) {
_L("Deletes the current selection"),[this](wxCommandEvent&) {
m_plater->remove_selected();
},
"", nullptr, [this](){return can_delete(); }, this);
Expand Down Expand Up @@ -2546,7 +2566,7 @@ void MainFrame::init_menubar_as_editor()

// BBS Select All
append_menu_item(editMenu, wxID_ANY, _L("Select all") + "\t" + ctrl + "A",
_L("Selects all objects"), [this, handle_key_event](wxCommandEvent&) {
_L("Selects all objects"), [this, handle_key_event](wxCommandEvent&) {
wxKeyEvent e;
e.SetEventType(wxEVT_KEY_DOWN);
e.SetControlDown(true);
Expand Down Expand Up @@ -2873,7 +2893,7 @@ void MainFrame::init_menubar_as_editor()
m_retraction_calib_dlg->ShowModal();
}, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);

append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("Orca Tolerance Test"), _L("Orca Tolerance Test"),
[this](wxCommandEvent&) {
m_plater->new_project();
Expand Down Expand Up @@ -2904,7 +2924,7 @@ void MainFrame::init_menubar_as_editor()
[this]() {return m_plater->is_view3D_shown();; }, this);
m_topbar->GetCalibMenu()->AppendSubMenu(advance_menu, _L("More..."));

// help
// help
append_menu_item(m_topbar->GetCalibMenu(), wxID_ANY, _L("Tutorial"), _L("Calibration help"),
[this](wxCommandEvent&) {
std::string url = "https://github.com/SoftFever/OrcaSlicer/wiki/Calibration";
Expand Down Expand Up @@ -2936,7 +2956,7 @@ void MainFrame::init_menubar_as_editor()
m_temp_calib_dlg->ShowModal();
}, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);

// Flowrate
auto flowrate_menu = new wxMenu();
append_menu_item(flowrate_menu, wxID_ANY, _L("Pass 1"), _L("Flow rate test - Pass 1"),
Expand Down Expand Up @@ -2985,28 +3005,28 @@ void MainFrame::init_menubar_as_editor()
auto advance_menu = new wxMenu();
append_menu_item(
advance_menu, wxID_ANY, _L("Max flowrate"), _L("Max flowrate"),
[this](wxCommandEvent&) {
[this](wxCommandEvent&) {
if (!m_vol_test_dlg)
m_vol_test_dlg = new MaxVolumetricSpeed_Test_Dlg((wxWindow*)this, wxID_ANY, m_plater);
m_vol_test_dlg->ShowModal();
m_vol_test_dlg->ShowModal();
}, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
append_menu_item(
advance_menu, wxID_ANY, _L("VFA"), _L("VFA"),
[this](wxCommandEvent&) {
[this](wxCommandEvent&) {
if (!m_vfa_test_dlg)
m_vfa_test_dlg = new VFA_Test_Dlg((wxWindow*)this, wxID_ANY, m_plater);
m_vfa_test_dlg->ShowModal();
}, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);
[this]() {return m_plater->is_view3D_shown();; }, this);

append_submenu(calib_menu, advance_menu, wxID_ANY, _L("More..."), _L("More calibrations"), "",
[this]() {return m_plater->is_view3D_shown();; });
// help
append_menu_item(calib_menu, wxID_ANY, _L("Tutorial"), _L("Calibration help"),
[this](wxCommandEvent&) { wxLaunchDefaultBrowser("https://github.com/SoftFever/OrcaSlicer/wiki/Calibration", wxBROWSER_NEW_WINDOW); }, "", nullptr,
[this]() {return m_plater->is_view3D_shown();; }, this);

m_menubar->Append(calib_menu,wxString::Format("&%s", _L("Calibration")));
if (helpMenu)
m_menubar->Append(helpMenu, wxString::Format("&%s", _L("Help")));
Expand Down Expand Up @@ -3169,7 +3189,7 @@ void MainFrame::export_config()
{
ExportConfigsDialog export_configs_dlg(nullptr);
export_configs_dlg.ShowModal();
return;
return;

// Generate a cummulative configuration for the selected print, filaments and printer.
wxDirDialog dlg(this, _L("Choose a directory"),
Expand Down
5 changes: 3 additions & 2 deletions src/slic3r/GUI/MainFrame.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ class MainFrame : public DPIFrame
eSendToPrinterAll = 6,
eUploadGcode = 7,
eExportAllSlicedFile = 8,
ePrintMultiMachine = 9
ePrintMultiMachine = 9,
eSendBambuConnect = 10
};

void update_layout();
Expand Down Expand Up @@ -382,7 +383,7 @@ class MainFrame : public DPIFrame
wxWindow* m_plater_page{ nullptr };
PrintHostQueueDialog* m_printhost_queue_dlg;


mutable int m_print_select{ ePrintAll };
mutable int m_slice_select{ eSliceAll };
// Button* m_publish_btn{ nullptr };
Expand Down
Loading