PRUSA 2.7.0

This commit is contained in:
sunsets
2023-12-27 18:02:35 +08:00
parent b33112327f
commit 0a3c63dcb1
488 changed files with 92371 additions and 29443 deletions

View File

@@ -40,6 +40,7 @@ namespace GUI {
wxDEFINE_EVENT(EVT_REMOVABLE_DRIVE_EJECTED, RemovableDriveEjectEvent);
wxDEFINE_EVENT(EVT_REMOVABLE_DRIVES_CHANGED, RemovableDrivesChangedEvent);
wxDEFINE_EVENT(EVT_REMOVABLE_DRIVE_ADDED, wxCommandEvent);
#if _WIN32
std::vector<DriveData> RemovableDriveManager::search_for_removable_drives() const
@@ -1032,11 +1033,26 @@ void RemovableDriveManager::update()
std::scoped_lock<std::mutex> lock(m_drives_mutex);
std::sort(current_drives.begin(), current_drives.end());
if (current_drives != m_current_drives) {
// event for writing / ejecting functions
assert(m_callback_evt_handler);
if (m_callback_evt_handler)
wxPostEvent(m_callback_evt_handler, RemovableDrivesChangedEvent(EVT_REMOVABLE_DRIVES_CHANGED));
// event for printer config file
std::vector<DriveData> new_drives;
std::set_difference(current_drives.begin(), current_drives.end(), m_current_drives.begin(), m_current_drives.end(),
std::inserter(new_drives, new_drives.begin()));
for (const DriveData& data : new_drives) {
if (data.path.empty())
continue;
wxCommandEvent* evt = new wxCommandEvent(EVT_REMOVABLE_DRIVE_ADDED);
evt->SetString(boost::nowide::widen(data.path));
evt->SetInt((int)m_first_update);
m_callback_evt_handler->QueueEvent(evt);
}
}
m_current_drives = std::move(current_drives);
m_first_update = false;
} else {
// Acquiring the m_iniside_update lock failed, therefore another update is running.
// Just block until the other instance of update() finishes.
@@ -1091,4 +1107,11 @@ void RemovableDriveManager::eject_thread_finish()
}
#endif // __APPLE__
std::vector<DriveData> RemovableDriveManager::get_drive_list()
{
{
std::lock_guard<std::mutex> guard(m_drives_mutex);
return m_current_drives;
}
}
}} // namespace Slic3r::GUI