mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 04:31:15 -06:00 
			
		
		
		
	Documentation of the UI config update functions,
documented missing AMF support for the variable layer thickness.
This commit is contained in:
		
							parent
							
								
									43ac693900
								
							
						
					
					
						commit
						e386a2bf72
					
				
					 9 changed files with 26 additions and 6 deletions
				
			
		|  | @ -132,9 +132,9 @@ sub _init_tabpanel { | |||
|         $tab = $self->{options_tabs}{$tab_name} = ($class_prefix . ucfirst $tab_name)->new( | ||||
|             $panel,  | ||||
|             no_controller => $self->{no_controller}); | ||||
|         # Callback to be executed after any of the configuration fields (Perl class Slic3r::GUI::OptionsGroup::Field) change their value. | ||||
|         $tab->on_value_change(sub { | ||||
|             my ($opt_key, $value) = @_; | ||||
|              | ||||
|             my ($opt_key, $value) = @_;             | ||||
|             my $config = $tab->config; | ||||
|             if ($self->{plater}) { | ||||
|                 $self->{plater}->on_config_change($config); # propagate config change events to the plater | ||||
|  | @ -158,6 +158,7 @@ sub _init_tabpanel { | |||
|         # a preset changes at Slic3r::GUI::Tab. | ||||
|         $tab->on_presets_changed(sub { | ||||
|             if ($self->{plater}) { | ||||
|                 # Update preset combo boxes (Print settings, Filament, Printer) from their respective tabs. | ||||
|                 $self->{plater}->update_presets($tab_name, @_); | ||||
|                 $self->{plater}->on_config_change($tab->config); | ||||
|                 if ($self->{controller}) { | ||||
|  |  | |||
|  | @ -389,6 +389,7 @@ sub append_single_option_line { | |||
|     return $self->append_line($self->create_single_option_line($option, $opt_index)); | ||||
| } | ||||
| 
 | ||||
| # Initialize UI components with the config values. | ||||
| sub reload_config { | ||||
|     my ($self) = @_; | ||||
|      | ||||
|  |  | |||
|  | @ -1,12 +1,17 @@ | |||
| # An input field class prototype. | ||||
| package Slic3r::GUI::OptionsGroup::Field; | ||||
| use Moo; | ||||
| 
 | ||||
| # This is a base class for option fields. | ||||
| 
 | ||||
| has 'parent'                => (is => 'ro', required => 1); | ||||
| has 'option'                => (is => 'ro', required => 1);     # Slic3r::GUI::OptionsGroup::Option | ||||
| # Slic3r::GUI::OptionsGroup::Option | ||||
| has 'option'                => (is => 'ro', required => 1); | ||||
| # On change callback | ||||
| has 'on_change'             => (is => 'rw', default => sub { sub {} }); | ||||
| has 'on_kill_focus'         => (is => 'rw', default => sub { sub {} }); | ||||
| # If set, the callback $self->on_change is not called. | ||||
| # This is used to avoid recursive invocation of the field change/update by wxWidgets. | ||||
| has 'disable_change_event'  => (is => 'rw', default => sub { 0 }); | ||||
| 
 | ||||
| # This method should not fire the on_change event | ||||
|  |  | |||
|  | @ -54,7 +54,9 @@ sub new { | |||
|         bed_shape complete_objects extruder_clearance_radius skirts skirt_distance brim_width | ||||
|         serial_port serial_speed octoprint_host octoprint_apikey | ||||
|     )); | ||||
|     # C++ Slic3r::Model with Perl extensions in Slic3r/Model.pm | ||||
|     $self->{model} = Slic3r::Model->new; | ||||
|     # C++ Slic3r::Print with Perl extensions in Slic3r/Print.pm | ||||
|     $self->{print} = Slic3r::Print->new; | ||||
|     # List of Perl objects Slic3r::GUI::Plater::Object, representing a 2D preview of the platter. | ||||
|     $self->{objects} = []; | ||||
|  | @ -498,7 +500,7 @@ sub update_ui_from_settings | |||
|     } | ||||
| } | ||||
| 
 | ||||
| # Update presets (Print settings, Filament, Printer) from their respective tabs. | ||||
| # Update preset combo boxes (Print settings, Filament, Printer) from their respective tabs. | ||||
| # Called by  | ||||
| #       Slic3r::GUI::Tab::Print::_on_presets_changed | ||||
| #       Slic3r::GUI::Tab::Filament::_on_presets_changed | ||||
|  |  | |||
|  | @ -21,8 +21,10 @@ sub new { | |||
|     my ($parent, %params) = @_; | ||||
|     my $self = $class->SUPER::new($parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL); | ||||
|      | ||||
|     my $object = $self->{model_object} = $params{model_object}; | ||||
|     my $print_object = $self->{print_object} = $params{print_object}; | ||||
|     # C++ type Slic3r::ModelObject | ||||
|     $self->{model_object} = $params{model_object}; | ||||
|     # Not set, not used. | ||||
|     # $self->{print_object} = $params{print_object}; | ||||
|      | ||||
|     # create TreeCtrl | ||||
|     my $tree = $self->{tree} = Wx::TreeCtrl->new($self, -1, wxDefaultPosition, [300, 100],  | ||||
|  |  | |||
|  | @ -11,6 +11,9 @@ use Wx qw(:dialog :id :misc :sizer :systemsettings :notebook wxTAB_TRAVERSAL); | |||
| use Wx::Event qw(EVT_BUTTON); | ||||
| use base 'Wx::Dialog'; | ||||
| 
 | ||||
| # Called with | ||||
| # %params{object} of a Perl type Slic3r::GUI::Plater::Object | ||||
| # %params{model_object} of a C++ type Slic3r::ModelObject | ||||
| sub new { | ||||
|     my $class = shift; | ||||
|     my ($parent, %params) = @_; | ||||
|  | @ -59,6 +62,7 @@ use base 'Wx::Panel'; | |||
| 
 | ||||
| sub model_object { | ||||
|     my ($self) = @_; | ||||
|     # $self->GetParent->GetParent is of type Slic3r::GUI::Plater::ObjectSettingsDialog | ||||
|     return $self->GetParent->GetParent->{model_object}; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -20,8 +20,10 @@ sub new { | |||
|     my $class = shift; | ||||
|     my ($parent, %params) = @_; | ||||
|     my $self = $class->SUPER::new($parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL); | ||||
|     # C++ class Slic3r::DynamicPrintConfig, initially empty. | ||||
|     $self->{default_config} = Slic3r::Config->new; | ||||
|     $self->{config} = Slic3r::Config->new; | ||||
|     # On change callback. | ||||
|     $self->{on_change} = $params{on_change}; | ||||
|     $self->{fixed_options} = {}; | ||||
|      | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 bubnikv
						bubnikv