mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-04 01:20:40 +08:00
Restrict file types for model exports to what we are permitting (UX fix). Changed extension from .amf.xml -> .amf (common usage)
Fixes #3774
This commit is contained in:
parent
af8ae8d268
commit
dddbe64b86
@ -53,6 +53,8 @@ use constant FILE_WILDCARDS => {
|
||||
svg => 'SVG files *.svg|*.svg;*.SVG',
|
||||
};
|
||||
use constant MODEL_WILDCARD => join '|', @{&FILE_WILDCARDS}{qw(known stl obj amf)};
|
||||
use constant STL_MODEL_WILDCARD => join '|', @{&FILE_WILDCARDS}{qw(stl)};
|
||||
use constant AMF_MODEL_WILDCARD => join '|', @{&FILE_WILDCARDS}{qw(amf)};
|
||||
|
||||
our $datadir;
|
||||
# If set, the "Controller" tab for the control of the printer over serial line and the serial port settings are hidden.
|
||||
|
@ -1570,14 +1570,21 @@ sub _get_export_file {
|
||||
my $self = shift;
|
||||
my ($format) = @_;
|
||||
|
||||
my $suffix = $format eq 'STL' ? '.stl' : '.amf.xml';
|
||||
my $suffix = $format eq 'STL' ? '.stl' : '.amf';
|
||||
|
||||
my $output_file = $main::opt{output};
|
||||
{
|
||||
$output_file = $self->{print}->output_filepath($output_file // '');
|
||||
$output_file =~ s/\.gcode$/$suffix/i;
|
||||
my $dlg = Wx::FileDialog->new($self, "Save $format file as:", dirname($output_file),
|
||||
basename($output_file), &Slic3r::GUI::MODEL_WILDCARD, wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
|
||||
my $dlg;
|
||||
$dlg = Wx::FileDialog->new($self, "Save $format file as:", dirname($output_file),
|
||||
basename($output_file), &Slic3r::GUI::STL_MODEL_WILDCARD, wxFD_SAVE | wxFD_OVERWRITE_PROMPT)
|
||||
if $format eq 'STL';
|
||||
|
||||
$dlg = Wx::FileDialog->new($self, "Save $format file as:", dirname($output_file),
|
||||
basename($output_file), &Slic3r::GUI::AMF_MODEL_WILDCARD, wxFD_SAVE | wxFD_OVERWRITE_PROMPT)
|
||||
if $format eq 'AMF';
|
||||
|
||||
if ($dlg->ShowModal != wxID_OK) {
|
||||
$dlg->Destroy;
|
||||
return undef;
|
||||
|
Loading…
x
Reference in New Issue
Block a user