FIX: add some missing translate keys

1. Add missing translation keys
2. Fix filament map dialog can't display in auto mode

JIRA:STUDIO-10216

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: I0c3927877dd91befc2463a300324bc6823615673
This commit is contained in:
xun.zhang 2025-02-14 17:19:30 +08:00 committed by lane.wei
parent 6e74a4a77b
commit 3733f33953
7 changed files with 27 additions and 24 deletions

View File

@ -5,6 +5,8 @@
#include "ParameterUtils.hpp"
#include "GCode/ToolOrderUtils.hpp"
#include "FilamentGroupUtils.hpp"
#include "I18N.hpp"
// #define SLIC3R_DEBUG
// Make assert active if SLIC3R_DEBUG
@ -23,6 +25,13 @@
namespace Slic3r {
//! macro used to mark string used at localization,
//! return same string
#ifndef _L
#define _L(s) Slic3r::I18N::translate(s)
#endif
const static bool g_wipe_into_objects = false;
constexpr double similar_color_threshold_de2000 = 20.0;
@ -63,9 +72,8 @@ bool check_filament_printable_after_group(const std::vector<unsigned int> &used_
std::vector<std::string> limit_types = split_string(print_config->unprintable_filament_types.get_at(idx), ',');
auto iter = std::find(limit_types.begin(), limit_types.end(), filament_type);
if (iter != limit_types.end()) {
std::string error_msg;
std::string extruder_name = idx == 0 ? "left" : "right";
error_msg = "Grouping error: " + filament_type + " can not be placed in the " + extruder_name + " extruder";
std::string extruder_name = idx == 0 ? _L("left") : _L("right");
std::string error_msg = _L("Grouping error: ") + filament_type + _L(" can not be placed in the ") + extruder_name + _L(" nozzle");
throw Slic3r::RuntimeError(error_msg);
}
}
@ -1141,12 +1149,10 @@ void ToolOrdering::reorder_extruders_for_minimum_flush_volume(bool reorder_first
check_filament_printable_after_group(used_filaments, filament_maps, print_config);
if (nozzle_nums > 1 && !check_tpu_group(used_filaments, filament_maps, print_config)) {
if (map_mode == FilamentMapMode::fmmManual) {
throw Slic3r::RuntimeError(std::string("Manual grouping error: TPU can only be placed in a nozzle alone."));
}
else {
throw Slic3r::RuntimeError(std::string("Auto grouping error: TPU can only be placed in a nozzle alone."));
}
int master_extruder_id = print_config->master_extruder_id.value - 1; // to 0 based
std::string nozzle_name = master_extruder_id == 0 ? "left" : "right";
std::string exception_str = _L(std::string("TPU is incompatible with AMS and must be printed seperately in the ") + nozzle_name + " nozzle.\nPlease adjust the filament group accordingly.");
throw Slic3r::RuntimeError(exception_str);
}
}
else {

View File

@ -1923,12 +1923,10 @@ void Print::process(std::unordered_map<std::string, long long>* slice_time, bool
// check map valid both in auto and mannual mode
std::transform(filament_maps.begin(), filament_maps.end(), filament_maps.begin(), [](int value) {return value - 1; });
if (!ToolOrdering::check_tpu_group(used_filaments, filament_maps, &m_config)) {
if (map_mode == FilamentMapMode::fmmManual) {
throw Slic3r::RuntimeError(std::string("Manual grouping error: TPU can only be placed in a nozzle alone."));
}
else {
throw Slic3r::RuntimeError(std::string("Auto grouping error: TPU can only be placed in a nozzle alone."));
}
int master_extruder_id = m_config.master_extruder_id.value - 1; // to 0 based
std::string nozzle_name = master_extruder_id == 0 ? "left" : "right";
std::string exception_str = L(std::string("TPU is incompatible with AMS and must be printed seperately in the ") + nozzle_name + " nozzle.\nPlease adjust the filament group accordingly.");
throw Slic3r::RuntimeError(exception_str);
}
// print_object_instances_ordering = sort_object_instances_by_max_z(print);

View File

@ -53,8 +53,8 @@ FilamentGroupPopup::FilamentGroupPopup(wxWindow *parent) : PopupWindow(parent, w
const wxString AutoForMatchLabel = _L("Convenience Mode");
const wxString ManualLabel = _L("Custom Mode");
const wxString AutoForFlushDetail = _L("Recommends filament grouping for the left and right nozzles based on the most filament-saving principles to minimize waste");
const wxString AutoForMatchDetail = _L("Recommends filament grouping for the left and right nozzles based on the printer's actual filament status, reducing the need for manual filament adjustment");
const wxString AutoForFlushDetail = _L("Generates filament grouping for the left and right nozzles based on the most filament-saving principles to minimize waste");
const wxString AutoForMatchDetail = _L("Generates filament grouping for the left and right nozzles based on the printer's actual filament status, reducing the need for manual filament adjustment");
const wxString ManualDetail = _L("Manually assign filament to the left or right nozzle");
const wxString AutoForFlushDesp = ""; //_L("(Post-slicing arrangement)");

View File

@ -37,14 +37,13 @@ extern std::string& get_left_extruder_unprintable_text();
extern std::string& get_right_extruder_unprintable_text();
bool try_pop_up_before_slice(bool is_slice_all, Plater* plater_ref, PartPlate* partplate_ref)
bool try_pop_up_before_slice(bool is_slice_all, Plater* plater_ref, PartPlate* partplate_ref, bool force_pop_up)
{
auto full_config = wxGetApp().preset_bundle->full_config();
const auto nozzle_diameters = full_config.option<ConfigOptionFloatsNullable>("nozzle_diameter");
if (nozzle_diameters->size() <= 1)
return true;
bool force_pop_up = get_pop_up_remind_flag();
bool sync_plate = true;
std::vector<std::string> filament_colors = full_config.option<ConfigOptionStrings>("filament_colour")->values;
@ -52,7 +51,7 @@ bool try_pop_up_before_slice(bool is_slice_all, Plater* plater_ref, PartPlate* p
std::vector<int> applied_maps = get_applied_map(full_config, plater_ref, partplate_ref, sync_plate);
applied_maps.resize(filament_colors.size(), 1);
if (applied_mode != fmmManual)
if (!force_pop_up && applied_mode != fmmManual)
return true;
std::vector<int> filament_lists;

View File

@ -27,7 +27,7 @@ class PartPlate;
* @param partplate_ref Partplate to get/set plate filament map mode
* @return whether continue slicing
*/
bool try_pop_up_before_slice(bool is_slice_all, Plater* plater_ref, PartPlate* partplate_ref);
bool try_pop_up_before_slice(bool is_slice_all, Plater* plater_ref, PartPlate* partplate_ref, bool force_pop_up = false);
class FilamentMapDialog : public wxDialog

View File

@ -282,9 +282,9 @@ void GUI::FilamentMapBtnPanel::Show()
FilamentMapAutoPanel::FilamentMapAutoPanel(wxWindow *parent, FilamentMapMode mode, bool machine_synced) : wxPanel(parent)
{
const wxString AutoForFlushDetail = _L("Recommends filament grouping for the left and right nozzles based on the most filament-saving principles to minimize waste");
const wxString AutoForFlushDetail = _L("Generates filament grouping for the left and right nozzles based on the most filament-saving principles to minimize waste");
const wxString AutoForMatchDetail = _L("Recommends filament grouping for the left and right nozzles based on the printer's actual filament status, reducing the need for manual filament adjustment");
const wxString AutoForMatchDetail = _L("Generates filament grouping for the left and right nozzles based on the printer's actual filament status, reducing the need for manual filament adjustment");
auto sizer = new wxBoxSizer(wxHORIZONTAL);
m_flush_panel = new FilamentMapBtnPanel(this, _L("Filament-Saving Mode"), AutoForFlushDetail, "flush_mode_panel_icon");

View File

@ -2806,7 +2806,7 @@ void NotificationManager::bbl_show_filament_map_invalid_notification_before_slic
auto callback = [](wxEvtHandler*) {
auto plater = wxGetApp().plater();
auto partplate = plater->get_partplate_list().get_curr_plate();
try_pop_up_before_slice(false, plater, partplate); // ignore the return value
try_pop_up_before_slice(false, plater, partplate, true); // ignore the return value
return false;
};