Fixing wxString::Format encoding mismatches (part 3)
This commit is contained in:
parent
bcd3842183
commit
f2b98bddee
@ -269,7 +269,7 @@ void PrintHostQueueDialog::on_error(Event &evt)
|
|||||||
|
|
||||||
set_state(evt.job_id, ST_ERROR);
|
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(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
|
job_list->SetValue(wxVariant(errormsg), evt.job_id, COL_ERRORMSG); // Stashes the error message into a hidden column for later
|
||||||
|
|
||||||
|
@ -1470,9 +1470,10 @@ void Selection::toggle_instance_printable_state()
|
|||||||
ModelInstance* instance = model_object->instances[instance_idx];
|
ModelInstance* instance = model_object->instances[instance_idx];
|
||||||
const bool printable = !instance->printable;
|
const bool printable = !instance->printable;
|
||||||
|
|
||||||
wxString snapshot_text = model_object->instances.size() == 1 ? wxString::Format("%s %s",
|
wxString snapshot_text = model_object->instances.size() == 1 ? wxString::FromUTF8((boost::format("%1% %2%")
|
||||||
printable ? _(L("Set Printable")) : _(L("Set Unprintable")), model_object->name) :
|
% (printable ? _utf8(L("Set Printable")) : _utf8(L("Set Unprintable")))
|
||||||
printable ? _(L("Set Printable Instance")) : _(L("Set Unprintable Instance"));
|
% model_object->name).str()) :
|
||||||
|
(printable ? _(L("Set Printable Instance")) : _(L("Set Unprintable Instance")));
|
||||||
wxGetApp().plater()->take_snapshot(snapshot_text);
|
wxGetApp().plater()->take_snapshot(snapshot_text);
|
||||||
|
|
||||||
instance->printable = printable;
|
instance->printable = printable;
|
||||||
|
@ -130,7 +130,7 @@ void Tab::create_preset_tab()
|
|||||||
add_scaled_button(panel, &m_btn_hide_incompatible_presets, m_bmp_hide_incompatible_presets.name());
|
add_scaled_button(panel, &m_btn_hide_incompatible_presets, m_bmp_hide_incompatible_presets.name());
|
||||||
|
|
||||||
// TRN "Save current Settings"
|
// 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->SetToolTip(_(L("Delete this preset")));
|
||||||
m_btn_delete_preset->Disable();
|
m_btn_delete_preset->Disable();
|
||||||
|
|
||||||
@ -956,8 +956,8 @@ void Tab::update_preset_description_line()
|
|||||||
} else if (parent == nullptr) {
|
} else if (parent == nullptr) {
|
||||||
description_line = _(L("Current preset is inherited from the default preset."));
|
description_line = _(L("Current preset is inherited from the default preset."));
|
||||||
} else {
|
} else {
|
||||||
description_line = wxString::Format(
|
description_line = from_u8((boost::format(
|
||||||
_(L("Current preset is inherited from:\n\t%s")), GUI::from_u8(parent->name));
|
_utf8(L("Current preset is inherited from:\n\t%s"))) % parent->name).str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preset.is_default || preset.is_system)
|
if (preset.is_default || preset.is_system)
|
||||||
@ -1683,8 +1683,7 @@ void TabPrinter::build_printhost(ConfigOptionsGroup *optgroup)
|
|||||||
btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) {
|
btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) {
|
||||||
std::unique_ptr<PrintHost> host(PrintHost::get_print_host(m_config));
|
std::unique_ptr<PrintHost> host(PrintHost::get_print_host(m_config));
|
||||||
if (! host) {
|
if (! host) {
|
||||||
const auto text = wxString::Format("%s",
|
const wxString text = _(L("Could not get a valid Printer Host reference"));
|
||||||
_(L("Could not get a valid Printer Host reference")));
|
|
||||||
show_error(this, text);
|
show_error(this, text);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1753,11 +1752,11 @@ void TabPrinter::build_printhost(ConfigOptionsGroup *optgroup)
|
|||||||
line.full_width = 1;
|
line.full_width = 1;
|
||||||
|
|
||||||
line.widget = [this, ca_file_hint] (wxWindow* parent) {
|
line.widget = [this, ca_file_hint] (wxWindow* parent) {
|
||||||
auto txt = new wxStaticText(parent, wxID_ANY, wxString::Format("%s\n\n\t%s",
|
auto txt = new wxStaticText(parent, wxID_ANY, from_u8((boost::format("%1%\n\n\t%2%")
|
||||||
wxString::Format(_(L("HTTPS CA File:\n\
|
% (boost::format(_utf8(L("HTTPS CA File:\n\
|
||||||
\tOn this system, %s uses HTTPS certificates from the system Certificate Store or Keychain.\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),
|
\tTo use a custom CA file, please import your CA file into Certificate Store / Keychain."))) % SLIC3R_APP_NAME).str()
|
||||||
ca_file_hint));
|
% std::string(ca_file_hint.ToUTF8())).str()));
|
||||||
txt->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
txt->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
||||||
auto sizer = new wxBoxSizer(wxHORIZONTAL);
|
auto sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
sizer->Add(txt);
|
sizer->Add(txt);
|
||||||
@ -2916,8 +2915,8 @@ bool Tab::may_discard_current_dirty_preset(PresetCollection* presets /*= nullptr
|
|||||||
std::string type_name = presets->name();
|
std::string type_name = presets->name();
|
||||||
wxString tab = " ";
|
wxString tab = " ";
|
||||||
wxString name = old_preset.is_default ?
|
wxString name = old_preset.is_default ?
|
||||||
wxString::Format(_(L("Default preset (%s)")), _(type_name)) :
|
from_u8((boost::format(_utf8(L("Default preset (%s)"))) % _utf8(type_name)).str()) :
|
||||||
wxString::Format(_(L("Preset (%s)")), _(type_name)) + "\n" + tab + old_preset.name;
|
from_u8((boost::format(_utf8(L("Preset (%s)"))) % _utf8(type_name)).str()) + "\n" + tab + old_preset.name;
|
||||||
|
|
||||||
// Collect descriptions of the dirty options.
|
// Collect descriptions of the dirty options.
|
||||||
wxString changes;
|
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 = new wxCheckBox(parent, wxID_ANY, _(L("All")));
|
||||||
deps.checkbox->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
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());
|
deps.btn->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
||||||
|
|
||||||
auto sizer = new wxBoxSizer(wxHORIZONTAL);
|
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)
|
void SavePresetWindow::build(const wxString& title, const std::string& default_name, std::vector<std::string> &values)
|
||||||
{
|
{
|
||||||
// TRN Preset
|
// 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);
|
wxDefaultPosition, wxDefaultSize);
|
||||||
m_combo = new wxComboBox(this, wxID_ANY, from_u8(default_name),
|
m_combo = new wxComboBox(this, wxID_ANY, from_u8(default_name),
|
||||||
wxDefaultPosition, wxDefaultSize, 0, 0, wxTE_PROCESS_ENTER);
|
wxDefaultPosition, wxDefaultSize, 0, 0, wxTE_PROCESS_ENTER);
|
||||||
|
@ -265,8 +265,8 @@ MsgDataIncompatible::~MsgDataIncompatible() {}
|
|||||||
MsgDataLegacy::MsgDataLegacy() :
|
MsgDataLegacy::MsgDataLegacy() :
|
||||||
MsgDialog(nullptr, _(L("Configuration update")), _(L("Configuration update")))
|
MsgDialog(nullptr, _(L("Configuration update")), _(L("Configuration update")))
|
||||||
{
|
{
|
||||||
auto *text = new wxStaticText(this, wxID_ANY, wxString::Format(
|
auto *text = new wxStaticText(this, wxID_ANY, from_u8((boost::format(
|
||||||
_(L(
|
_utf8(L(
|
||||||
"%s now uses an updated configuration structure.\n\n"
|
"%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 "
|
"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 "
|
"Please proceed with the %s that follows to set up the new presets "
|
||||||
"and to choose whether to enable automatic preset updates."
|
"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());
|
text->Wrap(CONTENT_WIDTH * wxGetApp().em_unit());
|
||||||
content_sizer->Add(text);
|
content_sizer->Add(text);
|
||||||
|
@ -603,7 +603,9 @@ void apply_extruder_selector(wxBitmapComboBox** ctrl,
|
|||||||
++i;
|
++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;
|
++i;
|
||||||
}
|
}
|
||||||
(*ctrl)->SetSelection(0);
|
(*ctrl)->SetSelection(0);
|
||||||
@ -700,8 +702,9 @@ ModeButton::ModeButton( wxWindow* parent,
|
|||||||
|
|
||||||
void ModeButton::Init(const wxString &mode)
|
void ModeButton::Init(const wxString &mode)
|
||||||
{
|
{
|
||||||
m_tt_focused = wxString::Format(_(L("Switch to the %s mode")), mode);
|
std::string mode_str = std::string(mode.ToUTF8());
|
||||||
m_tt_selected = wxString::Format(_(L("Current mode is %s")), mode);
|
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);
|
SetBitmapMargins(3, 0);
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include "libslic3r/PrintConfig.hpp"
|
#include "libslic3r/PrintConfig.hpp"
|
||||||
#include "slic3r/GUI/I18N.hpp"
|
#include "slic3r/GUI/I18N.hpp"
|
||||||
|
#include "slic3r/GUI/GUI.hpp"
|
||||||
#include "Http.hpp"
|
#include "Http.hpp"
|
||||||
|
|
||||||
|
|
||||||
@ -65,7 +66,7 @@ bool AstroBox::test(wxString &msg) const
|
|||||||
const auto text = ptree.get_optional<std::string>("text");
|
const auto text = ptree.get_optional<std::string>("text");
|
||||||
res = validate_version_text(text);
|
res = validate_version_text(text);
|
||||||
if (! res) {
|
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 &) {
|
catch (const std::exception &) {
|
||||||
@ -85,8 +86,10 @@ wxString AstroBox::get_test_ok_msg () const
|
|||||||
|
|
||||||
wxString AstroBox::get_test_failed_msg (wxString &msg) const
|
wxString AstroBox::get_test_failed_msg (wxString &msg) const
|
||||||
{
|
{
|
||||||
return wxString::Format("%s: %s\n\n%s",
|
return GUI::from_u8((boost::format("%s: %s\n\n%s")
|
||||||
_(L("Could not connect to AstroBox")), msg, _(L("Note: AstroBox version at least 1.1.0 is required.")));
|
% _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
|
bool AstroBox::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn) const
|
||||||
|
@ -51,7 +51,9 @@ wxString Duet::get_test_ok_msg () const
|
|||||||
|
|
||||||
wxString Duet::get_test_failed_msg (wxString &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
|
bool Duet::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn) const
|
||||||
|
@ -70,7 +70,10 @@ wxString FlashAir::get_test_ok_msg () const
|
|||||||
|
|
||||||
wxString FlashAir::get_test_failed_msg (wxString &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
|
bool FlashAir::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn) const
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include "libslic3r/PrintConfig.hpp"
|
#include "libslic3r/PrintConfig.hpp"
|
||||||
#include "slic3r/GUI/I18N.hpp"
|
#include "slic3r/GUI/I18N.hpp"
|
||||||
|
#include "slic3r/GUI/GUI.hpp"
|
||||||
#include "Http.hpp"
|
#include "Http.hpp"
|
||||||
|
|
||||||
|
|
||||||
@ -65,7 +66,7 @@ bool OctoPrint::test(wxString &msg) const
|
|||||||
const auto text = ptree.get_optional<std::string>("text");
|
const auto text = ptree.get_optional<std::string>("text");
|
||||||
res = validate_version_text(text);
|
res = validate_version_text(text);
|
||||||
if (! res) {
|
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 &) {
|
catch (const std::exception &) {
|
||||||
@ -85,8 +86,10 @@ wxString OctoPrint::get_test_ok_msg () const
|
|||||||
|
|
||||||
wxString OctoPrint::get_test_failed_msg (wxString &msg) const
|
wxString OctoPrint::get_test_failed_msg (wxString &msg) const
|
||||||
{
|
{
|
||||||
return wxString::Format("%s: %s\n\n%s",
|
return GUI::from_u8((boost::format("%s: %s\n\n%s")
|
||||||
_(L("Could not connect to OctoPrint")), msg, _(L("Note: OctoPrint version at least 1.1.0 is required.")));
|
% _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
|
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
|
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
|
bool SL1Host::validate_version_text(const boost::optional<std::string> &version_text) const
|
||||||
|
@ -702,15 +702,15 @@ PresetUpdater::UpdateResult PresetUpdater::config_update(const Semver &old_slic3
|
|||||||
const auto max_slic3r = incompat.version.max_slic3r_version;
|
const auto max_slic3r = incompat.version.max_slic3r_version;
|
||||||
wxString restrictions;
|
wxString restrictions;
|
||||||
if (min_slic3r != Semver::zero() && max_slic3r != Semver::inf()) {
|
if (min_slic3r != Semver::zero() && max_slic3r != Semver::inf()) {
|
||||||
restrictions = wxString::Format(_(L("requires min. %s and max. %s")),
|
restrictions = GUI::from_u8((boost::format(_utf8(L("requires min. %s and max. %s")))
|
||||||
min_slic3r.to_string(),
|
% min_slic3r.to_string()
|
||||||
max_slic3r.to_string()
|
% max_slic3r.to_string()).str()
|
||||||
);
|
);
|
||||||
} else if (min_slic3r != Semver::zero()) {
|
} 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.";
|
BOOST_LOG_TRIVIAL(debug) << "Bundle is not downgrade, user will now have to do whole wizard. This should not happen.";
|
||||||
} else {
|
} 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)));
|
incompats_map.emplace(std::make_pair(incompat.vendor, std::move(restrictions)));
|
||||||
|
Loading…
Reference in New Issue
Block a user