mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 16:57:53 -06:00
eject button functionality
This commit is contained in:
parent
01f1bed060
commit
f5e3750d23
4 changed files with 34 additions and 17 deletions
|
@ -902,6 +902,7 @@ Sidebar::Sidebar(Plater *parent)
|
|||
p->btn_send_gcode->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) { p->plater->send_gcode(); });
|
||||
p->btn_disconnect->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) {
|
||||
// #dk_FIXME
|
||||
p->plater->eject_drive();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -4149,7 +4150,7 @@ void Plater::priv::show_action_buttons(const bool is_ready_to_slice) const
|
|||
const auto prin_host_opt = config->option<ConfigOptionString>("print_host");
|
||||
const bool send_gcode_shown = prin_host_opt != nullptr && !prin_host_opt->value.empty();
|
||||
|
||||
const bool disconnect_shown = true; // #dk_FIXME
|
||||
const bool disconnect_shown = !(RemovableDriveManager::get_instance().is_last_drive_removed()); // #dk_FIXME
|
||||
|
||||
// when a background processing is ON, export_btn and/or send_btn are showing
|
||||
if (wxGetApp().app_config->get("background_processing") == "1")
|
||||
|
@ -4992,6 +4993,22 @@ void Plater::send_gcode()
|
|||
}
|
||||
}
|
||||
|
||||
void Plater::eject_drive()
|
||||
{
|
||||
if (GUI::RemovableDriveManager::get_instance().update())
|
||||
{
|
||||
RemovableDriveManager::get_instance().erase_callbacks();
|
||||
RemovableDriveManager::get_instance().add_callback(std::bind(&Plater::drive_ejected_callback, this));
|
||||
RemovableDriveManager::get_instance().eject_drive(RemovableDriveManager::get_instance().get_last_drive_path());
|
||||
}
|
||||
}
|
||||
void Plater::drive_ejected_callback()
|
||||
{
|
||||
p->show_action_buttons(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Plater::take_snapshot(const std::string &snapshot_name) { p->take_snapshot(snapshot_name); }
|
||||
void Plater::take_snapshot(const wxString &snapshot_name) { p->take_snapshot(snapshot_name); }
|
||||
void Plater::suppress_snapshots() { p->suppress_snapshots(); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue