mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-11-02 20:51:23 -07:00 
			
		
		
		
	Preset deletion
This commit is contained in:
		
							parent
							
								
									b910840f76
								
							
						
					
					
						commit
						0ef8da42a6
					
				
					 1 changed files with 15 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -97,6 +97,21 @@ sub new {
 | 
			
		|||
        $self->sync_presets;
 | 
			
		||||
    });
 | 
			
		||||
    
 | 
			
		||||
    EVT_BUTTON($self, $self->{btn_delete_preset}, sub {
 | 
			
		||||
        my $i = $self->{presets_choice}->GetSelection;
 | 
			
		||||
        return if $i == 0;  # this shouldn't happen but let's trap it anyway
 | 
			
		||||
        my $res = Wx::MessageDialog->new($self, "Are you sure you want to delete the selected preset?", 'Delete Preset', &Wx::wxYES_NO | &Wx::wxNO_DEFAULT | &Wx::wxICON_QUESTION)->ShowModal;
 | 
			
		||||
        return unless $res == &Wx::wxID_YES;
 | 
			
		||||
        if (-e $self->{presets}[$i-1]) {
 | 
			
		||||
            unlink $self->{presets}[$i-1];
 | 
			
		||||
        }
 | 
			
		||||
        splice @{$self->{presets}}, $i-1, 1;
 | 
			
		||||
        $self->{presets_choice}->Delete($i);
 | 
			
		||||
        $self->{presets_choice}->SetSelection(0);
 | 
			
		||||
        $self->on_select_preset;
 | 
			
		||||
        $self->sync_presets;
 | 
			
		||||
    });
 | 
			
		||||
    
 | 
			
		||||
    return $self;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue