From d421f5b1f8c0a8a009a92328edcfd3973cde5224 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Sun, 31 Mar 2024 07:38:08 +0200 Subject: [PATCH 1/6] Revert "Merge branch 'dk_master_desktop_integration' into master_27x" This reverts commit 4b50c41799c867047a510a2a06f3c8e75a6b9dac, reversing changes made to b9d8b8ce72cc6f32c35a87bfe5a6e5dd21c37c18. --- src/slic3r/GUI/ConfigWizard.cpp | 25 +++++++-------- src/slic3r/GUI/GUI_App.cpp | 42 ++++++++++---------------- src/slic3r/GUI/NotificationManager.hpp | 2 +- src/slic3r/GUI/Preferences.cpp | 40 ++++++++++-------------- 4 files changed, 44 insertions(+), 65 deletions(-) diff --git a/src/slic3r/GUI/ConfigWizard.cpp b/src/slic3r/GUI/ConfigWizard.cpp index 1f84b18104..370ab33d68 100644 --- a/src/slic3r/GUI/ConfigWizard.cpp +++ b/src/slic3r/GUI/ConfigWizard.cpp @@ -1473,11 +1473,12 @@ PageDownloader::PageDownloader(ConfigWizard* parent) boldfont.SetWeight(wxFONTWEIGHT_BOLD); append_spacer(VERTICAL_SPACING); + auto* box_allow_downloads = new wxCheckBox(this, wxID_ANY, _L("Allow built-in downloader")); // TODO: Do we want it like this? The downloader is allowed for very first time the wizard is run. bool box_allow_value = (app_config->has("downloader_url_registered") ? app_config->get_bool("downloader_url_registered") : true); box_allow_downloads->SetValue(box_allow_value); - append(box_allow_downloads); + append(box_allow_downloads); // append info line with link on printables.com { @@ -1517,13 +1518,13 @@ PageDownloader::PageDownloader(ConfigWizard* parent) )); } -#if defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION) +#ifdef __linux__ append_text(wxString::Format(_L( "On Linux systems the process of registration also creates desktop integration files for this version of application." ))); -#endif //(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION) +#endif - box_allow_downloads->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent& event) { this->m_downloader->allow(event.IsChecked()); }); + box_allow_downloads->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent& event) { this->m_downloader->allow(event.IsChecked()); }); m_downloader = new DownloaderUtils::Worker(this); append(m_downloader); @@ -1581,7 +1582,7 @@ bool DownloaderUtils::Worker::perform_register(const std::string& path_override/ #elif __APPLE__ // Apple registers for custom url in info.plist thus it has to be already registered since build. // The url will always trigger opening of prusaslicer and we have to check that user has allowed it. (GUI_App::MacOpenURL is the triggered method) -#elif defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION) +#else // the performation should be called later during desktop integration perform_registration_linux = true; #endif @@ -1599,7 +1600,7 @@ void DownloaderUtils::Worker::deregister() key_full = key_string; #elif __APPLE__ // TODO -#elif defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION) +#else BOOST_LOG_TRIVIAL(debug) << "DesktopIntegrationDialog::undo_downloader_registration"; DesktopIntegrationDialog::undo_downloader_registration(); perform_registration_linux = false; @@ -2407,9 +2408,7 @@ void ConfigWizard::priv::load_pages() btn_finish->Enable(any_fff_selected || any_sla_selected || custom_printer_selected || custom_printer_in_bundle); index->add_page(page_update); -#if !defined(__linux__) || (defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)) index->add_page(page_downloader); -#endif index->add_page(page_reload_from_disk); #ifdef _WIN32 index->add_page(page_files_association); @@ -2776,12 +2775,12 @@ void ConfigWizard::priv::on_3rdparty_install(const VendorProfile *vendor, bool i bool ConfigWizard::priv::on_bnt_finish() { wxBusyCursor wait; -#if !defined(__linux__) || (defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)) + if (!page_downloader->on_finish_downloader()) { index->go_to(page_downloader); return false; } -#endif + /* If some printers were added/deleted, but related MaterialPage wasn't activated, * than last changes wouldn't be updated for filaments/materials. * SO, do that before check_and_install_missing_materials() @@ -3064,14 +3063,14 @@ bool ConfigWizard::priv::apply_config(AppConfig *app_config, PresetBundle *prese if ((check_unsaved_preset_changes = install_bundles.size() > 0)) header = _L_PLURAL("A new vendor was installed and one of its printers will be activated", "New vendors were installed and one of theirs printers will be activated", install_bundles.size()); -#if defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION) +#ifdef __linux__ // Desktop integration on Linux BOOST_LOG_TRIVIAL(debug) << "ConfigWizard::priv::apply_config integrate_desktop" << page_welcome->integrate_desktop() << " perform_registration_linux " << page_downloader->m_downloader->get_perform_registration_linux(); if (page_welcome->integrate_desktop()) DesktopIntegrationDialog::perform_desktop_integration(); if (page_downloader->m_downloader->get_perform_registration_linux()) DesktopIntegrationDialog::perform_downloader_desktop_integration(); -#endif //(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION) +#endif // Decide whether to create snapshot based on run_reason and the reset profile checkbox bool snapshot = true; @@ -3405,9 +3404,7 @@ ConfigWizard::ConfigWizard(wxWindow *parent) p->add_page(p->page_update = new PageUpdate(this)); -#if !defined(__linux__) || (defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)) p->add_page(p->page_downloader = new PageDownloader(this)); -#endif p->add_page(p->page_reload_from_disk = new PageReloadFromDisk(this)); #ifdef _WIN32 p->add_page(p->page_files_association = new PageFilesAssociation(this)); diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 06d260771d..4ade379083 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -2987,7 +2987,13 @@ void GUI_App::MacOpenFiles(const wxArrayString &fileNames) void GUI_App::MacOpenURL(const wxString& url) { - start_download(into_u8(url)); + if (app_config && !app_config->get_bool("downloader_url_registered")) + { + notification_manager()->push_notification(NotificationType::URLNotRegistered); + BOOST_LOG_TRIVIAL(error) << "Recieved command to open URL, but it is not allowed in app configuration. URL: " << url; + return; + } + start_download(boost::nowide::narrow(url)); } #endif /* __APPLE */ @@ -3158,9 +3164,6 @@ void GUI_App::show_desktop_integration_dialog() void GUI_App::show_downloader_registration_dialog() { -#if defined(__linux__) && !defined(SLIC3R_DESKTOP_INTEGRATION) - return; -#endif InfoDialog msg(nullptr , format_wxstr(_L("Welcome to %1% version %2%."), SLIC3R_APP_NAME, SLIC3R_VERSION) , format_wxstr(_L( @@ -3172,10 +3175,10 @@ void GUI_App::show_downloader_registration_dialog() if (msg.ShowModal() == wxID_YES) { auto downloader_worker = new DownloaderUtils::Worker(nullptr); downloader_worker->perform_register(app_config->get("url_downloader_dest")); -#if defined(__linux__) +#ifdef __linux__ if (downloader_worker->get_perform_registration_linux()) DesktopIntegrationDialog::perform_downloader_desktop_integration(); -#endif //(__linux__) +#endif // __linux__ } else { app_config->set("downloader_url_registered", "0"); } @@ -3555,27 +3558,14 @@ void GUI_App::start_download(std::string url) BOOST_LOG_TRIVIAL(error) << "Could not start URL download: plater is nullptr."; return; } - - // Windows register and deregister executable path to registry - cant get here when not registered - // Apple registers via info.plist attached to exectable - might get here - // Linux registers via desktop integration file - might get here only if such file was created outside Slicer. - // Desktop integration is limited with SLIC3R_DESKTOP_INTEGRATION (cmake option). -#if defined(__APPLE__) || (defined(__linux__) && !defined(SLIC3R_DESKTOP_INTEGRATION)) - if (app_config && app_config->get_bool("downloader_url_registered")) { - notification_manager()->push_notification(NotificationType::URLNotRegistered); - BOOST_LOG_TRIVIAL(error) << "Recieved command to open URL, but it is not allowed in app configuration. URL: " << url; - return; - } -#endif //defined(__APPLE__) || (defined(__linux__) && !defined(SLIC3R_DESKTOP_INTEGRATION)) - //lets always init so if the download dest folder was changed, new dest is used - boost::filesystem::path dest_folder(app_config->get("url_downloader_dest")); - if (dest_folder.empty() || !boost::filesystem::is_directory(dest_folder)) { - std::string msg = _u8L("Could not start URL download. Destination folder is not set. Please choose destination folder in Configuration Wizard."); - BOOST_LOG_TRIVIAL(error) << msg; - show_error(nullptr, msg); - return; - } + boost::filesystem::path dest_folder(app_config->get("url_downloader_dest")); + if (dest_folder.empty() || !boost::filesystem::is_directory(dest_folder)) { + std::string msg = _u8L("Could not start URL download. Destination folder is not set. Please choose destination folder in Configuration Wizard."); + BOOST_LOG_TRIVIAL(error) << msg; + show_error(nullptr, msg); + return; + } m_downloader->init(dest_folder); m_downloader->start_download(url); } diff --git a/src/slic3r/GUI/NotificationManager.hpp b/src/slic3r/GUI/NotificationManager.hpp index 2f68c9384f..d74b28af60 100644 --- a/src/slic3r/GUI/NotificationManager.hpp +++ b/src/slic3r/GUI/NotificationManager.hpp @@ -126,7 +126,7 @@ enum class NotificationType ExportOngoing, // Progressbar of download from prusaslicer:// url URLDownload, - // MacOS and Linux flatpack (SLIC3R_DESKTOP_INTEGRATION = 0) specific - PS comes forward even when downloader is not allowed + // MacOS specific - PS comes forward even when downloader is not allowed URLNotRegistered, // Config file was detected during startup, open wifi config dialog via hypertext WifiConfigFileDetected diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index 750869b949..37e3422c59 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -1,11 +1,11 @@ -///|/ Copyright (c) Prusa Research 2018 - 2023 Oleksandra Iushchenko @YuSanka, David Kocík @kocikdav, Vojtěch Bubník @bubnikv, Pavel Mikuš @Godrak, Enrico Turri @enricoturri1966, Lukáš Matěna @lukasmatena, Vojtěch Král @vojtechkral -///|/ -///|/ ported from lib/Slic3r/GUI/Preferences.pm: -///|/ Copyright (c) Prusa Research 2016 - 2018 Vojtěch Bubník @bubnikv -///|/ Copyright (c) Slic3r 2013 - 2014 Alessandro Ranellucci @alranel -///|/ -///|/ PrusaSlicer is released under the terms of the AGPLv3 or higher -///|/ +///|/ Copyright (c) Prusa Research 2018 - 2023 Oleksandra Iushchenko @YuSanka, David Kocík @kocikdav, Vojtěch Bubník @bubnikv, Pavel Mikuš @Godrak, Enrico Turri @enricoturri1966, Lukáš Matěna @lukasmatena, Vojtěch Král @vojtechkral +///|/ +///|/ ported from lib/Slic3r/GUI/Preferences.pm: +///|/ Copyright (c) Prusa Research 2016 - 2018 Vojtěch Bubník @bubnikv +///|/ Copyright (c) Slic3r 2013 - 2014 Alessandro Ranellucci @alranel +///|/ +///|/ PrusaSlicer is released under the terms of the AGPLv3 or higher +///|/ #include "Preferences.hpp" #include "OptionsGroup.hpp" #include "GUI_App.hpp" @@ -28,13 +28,9 @@ #ifdef WIN32 #include #endif // WIN32 -#if defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION) +#ifdef __linux__ #include "DesktopIntegrationDialog.hpp" -#endif //(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION) - -#if defined(__linux__) && !defined(SLIC3R_DESKTOP_INTEGRATION) -#include "NotificationManager.hpp" -#endif //(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION) +#endif //__linux__ namespace Slic3r { @@ -134,10 +130,10 @@ void PreferencesDialog::show(const std::string& highlight_opt_key /*= std::strin if (wxGetApp().is_editor()) { auto app_config = get_app_config(); -#if !defined(__linux__) || (defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)) + downloader->set_path_name(app_config->get("url_downloader_dest")); downloader->allow(!app_config->has("downloader_url_registered") || app_config->get_bool("downloader_url_registered")); -#endif + for (const std::string& opt_key : {"suppress_hyperlinks", "downloader_url_registered"}) m_optgroup_other->set_value(opt_key, app_config->get_bool(opt_key)); @@ -644,17 +640,15 @@ void PreferencesDialog::build() //L("If enabled, the descriptions of configuration parameters in settings tabs wouldn't work as hyperlinks. " // "If disabled, the descriptions of configuration parameters in settings tabs will work as hyperlinks."), app_config->get_bool("suppress_hyperlinks")); -#if !defined(__linux__) || (defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)) + append_bool_option(m_optgroup_other, "downloader_url_registered", L("Allow downloads from Printables.com"), L("If enabled, PrusaSlicer will be allowed to download from Printables.com"), app_config->get_bool("downloader_url_registered")); -#endif activate_options_tab(m_optgroup_other); -#if !defined(__linux__) || (defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)) + create_downloader_path_sizer(); -#endif create_settings_font_widget(); #if ENABLE_ENVIRONMENT_MAP @@ -759,18 +753,16 @@ void PreferencesDialog::update_ctrls_alignment() void PreferencesDialog::accept(wxEvent&) { -#if !defined(__linux__) || (defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION)) if(wxGetApp().is_editor()) { if (const auto it = m_values.find("downloader_url_registered"); it != m_values.end()) downloader->allow(it->second == "1"); if (!downloader->on_finish()) return; -#if defined(__linux__) +#ifdef __linux__ if( downloader->get_perform_registration_linux()) DesktopIntegrationDialog::perform_downloader_desktop_integration(); -#endif +#endif // __linux__ } -#endif std::vector options_to_recreate_GUI = { "no_defaults", "tabs_as_menu", "sys_menu_enabled", "font_pt_size", "suppress_round_corners" }; From 691900201a6cdae06dc80ffad81ce21bb70cfa58 Mon Sep 17 00:00:00 2001 From: Elia Devito Date: Wed, 14 Feb 2024 21:03:07 +0100 Subject: [PATCH 2/6] Don't perform downloader desktop integration if built with SLIC3R_DESKTOP_INTEGRATION = 0 (PR #12252) --- src/slic3r/GUI/ConfigWizard.cpp | 12 ++++++------ src/slic3r/GUI/GUI_App.cpp | 4 ++-- src/slic3r/GUI/Preferences.cpp | 24 ++++++++++++------------ 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/slic3r/GUI/ConfigWizard.cpp b/src/slic3r/GUI/ConfigWizard.cpp index 370ab33d68..cecb8f4acd 100644 --- a/src/slic3r/GUI/ConfigWizard.cpp +++ b/src/slic3r/GUI/ConfigWizard.cpp @@ -1518,11 +1518,11 @@ PageDownloader::PageDownloader(ConfigWizard* parent) )); } -#ifdef __linux__ +#if defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION) append_text(wxString::Format(_L( "On Linux systems the process of registration also creates desktop integration files for this version of application." ))); -#endif +#endif //(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION) box_allow_downloads->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent& event) { this->m_downloader->allow(event.IsChecked()); }); @@ -1582,7 +1582,7 @@ bool DownloaderUtils::Worker::perform_register(const std::string& path_override/ #elif __APPLE__ // Apple registers for custom url in info.plist thus it has to be already registered since build. // The url will always trigger opening of prusaslicer and we have to check that user has allowed it. (GUI_App::MacOpenURL is the triggered method) -#else +#elif defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION) // the performation should be called later during desktop integration perform_registration_linux = true; #endif @@ -1600,7 +1600,7 @@ void DownloaderUtils::Worker::deregister() key_full = key_string; #elif __APPLE__ // TODO -#else +#elif defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION) BOOST_LOG_TRIVIAL(debug) << "DesktopIntegrationDialog::undo_downloader_registration"; DesktopIntegrationDialog::undo_downloader_registration(); perform_registration_linux = false; @@ -3063,14 +3063,14 @@ bool ConfigWizard::priv::apply_config(AppConfig *app_config, PresetBundle *prese if ((check_unsaved_preset_changes = install_bundles.size() > 0)) header = _L_PLURAL("A new vendor was installed and one of its printers will be activated", "New vendors were installed and one of theirs printers will be activated", install_bundles.size()); -#ifdef __linux__ +#if defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION) // Desktop integration on Linux BOOST_LOG_TRIVIAL(debug) << "ConfigWizard::priv::apply_config integrate_desktop" << page_welcome->integrate_desktop() << " perform_registration_linux " << page_downloader->m_downloader->get_perform_registration_linux(); if (page_welcome->integrate_desktop()) DesktopIntegrationDialog::perform_desktop_integration(); if (page_downloader->m_downloader->get_perform_registration_linux()) DesktopIntegrationDialog::perform_downloader_desktop_integration(); -#endif +#endif //(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION) // Decide whether to create snapshot based on run_reason and the reset profile checkbox bool snapshot = true; diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 4ade379083..7ed36aee3e 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -3175,10 +3175,10 @@ void GUI_App::show_downloader_registration_dialog() if (msg.ShowModal() == wxID_YES) { auto downloader_worker = new DownloaderUtils::Worker(nullptr); downloader_worker->perform_register(app_config->get("url_downloader_dest")); -#ifdef __linux__ +#if defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION) if (downloader_worker->get_perform_registration_linux()) DesktopIntegrationDialog::perform_downloader_desktop_integration(); -#endif // __linux__ +#endif //(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION) } else { app_config->set("downloader_url_registered", "0"); } diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index 37e3422c59..979ac11d30 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -1,11 +1,11 @@ -///|/ Copyright (c) Prusa Research 2018 - 2023 Oleksandra Iushchenko @YuSanka, David Kocík @kocikdav, Vojtěch Bubník @bubnikv, Pavel Mikuš @Godrak, Enrico Turri @enricoturri1966, Lukáš Matěna @lukasmatena, Vojtěch Král @vojtechkral -///|/ -///|/ ported from lib/Slic3r/GUI/Preferences.pm: -///|/ Copyright (c) Prusa Research 2016 - 2018 Vojtěch Bubník @bubnikv -///|/ Copyright (c) Slic3r 2013 - 2014 Alessandro Ranellucci @alranel -///|/ -///|/ PrusaSlicer is released under the terms of the AGPLv3 or higher -///|/ +///|/ Copyright (c) Prusa Research 2018 - 2023 Oleksandra Iushchenko @YuSanka, David Kocík @kocikdav, Vojtěch Bubník @bubnikv, Pavel Mikuš @Godrak, Enrico Turri @enricoturri1966, Lukáš Matěna @lukasmatena, Vojtěch Král @vojtechkral +///|/ +///|/ ported from lib/Slic3r/GUI/Preferences.pm: +///|/ Copyright (c) Prusa Research 2016 - 2018 Vojtěch Bubník @bubnikv +///|/ Copyright (c) Slic3r 2013 - 2014 Alessandro Ranellucci @alranel +///|/ +///|/ PrusaSlicer is released under the terms of the AGPLv3 or higher +///|/ #include "Preferences.hpp" #include "OptionsGroup.hpp" #include "GUI_App.hpp" @@ -28,9 +28,9 @@ #ifdef WIN32 #include #endif // WIN32 -#ifdef __linux__ +#if defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION) #include "DesktopIntegrationDialog.hpp" -#endif //__linux__ +#endif //(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION) namespace Slic3r { @@ -758,10 +758,10 @@ void PreferencesDialog::accept(wxEvent&) downloader->allow(it->second == "1"); if (!downloader->on_finish()) return; -#ifdef __linux__ +#if defined(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION) if( downloader->get_perform_registration_linux()) DesktopIntegrationDialog::perform_downloader_desktop_integration(); -#endif // __linux__ +#endif //(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION) } std::vector options_to_recreate_GUI = { "no_defaults", "tabs_as_menu", "sys_menu_enabled", "font_pt_size", "suppress_round_corners" }; From 6c8359f6ec4785d93d7050779967388d8e4319e4 Mon Sep 17 00:00:00 2001 From: David Kocik Date: Fri, 16 Feb 2024 09:54:58 +0100 Subject: [PATCH 3/6] check if downloads are allowed also on linux when SLIC3R_DESKTOP_INTEGRATION = 0 --- src/slic3r/GUI/GUI_App.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 7ed36aee3e..0a911b2298 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -2987,13 +2987,7 @@ void GUI_App::MacOpenFiles(const wxArrayString &fileNames) void GUI_App::MacOpenURL(const wxString& url) { - if (app_config && !app_config->get_bool("downloader_url_registered")) - { - notification_manager()->push_notification(NotificationType::URLNotRegistered); - BOOST_LOG_TRIVIAL(error) << "Recieved command to open URL, but it is not allowed in app configuration. URL: " << url; - return; - } - start_download(boost::nowide::narrow(url)); + start_download(into_u8(url)); } #endif /* __APPLE */ @@ -3558,6 +3552,16 @@ void GUI_App::start_download(std::string url) BOOST_LOG_TRIVIAL(error) << "Could not start URL download: plater is nullptr."; return; } + + #if defined(__APPLE__) || (defined(__linux__) && !defined(SLIC3R_DESKTOP_INTEGRATION)) + if (app_config && !app_config->get_bool("downloader_url_registered")) + { + notification_manager()->push_notification(NotificationType::URLNotRegistered); + BOOST_LOG_TRIVIAL(error) << "Received command to open URL, but it is not allowed in app configuration. URL: " << url; + return; + } + #endif //defined(__APPLE__) || (defined(__linux__) && !defined(SLIC3R_DESKTOP_INTEGRATION)) + //lets always init so if the download dest folder was changed, new dest is used boost::filesystem::path dest_folder(app_config->get("url_downloader_dest")); if (dest_folder.empty() || !boost::filesystem::is_directory(dest_folder)) { @@ -3565,7 +3569,7 @@ void GUI_App::start_download(std::string url) BOOST_LOG_TRIVIAL(error) << msg; show_error(nullptr, msg); return; - } + } m_downloader->init(dest_folder); m_downloader->start_download(url); } From 9974e9566122948e58adb204fd9d488b29a55515 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Thu, 4 Apr 2024 13:57:23 +0200 Subject: [PATCH 4/6] Bumped up version to 2.7.4 --- version.inc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/version.inc b/version.inc index d8d5432550..6d20f3e650 100644 --- a/version.inc +++ b/version.inc @@ -3,7 +3,7 @@ set(SLIC3R_APP_NAME "PrusaSlicer") set(SLIC3R_APP_KEY "PrusaSlicer") -set(SLIC3R_VERSION "2.7.3") +set(SLIC3R_VERSION "2.7.4") set(SLIC3R_BUILD_ID "PrusaSlicer-${SLIC3R_VERSION}+UNKNOWN") -set(SLIC3R_RC_VERSION "2,7,3,0") -set(SLIC3R_RC_VERSION_DOTS "2.7.3.0") +set(SLIC3R_RC_VERSION "2,7,4,0") +set(SLIC3R_RC_VERSION_DOTS "2.7.4.0") From 6e75a2e16d79cfb9d960d28bd5205973bd7db04e Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Thu, 4 Apr 2024 21:55:29 +0200 Subject: [PATCH 5/6] Allow more complex URLs when downloading from Printables --- src/slic3r/GUI/Downloader.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/slic3r/GUI/Downloader.cpp b/src/slic3r/GUI/Downloader.cpp index 529230df5b..7a3a631ea4 100644 --- a/src/slic3r/GUI/Downloader.cpp +++ b/src/slic3r/GUI/Downloader.cpp @@ -66,11 +66,11 @@ void open_folder(const std::string& path) std::string filename_from_url(const std::string& url) { - // TODO: can it be done with curl? - size_t slash = url.find_last_of("/"); - if (slash == std::string::npos && slash != url.size() - 1) + std::string url_plain = std::string(url.begin(), std::find(url.begin(), url.end(), '?')); + size_t slash = url_plain.find_last_of("/"); + if (slash == std::string::npos) return std::string(); - return url.substr(slash + 1, url.size() - slash + 1); + return std::string(url_plain.begin() + slash + 1, url_plain.end()); } } From dba0377c298ab2752d2f80b5ca89d619bb984415 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Thu, 4 Apr 2024 22:03:58 +0200 Subject: [PATCH 6/6] Load MM painting produced by BambuStudio (#12502) --- src/libslic3r/Format/3mf.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/Format/3mf.cpp b/src/libslic3r/Format/3mf.cpp index db5c064686..47b31ec474 100644 --- a/src/libslic3r/Format/3mf.cpp +++ b/src/libslic3r/Format/3mf.cpp @@ -1971,7 +1971,15 @@ namespace Slic3r { m_curr_object.geometry.custom_supports.push_back(get_attribute_value_string(attributes, num_attributes, CUSTOM_SUPPORTS_ATTR)); m_curr_object.geometry.custom_seam.push_back(get_attribute_value_string(attributes, num_attributes, CUSTOM_SEAM_ATTR)); - m_curr_object.geometry.mm_segmentation.push_back(get_attribute_value_string(attributes, num_attributes, MM_SEGMENTATION_ATTR)); + + // Now load MM segmentation data. Unfortunately, BambuStudio has changed the attribute name after they forked us, + // leading to https://github.com/prusa3d/PrusaSlicer/issues/12502. Let's try to load both keys if the usual + // one that PrusaSlicer uses is not present. + std::string mm_segmentation_serialized = get_attribute_value_string(attributes, num_attributes, MM_SEGMENTATION_ATTR); + if (mm_segmentation_serialized.empty()) + mm_segmentation_serialized = get_attribute_value_string(attributes, num_attributes, "paint_color"); + m_curr_object.geometry.mm_segmentation.push_back(mm_segmentation_serialized); + return true; }