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

This commit is contained in:
tamasmeszaros 2018-05-17 10:44:17 +02:00
commit cee965f5ac
23 changed files with 7847 additions and 684 deletions

View File

@ -12,6 +12,7 @@ my %prereqs = qw(
ExtUtils::ParseXS 3.22 ExtUtils::ParseXS 3.22
ExtUtils::XSpp 0 ExtUtils::XSpp 0
ExtUtils::Typemaps 0 ExtUtils::Typemaps 0
ExtUtils::Typemaps::Basic 0
File::Basename 0 File::Basename 0
File::Spec 0 File::Spec 0
Getopt::Long 0 Getopt::Long 0

View File

@ -679,8 +679,6 @@ sub select_view {
# Avoid gimball lock. # Avoid gimball lock.
$self->_stheta(GIMBALL_LOCK_THETA_MAX) if $self->_stheta > GIMBALL_LOCK_THETA_MAX; $self->_stheta(GIMBALL_LOCK_THETA_MAX) if $self->_stheta > GIMBALL_LOCK_THETA_MAX;
$self->_stheta(0) if $self->_stheta < 0; $self->_stheta(0) if $self->_stheta < 0;
# View everything.
$self->zoom_to_bounding_box($bb);
$self->on_viewport_changed->() if $self->on_viewport_changed; $self->on_viewport_changed->() if $self->on_viewport_changed;
$self->Refresh; $self->Refresh;
} }

View File

