Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_canvas_manager

This commit is contained in:
Enrico Turri 2020-03-03 11:10:59 +01:00
commit 96f5430cee
24 changed files with 150 additions and 123 deletions

View File

@ -36,7 +36,9 @@ void AboutDialogLogo::onRepaint(wxEvent &event)
// CopyrightsDialog
// -----------------------------------------
CopyrightsDialog::CopyrightsDialog()
: DPIDialog(NULL, wxID_ANY, wxString::Format("%s - %s", SLIC3R_APP_NAME, _(L("Portions copyright"))),
: DPIDialog(NULL, wxID_ANY, wxString::FromUTF8((boost::format("%1% - %2%")
% SLIC3R_APP_NAME
% _utf8(L("Portions copyright"))).str()),
wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
{
this->SetFont(wxGetApp().normal_font());
@ -196,7 +198,7 @@ void CopyrightsDialog::onCloseDialog(wxEvent &)
}
AboutDialog::AboutDialog()
: DPIDialog(NULL, wxID_ANY, wxString::Format(_(L("About %s")), SLIC3R_APP_NAME), wxDefaultPosition,
: DPIDialog(NULL, wxID_ANY, wxString::FromUTF8((boost::format(_utf8(L("About %s"))) % SLIC3R_APP_NAME).str()), wxDefaultPosition,
wxDefaultSize, /*wxCAPTION*/wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
{
SetFont(wxGetApp().normal_font());
@ -253,32 +255,33 @@ AboutDialog::AboutDialog()
int size[] = {fs,fs,fs,fs,fs,fs,fs};
m_html->SetFonts(font.GetFaceName(), font.GetFaceName(), size);
m_html->SetBorders(2);
const wxString copyright_str = _(L("Copyright"));
const std::string copyright_str = _utf8(L("Copyright"));
// TRN "Slic3r _is licensed under the_ License"
const wxString is_lecensed_str = _(L("is licensed under the"));
const wxString license_str = _(L("GNU Affero General Public License, version 3"));
const wxString based_on_str = _(L("PrusaSlicer is based on Slic3r by Alessandro Ranellucci and the RepRap community."));
const wxString contributors_str = _(L("Contributions by Henrik Brix Andersen, Nicolas Dandrimont, Mark Hindess, Petr Ledvina, Joseph Lenox, Y. Sapir, Mike Sheldrake, Vojtech Bubnik and numerous others."));
const auto text = wxString::Format(
const std::string is_lecensed_str = _utf8(L("is licensed under the"));
const std::string license_str = _utf8(L("GNU Affero General Public License, version 3"));
const std::string based_on_str = _utf8(L("PrusaSlicer is based on Slic3r by Alessandro Ranellucci and the RepRap community."));
const std::string contributors_str = _utf8(L("Contributions by Henrik Brix Andersen, Nicolas Dandrimont, Mark Hindess, Petr Ledvina, Joseph Lenox, Y. Sapir, Mike Sheldrake, Vojtech Bubnik and numerous others."));
const auto text = wxString::FromUTF8(
(boost::format(
"<html>"
"<body bgcolor= %s link= %s>"
"<font color=%s>"
"%s &copy; 2016-2019 Prusa Research. <br />"
"%s &copy; 2011-2018 Alessandro Ranellucci. <br />"
"<a href=\"http://slic3r.org/\">Slic3r</a> %s "
"<a href=\"http://www.gnu.org/licenses/agpl-3.0.html\">%s</a>."
"<body bgcolor= %1% link= %2%>"
"<font color=%3%>"
"%4% &copy; 2016-2019 Prusa Research. <br />"
"%5% &copy; 2011-2018 Alessandro Ranellucci. <br />"
"<a href=\"http://slic3r.org/\">Slic3r</a> %6% "
"<a href=\"http://www.gnu.org/licenses/agpl-3.0.html\">%7%</a>."
"<br /><br />"
"%s"
"%8%"
"<br /><br />"
"%s"
"%9%"
"</font>"
"</body>"
"</html>", bgr_clr_str, text_clr_str, text_clr_str,
copyright_str, copyright_str,
is_lecensed_str,
license_str,
based_on_str,
contributors_str);
"</html>") % bgr_clr_str % text_clr_str % text_clr_str
% copyright_str % copyright_str
% is_lecensed_str
% license_str
% based_on_str
% contributors_str).str());
m_html->SetPage(text);
vsizer->Add(m_html, 1, wxEXPAND | wxBOTTOM, 10);
m_html->Bind(wxEVT_HTML_LINK_CLICKED, &AboutDialog::onLinkClicked, this);

View File

@ -219,9 +219,9 @@ void BackgroundSlicingProcess::thread_proc()
// Canceled, this is all right.
assert(m_print->canceled());
} catch (const std::bad_alloc& ex) {
wxString errmsg = wxString::Format(_(L("%s has encountered an error. It was likely caused by running out of memory. "
wxString errmsg = wxString::FromUTF8((boost::format(_utf8(L("%s has encountered an error. It was likely caused by running out of memory. "
"If you are sure you have enough RAM on your system, this may also be a bug and we would "
"be glad if you reported it.")), SLIC3R_APP_NAME);
"be glad if you reported it."))) % SLIC3R_APP_NAME).str());
error = std::string(errmsg.ToUTF8()) + "\n\n" + std::string(ex.what());
} catch (std::exception &ex) {
error = ex.what();

View File

@ -215,14 +215,14 @@ void BonjourDialog::on_reply(BonjourReplyEvent &e)
void BonjourDialog::on_timer(wxTimerEvent &)
{
const auto search_str = _(L("Searching for devices"));
const auto search_str = _utf8(L("Searching for devices"));
if (timer_state > 0) {
const std::string dots(timer_state, '.');
label->SetLabel(wxString::Format("%s %s", search_str, dots));
label->SetLabel(wxString::FromUTF8((boost::format("%1% %2%") % search_str % dots).str()));
timer_state = (timer_state) % 3 + 1;
} else {
label->SetLabel(wxString::Format("%s: %s", search_str, _(L("Finished"))+"."));
label->SetLabel(wxString::FromUTF8((boost::format("%1%: %2%") % search_str % (_utf8(L("Finished"))+".")).str()));
timer->Stop();
}
}

View File

@ -72,7 +72,7 @@ static wxString generate_html_row(const Config::Snapshot &snapshot, bool row_eve
}
if (! compatible) {
text += "<p align=\"right\">" + wxString::Format(_(L("Incompatible with this %s")), SLIC3R_APP_NAME) + "</p>";
text += "<p align=\"right\">" + wxString::FromUTF8((boost::format(_utf8(L("Incompatible with this %s"))) % SLIC3R_APP_NAME).str()) + "</p>";
}
else if (! snapshot_active)
text += "<p align=\"right\"><a href=\"" + snapshot.id + "\">" + _(L("Activate")) + "</a></p>";

View File

@ -215,7 +215,7 @@ PrinterPicker::PrinterPicker(wxWindow *parent, const VendorProfile &vendor, wxSt
const auto &variant = model.variants[i];
const auto label = model.technology == ptFFF
? wxString::Format("%s %s %s", variant.name, _(L("mm")), _(L("nozzle")))
? from_u8((boost::format("%1% %2% %3%") % variant.name % _utf8(L("mm")) % _utf8(L("nozzle"))).str())
: from_u8(model.name);
if (i == 1) {
@ -422,17 +422,17 @@ void ConfigWizardPage::append_spacer(int space)
// Wizard pages
PageWelcome::PageWelcome(ConfigWizard *parent)
: ConfigWizardPage(parent, wxString::Format(
: ConfigWizardPage(parent, wxString::FromUTF8((boost::format(
#ifdef __APPLE__
_(L("Welcome to the %s Configuration Assistant"))
_utf8(L("Welcome to the %s Configuration Assistant"))
#else
_(L("Welcome to the %s Configuration Wizard"))
_utf8(L("Welcome to the %s Configuration Wizard"))
#endif
, SLIC3R_APP_NAME), _(L("Welcome")))
, welcome_text(append_text(wxString::Format(
_(L("Hello, welcome to %s! This %s helps you with the initial configuration; just a few settings and you will be ready to print.")),
SLIC3R_APP_NAME,
_(ConfigWizard::name()))
) % SLIC3R_APP_NAME).str()), _(L("Welcome")))
, welcome_text(append_text(wxString::FromUTF8((boost::format(
_utf8(L("Hello, welcome to %s! This %s helps you with the initial configuration; just a few settings and you will be ready to print.")))
% SLIC3R_APP_NAME
% _utf8(ConfigWizard::name())).str())
))
, cbox_reset(append(
new wxCheckBox(this, wxID_ANY, _(L("Remove user profiles - install from scratch (a snapshot will be taken beforehand)")))
@ -478,7 +478,7 @@ PagePrinters::PagePrinters(ConfigWizard *parent,
continue;
}
const auto picker_title = family.empty() ? wxString() : wxString::Format(_(L("%s Family")), family);
const auto picker_title = family.empty() ? wxString() : wxString::FromUTF8((boost::format(_utf8(L("%s Family"))) % family).str());
auto *picker = new PrinterPicker(this, vendor, picker_title, MAX_COLS, *appconfig, filter);
picker->Bind(EVT_PRINTER_PICK, [this, appconfig](const PrinterPickerEvent &evt) {

View File

@ -530,7 +530,7 @@ wxString Control::get_label(int tick) const
const wxString str = m_values.empty() ?
wxNumberFormatter::ToString(m_label_koef*value, 2, wxNumberFormatter::Style_None) :
wxNumberFormatter::ToString(m_values[value], 2, wxNumberFormatter::Style_None);
return wxString::Format("%s\n(%d)", str, m_values.empty() ? value : value+1);
return from_u8((boost::format("%1%\n(%2%)") % str % (m_values.empty() ? value : value+1)).str());
}
void Control::draw_tick_text(wxDC& dc, const wxPoint& pos, int tick, bool right_side/*=true*/) const
@ -952,8 +952,8 @@ wxString Control::get_tooltip(int tick/*=-1*/)
return _(L("Discard all custom changes"));
if (m_focus == fiCogIcon)
return m_mode == t_mode::MultiAsSingle ?
wxString::Format(_(L("Jump to height %s or "
"Set extruder sequence for the entire print")), " (Shift + G)\n") :
wxString::FromUTF8((boost::format(_utf8(L("Jump to height %s or "
"Set extruder sequence for the entire print"))) % " (Shift + G)\n").str()) :
_(L("Jump to height")) + " (Shift + G)";
if (m_focus == fiColorBand)
return m_mode != t_mode::SingleExtruder ? "" :

View File

@ -172,7 +172,7 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true
if (label.Last() == '\n') label.RemoveLast();
while (label.Last() == ' ') label.RemoveLast();
if (label.Last() == ':') label.RemoveLast();
show_error(m_parent, wxString::Format(_(L("%s doesn't support percentage")), label));
show_error(m_parent, from_u8((boost::format(_utf8(L("%s doesn't support percentage"))) % label).str()));
set_value(double_to_string(m_opt.min), true);
m_value = double(m_opt.min);
break;
@ -237,12 +237,12 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true
const std::string sidetext = m_opt.sidetext.rfind("mm/s") != std::string::npos ? "mm/s" : "mm";
const wxString stVal = double_to_string(val, 2);
const wxString msg_text = wxString::Format(_(L("Do you mean %s%% instead of %s %s?\n"
const wxString msg_text = from_u8((boost::format(_utf8(L("Do you mean %s%% instead of %s %s?\n"
"Select YES if you want to change this value to %s%%, \n"
"or NO if you are sure that %s %s is a correct value.")), stVal, stVal, sidetext, stVal, stVal, sidetext);
"or NO if you are sure that %s %s is a correct value."))) % stVal % stVal % sidetext % stVal % stVal % sidetext).str());
wxMessageDialog dialog(m_parent, msg_text, _(L("Parameter validation")) + ": " + m_opt_id , wxICON_WARNING | wxYES | wxNO);
if (dialog.ShowModal() == wxID_YES) {
set_value(wxString::Format("%s%%", stVal), false/*true*/);
set_value(from_u8((boost::format("%s%%") % stVal).str()), false/*true*/);
str += "%%";
}
else

View File

@ -361,9 +361,9 @@ void GLCanvas3DManager::init_gl()
if (! s_gl_info.is_version_greater_or_equal_to(2, 0)) {
// Complain about the OpenGL version.
wxString message = wxString::Format(
_(L("PrusaSlicer requires OpenGL 2.0 capable graphics driver to run correctly, \n"
"while OpenGL version %s, render %s, vendor %s was detected.")), wxString(s_gl_info.get_version()), wxString(s_gl_info.get_renderer()), wxString(s_gl_info.get_vendor()));
wxString message = from_u8((boost::format(
_utf8(L("PrusaSlicer requires OpenGL 2.0 capable graphics driver to run correctly, \n"
"while OpenGL version %s, render %s, vendor %s was detected."))) % s_gl_info.get_version() % s_gl_info.get_renderer() % s_gl_info.get_vendor()).str());
message += "\n";
message += _(L("You may need to update your graphics card driver."));
#ifdef _WIN32

View File

@ -817,7 +817,7 @@ void GUI_App::add_config_menu(wxMenuBar *menu)
wxWindowID config_id_base = wxWindow::NewControlId(int(ConfigMenuCnt));
const auto config_wizard_name = _(ConfigWizard::name(true));
const auto config_wizard_tooltip = wxString::Format(_(L("Run %s")), config_wizard_name);
const auto config_wizard_tooltip = from_u8((boost::format(_utf8(L("Run %s"))) % config_wizard_name).str());
// Cmd+, is standard on OS X - what about other operating systems?
local_menu->Append(config_id_base + ConfigMenuWizard, config_wizard_name + dots, config_wizard_tooltip);
local_menu->Append(config_id_base + ConfigMenuSnapshots, _(L("&Configuration Snapshots")) + dots, _(L("Inspect / activate configuration snapshots")));

View File

@ -354,7 +354,7 @@ wxString ObjectList::get_mesh_errors_list(const int obj_idx, const int vol_idx /
for (const auto& error : error_msg)
if (error.second > 0)
tooltip += wxString::Format("\t%d %s\n", error.second, _(error.first));
tooltip += from_u8((boost::format("\t%1% %2%\n") % error.second % _utf8(error.first)).str());
if (is_windows10())
tooltip += _(L("Right button click the icon to fix STL through Netfabb"));
@ -1180,7 +1180,7 @@ const std::vector<std::string>& ObjectList::get_options_for_bundle(const wxStrin
for (auto& it : bundle_quick)
{
if ( bundle_name == wxString::Format(_(L("Quick Add Settings (%s)")), _(it.first)) )
if ( bundle_name == from_u8((boost::format(_utf8(L("Quick Add Settings (%s)"))) % _(it.first)).str()) )
return it.second;
}
#endif
@ -1528,13 +1528,13 @@ wxMenuItem* ObjectList::append_menu_item_settings(wxMenu* menu_)
#if 0
for (auto& it : m_freq_settings_fff)
{
settings_id = menu->FindItem(wxString::Format(_(L("Quick Add Settings (%s)")), _(it.first)));
settings_id = menu->FindItem(from_u8((boost::format(_utf8(L("Quick Add Settings (%s)"))) % _(it.first)).str()));
if (settings_id != wxNOT_FOUND)
menu->Destroy(settings_id);
}
for (auto& it : m_freq_settings_sla)
{
settings_id = menu->FindItem(wxString::Format(_(L("Quick Add Settings (%s)")), _(it.first)));
settings_id = menu->FindItem(from_u8((boost::format(_utf8(L("Quick Add Settings (%s)"))) % _(it.first)).str()));
if (settings_id != wxNOT_FOUND)
menu->Destroy(settings_id);
}
@ -1847,7 +1847,7 @@ void ObjectList::create_freq_settings_popupmenu(wxMenu *menu, const bool is_obje
if (improper_category(it.first, extruders_cnt))
continue;
append_menu_item(menu, wxID_ANY, wxString::Format(_(L("Quick Add Settings (%s)")), _(it.first)), "",
append_menu_item(menu, wxID_ANY, from_u8((boost::format(_utf8(L("Quick Add Settings (%s)"))) % _(it.first)).str()), "",
[menu, this](wxCommandEvent& event) { get_freq_settings_choice(menu->GetLabel(event.GetId())); },
CATEGORY_ICON.find(it.first) == CATEGORY_ICON.end() ? wxNullBitmap : CATEGORY_ICON.at(it.first), menu,
[this]() { return true; }, wxGetApp().plater());
@ -4091,9 +4091,9 @@ void ObjectList::toggle_printable_state(wxDataViewItem item)
// get object's printable and change it
const bool printable = !m_objects_model->IsPrintable(item);
const wxString snapshot_text = wxString::Format("%s %s",
printable ? _(L("Set Printable")) : _(L("Set Unprintable")),
object->name);
const wxString snapshot_text = from_u8((boost::format("%1% %2%")
% (printable ? _(L("Set Printable")) : _(L("Set Unprintable")))
% object->name).str());
take_snapshot(snapshot_text);
// set printable value for all instances in object

View File

@ -98,7 +98,7 @@ bool ObjectSettings::update_settings_list()
btn->SetBitmapHover(m_bmp_delete_focus.bmp());
btn->Bind(wxEVT_BUTTON, [opt_key, config, this](wxEvent &event) {
wxGetApp().plater()->take_snapshot(wxString::Format(_(L("Delete Option %s")), opt_key));
wxGetApp().plater()->take_snapshot(from_u8((boost::format(_utf8(L("Delete Option %s"))) % opt_key).str()));
config->erase(opt_key);
wxGetApp().obj_list()->changed_object();
wxTheApp->CallAfter([this]() {
@ -149,7 +149,7 @@ bool ObjectSettings::update_settings_list()
optgroup->get_field(opt)->m_on_change = [optgroup](const std::string& opt_id, const boost::any& value) {
// first of all take a snapshot and then change value in configuration
wxGetApp().plater()->take_snapshot(wxString::Format(_(L("Change Option %s")), opt_id));
wxGetApp().plater()->take_snapshot(from_u8((boost::format(_utf8(L("Change Option %s"))) % opt_id).str()));
optgroup->on_change_OG(opt_id, value);
};

View File

@ -829,7 +829,7 @@ void MainFrame::quick_slice(const int qs)
}
else if (qs & qsSaveAs) {
// The following line may die if the output_filename_format template substitution fails.
wxFileDialog dlg(this, wxString::Format(_(L("Save %s file as:")) , qs & qsExportSVG ? _(L("SVG")) : _(L("G-code")) ),
wxFileDialog dlg(this, from_u8((boost::format(_utf8(L("Save %s file as:"))) % ((qs & qsExportSVG) ? _(L("SVG")) : _(L("G-code")))).str()),
wxGetApp().app_config->get_last_output_dir(get_dir_name(output_file)), get_base_name(input_file),
qs & qsExportSVG ? file_wildcards(FT_SVG) : file_wildcards(FT_GCODE),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
@ -852,7 +852,7 @@ void MainFrame::quick_slice(const int qs)
// show processbar dialog
m_progress_dialog = new wxProgressDialog(_(L("Slicing")) + dots,
// TRN "Processing input_file_basename"
wxString::Format(_(L("Processing %s")), input_file_basename + dots),
from_u8((boost::format(_utf8(L("Processing %s"))) % (input_file_basename + dots)).str()),
100, this, 4);
m_progress_dialog->Pulse();
{

View File

@ -1196,7 +1196,7 @@ void Sidebar::update_sliced_info_sizer()
wxString new_label = _(L("Used Material (ml)")) + " :";
const bool is_supports = ps.support_used_material > 0.0;
if (is_supports)
new_label += wxString::Format("\n - %s\n - %s", _(L("object(s)")), _(L("supports and pad")));
new_label += from_u8((boost::format("\n - %s\n - %s") % _utf8(L("object(s)")) % _utf8(L("supports and pad"))).str());
wxString info_text = is_supports ?
wxString::Format("%.2f \n%.2f \n%.2f", (ps.objects_used_material + ps.support_used_material) / 1000,
@ -1233,7 +1233,7 @@ void Sidebar::update_sliced_info_sizer()
wxString new_label = _(L("Used Filament (m)"));
if (is_wipe_tower)
new_label += wxString::Format(" :\n - %s\n - %s", _(L("objects")), _(L("wipe tower")));
new_label += from_u8((boost::format(" :\n - %1%\n - %2%") % _utf8(L("objects")) % _utf8(L("wipe tower"))).str());
wxString info_text = is_wipe_tower ?
wxString::Format("%.2f \n%.2f \n%.2f", ps.total_used_filament / 1000,
@ -1247,7 +1247,7 @@ void Sidebar::update_sliced_info_sizer()
new_label = _(L("Cost"));
if (is_wipe_tower)
new_label += wxString::Format(" :\n - %s\n - %s", _(L("objects")), _(L("wipe tower")));
new_label += from_u8((boost::format(" :\n - %1%\n - %2%") % _utf8(L("objects")) % _utf8(L("wipe tower"))).str());
info_text = ps.total_cost == 0.0 ? "N/A" :
is_wipe_tower ?
@ -1276,25 +1276,25 @@ void Sidebar::update_sliced_info_sizer()
for (int i = (int)times.size() - 1; i >= 0; --i)
{
if (i == 0 || times[i - 1].first == cgtPausePrint)
new_label += wxString::Format("\n - %s%d", str_color + " ", color_change_count);
new_label += from_u8((boost::format("\n - %1%%2%") % (std::string(str_color.ToUTF8()) + " ") % color_change_count).str());
else if (times[i - 1].first == cgtColorChange)
new_label += wxString::Format("\n - %s%d", str_color + " ", color_change_count--);
new_label += from_u8((boost::format("\n - %1%%2%") % (std::string(str_color.ToUTF8()) + " ") % color_change_count--).str());
if (i != (int)times.size() - 1 && times[i].first == cgtPausePrint)
new_label += wxString::Format(" -> %s", str_pause);
new_label += from_u8((boost::format(" -> %1%") % std::string(str_pause.ToUTF8())).str());
info_text += wxString::Format("\n%s", times[i].second);
info_text += from_u8((boost::format("\n%1%") % times[i].second).str());
}
};
if (ps.estimated_normal_print_time != "N/A") {
new_label += wxString::Format("\n - %s", _(L("normal mode")));
info_text += wxString::Format("\n%s", ps.estimated_normal_print_time);
new_label += from_u8((boost::format("\n - %1%") % _utf8(L("normal mode"))).str());
info_text += from_u8((boost::format("\n%1%") % ps.estimated_normal_print_time).str());
fill_labels(ps.estimated_normal_custom_gcode_print_times, new_label, info_text);
}
if (ps.estimated_silent_print_time != "N/A") {
new_label += wxString::Format("\n - %s", _(L("stealth mode")));
info_text += wxString::Format("\n%s", ps.estimated_silent_print_time);
new_label += from_u8((boost::format("\n - %1%") % _utf8(L("stealth mode"))).str());
info_text += from_u8((boost::format("\n%1%") % ps.estimated_silent_print_time).str());
fill_labels(ps.estimated_silent_custom_gcode_print_times, new_label, info_text);
}
p->sliced_info->SetTextAndShow(siEstimatedTime, info_text, new_label);
@ -2297,7 +2297,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
for (size_t i = 0; i < input_files.size(); i++) {
const auto &path = input_files[i];
const auto filename = path.filename();
const auto dlg_info = wxString::Format(_(L("Processing input file %s")), from_path(filename)) + "\n";
const auto dlg_info = from_u8((boost::format(_utf8(L("Processing input file %s"))) % from_path(filename)).str()) + "\n";
dlg.Update(100 * i / input_files.size(), dlg_info);
const bool type_3mf = std::regex_match(path.string(), pattern_3mf);
@ -2404,8 +2404,8 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
for (auto obj : model.objects)
if ( obj->volumes.size()>1 ) {
Slic3r::GUI::show_error(nullptr,
wxString::Format(_(L("You can't to add the object(s) from %s because of one or some of them is(are) multi-part")),
from_path(filename)));
from_u8((boost::format(_utf8(L("You can't to add the object(s) from %s because of one or some of them is(are) multi-part")))
% from_path(filename)).str()));
return obj_idxs;
}
}
@ -5000,7 +5000,7 @@ void Plater::export_stl(bool extended, bool selection_only)
}
Slic3r::store_stl(path_u8.c_str(), &mesh, true);
p->statusbar()->set_status_text(wxString::Format(_(L("STL file exported to %s")), path));
p->statusbar()->set_status_text(from_u8((boost::format(_utf8(L("STL file exported to %s"))) % path).str()));
}
void Plater::export_amf()
@ -5017,10 +5017,10 @@ void Plater::export_amf()
bool full_pathnames = wxGetApp().app_config->get("export_sources_full_pathnames") == "1";
if (Slic3r::store_amf(path_u8.c_str(), &p->model, export_config ? &cfg : nullptr, full_pathnames)) {
// Success
p->statusbar()->set_status_text(wxString::Format(_(L("AMF file exported to %s")), path));
p->statusbar()->set_status_text(from_u8((boost::format(_utf8(L("AMF file exported to %s"))) % path).str()));
} else {
// Failure
p->statusbar()->set_status_text(wxString::Format(_(L("Error exporting AMF file %s")), path));
p->statusbar()->set_status_text(from_u8((boost::format(_utf8(L("Error exporting AMF file %s"))) % path).str()));
}
}
@ -5053,12 +5053,12 @@ void Plater::export_3mf(const boost::filesystem::path& output_path)
if (Slic3r::store_3mf(path_u8.c_str(), &p->model, export_config ? &cfg : nullptr, full_pathnames)) {
#endif // ENABLE_THUMBNAIL_GENERATOR
// Success
p->statusbar()->set_status_text(wxString::Format(_(L("3MF file exported to %s")), path));
p->statusbar()->set_status_text(from_u8((boost::format(_utf8(L("3MF file exported to %s"))) % path).str()));
p->set_project_filename(path);
}
else {
// Failure
p->statusbar()->set_status_text(wxString::Format(_(L("Error exporting 3MF file %s")), path));
p->statusbar()->set_status_text(from_u8((boost::format(_utf8(L("Error exporting 3MF file %s"))) % path).str()));
}
}

View File

@ -1606,6 +1606,15 @@ void PresetBundle::update_plater_filament_ui(unsigned int idx_extruder, GUI::Pre
const int icon_height = m_bitmapLock->GetHeight();
#endif
/* To avoid asserts, each added bitmap to wxBitmapCombobox should be the same size.
* But for some display scaling (for example 125% or 175%) normal_icon_width differs from icon width.
* So:
* for nonsystem presets set a width of empty bitmap to m_bitmapLock->GetWidth()
* for compatible presets set a width of empty bitmap to m_bitmapIncompatible->GetWidth()
**/
const int lock_icon_width = m_bitmapLock->GetWidth();
const int flag_icon_width = m_bitmapIncompatible->GetWidth();
wxString tooltip = "";
for (int i = this->filaments().front().is_visible ? 0 : 1; i < int(this->filaments().size()); ++i) {
@ -1631,7 +1640,7 @@ void PresetBundle::update_plater_filament_ui(unsigned int idx_extruder, GUI::Pre
std::vector<wxBitmap> bmps;
if (wide_icons)
// Paint a red flag for incompatible presets.
bmps.emplace_back(preset.is_compatible ? m_bitmapCache->mkclear(normal_icon_width, icon_height) : *m_bitmapIncompatible);
bmps.emplace_back(preset.is_compatible ? m_bitmapCache->mkclear(flag_icon_width, icon_height) : *m_bitmapIncompatible);
// Paint the color bars.
m_bitmapCache->parse_color(filament_rgb, rgb);
bmps.emplace_back(m_bitmapCache->mksolid(single_bar ? wide_icon_width : normal_icon_width, icon_height, rgb));
@ -1641,9 +1650,7 @@ void PresetBundle::update_plater_filament_ui(unsigned int idx_extruder, GUI::Pre
}
// Paint a lock at the system presets.
bmps.emplace_back(m_bitmapCache->mkclear(space_icon_width, icon_height));
// To avoid asserts, each added bitmap to wxBitmapCombobox should be the same size, so
// for nonsystem presets set a width of empty bitmap to m_bitmapLock->GetWidth()
bmps.emplace_back((preset.is_system || preset.is_default) ? *m_bitmapLock : m_bitmapCache->mkclear(m_bitmapLock->GetWidth(), icon_height));
bmps.emplace_back((preset.is_system || preset.is_default) ? *m_bitmapLock : m_bitmapCache->mkclear(lock_icon_width, icon_height));
// (preset.is_dirty ? *m_bitmapLockOpen : *m_bitmapLock) : m_bitmapCache->mkclear(16, 16));
bitmap = m_bitmapCache->insert(bitmap_key, bmps);
}
@ -1695,7 +1702,7 @@ void PresetBundle::update_plater_filament_ui(unsigned int idx_extruder, GUI::Pre
std::vector<wxBitmap> bmps;
if (wide_icons)
// Paint a red flag for incompatible presets.
bmps.emplace_back(m_bitmapCache->mkclear(normal_icon_width, icon_height));
bmps.emplace_back(m_bitmapCache->mkclear(flag_icon_width, icon_height));
// Paint the color bars + a lock at the system presets.
bmps.emplace_back(m_bitmapCache->mkclear(wide_icon_width+space_icon_width, icon_height));
bmps.emplace_back(create_scaled_bitmap("edit_uni"));

View File

@ -269,7 +269,7 @@ void PrintHostQueueDialog::on_error(Event &evt)
set_state(evt.job_id, ST_ERROR);
auto errormsg = wxString::Format("%s\n%s", _(L("Error uploading to print host:")), evt.error);
auto errormsg = from_u8((boost::format("%1%\n%2%") % _utf8(L("Error uploading to print host:")) % std::string(evt.error.ToUTF8())).str());
job_list->SetValue(wxVariant(0), evt.job_id, COL_PROGRESS);
job_list->SetValue(wxVariant(errormsg), evt.job_id, COL_ERRORMSG); // Stashes the error message into a hidden column for later

View File

@ -1476,9 +1476,10 @@ void Selection::toggle_instance_printable_state()
ModelInstance* instance = model_object->instances[instance_idx];
const bool printable = !instance->printable;
wxString snapshot_text = model_object->instances.size() == 1 ? wxString::Format("%s %s",
printable ? _(L("Set Printable")) : _(L("Set Unprintable")), model_object->name) :
printable ? _(L("Set Printable Instance")) : _(L("Set Unprintable Instance"));
wxString snapshot_text = model_object->instances.size() == 1 ? wxString::FromUTF8((boost::format("%1% %2%")
% (printable ? _utf8(L("Set Printable")) : _utf8(L("Set Unprintable")))
% model_object->name).str()) :
(printable ? _(L("Set Printable Instance")) : _(L("Set Unprintable Instance")));
wxGetApp().plater()->take_snapshot(snapshot_text);
instance->printable = printable;

View File

@ -130,7 +130,7 @@ void Tab::create_preset_tab()
add_scaled_button(panel, &m_btn_hide_incompatible_presets, m_bmp_hide_incompatible_presets.name());
// TRN "Save current Settings"
m_btn_save_preset->SetToolTip(wxString::Format(_(L("Save current %s")),m_title));
m_btn_save_preset->SetToolTip(from_u8((boost::format(_utf8(L("Save current %s"))) % m_title).str()));
m_btn_delete_preset->SetToolTip(_(L("Delete this preset")));
m_btn_delete_preset->Disable();
@ -956,8 +956,8 @@ void Tab::update_preset_description_line()
} else if (parent == nullptr) {
description_line = _(L("Current preset is inherited from the default preset."));
} else {
description_line = wxString::Format(
_(L("Current preset is inherited from:\n\t%s")), GUI::from_u8(parent->name));
description_line = from_u8((boost::format(
_utf8(L("Current preset is inherited from:\n\t%s"))) % parent->name).str());
}
if (preset.is_default || preset.is_system)
@ -1683,8 +1683,7 @@ void TabPrinter::build_printhost(ConfigOptionsGroup *optgroup)
btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) {
std::unique_ptr<PrintHost> host(PrintHost::get_print_host(m_config));
if (! host) {
const auto text = wxString::Format("%s",
_(L("Could not get a valid Printer Host reference")));
const wxString text = _(L("Could not get a valid Printer Host reference"));
show_error(this, text);
return;
}
@ -1753,11 +1752,11 @@ void TabPrinter::build_printhost(ConfigOptionsGroup *optgroup)
line.full_width = 1;
line.widget = [this, ca_file_hint] (wxWindow* parent) {
auto txt = new wxStaticText(parent, wxID_ANY, wxString::Format("%s\n\n\t%s",
wxString::Format(_(L("HTTPS CA File:\n\
auto txt = new wxStaticText(parent, wxID_ANY, from_u8((boost::format("%1%\n\n\t%2%")
% (boost::format(_utf8(L("HTTPS CA File:\n\
\tOn this system, %s uses HTTPS certificates from the system Certificate Store or Keychain.\n\
\tTo use a custom CA file, please import your CA file into Certificate Store / Keychain.")), SLIC3R_APP_NAME),
ca_file_hint));
\tTo use a custom CA file, please import your CA file into Certificate Store / Keychain."))) % SLIC3R_APP_NAME).str()
% std::string(ca_file_hint.ToUTF8())).str()));
txt->SetFont(Slic3r::GUI::wxGetApp().normal_font());
auto sizer = new wxBoxSizer(wxHORIZONTAL);
sizer->Add(txt);
@ -2916,8 +2915,8 @@ bool Tab::may_discard_current_dirty_preset(PresetCollection* presets /*= nullptr
std::string type_name = presets->name();
wxString tab = " ";
wxString name = old_preset.is_default ?
wxString::Format(_(L("Default preset (%s)")), _(type_name)) :
wxString::Format(_(L("Preset (%s)")), _(type_name)) + "\n" + tab + old_preset.name;
from_u8((boost::format(_utf8(L("Default preset (%s)"))) % _utf8(type_name)).str()) :
from_u8((boost::format(_utf8(L("Preset (%s)"))) % _utf8(type_name)).str()) + "\n" + tab + old_preset.name;
// Collect descriptions of the dirty options.
wxString changes;
@ -3173,7 +3172,7 @@ wxSizer* Tab::compatible_widget_create(wxWindow* parent, PresetDependencies &dep
{
deps.checkbox = new wxCheckBox(parent, wxID_ANY, _(L("All")));
deps.checkbox->SetFont(Slic3r::GUI::wxGetApp().normal_font());
add_scaled_button(parent, &deps.btn, "printer_white", wxString::Format(" %s %s", _(L("Set")), dots), wxBU_LEFT | wxBU_EXACTFIT);
add_scaled_button(parent, &deps.btn, "printer_white", from_u8((boost::format(" %s %s") % _utf8(L("Set")) % std::string(dots.ToUTF8())).str()), wxBU_LEFT | wxBU_EXACTFIT);
deps.btn->SetFont(Slic3r::GUI::wxGetApp().normal_font());
auto sizer = new wxBoxSizer(wxHORIZONTAL);
@ -3414,7 +3413,7 @@ ConfigOptionsGroupShp Page::new_optgroup(const wxString& title, int noncommon_la
void SavePresetWindow::build(const wxString& title, const std::string& default_name, std::vector<std::string> &values)
{
// TRN Preset
auto text = new wxStaticText(this, wxID_ANY, wxString::Format(_(L("Save %s as:")), title),
auto text = new wxStaticText(this, wxID_ANY, from_u8((boost::format(_utf8(L("Save %s as:"))) % title).str()),
wxDefaultPosition, wxDefaultSize);
m_combo = new wxComboBox(this, wxID_ANY, from_u8(default_name),
wxDefaultPosition, wxDefaultSize, 0, 0, wxTE_PROCESS_ENTER);

View File

@ -265,8 +265,8 @@ MsgDataIncompatible::~MsgDataIncompatible() {}
MsgDataLegacy::MsgDataLegacy() :
MsgDialog(nullptr, _(L("Configuration update")), _(L("Configuration update")))
{
auto *text = new wxStaticText(this, wxID_ANY, wxString::Format(
_(L(
auto *text = new wxStaticText(this, wxID_ANY, from_u8((boost::format(
_utf8(L(
"%s now uses an updated configuration structure.\n\n"
"So called 'System presets' have been introduced, which hold the built-in default settings for various "
@ -276,8 +276,9 @@ MsgDataLegacy::MsgDataLegacy() :
"Please proceed with the %s that follows to set up the new presets "
"and to choose whether to enable automatic preset updates."
)),
SLIC3R_APP_NAME, _(ConfigWizard::name())
)))
% SLIC3R_APP_NAME
% _utf8(ConfigWizard::name())).str()
));
text->Wrap(CONTENT_WIDTH * wxGetApp().em_unit());
content_sizer->Add(text);

View File

@ -603,7 +603,9 @@ void apply_extruder_selector(wxBitmapComboBox** ctrl,
++i;
}
(*ctrl)->Append(use_full_item_name ? wxString::Format("%s %d", str, i) : wxString::Format("%d", i), *bmp);
(*ctrl)->Append(use_full_item_name
? wxString::FromUTF8((boost::format("%1% %2%") % str % i).str())
: wxString::Format("%d", i), *bmp);
++i;
}
(*ctrl)->SetSelection(0);
@ -700,8 +702,9 @@ ModeButton::ModeButton( wxWindow* parent,
void ModeButton::Init(const wxString &mode)
{
m_tt_focused = wxString::Format(_(L("Switch to the %s mode")), mode);
m_tt_selected = wxString::Format(_(L("Current mode is %s")), mode);
std::string mode_str = std::string(mode.ToUTF8());
m_tt_focused = wxString::FromUTF8((boost::format(_utf8(L("Switch to the %s mode"))) % mode_str).str());
m_tt_selected = wxString::FromUTF8((boost::format(_utf8(L("Current mode is %s"))) % mode_str).str());
SetBitmapMargins(3, 0);

View File

@ -13,6 +13,7 @@
#include "libslic3r/PrintConfig.hpp"
#include "slic3r/GUI/I18N.hpp"
#include "slic3r/GUI/GUI.hpp"
#include "Http.hpp"
@ -65,7 +66,7 @@ bool AstroBox::test(wxString &msg) const
const auto text = ptree.get_optional<std::string>("text");
res = validate_version_text(text);
if (! res) {
msg = wxString::Format(_(L("Mismatched type of print host: %s")), text ? *text : "AstroBox");
msg = GUI::from_u8((boost::format(_utf8(L("Mismatched type of print host: %s"))) % (text ? *text : "AstroBox")).str());
}
}
catch (const std::exception &) {
@ -85,8 +86,10 @@ wxString AstroBox::get_test_ok_msg () const
wxString AstroBox::get_test_failed_msg (wxString &msg) const
{
return wxString::Format("%s: %s\n\n%s",
_(L("Could not connect to AstroBox")), msg, _(L("Note: AstroBox version at least 1.1.0 is required.")));
return GUI::from_u8((boost::format("%s: %s\n\n%s")
% _utf8(L("Could not connect to AstroBox"))
% std::string(msg.ToUTF8())
% _utf8(L("Note: AstroBox version at least 1.1.0 is required."))).str());
}
bool AstroBox::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn) const

View File

@ -51,7 +51,9 @@ wxString Duet::get_test_ok_msg () const
wxString Duet::get_test_failed_msg (wxString &msg) const
{
return wxString::Format("%s: %s", _(L("Could not connect to Duet")), msg);
return GUI::from_u8((boost::format("%s: %s")
% _utf8(L("Could not connect to Duet"))
% std::string(msg.ToUTF8())).str());
}
bool Duet::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn) const

View File

@ -70,7 +70,10 @@ wxString FlashAir::get_test_ok_msg () const
wxString FlashAir::get_test_failed_msg (wxString &msg) const
{
return wxString::Format("%s: %s", _(L("Could not connect to FlashAir")), msg, _(L("Note: FlashAir with firmware 2.00.02 or newer and activated upload function is required.")));
return wxString::FromUTF8((boost::format("%s: %s")
% _utf8(L("Could not connect to FlashAir"))
% std::string(msg.ToUTF8())
% _utf8(L("Note: FlashAir with firmware 2.00.02 or newer and activated upload function is required."))).str());
}
bool FlashAir::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn) const

View File

@ -13,6 +13,7 @@
#include "libslic3r/PrintConfig.hpp"
#include "slic3r/GUI/I18N.hpp"
#include "slic3r/GUI/GUI.hpp"
#include "Http.hpp"
@ -65,7 +66,7 @@ bool OctoPrint::test(wxString &msg) const
const auto text = ptree.get_optional<std::string>("text");
res = validate_version_text(text);
if (! res) {
msg = wxString::Format(_(L("Mismatched type of print host: %s")), text ? *text : "OctoPrint");
msg = GUI::from_u8((boost::format(_utf8(L("Mismatched type of print host: %s"))) % (text ? *text : "OctoPrint")).str());
}
}
catch (const std::exception &) {
@ -85,8 +86,10 @@ wxString OctoPrint::get_test_ok_msg () const
wxString OctoPrint::get_test_failed_msg (wxString &msg) const
{
return wxString::Format("%s: %s\n\n%s",
_(L("Could not connect to OctoPrint")), msg, _(L("Note: OctoPrint version at least 1.1.0 is required.")));
return GUI::from_u8((boost::format("%s: %s\n\n%s")
% _utf8(L("Could not connect to OctoPrint"))
% std::string(msg.ToUTF8())
% _utf8(L("Note: OctoPrint version at least 1.1.0 is required."))).str());
}
bool OctoPrint::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn) const
@ -178,7 +181,9 @@ wxString SL1Host::get_test_ok_msg () const
wxString SL1Host::get_test_failed_msg (wxString &msg) const
{
return wxString::Format("%s: %s", _(L("Could not connect to Prusa SLA")), msg);
return GUI::from_u8((boost::format("%s: %s")
% _utf8(L("Could not connect to Prusa SLA"))
% std::string(msg.ToUTF8())).str());
}
bool SL1Host::validate_version_text(const boost::optional<std::string> &version_text) const

View File

@ -702,15 +702,15 @@ PresetUpdater::UpdateResult PresetUpdater::config_update(const Semver &old_slic3
const auto max_slic3r = incompat.version.max_slic3r_version;
wxString restrictions;
if (min_slic3r != Semver::zero() && max_slic3r != Semver::inf()) {
restrictions = wxString::Format(_(L("requires min. %s and max. %s")),
min_slic3r.to_string(),
max_slic3r.to_string()
restrictions = GUI::from_u8((boost::format(_utf8(L("requires min. %s and max. %s")))
% min_slic3r.to_string()
% max_slic3r.to_string()).str()
);
} else if (min_slic3r != Semver::zero()) {
restrictions = wxString::Format(_(L("requires min. %s")), min_slic3r.to_string());
restrictions = GUI::from_u8((boost::format(_utf8(L("requires min. %s"))) % min_slic3r.to_string()).str());
BOOST_LOG_TRIVIAL(debug) << "Bundle is not downgrade, user will now have to do whole wizard. This should not happen.";
} else {
restrictions = wxString::Format(_(L("requires max. %s")), max_slic3r.to_string());
restrictions = GUI::from_u8((boost::format(_utf8(L("requires max. %s"))) % max_slic3r.to_string()).str());
}
incompats_map.emplace(std::make_pair(incompat.vendor, std::move(restrictions)));