diff --git a/src/slic3r/GUI/DownloadManager.cpp b/src/slic3r/GUI/DownloadManager.cpp index 41fd1f5fb3c..7536169c097 100644 --- a/src/slic3r/GUI/DownloadManager.cpp +++ b/src/slic3r/GUI/DownloadManager.cpp @@ -1,5 +1,6 @@ #include "DownloadManager.hpp" #include "GUI_App.hpp" +#include "libslic3r/Utils.hpp" #include #include #include @@ -257,6 +258,8 @@ void DownloadManager::start_download_impl(std::shared_ptr task) { if (!file.is_open()) { std::string error_msg = "Failed to open file for writing: " + task->dest_path; BOOST_LOG_TRIVIAL(error) << "DownloadManager: " << error_msg; + // Flush logs immediately for critical errors + Slic3r::flush_logs(); send_error_update(task, error_msg); cleanup_task(task->task_id); return; @@ -266,6 +269,8 @@ void DownloadManager::start_download_impl(std::shared_ptr task) { if (file.fail()) { std::string error_msg = "Failed to write file: " + task->dest_path; BOOST_LOG_TRIVIAL(error) << "DownloadManager: " << error_msg << ", body size: " << body.size(); + // Flush logs immediately for critical errors + Slic3r::flush_logs(); file.close(); send_error_update(task, error_msg); cleanup_task(task->task_id); @@ -280,6 +285,8 @@ void DownloadManager::start_download_impl(std::shared_ptr task) { } catch (std::exception& e) { std::string error_msg = std::string("File write exception: ") + e.what(); BOOST_LOG_TRIVIAL(error) << "DownloadManager: " << error_msg << ", file: " << task->dest_path; + // Flush logs immediately for critical errors + Slic3r::flush_logs(); send_error_update(task, error_msg); cleanup_task(task->task_id); } @@ -301,6 +308,8 @@ void DownloadManager::start_download_impl(std::shared_ptr task) { << ", URL: " << task->file_url << ", file: " << task->file_name << ", dest: " << task->dest_path; + // Flush logs immediately for critical errors to ensure they are written + Slic3r::flush_logs(); task->state = DownloadTaskState::Error; task->error_message = error; send_error_update(task, error); diff --git a/src/slic3r/GUI/GenericDownloadDialog.cpp b/src/slic3r/GUI/GenericDownloadDialog.cpp index 301e9c0fbae..489fc72699a 100644 --- a/src/slic3r/GUI/GenericDownloadDialog.cpp +++ b/src/slic3r/GUI/GenericDownloadDialog.cpp @@ -355,6 +355,7 @@ void GenericDownloadDialog::on_download_error(size_t task_id, const std::string& void GenericDownloadDialog::on_retry_clicked(wxCommandEvent& event) { + SetTitle(m_title); if (m_on_retry) { m_on_retry(); } @@ -399,6 +400,8 @@ void GenericDownloadDialog::show_error_page(const std::string& error_msg) { m_simplebook_status->SetSelection(2); + SetTitle(_L("Donwload failed")); + // Display simple error message: filename + "Download failed" wxString filename = wxString::FromUTF8(m_file_name.c_str()); wxString error_text = filename + " - Download failed"; diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 524f68fadb6..9915dd671cd 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -4038,6 +4038,12 @@ void MainFrame::downloadOpenProject(const std::string& fileUrl, const std::strin wxGetApp().mainframe->plater()->load_project(wx_file_path); } } + else + { + // Not a valid 3mf file, show error message + wxString msg = wxString::Format(_L("The downloaded file '%s' is not a valid 3MF project file."), fileName); + MessageDialog(this, msg, _L("Invalid File"), wxOK | wxICON_WARNING).ShowModal(); + } }