Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYuSanka <yusanka@gmail.com>2018-08-24 13:20:24 +0300
committerYuSanka <yusanka@gmail.com>2018-08-24 13:20:24 +0300
commitada6970053d3c2f86cd0228ae9ced8925fe7b371 (patch)
treed36d5f75252400a28cde4a24437f22b62523b2a9 /lib
parent727a5fd99744d579b9590a402be2180494f95fdf (diff)
parentc1bef2f8de69e6cbff5dc967c594a066e3437f81 (diff)
Merge remote-tracking branch 'origin/SLA_ui' into dev
Diffstat (limited to 'lib')
-rw-r--r--lib/Slic3r/GUI/MainFrame.pm18
-rw-r--r--lib/Slic3r/GUI/Plater.pm34
2 files changed, 42 insertions, 10 deletions
diff --git a/lib/Slic3r/GUI/MainFrame.pm b/lib/Slic3r/GUI/MainFrame.pm
index 6baefa545..7bd019070 100644
--- a/lib/Slic3r/GUI/MainFrame.pm
+++ b/lib/Slic3r/GUI/MainFrame.pm
@@ -154,6 +154,10 @@ sub _init_tabpanel {
my $value = $event->GetInt();
$self->{plater}->on_extruders_change($value);
}
+ if ($opt_key eq 'printer_technology'){
+ my $value = $event->GetInt();# 0 ~ "ptFFF"; 1 ~ "ptSLA"
+ $self->{plater}->show_preset_comboboxes($value);
+ }
}
# don't save while loading for the first time
$self->config->save($Slic3r::GUI::autosave) if $Slic3r::GUI::autosave && $self->{loaded};
@@ -166,7 +170,7 @@ sub _init_tabpanel {
my $tab = Slic3r::GUI::get_preset_tab($tab_name);
if ($self->{plater}) {
- # Update preset combo boxes (Print settings, Filament, Printer) from their respective tabs.
+ # Update preset combo boxes (Print settings, Filament, Material, Printer) from their respective tabs.
my $presets = $tab->get_presets;
if (defined $presets){
my $reload_dependent_tabs = $tab->get_dependent_tabs;
@@ -174,7 +178,7 @@ sub _init_tabpanel {
$self->{plater}->{"selected_item_$tab_name"} = $tab->get_selected_preset_item;
if ($tab_name eq 'printer') {
# Printer selected at the Printer tab, update "compatible" marks at the print and filament selectors.
- for my $tab_name_other (qw(print filament)) {
+ for my $tab_name_other (qw(print filament sla_material)) {
# If the printer tells us that the print or filament preset has been switched or invalidated,
# refresh the print or filament tab page. Otherwise just refresh the combo box.
my $update_action = ($reload_dependent_tabs && (first { $_ eq $tab_name_other } (@{$reload_dependent_tabs})))
@@ -190,7 +194,7 @@ sub _init_tabpanel {
});
Slic3r::GUI::create_preset_tabs($self->{no_controller}, $VALUE_CHANGE_EVENT, $PRESETS_CHANGED_EVENT);
$self->{options_tabs} = {};
- for my $tab_name (qw(print filament printer)) {
+ for my $tab_name (qw(print filament sla_material printer)) {
$self->{options_tabs}{$tab_name} = Slic3r::GUI::get_preset_tab("$tab_name");
}
@@ -202,8 +206,14 @@ sub _init_tabpanel {
# load initial config
my $full_config = wxTheApp->{preset_bundle}->full_config;
$self->{plater}->on_config_change($full_config);
+
# Show a correct number of filament fields.
- $self->{plater}->on_extruders_change(int(@{$full_config->nozzle_diameter}));
+ if (defined $full_config->nozzle_diameter){ # nozzle_diameter is undefined when SLA printer is selected
+ $self->{plater}->on_extruders_change(int(@{$full_config->nozzle_diameter}));
+ }
+
+ # Show correct preset comboboxes according to the printer_technology
+ $self->{plater}->show_preset_comboboxes(($full_config->printer_technology eq "FFF") ? 0 : 1);
}
}
diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm
index 8c3b10b90..f4a2f99ff 100644
--- a/lib/Slic3r/GUI/Plater.pm
+++ b/lib/Slic3r/GUI/Plater.pm
@@ -520,20 +520,21 @@ sub new {
{
my $presets;
{
- $presets = $self->{presets_sizer} = Wx::FlexGridSizer->new(3, 2, 1, 2);
+ $presets = $self->{presets_sizer} = Wx::FlexGridSizer->new(4, 2, 1, 2);
$presets->AddGrowableCol(1, 1);
$presets->SetFlexibleDirection(wxHORIZONTAL);
my %group_labels = (
print => L('Print settings'),
filament => L('Filament'),
+ sla_material=> L('SLA material'),
printer => L('Printer'),
);
- # UI Combo boxes for a print, multiple filaments, and a printer.
+ # UI Combo boxes for a print, multiple filaments, SLA material and a printer.
# Initially a single filament combo box is created, but the number of combo boxes for the filament selection may increase,
# once a printer preset with multiple extruders is activated.
# $self->{preset_choosers}{$group}[$idx]
$self->{preset_choosers} = {};
- for my $group (qw(print filament printer)) {
+ for my $group (qw(print filament sla_material printer)) {
my $text = Wx::StaticText->new($self->{right_panel}, -1, "$group_labels{$group}:", wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
$text->SetFont($Slic3r::GUI::small_font);
my $choice = Wx::BitmapComboBox->new($self->{right_panel}, -1, "", wxDefaultPosition, wxDefaultSize, [], wxCB_READONLY);
@@ -554,7 +555,7 @@ sub new {
$presets->Layout;
}
- my $frequently_changed_parameters_sizer = Wx::BoxSizer->new(wxHORIZONTAL);
+ my $frequently_changed_parameters_sizer = $self->{frequently_changed_parameters_sizer} = Wx::BoxSizer->new(wxHORIZONTAL);
Slic3r::GUI::add_frequently_changed_parameters($self->{right_panel}, $frequently_changed_parameters_sizer, $presets);
my $object_info_sizer;
@@ -726,16 +727,17 @@ sub update_ui_from_settings
}
}
-# Update preset combo boxes (Print settings, Filament, Printer) from their respective tabs.
+# Update preset combo boxes (Print settings, Filament, Material, Printer) from their respective tabs.
# Called by
# Slic3r::GUI::Tab::Print::_on_presets_changed
# Slic3r::GUI::Tab::Filament::_on_presets_changed
+# Slic3r::GUI::Tab::Material::_on_presets_changed
# Slic3r::GUI::Tab::Printer::_on_presets_changed
# when the presets are loaded or the user selects another preset.
# For Print settings and Printer, synchronize the selection index with their tabs.
# For Filament, synchronize the selection index for a single extruder printer only, otherwise keep the selection.
sub update_presets {
- # $group: one of qw(print filament printer)
+ # $group: one of qw(print filament sla_material printer)
# $presets: PresetCollection
my ($self, $group, $presets) = @_;
my @choosers = @{$self->{preset_choosers}{$group}};
@@ -751,6 +753,8 @@ sub update_presets {
}
} elsif ($group eq 'print') {
wxTheApp->{preset_bundle}->print->update_platter_ui($choosers[0]);
+ } elsif ($group eq 'sla_material') {
+ wxTheApp->{preset_bundle}->sla_material->update_platter_ui($choosers[0]);
} elsif ($group eq 'printer') {
# Update the print choosers to only contain the compatible presets, update the dirty flags.
wxTheApp->{preset_bundle}->print->update_platter_ui($self->{preset_choosers}{print}->[0]);
@@ -1931,6 +1935,24 @@ sub update {
$self->{preview3D}->reload_print if $self->{preview3D};
}
+# When a printer technology is changed, the UI needs to be updated to show/hide needed preset combo boxes.
+sub show_preset_comboboxes{
+ my ($self, $showSLA) = @_; #if showSLA is oposite value to "ptFFF"
+
+ my $choices = $self->{preset_choosers}{filament};
+ my $print_filament_ctrls_cnt = 2 + 2 * ($#$choices+1);
+
+ foreach (0..$print_filament_ctrls_cnt-1){
+ $self->{presets_sizer}->Show($_, !$showSLA);
+ }
+ $self->{presets_sizer}->Show($print_filament_ctrls_cnt , $showSLA);
+ $self->{presets_sizer}->Show($print_filament_ctrls_cnt+1, $showSLA);
+
+ $self->{frequently_changed_parameters_sizer}->Show(0,!$showSLA);
+
+ $self->Layout;
+}
+
# When a number of extruders changes, the UI needs to be updated to show a single filament selection combo box per extruder.
# Also the wxTheApp->{preset_bundle}->filament_presets needs to be resized accordingly
# and some reasonable default has to be selected for the additional extruders.