From e1ee817a699ea366b91c00bd427af5e7bdd5e77c Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Wed, 19 Feb 2025 17:15:51 +0100 Subject: [PATCH 1/3] Moved ProfilesSharingUtils files into CLI folder --- src/CLI/LoadPrintData.cpp | 4 ++-- src/CLI/ProcessActions.cpp | 4 ++-- src/{libslic3r => CLI}/ProfilesSharingUtils.cpp | 14 +++++++------- src/{libslic3r => CLI}/ProfilesSharingUtils.hpp | 2 +- src/CMakeLists.txt | 2 ++ src/libslic3r/CMakeLists.txt | 2 -- 6 files changed, 14 insertions(+), 14 deletions(-) rename src/{libslic3r => CLI}/ProfilesSharingUtils.cpp (98%) rename src/{libslic3r => CLI}/ProfilesSharingUtils.hpp (97%) diff --git a/src/CLI/LoadPrintData.cpp b/src/CLI/LoadPrintData.cpp index fa64c43dc8..633bbc2844 100644 --- a/src/CLI/LoadPrintData.cpp +++ b/src/CLI/LoadPrintData.cpp @@ -11,10 +11,10 @@ #include "libslic3r/Config.hpp" #include "libslic3r/GCode/PostProcessor.hpp" #include "libslic3r/Model.hpp" -#include "libslic3r/ProfilesSharingUtils.hpp" #include "libslic3r/FileReader.hpp" -#include "CLI.hpp" +#include "CLI/CLI.hpp" +#include "CLI/ProfilesSharingUtils.hpp" namespace Slic3r::CLI { diff --git a/src/CLI/ProcessActions.cpp b/src/CLI/ProcessActions.cpp index 1a3452fa85..3d7254733f 100644 --- a/src/CLI/ProcessActions.cpp +++ b/src/CLI/ProcessActions.cpp @@ -23,7 +23,6 @@ #include "libslic3r/GCode/PostProcessor.hpp" #include "libslic3r/Model.hpp" #include "libslic3r/Preset.hpp" -#include "libslic3r/ProfilesSharingUtils.hpp" #include #include "libslic3r/Print.hpp" #include "libslic3r/SLAPrint.hpp" @@ -37,7 +36,8 @@ #include "libslic3r/MultipleBeds.hpp" #include "libslic3r/BuildVolume.hpp" -#include "CLI.hpp" +#include "CLI/CLI.hpp" +#include "CLI/ProfilesSharingUtils.hpp" #define STB_IMAGE_RESIZE_IMPLEMENTATION #include "stb_image_resize2.h" diff --git a/src/libslic3r/ProfilesSharingUtils.cpp b/src/CLI/ProfilesSharingUtils.cpp similarity index 98% rename from src/libslic3r/ProfilesSharingUtils.cpp rename to src/CLI/ProfilesSharingUtils.cpp index df83b4a541..70ce29b2e1 100644 --- a/src/libslic3r/ProfilesSharingUtils.cpp +++ b/src/CLI/ProfilesSharingUtils.cpp @@ -3,13 +3,13 @@ ///|/ PrusaSlicer is released under the terms of the AGPLv3 or higher ///|/ #include "ProfilesSharingUtils.hpp" -#include "Utils.hpp" -#include "format.hpp" -#include "PrintConfig.hpp" -#include "PresetBundle.hpp" -#include "Utils/DirectoriesUtils.hpp" -#include "Utils/JsonUtils.hpp" -#include "BuildVolume.hpp" +#include "libslic3r/Utils.hpp" +#include "libslic3r/format.hpp" +#include "libslic3r/PrintConfig.hpp" +#include "libslic3r/PresetBundle.hpp" +#include "libslic3r/Utils/DirectoriesUtils.hpp" +#include "libslic3r/Utils/JsonUtils.hpp" +#include "libslic3r/BuildVolume.hpp" #include diff --git a/src/libslic3r/ProfilesSharingUtils.hpp b/src/CLI/ProfilesSharingUtils.hpp similarity index 97% rename from src/libslic3r/ProfilesSharingUtils.hpp rename to src/CLI/ProfilesSharingUtils.hpp index d4e18f2a54..7e6d12d4d9 100644 --- a/src/libslic3r/ProfilesSharingUtils.hpp +++ b/src/CLI/ProfilesSharingUtils.hpp @@ -6,7 +6,7 @@ #define slic3r_ProfilesSharingUtils_hpp_ #include -#include "Config.hpp" +#include "libslic3r/Config.hpp" namespace Slic3r { diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ff579e82e7..c6ddf2e1d4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -109,6 +109,8 @@ set(SLIC3R_CLI_SOURCES CLI/ProcessTransform.cpp CLI/ProcessActions.cpp CLI/Run.cpp + CLI/ProfilesSharingUtils.cpp + CLI/ProfilesSharingUtils.hpp ) if (SLIC3R_GUI) list(APPEND SLIC3R_CLI_SOURCES diff --git a/src/libslic3r/CMakeLists.txt b/src/libslic3r/CMakeLists.txt index a880518ca3..d8c8d1e069 100644 --- a/src/libslic3r/CMakeLists.txt +++ b/src/libslic3r/CMakeLists.txt @@ -500,8 +500,6 @@ set(SLIC3R_SOURCES Arachne/WallToolPaths.hpp Arachne/WallToolPaths.cpp StaticMap.hpp - ProfilesSharingUtils.hpp - ProfilesSharingUtils.cpp Utils/DirectoriesUtils.hpp Utils/DirectoriesUtils.cpp Utils/JsonUtils.hpp From c19ce2cbaa1051ab350b858d73454eeef8128a39 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Wed, 19 Feb 2025 17:18:39 +0100 Subject: [PATCH 2/3] Follow-up 42d4f5c7: Reverted "export_sla" and "export_gcode" options into CLIActionsConfigDef --- src/CLI/ProcessActions.cpp | 10 +++++++++- src/libslic3r/PrintConfig.cpp | 2 -- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/CLI/ProcessActions.cpp b/src/CLI/ProcessActions.cpp index 3d7254733f..3c36dd5f96 100644 --- a/src/CLI/ProcessActions.cpp +++ b/src/CLI/ProcessActions.cpp @@ -298,8 +298,16 @@ bool process_actions(Data& cli, const DynamicPrintConfig& print_config, std::vec return 1; } - if (actions.has("slice")) { + if (actions.has("slice") || actions.has("export_gcode") || actions.has("export_sla")) { PrinterTechnology printer_technology = Preset::printer_technology(print_config); + if (actions.has("export_gcode") && printer_technology == ptSLA) { + boost::nowide::cerr << "error: cannot export G-code for an FFF configuration" << std::endl; + return 1; + } + else if (actions.has("export_sla") && printer_technology == ptFFF) { + boost::nowide::cerr << "error: cannot export SLA slices for a SLA configuration" << std::endl; + return 1; + } const Vec2crd gap{ s_multiple_beds.get_bed_gap() }; arr2::ArrangeBed bed = arr2::to_arrange_bed(get_bed_shape(print_config), gap); diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index f14110723e..3cc9dfaf3f 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -5792,7 +5792,6 @@ CLIActionsConfigDef::CLIActionsConfigDef() def->cli = "slice|s"; def->set_default_value(new ConfigOptionBool(false)); - /* looks like redundant actions. "slice" is complitely enough def = this->add("export_sla", coBool); def->label = L("Export SLA"); def->tooltip = L("Slice the model and export SLA printing layers as PNG."); @@ -5804,7 +5803,6 @@ CLIActionsConfigDef::CLIActionsConfigDef() def->tooltip = L("Slice the model and export toolpaths as G-code."); def->cli = "export-gcode|gcode|g"; def->set_default_value(new ConfigOptionBool(false)); -*/ } CLITransformConfigDef::CLITransformConfigDef() From 40fe9de63d4f636ac4addebeb5b07cdacc65f20f Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Tue, 18 Feb 2025 23:34:01 +0100 Subject: [PATCH 3/3] Some fixes in phrases --- src/libslic3r/PrintConfig.cpp | 16 +++++++------- src/slic3r/GUI/GUI_App.cpp | 12 +++++++++-- src/slic3r/GUI/GUI_App.hpp | 1 + src/slic3r/GUI/Plater.cpp | 6 ++++++ src/slic3r/GUI/UpdatesUIManager.cpp | 15 ++++++++++---- src/slic3r/GUI/UserAccount.cpp | 2 +- src/slic3r/GUI/UserAccount.hpp | 2 +- src/slic3r/GUI/UserAccountCommunication.cpp | 2 +- src/slic3r/GUI/UserAccountCommunication.hpp | 2 +- src/slic3r/GUI/WifiConfigDialog.cpp | 2 +- src/slic3r/Utils/PresetUpdaterWrapper.cpp | 23 ++++++++++++++------- 11 files changed, 57 insertions(+), 26 deletions(-) diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 3cc9dfaf3f..2f6836986c 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -738,6 +738,7 @@ void PrintConfigDef::init_fff_params() def->set_default_value(new ConfigOptionFloat(60)); def = this->add("over_bridge_speed", coFloatOrPercent); + // TRN: Label for speed used to print infill above bridges. def->label = L("Over bridges"); def->category = L("Speed"); def->tooltip = L("Speed for printing solid infill above bridges. Set to 0 to use solid infill speed. " @@ -1128,8 +1129,8 @@ void PrintConfigDef::init_fff_params() def = this->add("extruder_clearance_height", coFloat); def->label = L("Height"); def->tooltip = L("Only used when 'Print Settings -> Complete individual objects' is active. Set this to the vertical " - "distance between your nozzle tip and (usually) the X carriage rods so slicer can check for collisions " - "with previously printed objects and prevent them when arranging.\n" + "distance between your nozzle tip and (usually) the X carriage rods. Used to check for collisions " + "with previously printed objects and to prevent them when arranging.\n" "The value is ignored for most Prusa printers, which come with more detailed extruder model."); def->sidetext = L("mm"); def->min = 0; @@ -1138,9 +1139,10 @@ void PrintConfigDef::init_fff_params() def = this->add("extruder_clearance_radius", coFloat); def->label = L("Radius"); - def->tooltip = L("Only used when 'Print Settings -> Complete individual objects' is active. Set this so slicer can " - "check for collisions with previously printed objects and prevent them when arranging.\n" - "The value is ignored for most Prusa printers, which come with more detailed extruder model."); + def->tooltip = L("Only used when 'Print Settings -> Complete individual objects' is active. Set this to a radius " + "of a nozzle-centered cylinder big enough to enclose the extruder assembly. Used to check for collisions " + "with previously printed objects and to prevent them when arranging.\n" + "The value is ignored for most Prusa printers, which come with more detailed extruder model."); def->sidetext = L("mm"); def->min = 0; def->mode = comExpert; @@ -2018,7 +2020,7 @@ void PrintConfigDef::init_fff_params() def = this->add("interlocking_orientation", coFloat); def->label = L("Interlocking direction"); - def->tooltip = L("Orientation of interlock beams."); + def->tooltip = L("Orientation of interlocking beams."); def->sidetext = L("°"); def->min = 0; def->max = 360; @@ -5788,7 +5790,7 @@ CLIActionsConfigDef::CLIActionsConfigDef() def->label = L("Slice"); // def->tooltip = L("Slice the model as FFF or SLA based on the printer_technology configuration value."); def->tooltip = L("Slice the model as FFF or SLA based on the printer_technology configuration value " - "and export FFF printing toolpaths as G-code or SLA printing layers as PNG."); + "and export the result."); def->cli = "slice|s"; def->set_default_value(new ConfigOptionBool(false)); diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index a240bcc671..7039f822d8 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -1540,8 +1540,8 @@ bool GUI_App::on_init_inner() Bind(EVT_CONFIG_UPDATER_FAILED_ARCHIVE, [this](const wxCommandEvent& evt) { assert(!evt.GetString().empty()); - // TRN Notification text, 1 is list of vendors. - std::string notification_text = format(_u8L("Update Check Failed for the Following Vendors:\n\n%1%\nThis may be due to an account logout or a lost connection. Please verify your account status and internet connection. Then select \"Check for Configuration Updates\" to repeat."), evt.GetString()); + // TRN Notification text, %1% is list of vendors. + std::string notification_text = format(_u8L("Update check failed for the following vendors:\n\n%1%\nThis may be due to an account logout or a lost connection. Please verify your account status and internet connection. Then select \"Check for Configuration Updates\" to repeat."), evt.GetString()); notification_manager()->push_notification(NotificationType::FailedSecretVendorUpdateSync, NotificationManager::NotificationLevel::WarningNotificationLevel, notification_text); @@ -4229,6 +4229,14 @@ void GUI_App::open_link_in_printables(const std::string& url) mainframe->show_printables_tab(url); } + bool GUI_App::is_account_logged_in() const + { + if (!plater_ || !plater_->get_user_account()) { + return false; + } + return plater_->get_user_account()->is_logged(); + } + bool LogGui::ignorred_message(const wxString& msg) { for(const wxString& err : std::initializer_list{ wxString("cHRM chunk does not match sRGB"), diff --git a/src/slic3r/GUI/GUI_App.hpp b/src/slic3r/GUI/GUI_App.hpp index a5c98a35fc..230f936144 100644 --- a/src/slic3r/GUI/GUI_App.hpp +++ b/src/slic3r/GUI/GUI_App.hpp @@ -432,6 +432,7 @@ public: void printables_slice_request(const std::string& download_url, const std::string& model_url); void printables_login_request(); void open_link_in_printables(const std::string& url); + bool is_account_logged_in() const; private: bool on_init_inner(); void init_app_config(); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 9b0399c3c8..a4abcec3c4 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -1100,6 +1100,8 @@ void Plater::priv::init() this->notification_manager->push_notification(NotificationType::AccountTransientRetry , NotificationManager::NotificationLevel::RegularNotificationLevel , evt.data + // TRN: This is a hyperlink in a notification. It is preceded by a message from PrusaAccount (therefore not in this dictionary) + // saying something like "connection not established, I will keep trying". , _u8L("Stop now.") , [this](wxEvtHandler* ) { this->user_account->do_logout(); @@ -2169,8 +2171,12 @@ void Plater::priv::process_validation_warning(const std::vector& wa return true; }; } else if (text == "_BED_TEMPS_DIFFER" || text == "_BED_TEMPS_CHANGED") { + // TRN: Text of a notification, followed by (single) hyperlink to two of the config options. The sentence had to be split because of the hyperlink, sorry. + // The hyperlink part of the sentence reads "'Bed temperature by extruder' and 'Wipe tower extruder'", and it is also to be translated. text = _u8L("Bed temperatures for the used filaments differ significantly.\n" "For multi-material prints it is recommended to set the "); + // TRN: The other part of the sentence starting "Bed temperatures for the used" (also in the dictionary). Sorry for splitting it, technical reasons - + // this part of the sentence is a hyperlink. hypertext = _u8L("'Bed temperature by extruder' and 'Wipe tower extruder'"); multiline = true; notification_type = NotificationType::BedTemperaturesDiffer; diff --git a/src/slic3r/GUI/UpdatesUIManager.cpp b/src/slic3r/GUI/UpdatesUIManager.cpp index 3322e5d88e..0596a0e5e9 100644 --- a/src/slic3r/GUI/UpdatesUIManager.cpp +++ b/src/slic3r/GUI/UpdatesUIManager.cpp @@ -163,10 +163,17 @@ void RepositoryUpdateUIManager::fill_grids() if (entry.not_in_manifest) { wxStaticBitmap* bmp = new wxStaticBitmap(m_parent, wxID_ANY, *get_bmp_bundle("notification_warning")); - // TRN tooltip in Configuration Wizard - Configuration Sources - bmp->SetToolTip(_L("This source has installed vendors, yet you do not have rights to receive updates of it.\n" - "This may be because you are logged out. Log in to restore access to all your subscribed sources.\n" - "If you are logged in, please concider unsubscribing this source.")); + //wxGetApp().plater()->get_user_account() + if (wxGetApp().is_account_logged_in()) { + // TRN tooltip in Configuration Wizard - Configuration Sources + bmp->SetToolTip(_L("Some vendors were installed from this source, but you do not have the rights to receive updates from it.\n" + "This source may no longer be active, or your account may no longer be subscribed.\n" + "Please consider unsubscribing from this source.")); + } else { + // TRN tooltip in Configuration Wizard - Configuration Sources + bmp->SetToolTip(_L("Some vendors were installed from this source, but you do not have rights to receive updates from it.\n" + "Please log in to restore access to all your subscribed sources or consider unsubscribing from this source.")); + } add(bmp); } else if (!entry.visibility.empty()) { wxStaticBitmap* bmp = new wxStaticBitmap(m_parent, wxID_ANY, *get_bmp_bundle("info")); diff --git a/src/slic3r/GUI/UserAccount.cpp b/src/slic3r/GUI/UserAccount.cpp index b735da4393..4b48ff2c65 100644 --- a/src/slic3r/GUI/UserAccount.cpp +++ b/src/slic3r/GUI/UserAccount.cpp @@ -60,7 +60,7 @@ bool UserAccount::get_remember_session() return m_communication->get_remember_session(); } -bool UserAccount::is_logged() +bool UserAccount::is_logged() const { return m_communication->is_logged(); } diff --git a/src/slic3r/GUI/UserAccount.hpp b/src/slic3r/GUI/UserAccount.hpp index 65362eb812..5eb8b0384d 100644 --- a/src/slic3r/GUI/UserAccount.hpp +++ b/src/slic3r/GUI/UserAccount.hpp @@ -35,7 +35,7 @@ public: UserAccount(wxEvtHandler* evt_handler, Slic3r::AppConfig* app_config, const std::string& instance_hash); ~UserAccount(); - bool is_logged(); + bool is_logged() const; void do_login(); void do_logout(); wxString generate_login_redirect_url() { return m_communication->generate_login_redirect_url(); } diff --git a/src/slic3r/GUI/UserAccountCommunication.cpp b/src/slic3r/GUI/UserAccountCommunication.cpp index 0af26a86fc..cd753ff13d 100644 --- a/src/slic3r/GUI/UserAccountCommunication.cpp +++ b/src/slic3r/GUI/UserAccountCommunication.cpp @@ -429,7 +429,7 @@ void UserAccountCommunication::login_redirect() wxQueueEvent(m_evt_handler,new OpenPrusaAuthEvent(GUI::EVT_OPEN_PRUSAAUTH, {std::move(url1), std::move(url2)})); } -bool UserAccountCommunication::is_logged() +bool UserAccountCommunication::is_logged() const { return !m_username.empty(); } diff --git a/src/slic3r/GUI/UserAccountCommunication.hpp b/src/slic3r/GUI/UserAccountCommunication.hpp index 458857255e..a48e934955 100644 --- a/src/slic3r/GUI/UserAccountCommunication.hpp +++ b/src/slic3r/GUI/UserAccountCommunication.hpp @@ -46,7 +46,7 @@ public: // UI Session thread Interface // - bool is_logged(); + bool is_logged() const; void do_login(); void do_logout(); void do_clear(); diff --git a/src/slic3r/GUI/WifiConfigDialog.cpp b/src/slic3r/GUI/WifiConfigDialog.cpp index 058d86949f..5ffaedfc2b 100644 --- a/src/slic3r/GUI/WifiConfigDialog.cpp +++ b/src/slic3r/GUI/WifiConfigDialog.cpp @@ -251,7 +251,7 @@ void WifiConfigDialog::on_ok(wxCommandEvent& e) } if (boost::filesystem::exists(file_path)) { - // TRN placeholder 1 is path to file + // TRN placeholder %1% is path to file wxString msg_text = GUI::format_wxstr(_L("%1% already exists. Do you want to rewrite it?\n(Other items than Wi-Fi credentials will stay unchanged)"), file_path.string()); WarningDialog dialog(m_parent, msg_text, _L("Warning"), wxYES | wxNO); if (dialog.ShowModal() == wxID_NO) { diff --git a/src/slic3r/Utils/PresetUpdaterWrapper.cpp b/src/slic3r/Utils/PresetUpdaterWrapper.cpp index 3baac5887a..53f5d581ef 100644 --- a/src/slic3r/Utils/PresetUpdaterWrapper.cpp +++ b/src/slic3r/Utils/PresetUpdaterWrapper.cpp @@ -43,13 +43,20 @@ std::string proccess_failed_archives(const std::vector& failed_arch } return failed_vendors; } -void display_failed_vendors_dialog(wxWindow *parent, const std::string& failed_vendors) +void display_failed_vendors_dialog(wxWindow *parent, const std::string& failed_vendors, bool logged) { - // TRN Dialog text, 1 is list of vendors. - std::string dialog_text = format(_u8L("Update Check Failed for the Following Vendors:\n\n%1%\n" - "This may be because you are logged out. Log in to restore access to all your subscribed sources.\n" - "If you are logged in and a vendor is failing, it may no longer be available in your subscribed sources."), failed_vendors); - GUI::WarningDialog dialog(parent, dialog_text, _L("Update Check Failed"), wxOK); + std::string dialog_text; + if (logged) { + // TRN Dialog text, %1% is list of vendors. + dialog_text = format(_u8L("Update check failed for the following vendors:\n\n%1%\n" + "This may be because you are no longer subscribed to some configuration sources.\n" + "Please manage your configuration sources in Configuration Wizard"), failed_vendors); + } else { + // TRN Dialog text, %1% is list of vendors. + dialog_text = format(_u8L("Update check failed for the following vendors:\n\n%1%\n" + "Please log in to restore access to all your subscribed configuration sources."), failed_vendors); + } + GUI::WarningDialog dialog(parent, dialog_text, _L("Warning"), wxOK); dialog.ShowModal(); } } @@ -125,7 +132,7 @@ bool PresetUpdaterWrapper::wizard_sync(const PresetBundle* preset_bundle, const const SharedArchiveRepositoryVector &repos = m_preset_archive_database->get_selected_archive_repositories(); std::string failed_vendors = proccess_failed_archives(m_ui_status->get_failed_archives(), vendors_copy, repos); if (!failed_vendors.empty()) { - display_failed_vendors_dialog(parent, failed_vendors); + display_failed_vendors_dialog(parent, failed_vendors, GUI::wxGetApp().is_account_logged_in()); } // Offer update installation. @@ -208,7 +215,7 @@ PresetUpdater::UpdateResult PresetUpdaterWrapper::check_updates_on_user_request( const SharedArchiveRepositoryVector &repos = m_preset_archive_database->get_selected_archive_repositories(); std::string failed_vendors = proccess_failed_archives(m_ui_status->get_failed_archives(), vendors_copy, repos); if (!failed_vendors.empty()) { - display_failed_vendors_dialog(parent, failed_vendors); + display_failed_vendors_dialog(parent, failed_vendors, GUI::wxGetApp().is_account_logged_in()); } // preset_updater::config_update does show wxDialog