Merge remote-tracking branch 'origin/master' into new_main_page_ui

This commit is contained in:
YuSanka 2018-05-03 09:30:02 +02:00
commit 6abfee65ce
25 changed files with 1955 additions and 1029 deletions

View File

@ -1,18 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is autogenerated by CMake
Note: In the .in template file, the $ {}-style variables are interpreted by CMake while the $()-style variables belong to MSVC
-->
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets">
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<ExecutablePath>$(VC_ExecutablePath_x64);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(FxCopDir);$(PATH);c:\wperl64d\bin\;</ExecutablePath>
<ExecutablePath>$(VC_ExecutablePath_x64);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(FxCopDir);$(PATH);${PROPS_PERL_BIN_PATH}\;</ExecutablePath>
</PropertyGroup>
<ItemDefinitionGroup />
<ItemGroup />
<PropertyGroup>
<LocalDebuggerCommand>C:\wperl64d\bin\perl.exe</LocalDebuggerCommand>
<LocalDebuggerCommand>${PROPS_PERL_EXECUTABLE}</LocalDebuggerCommand>
<LocalDebuggerCommandArguments>slic3r.pl</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerWorkingDirectory>..\..</LocalDebuggerWorkingDirectory>
<LocalDebuggerWorkingDirectory>${PROPS_CMAKE_SOURCE_DIR}</LocalDebuggerWorkingDirectory>
</PropertyGroup>
</Project>

View File

