mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-20 07:11:12 -06:00
Update the codes to 01.01.00.10 for the formal release
1. first formal version of macos 2. add the bambu networking plugin install logic 3. auto compute the wipe volume when filament change 4. add the logic of wiping into support 5. refine the GUI layout and icons, improve the gui apperance in lots of small places 6. serveral improve to support 7. support AMS auto-mapping 8. disable lots of unstable features: such as params table, media file download, HMS 9. fix serveral kinds of bugs 10. update the document of building 11. ...
This commit is contained in:
parent
e1528e4299
commit
e9e4d75877
267 changed files with 10326 additions and 32228 deletions
136
src/slic3r/GUI/Jobs/UpgradeNetworkJob.cpp
Normal file
136
src/slic3r/GUI/Jobs/UpgradeNetworkJob.cpp
Normal file
|
@ -0,0 +1,136 @@
|
|||
#include "UpgradeNetworkJob.hpp"
|
||||
|
||||
#include "slic3r/GUI/GUI.hpp"
|
||||
#include "slic3r/GUI/GUI_App.hpp"
|
||||
#include "slic3r/Utils/Http.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
||||
wxDEFINE_EVENT(EVT_UPGRADE_UPDATE_MESSAGE, wxCommandEvent);
|
||||
wxDEFINE_EVENT(EVT_UPGRADE_NETWORK_SUCCESS, wxCommandEvent);
|
||||
wxDEFINE_EVENT(EVT_UPGRADE_NETWORK_FAILED, wxCommandEvent);
|
||||
|
||||
|
||||
UpgradeNetworkJob::UpgradeNetworkJob(std::shared_ptr<ProgressIndicator> pri)
|
||||
: Job{std::move(pri)}
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
void UpgradeNetworkJob::on_exception(const std::exception_ptr &eptr)
|
||||
{
|
||||
try {
|
||||
if (eptr)
|
||||
std::rethrow_exception(eptr);
|
||||
} catch (std::exception &e) {
|
||||
UpgradeNetworkJob::on_exception(eptr);
|
||||
}
|
||||
}
|
||||
|
||||
void UpgradeNetworkJob::on_success(std::function<void()> success)
|
||||
{
|
||||
m_success_fun = success;
|
||||
}
|
||||
|
||||
void UpgradeNetworkJob::update_status(int st, const wxString &msg)
|
||||
{
|
||||
GUI::Job::update_status(st, msg);
|
||||
wxCommandEvent event(EVT_UPGRADE_UPDATE_MESSAGE);
|
||||
event.SetString(msg);
|
||||
event.SetEventObject(m_event_handle);
|
||||
wxPostEvent(m_event_handle, event);
|
||||
}
|
||||
|
||||
void UpgradeNetworkJob::process()
|
||||
{
|
||||
// downloading
|
||||
int result = 0;
|
||||
|
||||
AppConfig* app_config = wxGetApp().app_config;
|
||||
if (!app_config)
|
||||
return;
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << "[download_plugin]: enter";
|
||||
|
||||
// get temp path
|
||||
fs::path target_file_path = (fs::temp_directory_path() / "network_plugin.zip");
|
||||
fs::path tmp_path = target_file_path;
|
||||
auto path_str = tmp_path.string() + wxString::Format(".%d%s", get_current_pid(), ".tmp").ToStdString();
|
||||
tmp_path = fs::path(path_str);
|
||||
|
||||
auto cancel_fn = [this]() {
|
||||
return was_canceled();
|
||||
};
|
||||
int curr_percent = 0;
|
||||
result = wxGetApp().download_plugin(
|
||||
[this, &curr_percent](int state, int percent, bool &cancel) {
|
||||
if (state == InstallStatusNormal) {
|
||||
update_status(percent, _L("Downloading"));
|
||||
} else if (state == InstallStatusDownloadFailed) {
|
||||
update_status(percent, _L("Download failed"));
|
||||
} else {
|
||||
update_status(percent, _L("Downloading"));
|
||||
}
|
||||
curr_percent = percent;
|
||||
}, cancel_fn);
|
||||
|
||||
if (was_canceled()) {
|
||||
update_status(0, _L("Cancelled"));
|
||||
wxCommandEvent event(wxEVT_CLOSE_WINDOW);
|
||||
event.SetEventObject(m_event_handle);
|
||||
wxPostEvent(m_event_handle, event);
|
||||
return;
|
||||
}
|
||||
|
||||
if (result < 0) {
|
||||
update_status(curr_percent, _L("Download failed"));
|
||||
wxCommandEvent event(EVT_UPGRADE_NETWORK_FAILED);
|
||||
event.SetEventObject(m_event_handle);
|
||||
wxPostEvent(m_event_handle, event);
|
||||
return;
|
||||
}
|
||||
|
||||
result = wxGetApp().install_plugin([this](int state, int percent, bool&cancel) {
|
||||
if (state == InstallStatusInstallCompleted) {
|
||||
update_status(percent, _L("Finish"));
|
||||
} else {
|
||||
update_status(percent, _L("Installing"));
|
||||
}
|
||||
}, cancel_fn);
|
||||
|
||||
if (was_canceled()) {
|
||||
update_status(0, _L("Cancelled"));
|
||||
wxCommandEvent event(wxEVT_CLOSE_WINDOW);
|
||||
event.SetEventObject(m_event_handle);
|
||||
wxPostEvent(m_event_handle, event);
|
||||
return;
|
||||
}
|
||||
|
||||
if (result != 0) {
|
||||
update_status(curr_percent, _L("Install failed"));
|
||||
wxCommandEvent event(EVT_UPGRADE_NETWORK_FAILED);
|
||||
event.SetEventObject(m_event_handle);
|
||||
wxPostEvent(m_event_handle, event);
|
||||
return;
|
||||
}
|
||||
|
||||
wxCommandEvent event(EVT_UPGRADE_NETWORK_SUCCESS);
|
||||
event.SetEventObject(m_event_handle);
|
||||
wxPostEvent(m_event_handle, event);
|
||||
return;
|
||||
}
|
||||
|
||||
void UpgradeNetworkJob::finalize()
|
||||
{
|
||||
if (was_canceled()) return;
|
||||
|
||||
Job::finalize();
|
||||
}
|
||||
|
||||
void UpgradeNetworkJob::set_event_handle(wxWindow *hanle)
|
||||
{
|
||||
m_event_handle = hanle;
|
||||
}
|
||||
|
||||
}} // namespace Slic3r::GUI
|
Loading…
Add table
Add a link
Reference in a new issue