-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
"Reload from disk" - UI function overhaul (#4388)
* C++ backend work to support reloading modifier files * UI update preserving configs and volumes of modifiers (those are not reloaded) * clarifying variable names * Setting up variables in the GUI enviroment * Implementation of added variables in (new ModelVolume(*)) funcion * Implementation of new reload function * Overhaul of the reload function, also renaming of some variables * Rewriting the main loop of the reload function, explicitly differentiating between the original file and later added parts and modifiers pointing to other files * Whitespace cleanup * Added dialog to choose from different reload behaviors, added hide and default option in preferences, copied volumes are matched the new object's origin translation
- Loading branch information
1 parent
c206ae7
commit 72db339
Showing
8 changed files
with
278 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# A tiny dialog to select how to reload an object that has additional parts or modifiers. | ||
|
||
package Slic3r::GUI::ReloadDialog; | ||
use strict; | ||
use warnings; | ||
use utf8; | ||
|
||
use Wx qw(:button :dialog :id :misc :sizer :choicebook wxTAB_TRAVERSAL); | ||
use Wx::Event qw(EVT_CLOSE); | ||
use base 'Wx::Dialog'; | ||
|
||
sub new { | ||
my $class = shift; | ||
my ($parent,$default_selection) = @_; | ||
my $self = $class->SUPER::new($parent, -1, "Additional parts and modifiers detected", wxDefaultPosition, [350,100], wxDEFAULT_DIALOG_STYLE); | ||
|
||
# label | ||
my $text = Wx::StaticText->new($self, -1, "Additional parts and modifiers are loaded in the current model. \n\nHow do you want to proceed?", wxDefaultPosition, wxDefaultSize); | ||
|
||
# selector | ||
$self->{choice} = my $choice = Wx::Choice->new($self, -1, wxDefaultPosition, wxDefaultSize, []); | ||
$choice->Append("Reload all linked files"); | ||
$choice->Append("Reload main file, copy added parts & modifiers"); | ||
$choice->Append("Reload main file, discard added parts & modifiers"); | ||
$choice->SetSelection($default_selection); | ||
|
||
# checkbox | ||
$self->{checkbox} = my $checkbox = Wx::CheckBox->new($self, -1, "Don't ask again"); | ||
|
||
my $vsizer = Wx::BoxSizer->new(wxVERTICAL); | ||
my $hsizer = Wx::BoxSizer->new(wxHORIZONTAL); | ||
$vsizer->Add($text, 0, wxEXPAND | wxALL, 10); | ||
$vsizer->Add($choice, 0, wxEXPAND | wxALL, 10); | ||
$hsizer->Add($checkbox, 1, wxEXPAND | wxALL, 10); | ||
$hsizer->Add($self->CreateButtonSizer(wxOK | wxCANCEL), 0, wxEXPAND | wxALL, 10); | ||
$vsizer->Add($hsizer, 0, wxEXPAND | wxALL, 0); | ||
|
||
$self->SetSizer($vsizer); | ||
$self->SetMinSize($self->GetSize); | ||
$vsizer->SetSizeHints($self); | ||
|
||
# needed to actually free memory | ||
EVT_CLOSE($self, sub { | ||
$self->EndModal(wxID_CANCEL); | ||
$self->Destroy; | ||
}); | ||
|
||
return $self; | ||
} | ||
|
||
sub GetSelection { | ||
my ($self) = @_; | ||
return $self->{choice}->GetSelection; | ||
} | ||
sub GetHideOnNext { | ||
my ($self) = @_; | ||
return $self->{checkbox}->GetValue; | ||
} | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.