Move ObjectDialog to a separate file
This commit is contained in:
parent
d2152a53a0
commit
6a0ba97f0e
4 changed files with 59 additions and 56 deletions
1
MANIFEST
1
MANIFEST
|
@ -32,6 +32,7 @@ lib/Slic3r/GUI/AboutDialog.pm
|
|||
lib/Slic3r/GUI/ConfigWizard.pm
|
||||
lib/Slic3r/GUI/OptionsGroup.pm
|
||||
lib/Slic3r/GUI/Plater.pm
|
||||
lib/Slic3r/GUI/Plater/ObjectDialog.pm
|
||||
lib/Slic3r/GUI/Preferences.pm
|
||||
lib/Slic3r/GUI/SkeinPanel.pm
|
||||
lib/Slic3r/GUI/SimpleTab.pm
|
||||
|
|
|
@ -7,6 +7,7 @@ use FindBin;
|
|||
use Slic3r::GUI::AboutDialog;
|
||||
use Slic3r::GUI::ConfigWizard;
|
||||
use Slic3r::GUI::Plater;
|
||||
use Slic3r::GUI::Plater::ObjectDialog;
|
||||
use Slic3r::GUI::Preferences;
|
||||
use Slic3r::GUI::OptionsGroup;
|
||||
use Slic3r::GUI::SkeinPanel;
|
||||
|
|
|
@ -975,7 +975,7 @@ sub list_item_activated {
|
|||
my ($self, $event, $obj_idx) = @_;
|
||||
|
||||
$obj_idx //= $event->GetIndex;
|
||||
my $dlg = Slic3r::GUI::Plater::ObjectInfoDialog->new($self,
|
||||
my $dlg = Slic3r::GUI::Plater::ObjectDialog->new($self,
|
||||
object => $self->{objects}[$obj_idx],
|
||||
);
|
||||
$dlg->ShowModal;
|
||||
|
@ -1173,59 +1173,4 @@ sub set_scale {
|
|||
$self->scale($scale);
|
||||
}
|
||||
|
||||
package Slic3r::GUI::Plater::ObjectInfoDialog;
|
||||
use Wx qw(:dialog :id :misc :sizer :systemsettings);
|
||||
use Wx::Event qw(EVT_BUTTON EVT_TEXT_ENTER);
|
||||
use base 'Wx::Dialog';
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my ($parent, %params) = @_;
|
||||
my $self = $class->SUPER::new($parent, -1, "Object Info", wxDefaultPosition, wxDefaultSize);
|
||||
$self->{object} = $params{object};
|
||||
|
||||
my $properties_box = Wx::StaticBox->new($self, -1, "Info", wxDefaultPosition, [400,200]);
|
||||
my $grid_sizer = Wx::FlexGridSizer->new(3, 2, 10, 5);
|
||||
$properties_box->SetSizer($grid_sizer);
|
||||
$grid_sizer->SetFlexibleDirection(wxHORIZONTAL);
|
||||
$grid_sizer->AddGrowableCol(1);
|
||||
|
||||
my $label_font = Wx::SystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
|
||||
$label_font->SetPointSize(10);
|
||||
|
||||
my $properties = $self->get_properties;
|
||||
foreach my $property (@$properties) {
|
||||
my $label = Wx::StaticText->new($properties_box, -1, $property->[0] . ":");
|
||||
my $value = Wx::StaticText->new($properties_box, -1, $property->[1]);
|
||||
$label->SetFont($label_font);
|
||||
$grid_sizer->Add($label, 1, wxALIGN_BOTTOM);
|
||||
$grid_sizer->Add($value, 0);
|
||||
}
|
||||
|
||||
my $buttons = $self->CreateStdDialogButtonSizer(wxOK);
|
||||
EVT_BUTTON($self, wxID_OK, sub { $self->EndModal(wxID_OK); });
|
||||
|
||||
my $sizer = Wx::BoxSizer->new(wxVERTICAL);
|
||||
$sizer->Add($properties_box, 0, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, 10);
|
||||
$sizer->Add($buttons, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 10);
|
||||
|
||||
$self->SetSizer($sizer);
|
||||
$sizer->SetSizeHints($self);
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub get_properties {
|
||||
my $self = shift;
|
||||
|
||||
return [
|
||||
['Name' => $self->{object}->name],
|
||||
['Size' => sprintf "%.2f x %.2f x %.2f", @{$self->{object}->size}],
|
||||
['Facets' => $self->{object}->facets],
|
||||
['Vertices' => $self->{object}->vertices],
|
||||
['Materials' => $self->{object}->materials],
|
||||
['Two-Manifold' => $self->{object}->is_manifold ? 'Yes' : 'No'],
|
||||
];
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
56
lib/Slic3r/GUI/Plater/ObjectDialog.pm
Normal file
56
lib/Slic3r/GUI/Plater/ObjectDialog.pm
Normal file
|
@ -0,0 +1,56 @@
|
|||
package Slic3r::GUI::Plater::ObjectDialog;
|
||||
use Wx qw(:dialog :id :misc :sizer :systemsettings);
|
||||
use Wx::Event qw(EVT_BUTTON EVT_TEXT_ENTER);
|
||||
use base 'Wx::Dialog';
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my ($parent, %params) = @_;
|
||||
my $self = $class->SUPER::new($parent, -1, "Object Info", wxDefaultPosition, wxDefaultSize);
|
||||
$self->{object} = $params{object};
|
||||
|
||||
my $properties_box = Wx::StaticBox->new($self, -1, "Info", wxDefaultPosition, [400,200]);
|
||||
my $grid_sizer = Wx::FlexGridSizer->new(3, 2, 10, 5);
|
||||
$properties_box->SetSizer($grid_sizer);
|
||||
$grid_sizer->SetFlexibleDirection(wxHORIZONTAL);
|
||||
$grid_sizer->AddGrowableCol(1);
|
||||
|
||||
my $label_font = Wx::SystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
|
||||
$label_font->SetPointSize(10);
|
||||
|
||||
my $properties = $self->get_properties;
|
||||
foreach my $property (@$properties) {
|
||||
my $label = Wx::StaticText->new($properties_box, -1, $property->[0] . ":");
|
||||
my $value = Wx::StaticText->new($properties_box, -1, $property->[1]);
|
||||
$label->SetFont($label_font);
|
||||
$grid_sizer->Add($label, 1, wxALIGN_BOTTOM);
|
||||
$grid_sizer->Add($value, 0);
|
||||
}
|
||||
|
||||
my $buttons = $self->CreateStdDialogButtonSizer(wxOK);
|
||||
EVT_BUTTON($self, wxID_OK, sub { $self->EndModal(wxID_OK); });
|
||||
|
||||
my $sizer = Wx::BoxSizer->new(wxVERTICAL);
|
||||
$sizer->Add($properties_box, 0, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, 10);
|
||||
$sizer->Add($buttons, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 10);
|
||||
|
||||
$self->SetSizer($sizer);
|
||||
$sizer->SetSizeHints($self);
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub get_properties {
|
||||
my $self = shift;
|
||||
|
||||
return [
|
||||
['Name' => $self->{object}->name],
|
||||
['Size' => sprintf "%.2f x %.2f x %.2f", @{$self->{object}->size}],
|
||||
['Facets' => $self->{object}->facets],
|
||||
['Vertices' => $self->{object}->vertices],
|
||||
['Materials' => $self->{object}->materials],
|
||||
['Two-Manifold' => $self->{object}->is_manifold ? 'Yes' : 'No'],
|
||||
];
|
||||
}
|
||||
|
||||
1;
|
Loading…
Reference in a new issue