@ -495,6 +495,7 @@ sub new {
$scrolled_window_sizer->Add($print_info_sizer, 0, wxEXPAND, 0); $scrolled_window_sizer->Add($print_info_sizer, 0, wxEXPAND, 0);
my $right_sizer = Wx::BoxSizer->new(wxVERTICAL); my $right_sizer = Wx::BoxSizer->new(wxVERTICAL);
$right_sizer->SetMinSize([320,-1]);
$right_sizer->Add($presets, 0, wxEXPAND | wxTOP, 10) if defined $presets; $right_sizer->Add($presets, 0, wxEXPAND | wxTOP, 10) if defined $presets;
$right_sizer->Add($frequently_changed_parameters_sizer, 0, wxEXPAND | wxTOP, 0) if defined $frequently_changed_parameters_sizer; $right_sizer->Add($frequently_changed_parameters_sizer, 0, wxEXPAND | wxTOP, 0) if defined $frequently_changed_parameters_sizer;
$right_sizer->Add($buttons_sizer, 0, wxEXPAND | wxBOTTOM, 5); $right_sizer->Add($buttons_sizer, 0, wxEXPAND | wxBOTTOM, 5);
@ -1375,6 +1376,8 @@ sub export_gcode {
}; };
Slic3r::GUI::catch_error($self) and return; Slic3r::GUI::catch_error($self) and return;
# Copy the names of active presets into the placeholder parser.
wxTheApp->{preset_bundle}->export_selections_pp($self->{print}->placeholder_parser);
# select output file # select output file
if ($output_file) { if ($output_file) {
$self->{export_gcode_output_file} = eval { $self->{print}->output_filepath($output_file) }; $self->{export_gcode_output_file} = eval { $self->{print}->output_filepath($output_file) };
@ -1666,6 +1669,8 @@ sub _get_export_file {
$suffix = '.3mf'; $suffix = '.3mf';
$wildcard = 'threemf'; $wildcard = 'threemf';
} }
# Copy the names of active presets into the placeholder parser.
wxTheApp->{preset_bundle}->export_selections_pp($self->{print}->placeholder_parser);
my $output_file = eval { $self->{print}->output_filepath($main::opt{output} // '') }; my $output_file = eval { $self->{print}->output_filepath($main::opt{output} // '') };
Slic3r::GUI::catch_error($self) and return undef; Slic3r::GUI::catch_error($self) and return undef;
$output_file =~ s/\.[gG][cC][oO][dD][eE]$/$suffix/; $output_file =~ s/\.[gG][cC][oO][dD][eE]$/$suffix/;
@ -2008,6 +2013,8 @@ sub selection_changed {
} else { } else {
$self->{object_info_manifold}->SetLabel(L("Yes")); $self->{object_info_manifold}->SetLabel(L("Yes"));
$self->{object_info_manifold_warning_icon}->Hide; $self->{object_info_manifold_warning_icon}->Hide;
$self->{object_info_manifold}->SetToolTipString("");
$self->{object_info_manifold_warning_icon}->SetToolTipString("");
} }
} else { } else {
$self->{object_info_facets}->SetLabel($object->facets); $self->{object_info_facets}->SetLabel($object->facets);
@ -2016,6 +2023,7 @@ sub selection_changed {
$self->{"object_info_$_"}->SetLabel("") for qw(size volume facets materials manifold); $self->{"object_info_$_"}->SetLabel("") for qw(size volume facets materials manifold);
$self->{object_info_manifold_warning_icon}->Hide; $self->{object_info_manifold_warning_icon}->Hide;
$self->{object_info_manifold}->SetToolTipString(""); $self->{object_info_manifold}->SetToolTipString("");
$self->{object_info_manifold_warning_icon}->SetToolTipString("");
} }
$self->Layout; $self->Layout;
} }

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -214,7 +214,7 @@ msgstr "&Carica Gruppo di Configurazioni…"
#: c:\src\Slic3r\lib\Slic3r\GUI\MainFrame.pm:254 #: c:\src\Slic3r\lib\Slic3r\GUI\MainFrame.pm:254
msgid "&Load Config…\tCtrl+L" msgid "&Load Config…\tCtrl+L"
msgstr "Carica Configurazione…\tCtrl+&L" msgstr "&Carica Configurazione…\tCtrl+L"
#: c:\src\Slic3r\xs\src\slic3r\GUI\GUI.cpp:339 #: c:\src\Slic3r\xs\src\slic3r\GUI\GUI.cpp:339
msgid "&Localization" msgid "&Localization"
@ -1856,7 +1856,7 @@ msgstr "Aprire un modello"
#: c:\src\Slic3r\lib\Slic3r\GUI\MainFrame.pm:251 #: c:\src\Slic3r\lib\Slic3r\GUI\MainFrame.pm:251
msgid "Open STL/OBJ/AMF…\tCtrl+O" msgid "Open STL/OBJ/AMF…\tCtrl+O"
msgstr "Aprire un STL/OBJ/AMF… Ctrl+O" msgstr "Aprire un STL/OBJ/AMF… \tCtrl+O"
#: c:\src\Slic3r\lib\Slic3r\GUI\Plater.pm:2102 #: c:\src\Slic3r\lib\Slic3r\GUI\Plater.pm:2102
msgid "Open the 3D cutting tool" msgid "Open the 3D cutting tool"
@ -2003,7 +2003,7 @@ msgstr "Preferenze"
#: c:\src\Slic3r\lib\Slic3r\GUI\MainFrame.pm:299 #: c:\src\Slic3r\lib\Slic3r\GUI\MainFrame.pm:299
msgid "Preferences…\tCtrl+," msgid "Preferences…\tCtrl+,"
msgstr "Preferenze…Ctrl+," msgstr "Preferenze…\tCtrl+,"
#: C:\src\Slic3r\xs\src\libslic3r\PrintConfig.cpp:1171 #: C:\src\Slic3r\xs\src\libslic3r\PrintConfig.cpp:1171
msgid "Preferred direction of the seam" msgid "Preferred direction of the seam"
@ -2079,7 +2079,7 @@ msgstr "Versioni Prusa Edition"
#: c:\src\Slic3r\lib\Slic3r\GUI\MainFrame.pm:268 #: c:\src\Slic3r\lib\Slic3r\GUI\MainFrame.pm:268
msgid "Q&uick Slice…\tCtrl+U" msgid "Q&uick Slice…\tCtrl+U"
msgstr "Slice Rapido… \tCtrl+&U" msgstr "Slice &Rapido… \tCtrl+U"
#: c:\src\Slic3r\xs\src\slic3r\GUI\Tab.cpp:335 #: c:\src\Slic3r\xs\src\slic3r\GUI\Tab.cpp:335
msgid "Quality (slower slicing)" msgid "Quality (slower slicing)"
@ -2593,7 +2593,7 @@ msgstr "Processa ora"
#: c:\src\Slic3r\lib\Slic3r\GUI\MainFrame.pm:287 #: c:\src\Slic3r\lib\Slic3r\GUI\MainFrame.pm:287
msgid "Slice to SV&G…\tCtrl+G" msgid "Slice to SV&G…\tCtrl+G"
msgstr "Processa a SV&G…\tCtrl+G" msgstr "Processa a SV&G…\tCtrl+G"
#: c:\src\Slic3r\lib\Slic3r\GUI\Plater.pm:438 #: c:\src\Slic3r\lib\Slic3r\GUI\Plater.pm:438
msgid "Sliced Info" msgid "Sliced Info"

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -1030,3 +1030,8 @@ max_print_height = 210
start_gcode = M115 U3.1.1-RC5 ; tell printer latest fw version\nM201 X1000 Y1000 Z200 E5000 ; sets maximum accelerations, mm/sec^2\nM203 X200 Y200 Z12 E120 ; sets maximum feedrates, mm/sec\nM204 S1250 T1250 ; sets acceleration (S) and retract acceleration (T)\nM205 X10 Y10 Z0.4 E2.5 ; sets the jerk limits, mm/sec\nM205 S0 T0 ; sets the minimum extruding and travel feed rate, mm/sec\nM83 ; extruder relative mode\nM104 S[first_layer_temperature] ; set extruder temp\nM140 S[first_layer_bed_temperature] ; set bed temp\nM190 S[first_layer_bed_temperature] ; wait for bed temp\nM109 S[first_layer_temperature] ; wait for extruder temp\nG28 W ; home all without mesh bed level\nG80 ; mesh bed leveling\nG1 Y-3.0 F1000.0 ; go outside print area\nG92 E0.0\nG1 X60.0 E9.0 F1000.0 ; intro line\nG1 X100.0 E12.5 F1000.0 ; intro line\nG92 E0.0\nM221 S{if layer_height==0.05}100{else}95{endif} start_gcode = M115 U3.1.1-RC5 ; tell printer latest fw version\nM201 X1000 Y1000 Z200 E5000 ; sets maximum accelerations, mm/sec^2\nM203 X200 Y200 Z12 E120 ; sets maximum feedrates, mm/sec\nM204 S1250 T1250 ; sets acceleration (S) and retract acceleration (T)\nM205 X10 Y10 Z0.4 E2.5 ; sets the jerk limits, mm/sec\nM205 S0 T0 ; sets the minimum extruding and travel feed rate, mm/sec\nM83 ; extruder relative mode\nM104 S[first_layer_temperature] ; set extruder temp\nM140 S[first_layer_bed_temperature] ; set bed temp\nM190 S[first_layer_bed_temperature] ; wait for bed temp\nM109 S[first_layer_temperature] ; wait for extruder temp\nG28 W ; home all without mesh bed level\nG80 ; mesh bed leveling\nG1 Y-3.0 F1000.0 ; go outside print area\nG92 E0.0\nG1 X60.0 E9.0 F1000.0 ; intro line\nG1 X100.0 E12.5 F1000.0 ; intro line\nG92 E0.0\nM221 S{if layer_height==0.05}100{else}95{endif}
printer_model = MK3 printer_model = MK3
default_print_profile = 0.15mm OPTIMAL 0.6 nozzle MK3 default_print_profile = 0.15mm OPTIMAL 0.6 nozzle MK3
# The obsolete presets will be removed when upgrading from the legacy configuration structure (up to Slic3r 1.39.2) to 1.40.0 and newer.
[obsolete_presets]
print="0.05mm DETAIL 0.25 nozzle";"0.05mm DETAIL MK3";"0.05mm DETAIL";"0.20mm NORMAL MK3";"0.35mm FAST MK3"
filament="ColorFabb Brass Bronze 1.75mm";"ColorFabb HT 1.75mm";"ColorFabb nGen 1.75mm";"ColorFabb Woodfil 1.75mm";"ColorFabb XT 1.75mm";"ColorFabb XT-CF20 1.75mm";"E3D PC-ABS 1.75mm";"Fillamentum ABS 1.75mm";"Fillamentum ASA 1.75mm";"Generic ABS 1.75mm";"Generic PET 1.75mm";"Generic PLA 1.75mm";"Prusa ABS 1.75mm";"Prusa HIPS 1.75mm";"Prusa PET 1.75mm";"Prusa PLA 1.75mm";"Taulman Bridge 1.75mm";"Taulman T-Glase 1.75mm"

