mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-06-11 06:23:08 +00:00
Merge pull request #153 from Snapmaker/dev_2.3.0_alves
feature add tips for import failed.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "DownloadManager.hpp"
|
||||
#include "GUI_App.hpp"
|
||||
#include "libslic3r/Utils.hpp"
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/nowide/fstream.hpp>
|
||||
#include <boost/log/trivial.hpp>
|
||||
@@ -257,6 +258,8 @@ void DownloadManager::start_download_impl(std::shared_ptr<DownloadTask> 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<DownloadTask> 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<DownloadTask> 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<DownloadTask> 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);
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user