calibration update: translation & protect

* update labels to be localizable
 * only create stamps when possible, to avoid crashes by missing file.
supermerill/SuperSlicer#1268
This commit is contained in:
supermerill 2021-06-07 19:43:16 +02:00
parent fcbd12c78f
commit 6008f0cef5
8 changed files with 56 additions and 53 deletions

View File

@ -82,7 +82,7 @@ ModelObject* CalibrationAbstractDialog::add_part(ModelObject* model_object, std:
model = Model::read_from_file(input_file);
}
catch (std::exception & e) {
auto msg = _(L("Error!")) + " " + input_file + " : " + e.what() + ".";
auto msg = _L("Error!") + " " + input_file + " : " + e.what() + ".";
show_error(this, msg);
exit(1);
}
@ -147,7 +147,7 @@ wxPanel* CalibrationAbstractDialog::create_header(wxWindow* parent, const wxFont
sizer->AddStretchSpacer();
// text
wxStaticText* text = new wxStaticText(panel, wxID_ANY, _(L("Keyboard shortcuts")));
wxStaticText* text = new wxStaticText(panel, wxID_ANY, _L("Keyboard shortcuts"));
text->SetFont(header_font);
sizer->Add(text, 0, wxALIGN_CENTER_VERTICAL);

View File

@ -33,7 +33,7 @@ void CalibrationBedDialog::create_buttons(wxStdDialogButtonSizer* buttons){
void CalibrationBedDialog::create_geometry(wxCommandEvent& event_args) {
Plater* plat = this->main_frame->plater();
Model& model = plat->model();
if (!plat->new_project("First layer calibration"))
if (!plat->new_project(L("First layer calibration")))
return;
bool autocenter = gui_app->app_config->get("autocenter") == "1";

View File

@ -28,17 +28,17 @@ namespace GUI {
void CalibrationBridgeDialog::create_buttons(wxStdDialogButtonSizer* buttons){
wxString choices_steps[] = { "5","10","15" };
steps = new wxComboBox(this, wxID_ANY, wxString{ "10" }, wxDefaultPosition, wxDefaultSize, 3, choices_steps);
steps->SetToolTip(_(L("Select the step in % between two tests.")));
steps->SetToolTip(_L("Select the step in % between two tests.\nNote that only multiple of 5 are engraved on the parts."));
steps->SetSelection(1);
wxString choices_nb[] = { "1","2","3","4","5","6" };
nb_tests = new wxComboBox(this, wxID_ANY, wxString{ "5" }, wxDefaultPosition, wxDefaultSize, 6, choices_nb);
nb_tests->SetToolTip(_(L("Select the number of tests")));
nb_tests->SetToolTip(_L("Select the number of tests"));
nb_tests->SetSelection(4);
buttons->Add(new wxStaticText(this, wxID_ANY, wxString{ "step:" }));
buttons->Add(new wxStaticText(this, wxID_ANY,_L("Step:")));
buttons->Add(steps);
buttons->AddSpacer(15);
buttons->Add(new wxStaticText(this, wxID_ANY, wxString{ "nb tests:" }));
buttons->Add(new wxStaticText(this, wxID_ANY, _L("Nb tests:")));
buttons->Add(nb_tests);
buttons->AddSpacer(40);
wxButton* bt = new wxButton(this, wxID_FILE1, _L("Test Flow Ratio"));
@ -53,7 +53,7 @@ void CalibrationBridgeDialog::create_buttons(wxStdDialogButtonSizer* buttons){
void CalibrationBridgeDialog::create_geometry(std::string setting_to_test, bool add) {
Plater* plat = this->main_frame->plater();
Model& model = plat->model();
if (!plat->new_project("Bridge calibration"))
if (!plat->new_project(L("Bridge calibration")))
return;
bool autocenter = gui_app->app_config->get("autocenter") == "1";
@ -99,10 +99,11 @@ void CalibrationBridgeDialog::create_geometry(std::string setting_to_test, bool
int start = bridge_flow_ratio->value;
float zshift = 2.3 * (1 - z_scale);
for (size_t i = 0; i < nb_items; i++) {
if((start + (add ? 1 : -1) * i * step) < 180 && (start + (add ? 1 : -1) * i * step) > 20)
add_part(model.objects[objs_idx[i]], Slic3r::resources_dir() + "/calibration/bridge_flow/f"+std::to_string(start + (add ? 1 : -1) * i * step)+".amf", Vec3d{ -10,0, zshift + 4.6 * z_scale }, Vec3d{ 1,1,z_scale });
int step_num = (start + (add ? 1 : -1) * i * step);
if (step_num < 180 && step_num > 20 && step_num%5 == 0) {
add_part(model.objects[objs_idx[i]], Slic3r::resources_dir() + "/calibration/bridge_flow/f" + std::to_string(step_num) + ".amf", Vec3d{ -10,0, zshift + 4.6 * z_scale }, Vec3d{ 1,1,z_scale });
}
}
/// --- translate ---;
bool has_to_arrange = false;
const float brim_width = std::max(print_config->option<ConfigOptionFloat>("brim_width")->value, nozzle_diameter * 5.);

View File

@ -26,37 +26,38 @@ namespace GUI {
void CalibrationCubeDialog::create_buttons(wxStdDialogButtonSizer* buttons){
wxString choices_scale[] = { "10", "20", "30", "40" };
scale = new wxComboBox(this, wxID_ANY, wxString{ "20" }, wxDefaultPosition, wxDefaultSize, 4, choices_scale);
scale->SetToolTip(_(L("You can choose the dimension of the cube. It's a simple scale, you can modify it in the right panel yourself if you prefer. It's just quicker to select it here.")));
scale->SetToolTip(_L("You can choose the dimension of the cube."
" It's a simple scale, you can modify it in the right panel yourself if you prefer. It's just quicker to select it here."));
scale->SetSelection(1);
wxString choices_goal[] = { "Dimensional accuracy (default)" , "infill/perimeter overlap"/*, "external perimeter overlap"*/};
calibrate = new wxComboBox(this, wxID_ANY, wxString{ "Dimensional accuracy (default)" }, wxDefaultPosition, wxDefaultSize, 2, choices_goal);
calibrate->SetToolTip(_(L("Select a goal, this will change settings to increase the effects to search.")));
calibrate = new wxComboBox(this, wxID_ANY, _L("Dimensional accuracy (default)"), wxDefaultPosition, wxDefaultSize, 2, choices_goal);
calibrate->SetToolTip(_L("Select a goal, this will change settings to increase the effects to search."));
calibrate->SetSelection(0);
calibrate->SetEditable(false);
buttons->Add(new wxStaticText(this, wxID_ANY, wxString{ "dimension:" }));
buttons->Add(new wxStaticText(this, wxID_ANY, _L("Dimension:")));
buttons->Add(scale);
buttons->Add(new wxStaticText(this, wxID_ANY, wxString{ "mm" }));
buttons->Add(new wxStaticText(this, wxID_ANY, _L("mm")));
buttons->AddSpacer(40);
buttons->Add(new wxStaticText(this, wxID_ANY, wxString{ "goal:" }));
buttons->Add(new wxStaticText(this, wxID_ANY, _L("Goal:")));
buttons->Add(calibrate);
buttons->AddSpacer(40);
wxButton* bt = new wxButton(this, wxID_FILE1, _(L("Standard Cube")));
bt->Bind(wxEVT_BUTTON, &CalibrationCubeDialog::create_geometry_standard, this);
bt->SetToolTip(_(L("Standard cubic xyz cube, with a flat top. Better for infill/perimeter overlap calibration.")));
bt->SetToolTip(_L("Standard cubic xyz cube, with a flat top. Better for infill/perimeter overlap calibration."));
buttons->Add(bt);
buttons->AddSpacer(10);
bt = new wxButton(this, wxID_FILE1, _(L("Voron Cube")));
bt->Bind(wxEVT_BUTTON, &CalibrationCubeDialog::create_geometry_voron, this);
bt->SetToolTip(_(L("Voron cubic cube with many features inside, with a bearing slot on top. Better to check dimensional accuracy.")));
bt->SetToolTip(_L("Voron cubic cube with many features inside, with a bearing slot on top. Better to check dimensional accuracy."));
buttons->Add(bt);
}
void CalibrationCubeDialog::create_geometry(std::string calibration_path) {
Plater* plat = this->main_frame->plater();
Model& model = plat->model();
if (!plat->new_project("Calibration cube"))
if (!plat->new_project(L("Calibration cube")))
return;
std::vector<size_t> objs_idx = plat->load_files(std::vector<std::string>{

View File

@ -26,10 +26,10 @@ namespace Slic3r {
namespace GUI {
void CalibrationFlowDialog::create_buttons(wxStdDialogButtonSizer* buttons){
wxButton* bt = new wxButton(this, wxID_FILE1, _(L("Generate 10% intervals around current value")));
wxButton* bt = new wxButton(this, wxID_FILE1, _L("Generate 10% intervals around current value"));
bt->Bind(wxEVT_BUTTON, &CalibrationFlowDialog::create_geometry_10, this);
buttons->Add(bt);
bt = new wxButton(this, wxID_FILE2, _(L("Generate 2% intervals below current value")));
bt = new wxButton(this, wxID_FILE2, _L("Generate 2% intervals below current value"));
bt->Bind(wxEVT_BUTTON, &CalibrationFlowDialog::create_geometry_2_5, this);
buttons->Add(bt);
}
@ -38,7 +38,7 @@ void CalibrationFlowDialog::create_buttons(wxStdDialogButtonSizer* buttons){
void CalibrationFlowDialog::create_geometry(float start, float delta) {
Plater* plat = this->main_frame->plater();
Model& model = plat->model();
if (!plat->new_project("Flow calibration"))
if (!plat->new_project(L("Flow calibration")))
return;
bool autocenter = gui_app->app_config->get("autocenter") == "1";

View File

@ -26,8 +26,8 @@ namespace Slic3r {
namespace GUI {
void CalibrationOverBridgeDialog::create_buttons(wxStdDialogButtonSizer* buttons){
wxButton* bt1 = new wxButton(this, wxID_FILE1, _(L("Over-Bridge calibration")));
wxButton* bt2 = new wxButton(this, wxID_FILE1, _(L("Top flow calibration")));
wxButton* bt1 = new wxButton(this, wxID_FILE1, _L("Over-Bridge calibration"));
wxButton* bt2 = new wxButton(this, wxID_FILE1, _L("Top flow calibration"));
bt1->Bind(wxEVT_BUTTON, &CalibrationOverBridgeDialog::create_geometry1, this);
bt2->Bind(wxEVT_BUTTON, &CalibrationOverBridgeDialog::create_geometry2, this);
buttons->Add(bt1);
@ -43,7 +43,7 @@ void CalibrationOverBridgeDialog::create_geometry2(wxCommandEvent& event_args) {
void CalibrationOverBridgeDialog::create_geometry(bool over_bridge) {
Plater* plat = this->main_frame->plater();
Model& model = plat->model();
if (!plat->new_project("Over-bridge calibration"))
if (!plat->new_project(L("Over-bridge calibration")))
return;
bool autocenter = gui_app->app_config->get("autocenter") == "1";

View File

@ -28,7 +28,7 @@ namespace GUI {
void CalibrationRetractionDialog::create_buttons(wxStdDialogButtonSizer* buttons){
wxString choices_steps[] = { "0.1","0.2","0.5","1","2" };
steps = new wxComboBox(this, wxID_ANY, wxString{ "0.2" }, wxDefaultPosition, wxDefaultSize, 5, choices_steps);
steps->SetToolTip(_L("Each militer add this value to the retraction value. "));
steps->SetToolTip(_L("Each militer add this value to the retraction value."));
steps->SetSelection(1);
wxString choices_nb[] = { "2","4","6","8","10","15","20","25" };
nb_steps = new wxComboBox(this, wxID_ANY, wxString{ "15" }, wxDefaultPosition, wxDefaultSize, 8, choices_nb);
@ -42,34 +42,34 @@ void CalibrationRetractionDialog::create_buttons(wxStdDialogButtonSizer* buttons
int temp = int((2 + filament_config->option<ConfigOptionInts>("temperature")->get_at(0)) / 5) * 5;
auto size = wxSize(4 * em_unit(), wxDefaultCoord);
temp_start = new wxTextCtrl(this, wxID_ANY, std::to_string(temp), wxDefaultPosition, size);
wxString degree = L'°' ;
wxString choices_decr[] = { "one test","2x10"+ degree,"3x10"+ degree, L"4x10°", _("3x50°"), _L("5x5°") };
temp_start->SetToolTip(_L("Note that only Multiple of 5 can be engraved in the part"));
wxString choices_decr[] = { _L("one test"),_L("2x10°"),_L("3x10°"), _L("4x10°"), _L("3x50°"), _L("5x5°") };
decr_temp = new wxComboBox(this, wxID_ANY, wxString{ "current" }, wxDefaultPosition, wxDefaultSize, 6, choices_decr);
decr_temp->SetToolTip(_L("Select the number tower to print, and by how many degrees C to decrease each time."));
decr_temp->SetSelection(0);
decr_temp->SetEditable(false);
buttons->Add(new wxStaticText(this, wxID_ANY, wxString{ "step:" }));
buttons->Add(new wxStaticText(this, wxID_ANY, _L("Step:")));
buttons->Add(steps);
buttons->AddSpacer(15);
buttons->Add(new wxStaticText(this, wxID_ANY, wxString{ "height:" }));
buttons->Add(new wxStaticText(this, wxID_ANY, _L("Height:")));
buttons->Add(nb_steps);
buttons->AddSpacer(20);
buttons->Add(new wxStaticText(this, wxID_ANY, wxString{ "start temp:" }));
buttons->Add(new wxStaticText(this, wxID_ANY, _L("Start temp:")));
buttons->Add(temp_start);
buttons->AddSpacer(15);
buttons->Add(new wxStaticText(this, wxID_ANY, wxString{ "temp decr:" }));
buttons->Add(new wxStaticText(this, wxID_ANY, _L("Temp decr:")));
buttons->Add(decr_temp);
buttons->AddSpacer(20);
wxButton* bt = new wxButton(this, wxID_FILE1, _(L("Remove fil. slowdown")));
wxButton* bt = new wxButton(this, wxID_FILE1, _L("Remove fil. slowdown"));
bt->Bind(wxEVT_BUTTON, &CalibrationRetractionDialog::remove_slowdown, this);
buttons->Add(bt);
buttons->AddSpacer(30);
bt = new wxButton(this, wxID_FILE1, _(L("Generate")));
bt = new wxButton(this, wxID_FILE1, _L("Generate"));
bt->Bind(wxEVT_BUTTON, &CalibrationRetractionDialog::create_geometry, this);
buttons->Add(bt);
}
@ -101,7 +101,7 @@ void CalibrationRetractionDialog::remove_slowdown(wxCommandEvent& event_args) {
void CalibrationRetractionDialog::create_geometry(wxCommandEvent& event_args) {
Plater* plat = this->main_frame->plater();
Model& model = plat->model();
if (!plat->new_project("Retraction calibration"))
if (!plat->new_project(L("Retraction calibration")))
return;
bool autocenter = gui_app->app_config->get("autocenter") == "1";
@ -175,12 +175,12 @@ void CalibrationRetractionDialog::create_geometry(wxCommandEvent& event_args) {
for (size_t id_item = 0; id_item < nb_items; id_item++) {
part_tower.emplace_back();
int mytemp = temp - temp_decr * id_item;
if (mytemp > 285) mytemp = 285;
if (mytemp < 180) mytemp = 180;
add_part(model.objects[objs_idx[id_item]], Slic3r::resources_dir() + "/calibration/filament_temp/t"+ std::to_string(mytemp) + ".amf",
Vec3d{ 0,0, scale * 0.2 -4.8 }, Vec3d{ scale,scale,scale });
model.objects[objs_idx[id_item]]->volumes[1]->rotate(PI / 2, Vec3d(0, 0, 1));
model.objects[objs_idx[id_item]]->volumes[1]->rotate(-PI / 2, Vec3d(1, 0, 0));
if (mytemp <= 285 && mytemp >= 180 && mytemp % 5 == 0) {
add_part(model.objects[objs_idx[id_item]], Slic3r::resources_dir() + "/calibration/filament_temp/t" + std::to_string(mytemp) + ".amf",
Vec3d{ 0,0, scale * 0.2 - 4.8 }, Vec3d{ scale,scale,scale });
model.objects[objs_idx[id_item]]->volumes[1]->rotate(PI / 2, Vec3d(0, 0, 1));
model.objects[objs_idx[id_item]]->volumes[1]->rotate(-PI / 2, Vec3d(1, 0, 0));
}
for (int num_retract = 0; num_retract < nb_retract; num_retract++) {
part_tower.back().push_back(add_part(model.objects[objs_idx[id_item]],
Slic3r::resources_dir() + "/calibration/retraction/retraction_calibration_pillar.amf",

View File

@ -28,27 +28,27 @@ namespace GUI {
void CalibrationTempDialog::create_buttons(wxStdDialogButtonSizer* buttons){
wxString choices_steps[] = { "5","10","15","20" };
steps = new wxComboBox(this, wxID_ANY, wxString{ "10" }, wxDefaultPosition, wxDefaultSize, 4, choices_steps);
steps->SetToolTip(_(L("Select the step in celcius between two tests.")));
steps->SetToolTip(_L("Select the step in celcius between two tests.\nNote that only multiple of 5 are engraved on the part."));
steps->SetSelection(1);
wxString choices_nb[] = { "0","1","2","3","4","5","6","7" };
nb_down = new wxComboBox(this, wxID_ANY, wxString{ "2" }, wxDefaultPosition, wxDefaultSize, 8, choices_nb);
nb_down->SetToolTip(_(L("Select the number of tests with lower temperature than the current one.")));
nb_down->SetToolTip(_L("Select the number of tests with lower temperature than the current one."));
nb_down->SetSelection(2);
nb_up = new wxComboBox(this, wxID_ANY, wxString{ "2" }, wxDefaultPosition, wxDefaultSize, 8, choices_nb);
nb_up->SetToolTip(_(L("Select the number of tests with higher temperature than the current one.")));
nb_up->SetToolTip(_L("Select the number of tests with higher temperature than the current one."));
nb_up->SetSelection(2);
buttons->Add(new wxStaticText(this, wxID_ANY, wxString{ "nb down:" }));
buttons->Add(new wxStaticText(this, wxID_ANY, _L("Nb down:")));
buttons->Add(nb_down);
buttons->AddSpacer(15);
buttons->Add(new wxStaticText(this, wxID_ANY, wxString{ "nb up:" }));
buttons->Add(new wxStaticText(this, wxID_ANY, _L("Nb up:")));
buttons->Add(nb_up);
buttons->AddSpacer(40);
buttons->Add(new wxStaticText(this, wxID_ANY, wxString{ "steps:" }));
buttons->Add(new wxStaticText(this, wxID_ANY, _L("Steps:")));
buttons->Add(steps);
buttons->AddSpacer(40);
wxButton* bt = new wxButton(this, wxID_FILE1, _(L("Generate")));
wxButton* bt = new wxButton(this, wxID_FILE1, _L("Generate"));
bt->Bind(wxEVT_BUTTON, &CalibrationTempDialog::create_geometry, this);
buttons->Add(bt);
}
@ -56,7 +56,7 @@ void CalibrationTempDialog::create_buttons(wxStdDialogButtonSizer* buttons){
void CalibrationTempDialog::create_geometry(wxCommandEvent& event_args) {
Plater* plat = this->main_frame->plater();
Model& model = plat->model();
if (!plat->new_project("Temperature calibration"))
if (!plat->new_project(L("Temperature calibration")))
return;
std::vector<size_t> objs_idx = plat->load_files(std::vector<std::string>{
@ -105,15 +105,16 @@ void CalibrationTempDialog::create_geometry(wxCommandEvent& event_args) {
std::vector<ModelObject*>tower;
tower.push_back(model.objects[objs_idx[0]]);
float zshift = (1 - xyzScale) / 2;
if (temperature > 175 && temperature < 290) {
if (temperature > 175 && temperature < 290 && temperature%5==0) {
tower.push_back(add_part(model.objects[objs_idx[0]], Slic3r::resources_dir()+"/calibration/filament_temp/t"+std::to_string(temperature)+".amf",
Vec3d{ xyzScale * 5, - xyzScale * 2.5, zshift - xyzScale * 2.5}, Vec3d{ xyzScale, xyzScale, xyzScale * 0.43 }));
}
for (int16_t i = 1; i < nb_items; i++) {
tower.push_back(add_part(model.objects[objs_idx[0]], Slic3r::resources_dir()+"/calibration/filament_temp/Smart_compact_temperature_calibration_item.amf",
Vec3d{ 0,0, i * 10 * xyzScale }, Vec3d{ xyzScale, xyzScale * 0.5, xyzScale }));
if (temperature - i * step_temp > 175 && temperature - i * step_temp < 290) {
tower.push_back(add_part(model.objects[objs_idx[0]], Slic3r::resources_dir()+"/calibration/filament_temp/t" + std::to_string(temperature - i * step_temp) + ".amf",
int sub_temp = temperature - i * step_temp;
if (sub_temp > 175 && sub_temp < 290 && sub_temp % 5 == 0) {
tower.push_back(add_part(model.objects[objs_idx[0]], Slic3r::resources_dir()+"/calibration/filament_temp/t" + std::to_string(sub_temp) + ".amf",
Vec3d{ xyzScale * 5, -xyzScale * 2.5, xyzScale * (i * 10 - 2.5) }, Vec3d{ xyzScale, xyzScale, xyzScale * 0.43 }));
}
}