View File

@ -1,4 +1,4 @@
use Test::More tests => 77; use Test::More tests => 81;
use strict; use strict;
use warnings; use warnings;
@ -71,6 +71,10 @@ use Slic3r::Test;
is $parser->process('{2*foo*(3-12)}'), '0', 'math: 2*foo*(3-12)'; is $parser->process('{2*foo*(3-12)}'), '0', 'math: 2*foo*(3-12)';
is $parser->process('{2*bar*(3-12)}'), '-36', 'math: 2*bar*(3-12)'; is $parser->process('{2*bar*(3-12)}'), '-36', 'math: 2*bar*(3-12)';
ok abs($parser->process('{2.5*bar*(3-12)}') - -45) < 1e-7, 'math: 2.5*bar*(3-12)'; ok abs($parser->process('{2.5*bar*(3-12)}') - -45) < 1e-7, 'math: 2.5*bar*(3-12)';
is $parser->process('{min(12, 14)}'), '12', 'math: min(12, 14)';
is $parser->process('{max(12, 14)}'), '14', 'math: max(12, 14)';
is $parser->process('{min(13.4, -1238.1)}'), '-1238.1', 'math: min(13.4, -1238.1)';
is $parser->process('{max(13.4, -1238.1)}'), '13.4', 'math: max(13.4, -1238.1)';
# Test the boolean expression parser. # Test the boolean expression parser.
is $parser->evaluate_boolean_expression('12 == 12'), 1, 'boolean expression parser: 12 == 12'; is $parser->evaluate_boolean_expression('12 == 12'), 1, 'boolean expression parser: 12 == 12';

View File

