mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-05 04:05:10 +08:00
info message - ejecting of sd/flash has failed
This commit is contained in:
parent
e2274bfc83
commit
3858257e28
@ -2191,10 +2191,16 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
|||||||
// Connect to a 3DConnextion driver (OSX).
|
// Connect to a 3DConnextion driver (OSX).
|
||||||
mouse3d_controller.init();
|
mouse3d_controller.init();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this->q->Bind(EVT_REMOVABLE_DRIVE_EJECTED, [this](RemovableDriveEjectEvent &evt) {
|
this->q->Bind(EVT_REMOVABLE_DRIVE_EJECTED, [this](RemovableDriveEjectEvent &evt) {
|
||||||
|
if (evt.data.second) {
|
||||||
this->show_action_buttons(this->ready_to_slice);
|
this->show_action_buttons(this->ready_to_slice);
|
||||||
Slic3r::GUI::show_info(this->q, (boost::format(_utf8(L("Unmounting successful. The device %s(%s) can now be safely removed from the computer.")))
|
Slic3r::GUI::show_info(this->q, (boost::format(_utf8(L("Unmounting successful. The device %s(%s) can now be safely removed from the computer.")))
|
||||||
% evt.data.name % evt.data.path).str());
|
% evt.data.first.name % evt.data.first.path).str());
|
||||||
|
} else
|
||||||
|
Slic3r::GUI::show_info(this->q, (boost::format(_utf8(L("Ejecting of device %s(%s) has failed.")))
|
||||||
|
% evt.data.first.name % evt.data.first.path).str());
|
||||||
});
|
});
|
||||||
this->q->Bind(EVT_REMOVABLE_DRIVES_CHANGED, [this](RemovableDrivesChangedEvent &) { this->show_action_buttons(this->ready_to_slice); });
|
this->q->Bind(EVT_REMOVABLE_DRIVES_CHANGED, [this](RemovableDrivesChangedEvent &) { this->show_action_buttons(this->ready_to_slice); });
|
||||||
// Start the background thread and register this window as a target for update events.
|
// Start the background thread and register this window as a target for update events.
|
||||||
|
@ -89,6 +89,9 @@ void RemovableDriveManager::eject_drive()
|
|||||||
HANDLE handle = CreateFileA(mpath.c_str(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, 0, nullptr);
|
HANDLE handle = CreateFileA(mpath.c_str(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, 0, nullptr);
|
||||||
if (handle == INVALID_HANDLE_VALUE) {
|
if (handle == INVALID_HANDLE_VALUE) {
|
||||||
std::cerr << "Ejecting " << mpath << " failed " << GetLastError() << " \n";
|
std::cerr << "Ejecting " << mpath << " failed " << GetLastError() << " \n";
|
||||||
|
assert(m_callback_evt_handler);
|
||||||
|
if (m_callback_evt_handler)
|
||||||
|
wxPostEvent(m_callback_evt_handler, RemovableDriveEjectEvent(EVT_REMOVABLE_DRIVE_EJECTED, std::pair< DriveData, bool >(std::move(*it_drive_data), false)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DWORD deviceControlRetVal(0);
|
DWORD deviceControlRetVal(0);
|
||||||
@ -101,12 +104,15 @@ void RemovableDriveManager::eject_drive()
|
|||||||
if (error == 0) {
|
if (error == 0) {
|
||||||
CloseHandle(handle);
|
CloseHandle(handle);
|
||||||
BOOST_LOG_TRIVIAL(error) << "Ejecting " << mpath << " failed " << deviceControlRetVal << " " << GetLastError() << " \n";
|
BOOST_LOG_TRIVIAL(error) << "Ejecting " << mpath << " failed " << deviceControlRetVal << " " << GetLastError() << " \n";
|
||||||
|
assert(m_callback_evt_handler);
|
||||||
|
if (m_callback_evt_handler)
|
||||||
|
wxPostEvent(m_callback_evt_handler, RemovableDriveEjectEvent(EVT_REMOVABLE_DRIVE_EJECTED, std::pair< DriveData, bool >(std::move(*it_drive_data),false)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CloseHandle(handle);
|
CloseHandle(handle);
|
||||||
assert(m_callback_evt_handler);
|
assert(m_callback_evt_handler);
|
||||||
if (m_callback_evt_handler)
|
if (m_callback_evt_handler)
|
||||||
wxPostEvent(m_callback_evt_handler, RemovableDriveEjectEvent(EVT_REMOVABLE_DRIVE_EJECTED, std::move(*it_drive_data)));
|
wxPostEvent(m_callback_evt_handler, RemovableDriveEjectEvent(EVT_REMOVABLE_DRIVE_EJECTED, std::pair< DriveData, bool >(std::move(*it_drive_data), true)));
|
||||||
m_current_drives.erase(it_drive_data);
|
m_current_drives.erase(it_drive_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -361,13 +367,16 @@ void RemovableDriveManager::eject_drive()
|
|||||||
if(err)
|
if(err)
|
||||||
{
|
{
|
||||||
BOOST_LOG_TRIVIAL(error) << "Ejecting failed";
|
BOOST_LOG_TRIVIAL(error) << "Ejecting failed";
|
||||||
|
assert(m_callback_evt_handler);
|
||||||
|
if (m_callback_evt_handler)
|
||||||
|
wxPostEvent(m_callback_evt_handler, RemovableDriveEjectEvent(EVT_REMOVABLE_DRIVE_EJECTED, std::pair< DriveData, bool >(std::move(*it_drive_data), false)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
BOOST_LOG_TRIVIAL(info) << "Ejecting finished";
|
BOOST_LOG_TRIVIAL(info) << "Ejecting finished";
|
||||||
|
|
||||||
assert(m_callback_evt_handler);
|
assert(m_callback_evt_handler);
|
||||||
if (m_callback_evt_handler)
|
if (m_callback_evt_handler)
|
||||||
wxPostEvent(m_callback_evt_handler, RemovableDriveEjectEvent(EVT_REMOVABLE_DRIVE_EJECTED, std::move(*it_drive_data)));
|
wxPostEvent(m_callback_evt_handler, RemovableDriveEjectEvent(EVT_REMOVABLE_DRIVE_EJECTED, std::pair< DriveData, bool >(std::move(*it_drive_data), true)));
|
||||||
m_current_drives.erase(it_drive_data);
|
m_current_drives.erase(it_drive_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ inline bool operator< (const DriveData &lhs, const DriveData &rhs) { return lhs.
|
|||||||
inline bool operator> (const DriveData &lhs, const DriveData &rhs) { return lhs.path > rhs.path; }
|
inline bool operator> (const DriveData &lhs, const DriveData &rhs) { return lhs.path > rhs.path; }
|
||||||
inline bool operator==(const DriveData &lhs, const DriveData &rhs) { return lhs.path == rhs.path; }
|
inline bool operator==(const DriveData &lhs, const DriveData &rhs) { return lhs.path == rhs.path; }
|
||||||
|
|
||||||
using RemovableDriveEjectEvent = Event<DriveData>;
|
using RemovableDriveEjectEvent = Event<std::pair<DriveData, bool>>;
|
||||||
wxDECLARE_EVENT(EVT_REMOVABLE_DRIVE_EJECTED, RemovableDriveEjectEvent);
|
wxDECLARE_EVENT(EVT_REMOVABLE_DRIVE_EJECTED, RemovableDriveEjectEvent);
|
||||||
|
|
||||||
using RemovableDrivesChangedEvent = SimpleEvent;
|
using RemovableDrivesChangedEvent = SimpleEvent;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user