mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-06-20 11:43:05 +08:00
Import wxTheApp
This commit is contained in:
parent
ddac2d1570
commit
3d8c8fa46e
@ -93,7 +93,7 @@ sub OnInit {
|
|||||||
$Settings->{_}{background_processing} //= 1;
|
$Settings->{_}{background_processing} //= 1;
|
||||||
}
|
}
|
||||||
$Settings->{_}{version} = $Slic3r::VERSION;
|
$Settings->{_}{version} = $Slic3r::VERSION;
|
||||||
&Wx::wxTheApp->save_settings;
|
$self->save_settings;
|
||||||
|
|
||||||
# application frame
|
# application frame
|
||||||
Wx::Image::AddHandler(Wx::PNGHandler->new);
|
Wx::Image::AddHandler(Wx::PNGHandler->new);
|
||||||
@ -114,8 +114,8 @@ sub OnInit {
|
|||||||
}
|
}
|
||||||
$self->{mainframe}->config_wizard if $run_wizard;
|
$self->{mainframe}->config_wizard if $run_wizard;
|
||||||
|
|
||||||
&Wx::wxTheApp->check_version
|
$self->check_version
|
||||||
if &Wx::wxTheApp->have_version_check
|
if $self->have_version_check
|
||||||
&& ($Settings->{_}{version_check} // 1)
|
&& ($Settings->{_}{version_check} // 1)
|
||||||
&& (!$Settings->{_}{last_version_check} || (time - $Settings->{_}{last_version_check}) >= 86400);
|
&& (!$Settings->{_}{last_version_check} || (time - $Settings->{_}{last_version_check}) >= 86400);
|
||||||
|
|
||||||
@ -240,7 +240,7 @@ sub check_version {
|
|||||||
Slic3r::GUI::show_info(undef, "You're using the latest version. No updates are available.") if $p{manual};
|
Slic3r::GUI::show_info(undef, "You're using the latest version. No updates are available.") if $p{manual};
|
||||||
}
|
}
|
||||||
$Settings->{_}{last_version_check} = time();
|
$Settings->{_}{last_version_check} = time();
|
||||||
&Wx::wxTheApp->save_settings;
|
$self->save_settings;
|
||||||
} else {
|
} else {
|
||||||
Slic3r::GUI::show_error(undef, "Failed to check for updates. Try later.") if $p{manual};
|
Slic3r::GUI::show_error(undef, "Failed to check for updates. Try later.") if $p{manual};
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ use utf8;
|
|||||||
|
|
||||||
use List::Util qw(min);
|
use List::Util qw(min);
|
||||||
use Wx qw(:frame :bitmap :id :misc :notebook :panel :sizer :menu :dialog :filedialog
|
use Wx qw(:frame :bitmap :id :misc :notebook :panel :sizer :menu :dialog :filedialog
|
||||||
:font :icon);
|
:font :icon wxTheApp);
|
||||||
use Wx::Event qw(EVT_CLOSE EVT_MENU);
|
use Wx::Event qw(EVT_CLOSE EVT_MENU);
|
||||||
use base 'Wx::Frame';
|
use base 'Wx::Frame';
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ sub _init_tabpanel {
|
|||||||
# so that user gets the config when switching to expert mode
|
# so that user gets the config when switching to expert mode
|
||||||
$tab->config->save(sprintf "$Slic3r::GUI::datadir/%s/%s.ini", $tab->name, 'Simple Mode');
|
$tab->config->save(sprintf "$Slic3r::GUI::datadir/%s/%s.ini", $tab->name, 'Simple Mode');
|
||||||
$Slic3r::GUI::Settings->{presets}{$tab->name} = 'Simple Mode.ini';
|
$Slic3r::GUI::Settings->{presets}{$tab->name} = 'Simple Mode.ini';
|
||||||
&Wx::wxTheApp->save_settings;
|
wxTheApp->save_settings;
|
||||||
}
|
}
|
||||||
$self->config->save($Slic3r::GUI::autosave) if $Slic3r::GUI::autosave;
|
$self->config->save($Slic3r::GUI::autosave) if $Slic3r::GUI::autosave;
|
||||||
}
|
}
|
||||||
@ -241,15 +241,15 @@ sub _init_menubar {
|
|||||||
$helpMenu->AppendSeparator();
|
$helpMenu->AppendSeparator();
|
||||||
$helpMenu->Append(MI_WEBSITE, "Slic3r &Website", 'Open the Slic3r website in your browser');
|
$helpMenu->Append(MI_WEBSITE, "Slic3r &Website", 'Open the Slic3r website in your browser');
|
||||||
my $versioncheck = $helpMenu->Append(MI_VERSIONCHECK, "Check for &Updates...", 'Check for new Slic3r versions');
|
my $versioncheck = $helpMenu->Append(MI_VERSIONCHECK, "Check for &Updates...", 'Check for new Slic3r versions');
|
||||||
$versioncheck->Enable(&Wx::wxTheApp->have_version_check);
|
$versioncheck->Enable(wxTheApp->have_version_check);
|
||||||
$helpMenu->Append(MI_DOCUMENTATION, "Slic3r &Manual", 'Open the Slic3r manual in your browser');
|
$helpMenu->Append(MI_DOCUMENTATION, "Slic3r &Manual", 'Open the Slic3r manual in your browser');
|
||||||
$helpMenu->AppendSeparator();
|
$helpMenu->AppendSeparator();
|
||||||
$helpMenu->Append(wxID_ABOUT, "&About Slic3r", 'Show about dialog');
|
$helpMenu->Append(wxID_ABOUT, "&About Slic3r", 'Show about dialog');
|
||||||
EVT_MENU($self, MI_CONF_WIZARD, sub { $self->config_wizard });
|
EVT_MENU($self, MI_CONF_WIZARD, sub { $self->config_wizard });
|
||||||
EVT_MENU($self, MI_WEBSITE, sub { Wx::LaunchDefaultBrowser('http://slic3r.org/') });
|
EVT_MENU($self, MI_WEBSITE, sub { Wx::LaunchDefaultBrowser('http://slic3r.org/') });
|
||||||
EVT_MENU($self, MI_VERSIONCHECK, sub { &Wx::wxTheApp->check_version(manual => 1) });
|
EVT_MENU($self, MI_VERSIONCHECK, sub { wxTheApp->check_version(manual => 1) });
|
||||||
EVT_MENU($self, MI_DOCUMENTATION, sub { Wx::LaunchDefaultBrowser('http://manual.slic3r.org/') });
|
EVT_MENU($self, MI_DOCUMENTATION, sub { Wx::LaunchDefaultBrowser('http://manual.slic3r.org/') });
|
||||||
EVT_MENU($self, wxID_ABOUT, sub { &Wx::wxTheApp->about });
|
EVT_MENU($self, wxID_ABOUT, sub { wxTheApp->about });
|
||||||
}
|
}
|
||||||
|
|
||||||
# menubar
|
# menubar
|
||||||
@ -316,7 +316,7 @@ sub quick_slice {
|
|||||||
}
|
}
|
||||||
my $input_file_basename = basename($input_file);
|
my $input_file_basename = basename($input_file);
|
||||||
$Slic3r::GUI::Settings->{recent}{skein_directory} = dirname($input_file);
|
$Slic3r::GUI::Settings->{recent}{skein_directory} = dirname($input_file);
|
||||||
&Wx::wxTheApp->save_settings;
|
wxTheApp->save_settings;
|
||||||
|
|
||||||
my $sprint = Slic3r::Print::Simple->new(
|
my $sprint = Slic3r::Print::Simple->new(
|
||||||
status_cb => sub {
|
status_cb => sub {
|
||||||
@ -342,7 +342,7 @@ sub quick_slice {
|
|||||||
$output_file = $sprint->expanded_output_filepath;
|
$output_file = $sprint->expanded_output_filepath;
|
||||||
$output_file =~ s/\.gcode$/.svg/i if $params{export_svg};
|
$output_file =~ s/\.gcode$/.svg/i if $params{export_svg};
|
||||||
my $dlg = Wx::FileDialog->new($self, 'Save ' . ($params{export_svg} ? 'SVG' : 'G-code') . ' file as:',
|
my $dlg = Wx::FileDialog->new($self, 'Save ' . ($params{export_svg} ? 'SVG' : 'G-code') . ' file as:',
|
||||||
&Wx::wxTheApp->output_path(dirname($output_file)),
|
wxTheApp->output_path(dirname($output_file)),
|
||||||
basename($output_file), $params{export_svg} ? &Slic3r::GUI::FILE_WILDCARDS->{svg} : &Slic3r::GUI::FILE_WILDCARDS->{gcode}, wxFD_SAVE);
|
basename($output_file), $params{export_svg} ? &Slic3r::GUI::FILE_WILDCARDS->{svg} : &Slic3r::GUI::FILE_WILDCARDS->{gcode}, wxFD_SAVE);
|
||||||
if ($dlg->ShowModal != wxID_OK) {
|
if ($dlg->ShowModal != wxID_OK) {
|
||||||
$dlg->Destroy;
|
$dlg->Destroy;
|
||||||
@ -351,7 +351,7 @@ sub quick_slice {
|
|||||||
$output_file = $dlg->GetPath;
|
$output_file = $dlg->GetPath;
|
||||||
$last_output_file = $output_file unless $params{export_svg};
|
$last_output_file = $output_file unless $params{export_svg};
|
||||||
$Slic3r::GUI::Settings->{_}{last_output_path} = dirname($output_file);
|
$Slic3r::GUI::Settings->{_}{last_output_path} = dirname($output_file);
|
||||||
&Wx::wxTheApp->save_settings;
|
wxTheApp->save_settings;
|
||||||
$dlg->Destroy;
|
$dlg->Destroy;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -377,7 +377,7 @@ sub quick_slice {
|
|||||||
undef $progress_dialog;
|
undef $progress_dialog;
|
||||||
|
|
||||||
my $message = "$input_file_basename was successfully sliced.";
|
my $message = "$input_file_basename was successfully sliced.";
|
||||||
&Wx::wxTheApp->notify($message);
|
wxTheApp->notify($message);
|
||||||
Wx::MessageDialog->new($self, $message, 'Slicing Done!',
|
Wx::MessageDialog->new($self, $message, 'Slicing Done!',
|
||||||
wxOK | wxICON_INFORMATION)->ShowModal;
|
wxOK | wxICON_INFORMATION)->ShowModal;
|
||||||
};
|
};
|
||||||
@ -447,7 +447,7 @@ sub export_config {
|
|||||||
if ($dlg->ShowModal == wxID_OK) {
|
if ($dlg->ShowModal == wxID_OK) {
|
||||||
my $file = $dlg->GetPath;
|
my $file = $dlg->GetPath;
|
||||||
$Slic3r::GUI::Settings->{recent}{config_directory} = dirname($file);
|
$Slic3r::GUI::Settings->{recent}{config_directory} = dirname($file);
|
||||||
&Wx::wxTheApp->save_settings;
|
wxTheApp->save_settings;
|
||||||
$last_config = $file;
|
$last_config = $file;
|
||||||
$config->save($file);
|
$config->save($file);
|
||||||
}
|
}
|
||||||
@ -468,7 +468,7 @@ sub load_config_file {
|
|||||||
$dlg->Destroy;
|
$dlg->Destroy;
|
||||||
}
|
}
|
||||||
$Slic3r::GUI::Settings->{recent}{config_directory} = dirname($file);
|
$Slic3r::GUI::Settings->{recent}{config_directory} = dirname($file);
|
||||||
&Wx::wxTheApp->save_settings;
|
wxTheApp->save_settings;
|
||||||
$last_config = $file;
|
$last_config = $file;
|
||||||
for my $tab (values %{$self->{options_tabs}}) {
|
for my $tab (values %{$self->{options_tabs}}) {
|
||||||
$tab->load_config_file($file);
|
$tab->load_config_file($file);
|
||||||
@ -491,7 +491,7 @@ sub export_configbundle {
|
|||||||
if ($dlg->ShowModal == wxID_OK) {
|
if ($dlg->ShowModal == wxID_OK) {
|
||||||
my $file = $dlg->GetPath;
|
my $file = $dlg->GetPath;
|
||||||
$Slic3r::GUI::Settings->{recent}{config_directory} = dirname($file);
|
$Slic3r::GUI::Settings->{recent}{config_directory} = dirname($file);
|
||||||
&Wx::wxTheApp->save_settings;
|
wxTheApp->save_settings;
|
||||||
|
|
||||||
# leave default category empty to prevent the bundle from being parsed as a normal config file
|
# leave default category empty to prevent the bundle from being parsed as a normal config file
|
||||||
my $ini = { _ => {} };
|
my $ini = { _ => {} };
|
||||||
@ -503,7 +503,7 @@ sub export_configbundle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach my $section (qw(print filament printer)) {
|
foreach my $section (qw(print filament printer)) {
|
||||||
my %presets = &Wx::wxTheApp->presets($section);
|
my %presets = wxTheApp->presets($section);
|
||||||
foreach my $preset_name (keys %presets) {
|
foreach my $preset_name (keys %presets) {
|
||||||
my $config = Slic3r::Config->load($presets{$preset_name});
|
my $config = Slic3r::Config->load($presets{$preset_name});
|
||||||
$ini->{"$section:$preset_name"} = $config->as_ini->{_};
|
$ini->{"$section:$preset_name"} = $config->as_ini->{_};
|
||||||
@ -526,18 +526,18 @@ sub load_configbundle {
|
|||||||
$dlg->Destroy;
|
$dlg->Destroy;
|
||||||
|
|
||||||
$Slic3r::GUI::Settings->{recent}{config_directory} = dirname($file);
|
$Slic3r::GUI::Settings->{recent}{config_directory} = dirname($file);
|
||||||
&Wx::wxTheApp->save_settings;
|
wxTheApp->save_settings;
|
||||||
|
|
||||||
# load .ini file
|
# load .ini file
|
||||||
my $ini = Slic3r::Config->read_ini($file);
|
my $ini = Slic3r::Config->read_ini($file);
|
||||||
|
|
||||||
if ($ini->{settings}) {
|
if ($ini->{settings}) {
|
||||||
$Slic3r::GUI::Settings->{_}{$_} = $ini->{settings}{$_} for keys %{$ini->{settings}};
|
$Slic3r::GUI::Settings->{_}{$_} = $ini->{settings}{$_} for keys %{$ini->{settings}};
|
||||||
&Wx::wxTheApp->save_settings;
|
wxTheApp->save_settings;
|
||||||
}
|
}
|
||||||
if ($ini->{presets}) {
|
if ($ini->{presets}) {
|
||||||
$Slic3r::GUI::Settings->{presets} = $ini->{presets};
|
$Slic3r::GUI::Settings->{presets} = $ini->{presets};
|
||||||
&Wx::wxTheApp->save_settings;
|
wxTheApp->save_settings;
|
||||||
}
|
}
|
||||||
if ($ini->{simple}) {
|
if ($ini->{simple}) {
|
||||||
my $config = Slic3r::Config->load_ini_hash($ini->{simple});
|
my $config = Slic3r::Config->load_ini_hash($ini->{simple});
|
||||||
|
@ -2,7 +2,7 @@ package Slic3r::GUI::OptionsGroup;
|
|||||||
use Moo;
|
use Moo;
|
||||||
|
|
||||||
use List::Util qw(first);
|
use List::Util qw(first);
|
||||||
use Wx qw(:combobox :font :misc :sizer :systemsettings :textctrl);
|
use Wx qw(:combobox :font :misc :sizer :systemsettings :textctrl wxTheApp);
|
||||||
use Wx::Event qw(EVT_CHECKBOX EVT_COMBOBOX EVT_SPINCTRL EVT_TEXT EVT_KILL_FOCUS EVT_SLIDER);
|
use Wx::Event qw(EVT_CHECKBOX EVT_COMBOBOX EVT_SPINCTRL EVT_TEXT EVT_KILL_FOCUS EVT_SLIDER);
|
||||||
|
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
@ -208,7 +208,7 @@ sub _build_field {
|
|||||||
};
|
};
|
||||||
EVT_COMBOBOX($self->parent, $field, sub {
|
EVT_COMBOBOX($self->parent, $field, sub {
|
||||||
# Without CallAfter, the field text is not populated on Windows.
|
# Without CallAfter, the field text is not populated on Windows.
|
||||||
&Wx::wxTheApp->CallAfter(sub {
|
wxTheApp->CallAfter(sub {
|
||||||
$field->SetValue($opt->{values}[ $field->GetSelection ]); # set the text field to the selected value
|
$field->SetValue($opt->{values}[ $field->GetSelection ]); # set the text field to the selected value
|
||||||
$self->_on_change($opt_key, $on_change);
|
$self->_on_change($opt_key, $on_change);
|
||||||
});
|
});
|
||||||
|
@ -9,7 +9,7 @@ use Slic3r::Geometry qw(X Y Z MIN MAX scale unscale);
|
|||||||
use threads::shared qw(shared_clone);
|
use threads::shared qw(shared_clone);
|
||||||
use Thread::Semaphore;
|
use Thread::Semaphore;
|
||||||
use Wx qw(:button :cursor :dialog :filedialog :keycode :icon :font :id :listctrl :misc
|
use Wx qw(:button :cursor :dialog :filedialog :keycode :icon :font :id :listctrl :misc
|
||||||
:panel :sizer :toolbar :window);
|
:panel :sizer :toolbar :window wxTheApp);
|
||||||
use Wx::Event qw(EVT_BUTTON EVT_COMMAND EVT_KEY_DOWN EVT_LIST_ITEM_ACTIVATED
|
use Wx::Event qw(EVT_BUTTON EVT_COMMAND EVT_KEY_DOWN EVT_LIST_ITEM_ACTIVATED
|
||||||
EVT_LIST_ITEM_DESELECTED EVT_LIST_ITEM_SELECTED EVT_MOUSE_EVENTS EVT_PAINT EVT_TOOL
|
EVT_LIST_ITEM_DESELECTED EVT_LIST_ITEM_SELECTED EVT_MOUSE_EVENTS EVT_PAINT EVT_TOOL
|
||||||
EVT_CHOICE EVT_TIMER);
|
EVT_CHOICE EVT_TIMER);
|
||||||
@ -352,7 +352,7 @@ sub on_select_preset {
|
|||||||
$Slic3r::GUI::Settings->{presets}{filament} = $choice->GetString($filament_presets[0]) . ".ini";
|
$Slic3r::GUI::Settings->{presets}{filament} = $choice->GetString($filament_presets[0]) . ".ini";
|
||||||
$Slic3r::GUI::Settings->{presets}{"filament_${_}"} = $choice->GetString($filament_presets[$_])
|
$Slic3r::GUI::Settings->{presets}{"filament_${_}"} = $choice->GetString($filament_presets[$_])
|
||||||
for 1 .. $#filament_presets;
|
for 1 .. $#filament_presets;
|
||||||
&Wx::wxTheApp->save_settings;
|
wxTheApp->save_settings;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$self->GetFrame->{options_tabs}{$group}->select_preset($choice->GetSelection);
|
$self->GetFrame->{options_tabs}{$group}->select_preset($choice->GetSelection);
|
||||||
@ -385,7 +385,7 @@ sub filament_presets {
|
|||||||
sub add {
|
sub add {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
||||||
my @input_files = &Wx::wxTheApp->open_model($self);
|
my @input_files = wxTheApp->open_model($self);
|
||||||
$self->load_file($_) for @input_files;
|
$self->load_file($_) for @input_files;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -394,7 +394,7 @@ sub load_file {
|
|||||||
my ($input_file) = @_;
|
my ($input_file) = @_;
|
||||||
|
|
||||||
$Slic3r::GUI::Settings->{recent}{skein_directory} = dirname($input_file);
|
$Slic3r::GUI::Settings->{recent}{skein_directory} = dirname($input_file);
|
||||||
&Wx::wxTheApp->save_settings;
|
wxTheApp->save_settings;
|
||||||
|
|
||||||
my $process_dialog = Wx::ProgressDialog->new('Loading…', "Processing input file…", 100, $self, 0);
|
my $process_dialog = Wx::ProgressDialog->new('Loading…', "Processing input file…", 100, $self, 0);
|
||||||
$process_dialog->Pulse;
|
$process_dialog->Pulse;
|
||||||
@ -852,7 +852,7 @@ sub export_gcode {
|
|||||||
$self->{export_gcode_output_file} = $main::opt{output};
|
$self->{export_gcode_output_file} = $main::opt{output};
|
||||||
{
|
{
|
||||||
my $default_output_file = $self->{print}->expanded_output_filepath($self->{export_gcode_output_file});
|
my $default_output_file = $self->{print}->expanded_output_filepath($self->{export_gcode_output_file});
|
||||||
my $dlg = Wx::FileDialog->new($self, 'Save G-code file as:', &Wx::wxTheApp->output_path(dirname($default_output_file)),
|
my $dlg = Wx::FileDialog->new($self, 'Save G-code file as:', wxTheApp->output_path(dirname($default_output_file)),
|
||||||
basename($default_output_file), &Slic3r::GUI::FILE_WILDCARDS->{gcode}, wxFD_SAVE);
|
basename($default_output_file), &Slic3r::GUI::FILE_WILDCARDS->{gcode}, wxFD_SAVE);
|
||||||
if ($dlg->ShowModal != wxID_OK) {
|
if ($dlg->ShowModal != wxID_OK) {
|
||||||
$dlg->Destroy;
|
$dlg->Destroy;
|
||||||
@ -860,7 +860,7 @@ sub export_gcode {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$Slic3r::GUI::Settings->{_}{last_output_path} = dirname($dlg->GetPath);
|
$Slic3r::GUI::Settings->{_}{last_output_path} = dirname($dlg->GetPath);
|
||||||
&Wx::wxTheApp->save_settings;
|
wxTheApp->save_settings;
|
||||||
$self->{export_gcode_output_file} = $Slic3r::GUI::MainFrame::last_output_file = $dlg->GetPath;
|
$self->{export_gcode_output_file} = $Slic3r::GUI::MainFrame::last_output_file = $dlg->GetPath;
|
||||||
$dlg->Destroy;
|
$dlg->Destroy;
|
||||||
}
|
}
|
||||||
@ -961,7 +961,7 @@ sub on_export_completed {
|
|||||||
}
|
}
|
||||||
$self->{export_gcode_output_file} = undef;
|
$self->{export_gcode_output_file} = undef;
|
||||||
$self->statusbar->SetStatusText($message);
|
$self->statusbar->SetStatusText($message);
|
||||||
&Wx::wxTheApp->notify($message);
|
wxTheApp->notify($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub export_stl {
|
sub export_stl {
|
||||||
|
@ -4,7 +4,8 @@ use warnings;
|
|||||||
use utf8;
|
use utf8;
|
||||||
|
|
||||||
use File::Basename qw(basename);
|
use File::Basename qw(basename);
|
||||||
use Wx qw(:misc :sizer :treectrl :button wxTAB_TRAVERSAL wxSUNKEN_BORDER wxBITMAP_TYPE_PNG);
|
use Wx qw(:misc :sizer :treectrl :button wxTAB_TRAVERSAL wxSUNKEN_BORDER wxBITMAP_TYPE_PNG
|
||||||
|
wxTheApp);
|
||||||
use Wx::Event qw(EVT_BUTTON EVT_TREE_ITEM_COLLAPSING EVT_TREE_SEL_CHANGED);
|
use Wx::Event qw(EVT_BUTTON EVT_TREE_ITEM_COLLAPSING EVT_TREE_SEL_CHANGED);
|
||||||
use base 'Wx::Panel';
|
use base 'Wx::Panel';
|
||||||
|
|
||||||
@ -186,7 +187,7 @@ sub selection_changed {
|
|||||||
sub on_btn_load {
|
sub on_btn_load {
|
||||||
my ($self, $is_modifier) = @_;
|
my ($self, $is_modifier) = @_;
|
||||||
|
|
||||||
my @input_files = &Wx::wxTheApp->open_model($self);
|
my @input_files = wxTheApp->open_model($self);
|
||||||
foreach my $input_file (@input_files) {
|
foreach my $input_file (@input_files) {
|
||||||
my $model = eval { Slic3r::Model->read_from_file($input_file) };
|
my $model = eval { Slic3r::Model->read_from_file($input_file) };
|
||||||
if ($@) {
|
if ($@) {
|
||||||
|
@ -4,7 +4,8 @@ use warnings;
|
|||||||
use utf8;
|
use utf8;
|
||||||
|
|
||||||
use List::Util qw(first);
|
use List::Util qw(first);
|
||||||
use Wx qw(:misc :sizer :button wxTAB_TRAVERSAL wxSUNKEN_BORDER wxBITMAP_TYPE_PNG);
|
use Wx qw(:misc :sizer :button wxTAB_TRAVERSAL wxSUNKEN_BORDER wxBITMAP_TYPE_PNG
|
||||||
|
wxTheApp);
|
||||||
use Wx::Event qw(EVT_BUTTON EVT_LEFT_DOWN EVT_MENU);
|
use Wx::Event qw(EVT_BUTTON EVT_LEFT_DOWN EVT_MENU);
|
||||||
use base 'Wx::ScrolledWindow';
|
use base 'Wx::ScrolledWindow';
|
||||||
|
|
||||||
@ -109,7 +110,7 @@ sub update_optgroup {
|
|||||||
EVT_BUTTON($self, $btn, sub {
|
EVT_BUTTON($self, $btn, sub {
|
||||||
$self->{config}->erase($opt_key);
|
$self->{config}->erase($opt_key);
|
||||||
$self->{on_change}->() if $self->{on_change};
|
$self->{on_change}->() if $self->{on_change};
|
||||||
&Wx::wxTheApp->CallAfter(sub { $self->update_optgroup });
|
wxTheApp->CallAfter(sub { $self->update_optgroup });
|
||||||
});
|
});
|
||||||
return $btn;
|
return $btn;
|
||||||
},
|
},
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package Slic3r::GUI::Preferences;
|
package Slic3r::GUI::Preferences;
|
||||||
use Wx qw(:dialog :id :misc :sizer :systemsettings);
|
use Wx qw(:dialog :id :misc :sizer :systemsettings wxTheApp);
|
||||||
use Wx::Event qw(EVT_BUTTON EVT_TEXT_ENTER);
|
use Wx::Event qw(EVT_BUTTON EVT_TEXT_ENTER);
|
||||||
use base 'Wx::Dialog';
|
use base 'Wx::Dialog';
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ sub new {
|
|||||||
label => 'Check for updates',
|
label => 'Check for updates',
|
||||||
tooltip => 'If this is enabled, Slic3r will check for updates daily and display a reminder if a newer version is available.',
|
tooltip => 'If this is enabled, Slic3r will check for updates daily and display a reminder if a newer version is available.',
|
||||||
default => $Slic3r::GUI::Settings->{_}{version_check} // 1,
|
default => $Slic3r::GUI::Settings->{_}{version_check} // 1,
|
||||||
readonly => !&Wx::wxTheApp->have_version_check,
|
readonly => !wxTheApp->have_version_check,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
opt_key => 'remember_output_path',
|
opt_key => 'remember_output_path',
|
||||||
@ -77,7 +77,7 @@ sub _accept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$Slic3r::GUI::Settings->{_}{$_} = $self->{values}{$_} for keys %{$self->{values}};
|
$Slic3r::GUI::Settings->{_}{$_} = $self->{values}{$_} for keys %{$self->{values}};
|
||||||
&Wx::wxTheApp->save_settings;
|
wxTheApp->save_settings;
|
||||||
|
|
||||||
$self->EndModal(wxID_OK);
|
$self->EndModal(wxID_OK);
|
||||||
$self->Close; # needed on Linux
|
$self->Close; # needed on Linux
|
||||||
|
@ -5,7 +5,8 @@ use utf8;
|
|||||||
|
|
||||||
use File::Basename qw(basename);
|
use File::Basename qw(basename);
|
||||||
use List::Util qw(first);
|
use List::Util qw(first);
|
||||||
use Wx qw(:bookctrl :dialog :keycode :icon :id :misc :panel :sizer :treectrl :window);
|
use Wx qw(:bookctrl :dialog :keycode :icon :id :misc :panel :sizer :treectrl :window
|
||||||
|
wxTheApp);
|
||||||
use Wx::Event qw(EVT_BUTTON EVT_CHOICE EVT_KEY_DOWN EVT_TREE_SEL_CHANGED);
|
use Wx::Event qw(EVT_BUTTON EVT_CHOICE EVT_KEY_DOWN EVT_TREE_SEL_CHANGED);
|
||||||
use base 'Wx::Panel';
|
use base 'Wx::Panel';
|
||||||
|
|
||||||
@ -217,7 +218,7 @@ sub on_select_preset {
|
|||||||
$self->select_default_preset;
|
$self->select_default_preset;
|
||||||
}
|
}
|
||||||
|
|
||||||
&Wx::wxTheApp->save_settings;
|
wxTheApp->save_settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub get_preset_config {
|
sub get_preset_config {
|
||||||
@ -347,7 +348,7 @@ sub load_presets {
|
|||||||
name => '- default -',
|
name => '- default -',
|
||||||
}];
|
}];
|
||||||
|
|
||||||
my %presets = &Wx::wxTheApp->presets($self->name);
|
my %presets = wxTheApp->presets($self->name);
|
||||||
foreach my $preset_name (sort keys %presets) {
|
foreach my $preset_name (sort keys %presets) {
|
||||||
push @{$self->{presets}}, {
|
push @{$self->{presets}}, {
|
||||||
name => $preset_name,
|
name => $preset_name,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user