@ -644,12 +644,9 @@ public:
bool deserialize(const std::string &str, bool append = false) override bool deserialize(const std::string &str, bool append = false) override
{ {
UNUSED(append); UNUSED(append);
std::istringstream iss(str); char dummy;
iss >> this->value.x; return sscanf(str.data(), " %lf , %lf %c", &this->value.x, &this->value.y, &dummy) == 2 ||
iss.ignore(std::numeric_limits<std::streamsize>::max(), ','); sscanf(str.data(), " %lf x %lf %c", &this->value.x, &this->value.y, &dummy) == 2;
iss.ignore(std::numeric_limits<std::streamsize>::max(), 'x');
iss >> this->value.y;
return true;
} }
}; };

View File

@ -674,6 +674,33 @@ bool load_amf(const char *path, PresetBundle* bundle, Model *model)
return false; return false;
} }
std::string xml_escape(std::string text)
{
std::string::size_type pos = 0;
for (;;)
{
pos = text.find_first_of("\"\'&<>", pos);
if (pos == std::string::npos)
break;
std::string replacement;
switch (text[pos])
{
case '\"': replacement = "&quot;"; break;
case '\'': replacement = "&apos;"; break;
case '&': replacement = "&amp;"; break;
case '<': replacement = "&lt;"; break;
case '>': replacement = "&gt;"; break;
default: break;
}
text.replace(pos, 1, replacement);
pos += replacement.size();
}
return text;
}
bool store_amf(const char *path, Model *model, Print* print, bool export_print_config) bool store_amf(const char *path, Model *model, Print* print, bool export_print_config)
{ {
if ((path == nullptr) || (model == nullptr) || (print == nullptr)) if ((path == nullptr) || (model == nullptr) || (print == nullptr))
@ -701,7 +728,7 @@ bool store_amf(const char *path, Model *model, Print* print, bool export_print_c
{ {
std::string config = "\n"; std::string config = "\n";
GCode::append_full_config(*print, config); GCode::append_full_config(*print, config);
stream << "<metadata type=\"" << SLIC3R_CONFIG_TYPE << "\">" << config << "</metadata>\n"; stream << "<metadata type=\"" << SLIC3R_CONFIG_TYPE << "\">" << xml_escape(config) << "</metadata>\n";
} }
for (const auto &material : model->materials) { for (const auto &material : model->materials) {

View File

@ -789,14 +789,19 @@ void GCode::_do_export(Print &print, FILE *file, GCodePreviewData *preview_data)
} }
// Process filament-specific gcode in extruder order. // Process filament-specific gcode in extruder order.
if (print.config.single_extruder_multi_material) { {
// Process the end_filament_gcode for the active filament only. DynamicConfig config;
_writeln(file, this->placeholder_parser_process("end_filament_gcode", print.config.end_filament_gcode.get_at(m_writer.extruder()->id()), m_writer.extruder()->id())); config.set_key_value("layer_num", new ConfigOptionInt(m_layer_index));
} else { config.set_key_value("layer_z", new ConfigOptionFloat(m_writer.get_position().z - m_config.z_offset.value));
for (const std::string &end_gcode : print.config.end_filament_gcode.values) if (print.config.single_extruder_multi_material) {
_writeln(file, this->placeholder_parser_process("end_filament_gcode", end_gcode, (unsigned int)(&end_gcode - &print.config.end_filament_gcode.values.front()))); // Process the end_filament_gcode for the active filament only.
_writeln(file, this->placeholder_parser_process("end_filament_gcode", print.config.end_filament_gcode.get_at(m_writer.extruder()->id()), m_writer.extruder()->id(), &config));
} else {
for (const std::string &end_gcode : print.config.end_filament_gcode.values)
_writeln(file, this->placeholder_parser_process("end_filament_gcode", end_gcode, (unsigned int)(&end_gcode - &print.config.end_filament_gcode.values.front()), &config));
}
_writeln(file, this->placeholder_parser_process("end_gcode", print.config.end_gcode, m_writer.extruder()->id(), &config));
} }
_writeln(file, this->placeholder_parser_process("end_gcode", print.config.end_gcode, m_writer.extruder()->id()));
_write(file, m_writer.update_progress(m_layer_count, m_layer_count, true)); // 100% _write(file, m_writer.update_progress(m_layer_count, m_layer_count, true)); // 100%
_write(file, m_writer.postamble()); _write(file, m_writer.postamble());

View File

@ -414,6 +414,7 @@ namespace client
lhs.type = TYPE_BOOL; lhs.type = TYPE_BOOL;
lhs.data.b = invert ? ! value : value; lhs.data.b = invert ? ! value : value;
} }
// Compare operators, store the result into lhs.
static void equal (expr &lhs, expr &rhs) { compare_op(lhs, rhs, '=', false); } static void equal (expr &lhs, expr &rhs) { compare_op(lhs, rhs, '=', false); }
static void not_equal(expr &lhs, expr &rhs) { compare_op(lhs, rhs, '=', true ); } static void not_equal(expr &lhs, expr &rhs) { compare_op(lhs, rhs, '=', true ); }
static void lower (expr &lhs, expr &rhs) { compare_op(lhs, rhs, '<', false); } static void lower (expr &lhs, expr &rhs) { compare_op(lhs, rhs, '<', false); }
@ -421,6 +422,40 @@ namespace client
static void leq (expr &lhs, expr &rhs) { compare_op(lhs, rhs, '>', true ); } static void leq (expr &lhs, expr &rhs) { compare_op(lhs, rhs, '>', true ); }
static void geq (expr &lhs, expr &rhs) { compare_op(lhs, rhs, '<', true ); } static void geq (expr &lhs, expr &rhs) { compare_op(lhs, rhs, '<', true ); }
enum Function2ParamsType {
FUNCTION_MIN,
FUNCTION_MAX,
};
// Store the result into param1.
static void function_2params(expr &param1, expr &param2, Function2ParamsType fun)
{
const char *err_msg = "Not a numeric type.";
param1.throw_if_not_numeric(err_msg);
param2.throw_if_not_numeric(err_msg);
if (param1.type == TYPE_DOUBLE || param2.type == TYPE_DOUBLE) {
double d = 0.;
switch (fun) {
case FUNCTION_MIN: d = std::min(param1.as_d(), param2.as_d()); break;
case FUNCTION_MAX: d = std::max(param1.as_d(), param2.as_d()); break;
default: param1.throw_exception("Internal error: invalid function");
}
param1.data.d = d;
param1.type = TYPE_DOUBLE;
} else {
int i = 0.;
switch (fun) {
case FUNCTION_MIN: i = std::min(param1.as_i(), param2.as_i()); break;
case FUNCTION_MAX: i = std::max(param1.as_i(), param2.as_i()); break;
default: param1.throw_exception("Internal error: invalid function");
}
param1.data.i = i;
param1.type = TYPE_INT;
}
}
// Store the result into param1.
static void min(expr &param1, expr &param2) { function_2params(param1, param2, FUNCTION_MIN); }
static void max(expr &param1, expr &param2) { function_2params(param1, param2, FUNCTION_MAX); }
static void regex_op(expr &lhs, boost::iterator_range<Iterator> &rhs, char op) static void regex_op(expr &lhs, boost::iterator_range<Iterator> &rhs, char op)
{ {
const std::string *subject = nullptr; const std::string *subject = nullptr;
@ -1019,6 +1054,10 @@ namespace client
| (lit('-') > unary_expression(_r1) ) [ px::bind(&FactorActions::minus_, _1, _val) ] | (lit('-') > unary_expression(_r1) ) [ px::bind(&FactorActions::minus_, _1, _val) ]
| (lit('+') > unary_expression(_r1) > iter_pos) [ px::bind(&FactorActions::expr_, _1, _2, _val) ] | (lit('+') > unary_expression(_r1) > iter_pos) [ px::bind(&FactorActions::expr_, _1, _2, _val) ]
| ((kw["not"] | '!') > unary_expression(_r1) > iter_pos) [ px::bind(&FactorActions::not_, _1, _val) ] | ((kw["not"] | '!') > unary_expression(_r1) > iter_pos) [ px::bind(&FactorActions::not_, _1, _val) ]
| (kw["min"] > '(' > conditional_expression(_r1) [_val = _1] > ',' > conditional_expression(_r1) > ')')
[ px::bind(&expr<Iterator>::min, _val, _2) ]
| (kw["max"] > '(' > conditional_expression(_r1) [_val = _1] > ',' > conditional_expression(_r1) > ')')
[ px::bind(&expr<Iterator>::max, _val, _2) ]
| (strict_double > iter_pos) [ px::bind(&FactorActions::double_, _1, _2, _val) ] | (strict_double > iter_pos) [ px::bind(&FactorActions::double_, _1, _2, _val) ]
| (int_ > iter_pos) [ px::bind(&FactorActions::int_, _1, _2, _val) ] | (int_ > iter_pos) [ px::bind(&FactorActions::int_, _1, _2, _val) ]
| (kw[bool_] > iter_pos) [ px::bind(&FactorActions::bool_, _1, _2, _val) ] | (kw[bool_] > iter_pos) [ px::bind(&FactorActions::bool_, _1, _2, _val) ]
@ -1051,6 +1090,8 @@ namespace client
("elsif") ("elsif")
("endif") ("endif")
("false") ("false")
("min")
("max")
("not") ("not")
("or") ("or")
("true"); ("true");

View File

@ -1762,12 +1762,13 @@ void _3DScene::load_gcode_preview(const Print* print, const GCodePreviewData* pr
else else
{ {
_generate_legend_texture(*preview_data, tool_colors); _generate_legend_texture(*preview_data, tool_colors);
_load_shells(*print, *volumes, use_VBOs);
// removes empty volumes // removes empty volumes
volumes->volumes.erase(std::remove_if(volumes->volumes.begin(), volumes->volumes.end(), volumes->volumes.erase(std::remove_if(volumes->volumes.begin(), volumes->volumes.end(),
[](const GLVolume *volume) { return volume->print_zs.empty(); }), [](const GLVolume *volume) { return volume->print_zs.empty(); }),
volumes->volumes.end()); volumes->volumes.end());
_load_shells(*print, *volumes, use_VBOs);
} }
} }

View File

@ -29,20 +29,27 @@ void AboutDialogLogo::onRepaint(wxEvent &event)
} }
AboutDialog::AboutDialog() AboutDialog::AboutDialog()
: wxDialog(NULL, wxID_ANY, _(L("About Slic3r")), wxDefaultPosition, wxSize(600, 340), wxCAPTION) : wxDialog(NULL, wxID_ANY, _(L("About Slic3r")), wxDefaultPosition, wxDefaultSize, wxCAPTION)
{ {
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)/**wxWHITE*/); wxColour bgr_clr = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
SetBackgroundColour(bgr_clr);
wxBoxSizer* hsizer = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* hsizer = new wxBoxSizer(wxHORIZONTAL);
this->SetSizer(hsizer);
auto main_sizer = new wxBoxSizer(wxVERTICAL);
main_sizer->Add(hsizer, 0, wxEXPAND | wxALL, 20);
// logo // logo
// AboutDialogLogo* logo = new AboutDialogLogo(this);
wxBitmap logo_bmp = wxBitmap(from_u8(Slic3r::var("Slic3r_192px.png")), wxBITMAP_TYPE_PNG); wxBitmap logo_bmp = wxBitmap(from_u8(Slic3r::var("Slic3r_192px.png")), wxBITMAP_TYPE_PNG);
auto *logo = new wxStaticBitmap(this, wxID_ANY, std::move(logo_bmp)); auto *logo = new wxStaticBitmap(this, wxID_ANY, std::move(logo_bmp));
hsizer->Add(logo, 0, wxEXPAND | wxLEFT | wxRIGHT, 30); hsizer->Add(logo, 1, wxALIGN_CENTRE_VERTICAL | wxEXPAND | wxTOP | wxBOTTOM, 35);
wxBoxSizer* vsizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer* vsizer = new wxBoxSizer(wxVERTICAL);
hsizer->Add(vsizer, 1, wxEXPAND, 0); #ifdef __WXMSW__
int proportion = 2;
#else
int proportion = 3;
#endif
hsizer->Add(vsizer, proportion, wxEXPAND|wxLEFT, 20);
// title // title
{ {
@ -52,7 +59,7 @@ AboutDialog::AboutDialog()
title_font.SetFamily(wxFONTFAMILY_ROMAN); title_font.SetFamily(wxFONTFAMILY_ROMAN);
title_font.SetPointSize(24); title_font.SetPointSize(24);
title->SetFont(title_font); title->SetFont(title_font);
vsizer->Add(title, 0, wxALIGN_LEFT | wxTOP, 30); vsizer->Add(title, 0, wxALIGN_LEFT | wxTOP, 10);
} }
// version // version
@ -70,34 +77,34 @@ AboutDialog::AboutDialog()
} }
// text // text
wxHtmlWindow* html = new wxHtmlWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_NEVER); wxHtmlWindow* html = new wxHtmlWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO/*NEVER*/);
{ {
wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
#ifdef __WXMSW__ const auto text_clr = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
int size[] = {8,8,8,8,8,8,8}; auto text_clr_str = wxString::Format(wxT("#%02X%02X%02X"), text_clr.Red(), text_clr.Green(), text_clr.Blue());
#else auto bgr_clr_str = wxString::Format(wxT("#%02X%02X%02X"), bgr_clr.Red(), bgr_clr.Green(), bgr_clr.Blue());
int size[] = {11,11,11,11,11,11,11};
#endif const int fs = font.GetPointSize()-1;
int size[] = {fs,fs,fs,fs,fs,fs,fs};
html->SetFonts(font.GetFaceName(), font.GetFaceName(), size); html->SetFonts(font.GetFaceName(), font.GetFaceName(), size);
html->SetHTMLBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
html->SetBorders(2); html->SetBorders(2);
const char* text = const auto text = wxString::Format(
"<html>" "<html>"
"<body bgcolor=\"#ffffff\" link=\"#808080\">" "<body bgcolor= %s link= %s>"
"<font color=\"#808080\">" "<font color=%s>"
"Copyright &copy; 2016-2018 Prusa Research. <br />" "Copyright &copy; 2016-2018 Prusa Research. <br />"
"Copyright &copy; 2011-2017 Alessandro Ranellucci. <br />" "Copyright &copy; 2011-2017 Alessandro Ranellucci. <br />"
"<a href=\"http://slic3r.org/\">Slic3r</a> is licensed under the " "<a href=\"http://slic3r.org/\">Slic3r</a> is licensed under the "
"<a href=\"http://www.gnu.org/licenses/agpl-3.0.html\">GNU Affero General Public License, version 3</a>." "<a href=\"http://www.gnu.org/licenses/agpl-3.0.html\">GNU Affero General Public License, version 3</a>."
"<br /><br /><br />" "<br /><br />"
"Contributions by Henrik Brix Andersen, Nicolas Dandrimont, Mark Hindess, Petr Ledvina, Joseph Lenox, Y. Sapir, Mike Sheldrake, Vojtech Bubnik and numerous others. " "Contributions by Henrik Brix Andersen, Nicolas Dandrimont, Mark Hindess, Petr Ledvina, Joseph Lenox, Y. Sapir, Mike Sheldrake, Vojtech Bubnik and numerous others. "
"Manual by Gary Hodgson. Inspired by the RepRap community. <br />" "Manual by Gary Hodgson. Inspired by the RepRap community. <br />"
"Slic3r logo designed by Corey Daniels, <a href=\"http://www.famfamfam.com/lab/icons/silk/\">Silk Icon Set</a> designed by Mark James. " "Slic3r logo designed by Corey Daniels, <a href=\"http://www.famfamfam.com/lab/icons/silk/\">Silk Icon Set</a> designed by Mark James. "
"</font>" "</font>"
"</body>" "</body>"
"</html>"; "</html>", bgr_clr_str, text_clr_str, text_clr_str);
html->SetPage(text); html->SetPage(text);
vsizer->Add(html, 1, wxEXPAND | wxALIGN_LEFT | wxRIGHT | wxBOTTOM, 20); vsizer->Add(html, 1, wxEXPAND | wxBOTTOM, 10);
html->Bind(wxEVT_HTML_LINK_CLICKED, &AboutDialog::onLinkClicked, this); html->Bind(wxEVT_HTML_LINK_CLICKED, &AboutDialog::onLinkClicked, this);
} }
@ -108,6 +115,9 @@ AboutDialog::AboutDialog()
this->Bind(wxEVT_LEFT_DOWN, &AboutDialog::onCloseDialog, this); this->Bind(wxEVT_LEFT_DOWN, &AboutDialog::onCloseDialog, this);
logo->Bind(wxEVT_LEFT_DOWN, &AboutDialog::onCloseDialog, this); logo->Bind(wxEVT_LEFT_DOWN, &AboutDialog::onCloseDialog, this);
SetSizer(main_sizer);
main_sizer->SetSizeHints(this);
} }
void AboutDialog::onLinkClicked(wxHtmlLinkEvent &event) void AboutDialog::onLinkClicked(wxHtmlLinkEvent &event)

