Localize the Plater tab
* Marking and translation of Plater tab are complited * GUI.pm is marked to l10n * Fix small bug with Extruder adding at Printer Settings tab
This commit is contained in:
parent
0596660dda
commit
751c97c503
@ -31,6 +31,8 @@ use Slic3r::GUI::OptionsGroup;
|
||||
use Slic3r::GUI::OptionsGroup::Field;
|
||||
use Slic3r::GUI::SystemInfo;
|
||||
|
||||
use Wx::Locale gettext => 'L';
|
||||
|
||||
our $have_OpenGL = eval "use Slic3r::GUI::3DScene; 1";
|
||||
our $have_LWP = eval "use LWP::UserAgent; 1";
|
||||
|
||||
@ -280,8 +282,9 @@ sub update_ui_from_settings {
|
||||
|
||||
sub open_model {
|
||||
my ($self, $window) = @_;
|
||||
|
||||
my $dialog = Wx::FileDialog->new($window // $self->GetTopWindow, 'Choose one or more files (STL/OBJ/AMF/PRUSA):',
|
||||
|
||||
my $dlg_title = L('Choose one or more files (STL/OBJ/AMF/3MF/PRUSA):');
|
||||
my $dialog = Wx::FileDialog->new($window // $self->GetTopWindow, $dlg_title,
|
||||
$self->{app_config}->get_last_dir, "",
|
||||
MODEL_WILDCARD, wxFD_OPEN | wxFD_MULTIPLE | wxFD_FILE_MUST_EXIST);
|
||||
if ($dialog->ShowModal != wxID_OK) {
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "Analyzer.hpp"
|
||||
#include "PreviewData.hpp"
|
||||
#include <float.h>
|
||||
#include <wx/intl.h>
|
||||
#include "slic3r/GUI/GUI.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
@ -369,7 +370,7 @@ GCodePreviewData::LegendItemsList GCodePreviewData::get_legend_items(const std::
|
||||
items.reserve(last_valid - first_valid + 1);
|
||||
for (unsigned int i = (unsigned int)first_valid; i <= (unsigned int)last_valid; ++i)
|
||||
{
|
||||
items.emplace_back(extrusion.role_names[i], extrusion.role_colors[i]);
|
||||
items.emplace_back(_CHB(extrusion.role_names[i].c_str()).data(), extrusion.role_colors[i]);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -395,8 +396,8 @@ GCodePreviewData::LegendItemsList GCodePreviewData::get_legend_items(const std::
|
||||
items.reserve(tools_colors_count);
|
||||
for (unsigned int i = 0; i < tools_colors_count; ++i)
|
||||
{
|
||||
char buf[32];
|
||||
sprintf(buf, "Extruder %d", i + 1);
|
||||
char buf[MIN_BUF_LENGTH_FOR_L];
|
||||
sprintf(buf, _CHB(L("Extruder %d")), i + 1);
|
||||
|
||||
GCodePreviewData::Color color;
|
||||
::memcpy((void*)color.rgba, (const void*)(tool_colors.data() + i * 4), 4 * sizeof(float));
|
||||
|
@ -1168,7 +1168,7 @@ bool _3DScene::LegendTexture::generate(const GCodePreviewData& preview_data, con
|
||||
unsigned int max_text_height = 0;
|
||||
for (const GCodePreviewData::LegendItem& item : items)
|
||||
{
|
||||
memDC.GetTextExtent(GUI::L_str(item.text), &w, &h);
|
||||
memDC.GetTextExtent(GUI::from_u8(item.text), &w, &h);
|
||||
max_text_width = std::max(max_text_width, (unsigned int)w);
|
||||
max_text_height = std::max(max_text_height, (unsigned int)h);
|
||||
}
|
||||
@ -1245,7 +1245,7 @@ bool _3DScene::LegendTexture::generate(const GCodePreviewData& preview_data, con
|
||||
memDC.DrawRectangle(wxRect(icon_x_inner, icon_y + 1, px_inner_square, px_inner_square));
|
||||
|
||||
// draw text
|
||||
memDC.DrawText(GUI::L_str(item.text), text_x, icon_y + text_y_offset);
|
||||
memDC.DrawText(GUI::from_u8(item.text), text_x, icon_y + text_y_offset);
|
||||
|
||||
// update y
|
||||
icon_y += icon_y_step;
|
||||
|
@ -23,8 +23,7 @@ namespace Slic3r { namespace GUI {
|
||||
// Also, docs for wxEvent::Skip() say "In general, it is recommended to skip all
|
||||
// non-command events to allow the default handling to take place."
|
||||
event.Skip();
|
||||
std::cerr << "calling Field::on_kill_focus from " << m_opt_id<< "\n";
|
||||
// call the registered function if it is available
|
||||
// call the registered function if it is available
|
||||
if (m_on_kill_focus!=nullptr)
|
||||
m_on_kill_focus();
|
||||
}
|
||||
|
@ -519,7 +519,7 @@ void create_combochecklist(wxComboCtrl* comboCtrl, std::string text, std::string
|
||||
|
||||
comboCtrl->EnablePopupAnimation(false);
|
||||
comboCtrl->SetPopupControl(popup);
|
||||
popup->SetStringValue(text);
|
||||
popup->SetStringValue(from_u8(text));
|
||||
popup->Bind(wxEVT_CHECKLISTBOX, [popup](wxCommandEvent& evt) { popup->OnCheckListBox(evt); });
|
||||
popup->Bind(wxEVT_LISTBOX, [popup](wxCommandEvent& evt) { popup->OnListBoxSelection(evt); });
|
||||
popup->Bind(wxEVT_KEY_DOWN, [popup](wxKeyEvent& evt) { popup->OnKeyEvent(evt); });
|
||||
|
@ -34,6 +34,9 @@ class TabIface;
|
||||
//! With wxConvUTF8 explicitly specify that the source string is already in UTF-8 encoding
|
||||
#define _CHB(s) wxGetTranslation(wxString(s, wxConvUTF8)).utf8_str()
|
||||
|
||||
// Minimal buffer length for translated string (char buf[MIN_BUF_LENGTH_FOR_L])
|
||||
#define MIN_BUF_LENGTH_FOR_L 128
|
||||
|
||||
namespace GUI {
|
||||
|
||||
class Tab;
|
||||
|
@ -151,7 +151,12 @@ void OptionsGroup::append_line(const Line& line) {
|
||||
ConfigOptionDef option = opt.opt;
|
||||
// add label if any
|
||||
if (option.label != "") {
|
||||
auto field_label = new wxStaticText(parent(), wxID_ANY, L_str(option.label) + ":", wxDefaultPosition, wxDefaultSize);
|
||||
wxString str_label = L_str(option.label);
|
||||
//! To correct translation by context have to use wxGETTEXT_IN_CONTEXT macro from wxWidget 3.1.1
|
||||
// wxString str_label = (option.label == "Top" || option.label == "Bottom") ?
|
||||
// wxGETTEXT_IN_CONTEXT("Layers", wxString(option.label.c_str()):
|
||||
// L_str(option.label);
|
||||
auto field_label = new wxStaticText(parent(), wxID_ANY, str_label + ":", wxDefaultPosition, wxDefaultSize);
|
||||
field_label->SetFont(label_font);
|
||||
sizer->Add(field_label, 0, wxALIGN_CENTER_VERTICAL, 0);
|
||||
}
|
||||
|
@ -113,8 +113,7 @@ PageShp Tab::add_options_page(wxString title, std::string icon, bool is_extruder
|
||||
// Index of icon in an icon list $self->{icons}.
|
||||
auto icon_idx = 0;
|
||||
if (!icon.empty()) {
|
||||
if (m_icon_index.find(icon) == m_icon_index.end())
|
||||
icon_idx = -1;
|
||||
icon_idx = (m_icon_index.find(icon) == m_icon_index.end()) ? -1 : m_icon_index.at(icon);
|
||||
if (icon_idx == -1) {
|
||||
// Add a new icon to the icon list.
|
||||
const auto img_icon = new wxIcon(from_u8(Slic3r::var(icon)), wxBITMAP_TYPE_PNG);
|
||||
@ -1184,7 +1183,9 @@ void TabPrinter::extruders_count_changed(size_t extruders_count){
|
||||
void TabPrinter::build_extruder_pages(){
|
||||
for (auto extruder_idx = m_extruder_pages.size(); extruder_idx < m_extruders_count; ++extruder_idx){
|
||||
//# build page
|
||||
auto page = add_options_page(_(L("Extruder ")) + wxString::Format(_T("%i"), extruder_idx + 1), "funnel.png", true);
|
||||
char buf[MIN_BUF_LENGTH_FOR_L];
|
||||
sprintf(buf, _CHB(L("Extruder %d")), extruder_idx + 1);
|
||||
auto page = add_options_page(from_u8(buf), "funnel.png", true);
|
||||
m_extruder_pages.push_back(page);
|
||||
|
||||
auto optgroup = page->new_optgroup(_(L("Size")));
|
||||
|
Loading…
Reference in New Issue
Block a user