diff --git a/src/slic3r/GUI/KBShortcutsDialog.cpp b/src/slic3r/GUI/KBShortcutsDialog.cpp index b6e55a7c9d..b595f12752 100644 --- a/src/slic3r/GUI/KBShortcutsDialog.cpp +++ b/src/slic3r/GUI/KBShortcutsDialog.cpp @@ -122,6 +122,8 @@ void KBShortcutsDialog::fill_shortcuts() { ctrl + "G", L("Export G-code") }, { ctrl + "Shift+" + "G", L("Send G-code") }, { ctrl + "E", L("Export config") }, + { ctrl + "U", L("Export to SD card / Flash drive") }, + { ctrl + "T", L("Eject SD card / Flash drive") }, // Edit { ctrl + "A", L("Select all objects") }, { "Esc", L("Deselect all") }, diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 834ec6ff0a..65f73b776b 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -327,6 +327,27 @@ bool MainFrame::can_send_gcode() const return print_host_opt != nullptr && !print_host_opt->value.empty(); } +bool MainFrame::can_export_gcode_sd() const +{ + if (m_plater == nullptr) + return false; + + if (m_plater->model().objects.empty()) + return false; + + if (m_plater->is_export_gcode_scheduled()) + return false; + + // TODO:: add other filters + + return wxGetApp().removable_drive_manager()->status().has_removable_drives; +} + +bool MainFrame::can_eject() const +{ + return wxGetApp().removable_drive_manager()->status().has_eject; +} + bool MainFrame::can_slice() const { bool bg_proc = wxGetApp().app_config->get("background_processing") == "1"; @@ -497,6 +518,9 @@ void MainFrame::init_menubar() [this](wxCommandEvent&) { if (m_plater) m_plater->send_gcode(); }, "export_gcode", nullptr, [this](){return can_send_gcode(); }, this); m_changeable_menu_items.push_back(item_send_gcode); + append_menu_item(export_menu, wxID_ANY, _(L("Export G-code to SD card / Flash drive")) + dots + "\tCtrl+U", _(L("Export current plate as G-code to SD card / Flash drive")), + [this](wxCommandEvent&) { if (m_plater) m_plater->export_gcode(true); }, "export_to_sd", nullptr, + [this]() {return can_export_gcode_sd(); }, this); export_menu->AppendSeparator(); append_menu_item(export_menu, wxID_ANY, _(L("Export plate as &STL")) + dots, _(L("Export current plate as STL")), [this](wxCommandEvent&) { if (m_plater) m_plater->export_stl(); }, "export_plater", nullptr, @@ -520,6 +544,10 @@ void MainFrame::init_menubar() [this]() {return true; }, this); append_submenu(fileMenu, export_menu, wxID_ANY, _(L("&Export")), ""); + append_menu_item(fileMenu, wxID_ANY, _(L("Ejec&t SD card / Flash drive")) + dots + "\tCtrl+T", _(L("Eject SD card / Flash drive after the G-code was exported to it.")), + [this](wxCommandEvent&) { if (m_plater) m_plater->eject_drive(); }, "eject_sd", nullptr, + [this]() {return can_eject(); }, this); + fileMenu->AppendSeparator(); #if 0 diff --git a/src/slic3r/GUI/MainFrame.hpp b/src/slic3r/GUI/MainFrame.hpp index a6d0749ab6..20e18fc53f 100644 --- a/src/slic3r/GUI/MainFrame.hpp +++ b/src/slic3r/GUI/MainFrame.hpp @@ -70,6 +70,8 @@ class MainFrame : public DPIFrame bool can_export_supports() const; bool can_export_gcode() const; bool can_send_gcode() const; + bool can_export_gcode_sd() const; + bool can_eject() const; bool can_slice() const; bool can_change_view() const; bool can_select() const; diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 89087be988..71106b8264 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -876,8 +876,8 @@ Sidebar::Sidebar(Plater *parent) }; init_scalable_btn(&p->btn_send_gcode , "export_gcode", _(L("Send to printer")) + "\tCtrl+Shift+G"); - init_scalable_btn(&p->btn_remove_device, "eject_sd" , _(L("Remove device"))); - init_scalable_btn(&p->btn_export_gcode_removable, "export_to_sd", _(L("Export to SD card / Flash drive"))); + init_scalable_btn(&p->btn_remove_device, "eject_sd" , _(L("Remove device")) + "\tCtrl+T"); + init_scalable_btn(&p->btn_export_gcode_removable, "export_to_sd", _(L("Export to SD card / Flash drive")) + "\tCtrl+U"); // regular buttons "Slice now" and "Export G-code"