View File

@ -106,7 +106,7 @@ namespace Slic3r { namespace GUI {
} }
double val; double val;
str.ToCDouble(&val); str.ToCDouble(&val);
if (m_opt.min > val && val > m_opt.max) if (m_opt.min > val || val > m_opt.max)
{ {
show_error(m_parent, _(L("Input value is out of range"))); show_error(m_parent, _(L("Input value is out of range")));
if (m_opt.min > val) val = m_opt.min; if (m_opt.min > val) val = m_opt.min;

View File

@ -104,6 +104,9 @@ void PresetBundle::reset(bool delete_files)
this->printers .reset(delete_files); this->printers .reset(delete_files);
this->filament_presets.clear(); this->filament_presets.clear();
this->filament_presets.emplace_back(this->filaments.get_selected_preset().name); this->filament_presets.emplace_back(this->filaments.get_selected_preset().name);
this->obsolete_presets.prints.clear();
this->obsolete_presets.filaments.clear();
this->obsolete_presets.printers.clear();
} }
void PresetBundle::setup_directories() void PresetBundle::setup_directories()
@ -210,6 +213,10 @@ std::string PresetBundle::load_system_presets()
errors_cummulative += "\n"; errors_cummulative += "\n";
} }
} }
if (first) {
// No config bundle loaded, reset.
this->reset(false);
}
return errors_cummulative; return errors_cummulative;
} }
@ -220,7 +227,10 @@ std::vector<std::string> PresetBundle::merge_presets(PresetBundle &&other)
std::vector<std::string> duplicate_prints = this->prints .merge_presets(std::move(other.prints), this->vendors); std::vector<std::string> duplicate_prints = this->prints .merge_presets(std::move(other.prints), this->vendors);
std::vector<std::string> duplicate_filaments = this->filaments.merge_presets(std::move(other.filaments), this->vendors); std::vector<std::string> duplicate_filaments = this->filaments.merge_presets(std::move(other.filaments), this->vendors);
std::vector<std::string> duplicate_printers = this->printers .merge_presets(std::move(other.printers), this->vendors); std::vector<std::string> duplicate_printers = this->printers .merge_presets(std::move(other.printers), this->vendors);
append(duplicate_prints, std::move(duplicate_filaments)); append(this->obsolete_presets.prints, std::move(other.obsolete_presets.prints));
append(this->obsolete_presets.filaments, std::move(other.obsolete_presets.filaments));
append(this->obsolete_presets.printers, std::move(other.obsolete_presets.printers));
append(duplicate_prints, std::move(duplicate_filaments));
append(duplicate_prints, std::move(duplicate_printers)); append(duplicate_prints, std::move(duplicate_printers));
return duplicate_prints; return duplicate_prints;
} }
@ -361,6 +371,7 @@ DynamicPrintConfig PresetBundle::full_config() const
} else { } else {
// Retrieve filament presets and build a single config object for them. // Retrieve filament presets and build a single config object for them.
// First collect the filament configurations based on the user selection of this->filament_presets. // First collect the filament configurations based on the user selection of this->filament_presets.
// Here this->filaments.find_preset() and this->filaments.first_visible() return the edited copy of the preset if active.
std::vector<const DynamicPrintConfig*> filament_configs; std::vector<const DynamicPrintConfig*> filament_configs;
for (const std::string &filament_preset_name : this->filament_presets) for (const std::string &filament_preset_name : this->filament_presets)
filament_configs.emplace_back(&this->filaments.find_preset(filament_preset_name, true)->config); filament_configs.emplace_back(&this->filaments.find_preset(filament_preset_name, true)->config);
@ -756,6 +767,7 @@ size_t PresetBundle::load_configbundle(const std::string &path, unsigned int fla
flatten_configbundle_hierarchy(tree); flatten_configbundle_hierarchy(tree);
// 2) Parse the property_tree, extract the active preset names and the profiles, save them into local config files. // 2) Parse the property_tree, extract the active preset names and the profiles, save them into local config files.
// Parse the obsolete preset names, to be deleted when upgrading from the old configuration structure.
std::vector<std::string> loaded_prints; std::vector<std::string> loaded_prints;
std::vector<std::string> loaded_filaments; std::vector<std::string> loaded_filaments;
std::vector<std::string> loaded_printers; std::vector<std::string> loaded_printers;
@ -795,6 +807,20 @@ size_t PresetBundle::load_configbundle(const std::string &path, unsigned int fla
active_printer = kvp.second.data(); active_printer = kvp.second.data();
} }
} }
} else if (section.first == "obsolete_presets") {
// Parse the names of obsolete presets. These presets will be deleted from user's
// profile directory on installation of this vendor preset.
for (auto &kvp : section.second) {
std::vector<std::string> *dst = nullptr;
if (kvp.first == "print")
dst = &this->obsolete_presets.prints;
else if (kvp.first == "filament")
dst = &this->obsolete_presets.filaments;
else if (kvp.first == "printer")
dst = &this->obsolete_presets.printers;
if (dst)
unescape_strings_cstyle(kvp.second.data(), *dst);
}
} else if (section.first == "settings") { } else if (section.first == "settings") {
// Load the settings. // Load the settings.
for (auto &kvp : section.second) { for (auto &kvp : section.second) {

View File

@ -54,6 +54,13 @@ public:
// and the system profiles will point to the VendorProfile instances owned by PresetBundle::vendors. // and the system profiles will point to the VendorProfile instances owned by PresetBundle::vendors.
std::set<VendorProfile> vendors; std::set<VendorProfile> vendors;
struct ObsoletePresets {
std::vector<std::string> prints;
std::vector<std::string> filaments;
std::vector<std::string> printers;
};
ObsoletePresets obsolete_presets;
bool has_defauls_only() const bool has_defauls_only() const
{ return prints.size() <= 1 && filaments.size() <= 1 && printers.size() <= 1; } { return prints.size() <= 1 && filaments.size() <= 1 && printers.size() <= 1; }

View File

@ -2125,7 +2125,7 @@ void Tab::save_preset(std::string name /*= ""*/)
return; return;
} }
if (existing && (existing->is_external)) { if (existing && (existing->is_external)) {
show_error(this, _(L("Cannot overwrite an external."))); show_error(this, _(L("Cannot overwrite an external profile.")));
return; return;
} }
} }

View File

@ -136,7 +136,7 @@ void PresetUpdater::priv::set_download_prefs(AppConfig *app_config)
{ {
enabled_version_check = app_config->get("version_check") == "1"; enabled_version_check = app_config->get("version_check") == "1";
version_check_url = app_config->version_check_url(); version_check_url = app_config->version_check_url();
enabled_config_update = app_config->get("preset_update") == "1"; enabled_config_update = app_config->get("preset_update") == "1" && !app_config->legacy_datadir();
} }
// Downloads a file (http get operation). Cancels if the Updater is being destroyed. // Downloads a file (http get operation). Cancels if the Updater is being destroyed.