mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	Merge remote-tracking branch 'origin/updating' into config_snapshots
This commit is contained in:
		
						commit
						4275b15dcd
					
				
					 40 changed files with 3378 additions and 85 deletions
				
			
		|  | @ -69,6 +69,8 @@ our $grey = Wx::Colour->new(200,200,200); | |||
| our $LANGUAGE_CHANGE_EVENT  = Wx::NewEventType; | ||||
| # 2) To inform about a change of Preferences. | ||||
| our $PREFERENCES_EVENT      = Wx::NewEventType; | ||||
| # To inform AppConfig about Slic3r version available online | ||||
| our $VERSION_ONLINE_EVENT   = Wx::NewEventType; | ||||
| 
 | ||||
| sub OnInit { | ||||
|     my ($self) = @_; | ||||
|  | @ -100,6 +102,10 @@ sub OnInit { | |||
|     $self->{app_config}->set('version', $Slic3r::VERSION); | ||||
|     $self->{app_config}->save; | ||||
| 
 | ||||
|     # my $version_check = $self->{app_config}->get('version_check'); | ||||
|     $self->{preset_updater} = Slic3r::PresetUpdater->new($VERSION_ONLINE_EVENT, $self->{app_config}); | ||||
|     my $slic3r_update = $self->{app_config}->slic3r_update_avail; | ||||
| 
 | ||||
|     Slic3r::GUI::set_app_config($self->{app_config}); | ||||
|     Slic3r::GUI::load_language(); | ||||
| 
 | ||||
|  | @ -110,6 +116,7 @@ sub OnInit { | |||
|         warn $@ . "\n"; | ||||
|         show_error(undef, $@); | ||||
|     } | ||||
|     # TODO: check previously downloaded updates | ||||
|     $run_wizard = 1 if $self->{preset_bundle}->has_defauls_only; | ||||
| 
 | ||||
|     Slic3r::GUI::set_preset_bundle($self->{preset_bundle}); | ||||
|  | @ -133,14 +140,21 @@ sub OnInit { | |||
|         $self->{app_config}->save if $self->{app_config}->dirty; | ||||
|     }); | ||||
| 
 | ||||
|     if ($run_wizard) { | ||||
|         # On OSX the UI was not initialized correctly if the wizard was called | ||||
|         # before the UI was up and running. | ||||
|         $self->CallAfter(sub { | ||||
|     # On OSX the UI was not initialized correctly if the wizard was called | ||||
|     # before the UI was up and running. | ||||
|     $self->CallAfter(sub { | ||||
|         # XXX: recreate_GUI ??? | ||||
|         if ($slic3r_update) { | ||||
|             # TODO | ||||
|         } | ||||
|         # XXX: ? | ||||
|         if ($run_wizard) { | ||||
|             # Run the config wizard, don't offer the "reset user profile" checkbox. | ||||
|             $self->{mainframe}->config_wizard(1); | ||||
|         }); | ||||
|     } | ||||
|         } | ||||
| 
 | ||||
|         # $self->{preset_updater}->download($self->{preset_bundle}); | ||||
|     }); | ||||
| 
 | ||||
|     # The following event is emited by the C++ menu implementation of application language change. | ||||
|     EVT_COMMAND($self, -1, $LANGUAGE_CHANGE_EVENT, sub{ | ||||
|  | @ -152,6 +166,14 @@ sub OnInit { | |||
|         $self->update_ui_from_settings; | ||||
|     }); | ||||
|      | ||||
|     # The following event is emited by PresetUpdater (C++) | ||||
|     EVT_COMMAND($self, -1, $VERSION_ONLINE_EVENT, sub { | ||||
|         my ($self, $event) = @_; | ||||
|         my $version = $event->GetString; | ||||
|         $self->{app_config}->set('version_online', $version); | ||||
|         $self->{app_config}->save; | ||||
|     }); | ||||
| 
 | ||||
|     return 1; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -95,7 +95,7 @@ sub new { | |||
|     }); | ||||
| 
 | ||||
|     $self->update_ui_from_settings; | ||||
|      | ||||
| 
 | ||||
|     return $self; | ||||
| } | ||||
| 
 | ||||
|  | @ -635,39 +635,9 @@ sub config_wizard { | |||
|     my ($self, $fresh_start) = @_; | ||||
|     # Exit wizard if there are unsaved changes and the user cancels the action. | ||||
|     return unless $self->check_unsaved_changes; | ||||
|     # Enumerate the profiles bundled with the Slic3r installation under resources/profiles. | ||||
|     my $directory = Slic3r::resources_dir() . "/profiles"; | ||||
|     my @profiles = (); | ||||
|     if (opendir(DIR, Slic3r::encode_path($directory))) { | ||||
|         while (my $file = readdir(DIR)) { | ||||
|             if ($file =~ /\.ini$/) { | ||||
|                 $file =~ s/\.ini$//; | ||||
|                 push @profiles, Slic3r::decode_path($file); | ||||
|             } | ||||
|         } | ||||
|         closedir(DIR); | ||||
|     } | ||||
|     # Open the wizard. | ||||
|     if (my $result = Slic3r::GUI::ConfigWizard->new($self, \@profiles, $fresh_start)->run) { | ||||
|         eval { | ||||
|             if ($result->{reset_user_profile}) { | ||||
|                 wxTheApp->{preset_bundle}->reset(1); | ||||
|             } | ||||
|             if (defined $result->{config}) { | ||||
|                 # Load and save the settings into print, filament and printer presets. | ||||
|                 wxTheApp->{preset_bundle}->load_config('My Settings', $result->{config}); | ||||
|             } else { | ||||
|                 # Wizard returned a name of a preset bundle bundled with the installation. Unpack it. | ||||
|                 wxTheApp->{preset_bundle}->install_vendor_configbundle($directory . '/' . $result->{preset_name} . '.ini'); | ||||
|                 # Reset the print / filament / printer selections, so that following line will select some sensible defaults. | ||||
|                 if ($fresh_start) { | ||||
|                     wxTheApp->{app_config}->reset_selections; | ||||
|                 } | ||||
|                 # Reload all presets after the vendor config bundle has been installed. | ||||
|                 wxTheApp->{preset_bundle}->load_presets(wxTheApp->{app_config}); | ||||
|             } | ||||
|         }; | ||||
|         Slic3r::GUI::catch_error($self) and return; | ||||
| 
 | ||||
|     # TODO: Offer "reset user profile" ??? | ||||
|     if (Slic3r::GUI::open_config_wizard(wxTheApp->{preset_bundle})) { | ||||
|         # Load the currently selected preset into the GUI, update the preset selection box. | ||||
|         foreach my $tab (values %{$self->{options_tabs}}) { | ||||
|             $tab->load_current_preset; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 bubnikv
						bubnikv