@ -549,8 +549,8 @@ sub _on_select_preset {
return if ($selected_item == $self->{"selected_item_$group"});
my $selected_string = $choice->GetString($selected_item);
if ($selected_string eq "------- System presets -------" ||
$selected_string eq "------- User presets -------"){
if ($selected_string eq ("------- ".L("System presets")." -------") ||
$selected_string eq ("------- ".L("User presets")." -------") ){
$choice->SetSelection($self->{"selected_item_$group"});
return;
}
@ -1809,8 +1809,7 @@ sub list_item_deselected {
if ($self->{list}->GetFirstSelected == -1) {
$self->select_object(undef);
$self->{canvas}->Refresh;
#FIXME VBOs are being refreshed just to change a selection color?
$self->{canvas3D}->reload_scene if $self->{canvas3D};
$self->{canvas3D}->deselect_volumes if $self->{canvas3D};
}
undef $self->{_lecursor};
}
@ -1822,8 +1821,7 @@ sub list_item_selected {
my $obj_idx = $event->GetIndex;
$self->select_object($obj_idx);
$self->{canvas}->Refresh;
#FIXME VBOs are being refreshed just to change a selection color?
$self->{canvas3D}->reload_scene if $self->{canvas3D};
$self->{canvas3D}->update_volumes_selection if $self->{canvas3D};
undef $self->{_lecursor};
}
@ -2015,8 +2013,15 @@ sub selection_changed {
sub select_object {
my ($self, $obj_idx) = @_;
# remove current selection
foreach my $o (0..$#{$self->{objects}}) {
$PreventListEvents = 1;
$self->{objects}->[$o]->selected(0);
$self->{list}->Select($o, 0);
$PreventListEvents = 0;
}
$_->selected(0) for @{ $self->{objects} };
if (defined $obj_idx) {
$self->{objects}->[$obj_idx]->selected(1);
# We use this flag to avoid circular event handling

View File

@ -31,7 +31,9 @@ sub new {
$self->{on_select_object} = sub {};
$self->{on_instances_moved} = sub {};
$self->{on_wipe_tower_moved} = sub {};
$self->{objects_volumes_idxs} = ();
$self->on_select(sub {
my ($volume_idx) = @_;
$self->{on_select_object}->(($volume_idx == -1) ? undef : $self->volumes->[$volume_idx]->object_idx)
@ -181,6 +183,17 @@ sub set_on_enable_action_buttons {
$self->on_enable_action_buttons($cb);
}
sub update_volumes_selection {
my ($self) = @_;
foreach my $obj_idx (0..$#{$self->{model}->objects}) {
if ($self->{objects}[$obj_idx]->selected) {
my @volume_idxs = @{$self->{objects_volumes_idxs}[$obj_idx]};
$self->select_volume($_) for @volume_idxs;
}
}
}
sub reload_scene {
my ($self, $force) = @_;
@ -194,12 +207,14 @@ sub reload_scene {
$self->{reload_delayed} = 0;
$self->{objects_volumes_idxs} = ();
foreach my $obj_idx (0..$#{$self->{model}->objects}) {
my @volume_idxs = $self->load_object($self->{model}, $self->{print}, $obj_idx);
if ($self->{objects}[$obj_idx]->selected) {
$self->select_volume($_) for @volume_idxs;
}
push(@{$self->{objects_volumes_idxs}}, \@volume_idxs);
}
$self->update_volumes_selection;
if (defined $self->{config}->nozzle_diameter) {
# Should the wipe tower be visualized?
my $extruders_count = scalar @{ $self->{config}->nozzle_diameter };

View File

@ -116,7 +116,6 @@ sub new {
$canvas->set_auto_bed_shape;
$canvas->SetSize([500,500]);
$canvas->SetMinSize($canvas->GetSize);
$canvas->zoom_to_volumes;
}
$self->{sizer} = Wx::BoxSizer->new(wxHORIZONTAL);

View File

@ -163,7 +163,6 @@ sub new {
$canvas->set_auto_bed_shape;
$canvas->SetSize([500,700]);
$canvas->update_volumes_colors_by_extruder($self->GetParent->GetParent->GetParent->{config});
$canvas->zoom_to_volumes;
}
$self->{sizer} = Wx::BoxSizer->new(wxHORIZONTAL);

File diff suppressed because it is too large Load Diff

View File

@ -1,15 +1,23 @@
xs/src/slic3r/GUI/AboutDialog.cpp
xs/src/slic3r/GUI/BedShapeDialog.cpp
xs/src/slic3r/GUI/BedShapeDialog.hpp
xs/src/slic3r/GUI/BonjourDialog.cpp
xs/src/slic3r/GUI/ButtonsDescription.cpp
xs/src/slic3r/GUI/ConfigSnapshotDialog.cpp
xs/src/slic3r/GUI/ConfigWizard.cpp
xs/src/slic3r/GUI/GUI.cpp
xs/src/slic3r/GUI/MsgDialog.cpp
xs/src/slic3r/GUI/Tab.cpp
xs/src/slic3r/GUI/Tab.hpp
xs/src/slic3r/GUI/Field.cpp
xs/src/slic3r/GUI/OptionsGroup.cpp
xs/src/slic3r/GUI/2DBed.cpp
xs/src/slic3r/GUI/Preset.cpp
xs/src/slic3r/GUI/PresetBundle.cpp
xs/src/slic3r/GUI/PresetHints.cpp
xs/src/slic3r/GUI/Preferences.hpp
xs/src/slic3r/GUI/Preferences.cpp
xs/src/slic3r/GUI/BonjourDialog.cpp
xs/src/slic3r/GUI/RammingChart.cpp
xs/src/slic3r/GUI/UpdateDialogs.cpp
xs/src/slic3r/GUI/WipeTowerDialog.cpp
xs/src/slic3r/Utils/OctoPrint.cpp
xs/src/libslic3r/PrintConfig.cpp
xs/src/libslic3r/GCode/PreviewData.cpp

View File

@ -665,7 +665,12 @@ endif ()
if (MSVC)
# Here we associate some additional properties with the MSVC project to enable compilation and debugging out of the box.
set_target_properties(XS PROPERTIES VS_USER_PROPS "${PROJECT_SOURCE_DIR}/cmake/msvc/xs.wperl64d.props")
get_filename_component(PROPS_PERL_BIN_PATH "${PERL_EXECUTABLE}" DIRECTORY)
string(REPLACE "/" "\\" PROPS_PERL_BIN_PATH "${PROPS_PERL_BIN_PATH}")
string(REPLACE "/" "\\" PROPS_PERL_EXECUTABLE "${PERL_EXECUTABLE}")
string(REPLACE "/" "\\" PROPS_CMAKE_SOURCE_DIR "${CMAKE_SOURCE_DIR}")
configure_file("${PROJECT_SOURCE_DIR}/cmake/msvc/xs.wperl.props.in" "${CMAKE_BINARY_DIR}/xs.wperl.props" NEWLINE_STYLE CRLF)
set_target_properties(XS PROPERTIES VS_USER_PROPS "${CMAKE_BINARY_DIR}/xs.wperl.props")
endif()
# l10n

View File

@ -269,6 +269,10 @@ TriangleMesh Model::mesh() const
static bool _arrange(const Pointfs &sizes, coordf_t dist, const BoundingBoxf* bb, Pointfs &out)
{
if (sizes.empty())
// return if the list is empty or the following call to BoundingBoxf constructor will lead to a crash
return true;
// we supply unscaled data to arrange()
bool result = Slic3r::Geometry::arrange(
sizes.size(), // number of parts

View File

@ -598,10 +598,10 @@ std::string Print::validate() const
return "The Wipe Tower is currently only supported with the relative extruder addressing (use_relative_e_distances=1).";
SlicingParameters slicing_params0 = this->objects.front()->slicing_parameters();
const PrintObject* most_layered_object = this->objects.front(); // object with highest layer_height_profile.size() encountered so far
const PrintObject* tallest_object = this->objects.front(); // let's find the tallest object
for (const auto* object : objects)
if (object->layer_height_profile.size() > most_layered_object->layer_height_profile.size())
most_layered_object = object;
if (*(object->layer_height_profile.end()-2) > *(tallest_object->layer_height_profile.end()-2) )
tallest_object = object;
for (PrintObject *object : this->objects) {
SlicingParameters slicing_params = object->slicing_parameters();
@ -618,17 +618,26 @@ std::string Print::validate() const
object->update_layer_height_profile();
object->layer_height_profile_valid = was_layer_height_profile_valid;
if ( this->config.variable_layer_height ) {
int i = 0;
while ( i < object->layer_height_profile.size() ) {
if (std::abs(most_layered_object->layer_height_profile[i] - object->layer_height_profile[i]) > EPSILON)
return "The Wipe tower is only supported if all objects have the same layer height profile";
++i;
if (i == object->layer_height_profile.size()-2) // this element contains the objects max z, if the other object is taller,
// it does not have to match - we will step over it
if (most_layered_object->layer_height_profile[i] > object->layer_height_profile[i])
++i;
if ( this->config.variable_layer_height ) { // comparing layer height profiles
bool failed = false;
if (tallest_object->layer_height_profile.size() >= object->layer_height_profile.size() ) {
int i = 0;
while ( i < object->layer_height_profile.size() && i < tallest_object->layer_height_profile.size()) {
if (std::abs(tallest_object->layer_height_profile[i] - object->layer_height_profile[i])) {
failed = true;
break;
}
++i;
if (i == object->layer_height_profile.size()-2) // this element contains this objects max z
if (tallest_object->layer_height_profile[i] > object->layer_height_profile[i]) // the difference does not matter in this case
++i;
}
}
else
failed = true;
if (failed)
return "The Wipe tower is only supported if all objects have the same layer height profile";
}
/*for (size_t i = 5; i < object->layer_height_profile.size(); i += 2)

View File

@ -57,7 +57,7 @@ AboutDialog::AboutDialog()
// version
{
auto version_string = _(L("Version ")) + std::string(SLIC3R_VERSION);
auto version_string = _(L("Version"))+ " " + std::string(SLIC3R_VERSION);
wxStaticText* version = new wxStaticText(this, wxID_ANY, version_string.c_str(), wxDefaultPosition, wxDefaultSize);
wxFont version_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
#ifdef __WXMSW__

View File

@ -191,7 +191,7 @@ void BonjourDialog::on_timer(wxTimerEvent &)
label->SetLabel(wxString::Format("%s %s", search_str, dots));
timer_state = (timer_state) % 3 + 1;
} else {
label->SetLabel(wxString::Format("%s: %s", search_str, _(L("Finished."))));
label->SetLabel(wxString::Format("%s: %s", search_str, _(L("Finished"))+"."));
timer->Stop();
}
}

View File

@ -10,7 +10,7 @@ namespace Slic3r {
namespace GUI {
ButtonsDescription::ButtonsDescription(wxWindow* parent, t_icon_descriptions* icon_descriptions) :
wxDialog(parent, wxID_ANY, "Buttons And Text Colors Description", wxDefaultPosition, wxDefaultSize),
wxDialog(parent, wxID_ANY, _(L("Buttons And Text Colors Description")), wxDefaultPosition, wxDefaultSize),
m_icon_descriptions(icon_descriptions)
{
auto grid_sizer = new wxFlexGridSizer(3, 20, 20);

View File

@ -8,32 +8,32 @@
namespace Slic3r {
namespace GUI {
static std::string format_reason(const Config::Snapshot::Reason reason)
static wxString format_reason(const Config::Snapshot::Reason reason)
{
switch (reason) {
case Config::Snapshot::SNAPSHOT_UPGRADE:
return std::string(_(L("Upgrade")));
return wxString(_(L("Upgrade")));
case Config::Snapshot::SNAPSHOT_DOWNGRADE:
return std::string(_(L("Downgrade")));
return wxString(_(L("Downgrade")));
case Config::Snapshot::SNAPSHOT_BEFORE_ROLLBACK:
return std::string(_(L("Before roll back")));
return wxString(_(L("Before roll back")));
case Config::Snapshot::SNAPSHOT_USER:
return std::string(_(L("User")));
return wxString(_(L("User")));
case Config::Snapshot::SNAPSHOT_UNKNOWN:
default:
return std::string(_(L("Unknown")));
return wxString(_(L("Unknown")));
}
}
static std::string generate_html_row(const Config::Snapshot &snapshot, bool row_even, bool snapshot_active)
static wxString generate_html_row(const Config::Snapshot &snapshot, bool row_even, bool snapshot_active)
{
// Start by declaring a row with an alternating background color.
std::string text = "<tr bgcolor=\"";
wxString text = "<tr bgcolor=\"";
text += snapshot_active ? "#B3FFCB" : (row_even ? "#FFFFFF" : "#D5D5D5");
text += "\">";
text += "<td>";
// Format the row header.
text += std::string("<font size=\"5\"><b>") + (snapshot_active ? _(L("Active: ")) : "") +
text += wxString("<font size=\"5\"><b>") + (snapshot_active ? _(L("Active: ")) : "") +
Utils::format_local_date_time(snapshot.time_captured) + ": " + format_reason(snapshot.reason);
if (! snapshot.comment.empty())
text += " (" + snapshot.comment + ")";
@ -46,9 +46,10 @@ static std::string generate_html_row(const Config::Snapshot &snapshot, bool row_
bool compatible = true;
for (const Config::Snapshot::VendorConfig &vc : snapshot.vendor_configs) {
text += _(L("vendor")) + ": " + vc.name + ", ver: " + vc.version.config_version.to_string() + ", min slic3r ver: " + vc.version.min_slic3r_version.to_string();
text += _(L("vendor")) + ": " + vc.name +", " + _(L("version")) + ": " + vc.version.config_version.to_string() +
", " + _(L("min slic3r version")) + ": " + vc.version.min_slic3r_version.to_string();
if (vc.version.max_slic3r_version != Semver::inf())
text += ", max slic3r ver: " + vc.version.max_slic3r_version.to_string();
text += ", " + _(L("max slic3r version")) + ": " + vc.version.max_slic3r_version.to_string();
text += "<br>";
for (const std::pair<std::string, std::set<std::string>> &model : vc.models_variants_installed) {
text += _(L("model")) + ": " + model.first + ", " + _(L("variants")) + ": ";
@ -72,9 +73,9 @@ static std::string generate_html_row(const Config::Snapshot &snapshot, bool row_
return text;
}
static std::string generate_html_page(const Config::SnapshotDB &snapshot_db, const std::string &on_snapshot)
static wxString generate_html_page(const Config::SnapshotDB &snapshot_db, const wxString &on_snapshot)
{
std::string text =
wxString text =
"<html>"
"<body bgcolor=\"#ffffff\" cellspacing=\"2\" cellpadding=\"0\" border=\"0\" link=\"#800000\">"
"<font color=\"#000000\">";
@ -91,7 +92,7 @@ static std::string generate_html_page(const Config::SnapshotDB &snapshot_db, con
return text;
}
ConfigSnapshotDialog::ConfigSnapshotDialog(const Config::SnapshotDB &snapshot_db, const std::string &on_snapshot)
ConfigSnapshotDialog::ConfigSnapshotDialog(const Config::SnapshotDB &snapshot_db, const wxString &on_snapshot)
: wxDialog(NULL, wxID_ANY, _(L("Configuration Snapshots")), wxDefaultPosition, wxSize(600, 500), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMAXIMIZE_BOX)
{
this->SetBackgroundColour(*wxWHITE);
@ -110,8 +111,8 @@ ConfigSnapshotDialog::ConfigSnapshotDialog(const Config::SnapshotDB &snapshot_db
#endif
html->SetFonts(font.GetFaceName(), font.GetFaceName(), size);
html->SetBorders(2);
std::string text = generate_html_page(snapshot_db, on_snapshot);
html->SetPage(text.c_str());
wxString text = generate_html_page(snapshot_db, on_snapshot);
html->SetPage(text);
vsizer->Add(html, 1, wxEXPAND | wxALIGN_LEFT | wxRIGHT | wxBOTTOM, 0);
html->Bind(wxEVT_HTML_LINK_CLICKED, &ConfigSnapshotDialog::onLinkClicked, this);
}

View File

@ -17,7 +17,7 @@ namespace Config {
class ConfigSnapshotDialog : public wxDialog
{
public:
ConfigSnapshotDialog(const Config::SnapshotDB &snapshot_db, const std::string &id);
ConfigSnapshotDialog(const Config::SnapshotDB &snapshot_db, const wxString &id);
const std::string& snapshot_to_activate() const { return m_snapshot_to_activate; }
private:

View File

@ -4,6 +4,8 @@
#include <utility>
#include <unordered_map>
#include <boost/log/trivial.hpp>
#include <wx/settings.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
@ -741,9 +743,12 @@ void ConfigWizard::priv::apply_config(AppConfig *app_config, PresetBundle *prese
if (install_bundles.size() > 0) {
// Install bundles from resources.
updater->install_bundles_rsrc(std::move(install_bundles), snapshot);
} else {
BOOST_LOG_TRIVIAL(info) << "No bundles need to be installed from resources";
}
if (page_welcome->reset_user_profile()) {
BOOST_LOG_TRIVIAL(info) << "Resetting user profiles...";
preset_bundle->reset(true);
}
@ -828,10 +833,13 @@ ConfigWizard::~ConfigWizard() {}
bool ConfigWizard::run(PresetBundle *preset_bundle, const PresetUpdater *updater)
{
BOOST_LOG_TRIVIAL(info) << "Running ConfigWizard, reason: " << p->run_reason;
if (ShowModal() == wxID_OK) {
p->apply_config(GUI::get_app_config(), preset_bundle, updater);
BOOST_LOG_TRIVIAL(info) << "ConfigWizard applied";
return true;
} else {
BOOST_LOG_TRIVIAL(info) << "ConfigWizard cancelled";
return false;
}
}

View File

@ -205,7 +205,7 @@ static void init_label_colours()
{
auto luma = get_colour_approx_luma(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
if (luma >= 128) {
g_color_label_modified = wxColour(253, 88, 0);
g_color_label_modified = wxColour(252, 77, 1);
g_color_label_sys = wxColour(26, 132, 57);
} else {
g_color_label_modified = wxColour(253, 111, 40);
@ -311,22 +311,18 @@ bool select_language(wxArrayString & names,
bool load_language()
{
long language;
if (!g_AppConfig->has("translation_language"))
language = wxLANGUAGE_UNKNOWN;
else {
auto str_language = g_AppConfig->get("translation_language");
language = str_language != "" ? stol(str_language) : wxLANGUAGE_UNKNOWN;
}
wxString language = wxEmptyString;
if (g_AppConfig->has("translation_language"))
language = g_AppConfig->get("translation_language");
if (language == wxLANGUAGE_UNKNOWN)
if (language.IsEmpty())
return false;
wxArrayString names;
wxArrayLong identifiers;
get_installed_languages(names, identifiers);
for (size_t i = 0; i < identifiers.Count(); i++)
{
if (identifiers[i] == language)
if (wxLocale::GetLanguageCanonicalName(identifiers[i]) == language)
{
g_wxLocale = new wxLocale;
g_wxLocale->Init(identifiers[i]);
@ -341,12 +337,11 @@ bool load_language()
void save_language()
{
long language = wxLANGUAGE_UNKNOWN;
if (g_wxLocale) {
language = g_wxLocale->GetLanguage();
}
std::string str_language = std::to_string(language);
g_AppConfig->set("translation_language", str_language);
wxString language = wxEmptyString;
if (g_wxLocale)
language = g_wxLocale->GetCanonicalName();
g_AppConfig->set("translation_language", language.ToStdString());
g_AppConfig->save();
}
@ -400,12 +395,12 @@ void add_config_menu(wxMenuBar *menu, int event_preferences_changed, int event_l
const auto config_wizard_tooltip = wxString::Format(_(L("Run %s")), ConfigWizard::name());
// Cmd+, is standard on OS X - what about other operating systems?
local_menu->Append(config_id_base + ConfigMenuWizard, ConfigWizard::name() + "\u2026", config_wizard_tooltip);
local_menu->Append(config_id_base + ConfigMenuSnapshots, _(L("Configuration Snapshots\u2026")), _(L("Inspect / activate configuration snapshots")));
local_menu->Append(config_id_base + ConfigMenuTakeSnapshot, _(L("Take Configuration Snapshot")), _(L("Capture a configuration snapshot")));
local_menu->Append(config_id_base + ConfigMenuUpdate, _(L("Check for updates")), _(L("Check for configuration updates")));
local_menu->Append(config_id_base + ConfigMenuWizard, ConfigWizard::name() + "\u2026", config_wizard_tooltip);
local_menu->Append(config_id_base + ConfigMenuSnapshots, _(L("Configuration Snapshots"))+"\u2026", _(L("Inspect / activate configuration snapshots")));
local_menu->Append(config_id_base + ConfigMenuTakeSnapshot, _(L("Take Configuration Snapshot")), _(L("Capture a configuration snapshot")));
local_menu->Append(config_id_base + ConfigMenuUpdate, _(L("Check for updates")), _(L("Check for configuration updates")));
local_menu->AppendSeparator();
local_menu->Append(config_id_base + ConfigMenuPreferences, _(L("Preferences\u2026\tCtrl+,")), _(L("Application preferences")));
local_menu->Append(config_id_base + ConfigMenuPreferences, _(L("Preferences"))+"\u2026\tCtrl+,", _(L("Application preferences")));
local_menu->AppendSeparator();
local_menu->Append(config_id_base + ConfigMenuLanguage, _(L("Change Application Language")));
local_menu->Bind(wxEVT_MENU, [config_id_base, event_language_change, event_preferences_changed](wxEvent &event){
@ -687,7 +682,7 @@ void show_info(wxWindow* parent, const wxString& message, const wxString& title)
}
void warning_catcher(wxWindow* parent, const wxString& message){
if (message == _(L("GLUquadricObjPtr | Attempt to free unreferenced scalar")) )
if (message == "GLUquadricObjPtr | " + _(L("Attempt to free unreferenced scalar")) )
return;
wxMessageDialog msg(parent, message, _(L("Warning")), wxOK | wxICON_WARNING);
msg.ShowModal();
@ -923,7 +918,7 @@ void add_frequently_changed_parameters(wxWindow* parent, wxBoxSizer* sizer, wxFl
m_optgroup->append_single_option_line(option);
Line line = { _(L("")), "" };
Line line = { "", "" };
line.widget = [config](wxWindow* parent){
g_wiping_dialog_button = new wxButton(parent, wxID_ANY, _(L("Purging volumes")) + "\u2026", wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
auto sizer = new wxBoxSizer(wxHORIZONTAL);

View File

@ -5,6 +5,12 @@
namespace Slic3r {
namespace GUI {
PreferencesDialog::PreferencesDialog(wxWindow* parent, int event_preferences) :
wxDialog(parent, wxID_ANY, _(L("Preferences")), wxDefaultPosition, wxDefaultSize),
m_event_preferences(event_preferences) {
build();
}
void PreferencesDialog::build()
{
auto app_config = get_app_config();

View File

@ -17,8 +17,7 @@ class PreferencesDialog : public wxDialog
std::shared_ptr<ConfigOptionsGroup> m_optgroup;
int m_event_preferences;
public:
PreferencesDialog(wxWindow* parent, int event_preferences) : wxDialog(parent, wxID_ANY, _(L("Preferences")),
wxDefaultPosition, wxDefaultSize), m_event_preferences(event_preferences) { build(); }
PreferencesDialog(wxWindow* parent, int event_preferences);
~PreferencesDialog(){ }
void build();

View File

@ -602,7 +602,7 @@ void PresetCollection::update_platter_ui(wxBitmapComboBox *ui)
std::map<wxString, wxBitmap*> nonsys_presets;
wxString selected = "";
if (!this->m_presets.front().is_visible)
ui->Append("------- System presets -------", wxNullBitmap);
ui->Append("------- " +_(L("System presets")) + " -------", wxNullBitmap);
for (size_t i = this->m_presets.front().is_visible ? 0 : 1; i < this->m_presets.size(); ++i) {
const Preset &preset = this->m_presets[i];
if (! preset.is_visible || (! preset.is_compatible && i != m_idx_selected))
@ -642,11 +642,11 @@ void PresetCollection::update_platter_ui(wxBitmapComboBox *ui)
selected = wxString::FromUTF8((preset.name + (preset.is_dirty ? g_suffix_modified : "")).c_str());
}
if (preset.is_default)
ui->Append("------- System presets -------", wxNullBitmap);
ui->Append("------- " + _(L("System presets")) + " -------", wxNullBitmap);
}
if (!nonsys_presets.empty())
{
ui->Append("------- User presets -------", wxNullBitmap);
ui->Append("------- " + _(L("User presets")) + " -------", wxNullBitmap);
for (std::map<wxString, wxBitmap*>::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) {
ui->Append(it->first, *it->second);
if (it->first == selected)
@ -667,7 +667,7 @@ size_t PresetCollection::update_tab_ui(wxBitmapComboBox *ui, bool show_incompati
std::map<wxString, wxBitmap*> nonsys_presets;
wxString selected = "";
if (!this->m_presets.front().is_visible)
ui->Append("------- System presets -------", wxNullBitmap);
ui->Append("------- " + _(L("System presets")) + " -------", wxNullBitmap);
for (size_t i = this->m_presets.front().is_visible ? 0 : 1; i < this->m_presets.size(); ++i) {
const Preset &preset = this->m_presets[i];
if (! preset.is_visible || (! show_incompatible && ! preset.is_compatible && i != m_idx_selected))
@ -699,11 +699,11 @@ size_t PresetCollection::update_tab_ui(wxBitmapComboBox *ui, bool show_incompati
selected = wxString::FromUTF8((preset.name + (preset.is_dirty ? g_suffix_modified : "")).c_str());
}
if (preset.is_default)
ui->Append("------- System presets -------", wxNullBitmap);
ui->Append("------- " + _(L("System presets")) + " -------", wxNullBitmap);
}
if (!nonsys_presets.empty())
{
ui->Append("------- User presets -------", wxNullBitmap);
ui->Append("------- " + _(L("User presets")) + " -------", wxNullBitmap);
for (std::map<wxString, wxBitmap*>::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) {
ui->Append(it->first, *it->second);
if (it->first == selected)
@ -808,11 +808,6 @@ bool PresetCollection::select_preset_by_name(const std::string &name_w_suffix, b
// If the first visible preset was not found, return the 0th element, which is the default preset.
}
// Temporary decision
if (name_w_suffix == "------- System presets -------" ||
name_w_suffix == "------- User presets -------")
return true;
// 2) Select the new preset.
if (m_idx_selected != idx || force) {
this->select_preset(idx);

View File

@ -1011,8 +1011,7 @@ void PresetBundle::export_configbundle(const std::string &path) //, const Dynami
// an optional "(modified)" suffix will be removed from the filament name.
void PresetBundle::set_filament_preset(size_t idx, const std::string &name)
{
if (name == "------- System presets -------" ||
name == "------- User presets -------")
if (name.find_first_of("-------") == 0)
return;
if (idx >= filament_presets.size())
@ -1066,7 +1065,7 @@ void PresetBundle::update_platter_filament_ui(unsigned int idx_extruder, wxBitma
std::map<wxString, wxBitmap*> nonsys_presets;
wxString selected_str = "";
if (!this->filaments().front().is_visible)
ui->Append("------- System presets -------", wxNullBitmap);
ui->Append("------- " + _(L("System presets")) + " -------", wxNullBitmap);
for (int i = this->filaments().front().is_visible ? 0 : 1; i < int(this->filaments().size()); ++i) {
const Preset &preset = this->filaments.preset(i);
bool selected = this->filament_presets[idx_extruder] == preset.name;
@ -1119,12 +1118,12 @@ void PresetBundle::update_platter_filament_ui(unsigned int idx_extruder, wxBitma
selected_str = wxString::FromUTF8((preset.name + (preset.is_dirty ? Preset::suffix_modified() : "")).c_str());
}
if (preset.is_default)
ui->Append("------- System presets -------", wxNullBitmap);
ui->Append("------- " + _(L("System presets")) + " -------", wxNullBitmap);
}
if (!nonsys_presets.empty())
{
ui->Append("------- User presets -------", wxNullBitmap);
ui->Append("------- " + _(L("User presets")) + " -------", wxNullBitmap);
for (std::map<wxString, wxBitmap*>::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) {
ui->Append(it->first, *it->second);
if (it->first == selected_str)

View File

@ -25,7 +25,7 @@ void Chart::draw() {
dc.DrawRectangle(m_rect);
if (visible_area.m_width < 0.499) {
dc.DrawText("NO RAMMING AT ALL",wxPoint(m_rect.GetLeft()+m_rect.GetWidth()/2-50,m_rect.GetBottom()-m_rect.GetHeight()/2));
dc.DrawText(_(L("NO RAMMING AT ALL")),wxPoint(m_rect.GetLeft()+m_rect.GetWidth()/2-50,m_rect.GetBottom()-m_rect.GetHeight()/2));
return;
}
@ -78,12 +78,12 @@ void Chart::draw() {
}
// axis labels:
wxString label = L("Time (s)");
wxString label = _(L("Time")) + " ("+_(L("s"))+")";
int text_width = 0;
int text_height = 0;
dc.GetTextExtent(label,&text_width,&text_height);
dc.DrawText(label,wxPoint(0.5*(m_rect.GetRight()+m_rect.GetLeft())-text_width/2.f, m_rect.GetBottom()+25));
label = L("Volumetric speed (mm\u00B3/s)");
label = _(L("Volumetric speed")) + " (" + _(L("mm")) + "\u00B3/" + _(L("s")) + ")";
dc.GetTextExtent(label,&text_width,&text_height);
dc.DrawRotatedText(label,wxPoint(0,0.5*(m_rect.GetBottom()+m_rect.GetTop())+text_width/2.f),90);
}

View File

@ -230,8 +230,9 @@ void Tab::create_preset_tab(PresetBundle *preset_bundle)
return;
if (selected_item >= 0){
std::string selected_string = m_presets_choice->GetString(selected_item).ToUTF8().data();
if (selected_string == "------- System presets -------" ||
selected_string == "------- User presets -------"){
if (selected_string.find_first_of("-------") == 0
/*selected_string == "------- System presets -------" ||
selected_string == "------- User presets -------"*/){
m_presets_choice->SetSelection(m_selected_preset_item);
return;
}
@ -1311,7 +1312,7 @@ void TabFilament::build()
};
optgroup->append_line(line);
optgroup = page->new_optgroup(_(L("Toolchange behaviour")));
optgroup = page->new_optgroup(_(L("Toolchange parameters with single extruder MM printers")));
optgroup->append_single_option_line("filament_loading_speed");
optgroup->append_single_option_line("filament_unloading_speed");
optgroup->append_single_option_line("filament_toolchange_delay");

View File

@ -79,15 +79,15 @@ RammingPanel::RammingPanel(wxWindow* parent, const std::string& parameters)
m_widget_ramming_step_multiplicator = new wxSpinCtrl(this,wxID_ANY,wxEmptyString,wxDefaultPosition,wxSize(75, -1),wxSP_ARROW_KEYS,10,200,100);
auto gsizer_param = new wxFlexGridSizer(2, 5, 15);
gsizer_param->Add(new wxStaticText(this, wxID_ANY, wxString(_(L("Total ramming time (s):")))), 0, wxALIGN_CENTER_VERTICAL);
gsizer_param->Add(new wxStaticText(this, wxID_ANY, wxString(_(L("Total ramming time")) + " (" + _(L("s")) + "):")), 0, wxALIGN_CENTER_VERTICAL);
gsizer_param->Add(m_widget_time);
gsizer_param->Add(new wxStaticText(this, wxID_ANY, wxString(_(L("Total rammed volume (mm"))+"\u00B3):")), 0, wxALIGN_CENTER_VERTICAL);
gsizer_param->Add(new wxStaticText(this, wxID_ANY, wxString(_(L("Total rammed volume")) + " (" + _(L("mm")) + "\u00B3):")), 0, wxALIGN_CENTER_VERTICAL);
gsizer_param->Add(m_widget_volume);
gsizer_param->AddSpacer(20);
gsizer_param->AddSpacer(20);
gsizer_param->Add(new wxStaticText(this, wxID_ANY, wxString(_(L("Ramming line width (%):")))), 0, wxALIGN_CENTER_VERTICAL);
gsizer_param->Add(new wxStaticText(this, wxID_ANY, wxString(_(L("Ramming line width")) + " (%):")), 0, wxALIGN_CENTER_VERTICAL);
gsizer_param->Add(m_widget_ramming_line_width_multiplicator);
gsizer_param->Add(new wxStaticText(this, wxID_ANY, wxString(_(L("Ramming line spacing (%):")))), 0, wxALIGN_CENTER_VERTICAL);
gsizer_param->Add(new wxStaticText(this, wxID_ANY, wxString(_(L("Ramming line spacing")) + " (%):")), 0, wxALIGN_CENTER_VERTICAL);
gsizer_param->Add(m_widget_ramming_step_multiplicator);
sizer_param->Add(gsizer_param, 0, wxTOP, 100);
@ -220,7 +220,7 @@ WipingPanel::WipingPanel(wxWindow* parent, const std::vector<float>& matrix, con
// collect and format sizer
format_sizer(m_sizer_advanced, m_page_advanced, m_gridsizer_advanced,
_(L("Here you can adjust required purging volume (mm\u00B3) for any given pair of tools.")),
wxString::Format(_(L("Here you can adjust required purging volume (mm%s) for any given pair of tools.")), "\u00B3"),
_(L("Extruder changed to")));
// Hide preview page before new page creating
@ -243,7 +243,7 @@ WipingPanel::WipingPanel(wxWindow* parent, const std::vector<float>& matrix, con
// collect and format sizer
format_sizer(m_sizer_simple, m_page_simple, gridsizer_simple,
_(L("Total purging volume is calculated by summing two values below, depending on which tools are loaded/unloaded.")),
_(L("Volume to purge (mm\u00B3) when the filament is being")), 50);
wxString::Format(_(L("Volume to purge (mm%s) when the filament is being")), "\u00B3"), 50);
m_sizer = new wxBoxSizer(wxVERTICAL);
m_sizer->Add(m_page_simple, 0, wxEXPAND | wxALL, 25);

View File

@ -359,6 +359,11 @@ Updates PresetUpdater::priv::get_config_updates() const
const auto cached_vp = VendorProfile::from_ini(path_in_cache, false);
if (cached_vp.config_version == recommended->config_version) {
updates.updates.emplace_back(std::move(path_in_cache), std::move(bundle_path), *recommended);
} else {
BOOST_LOG_TRIVIAL(warning) << boost::format("Vendor: %1%: Index indicates update (%2%) but cached bundle has a different version: %3%")
% idx.vendor()
% recommended->config_version.to_string()
% cached_vp.config_version.to_string();
}
}
}