Removed the LWP and Growl Perl dependencies.
This commit is contained in:
parent
c88d2780ce
commit
a38cbac312
3
Build.PL
3
Build.PL
@ -40,10 +40,7 @@ if ($gui) {
|
|||||||
Socket 2.016
|
Socket 2.016
|
||||||
);
|
);
|
||||||
%recommends = qw(
|
%recommends = qw(
|
||||||
Growl::GNTP 0.15
|
|
||||||
Wx::GLCanvas 0
|
Wx::GLCanvas 0
|
||||||
LWP::UserAgent 0
|
|
||||||
Net::Bonjour 0
|
|
||||||
);
|
);
|
||||||
if ($^O eq 'MSWin32') {
|
if ($^O eq 'MSWin32') {
|
||||||
$recommends{"Win32::TieRegistry"} = 0;
|
$recommends{"Win32::TieRegistry"} = 0;
|
||||||
|
@ -34,7 +34,6 @@ use Slic3r::GUI::SystemInfo;
|
|||||||
use Wx::Locale gettext => 'L';
|
use Wx::Locale gettext => 'L';
|
||||||
|
|
||||||
our $have_OpenGL = eval "use Slic3r::GUI::3DScene; 1";
|
our $have_OpenGL = eval "use Slic3r::GUI::3DScene; 1";
|
||||||
our $have_LWP = eval "use LWP::UserAgent; 1";
|
|
||||||
|
|
||||||
use Wx 0.9901 qw(:bitmap :dialog :icon :id :misc :systemsettings :toplevelwindow :filedialog :font);
|
use Wx 0.9901 qw(:bitmap :dialog :icon :id :misc :systemsettings :toplevelwindow :filedialog :font);
|
||||||
use Wx::Event qw(EVT_IDLE EVT_COMMAND EVT_MENU);
|
use Wx::Event qw(EVT_IDLE EVT_COMMAND EVT_MENU);
|
||||||
|
@ -25,10 +25,6 @@ our $last_config;
|
|||||||
our $VALUE_CHANGE_EVENT = Wx::NewEventType;
|
our $VALUE_CHANGE_EVENT = Wx::NewEventType;
|
||||||
# 2) To inform about a preset selection change or a "modified" status change.
|
# 2) To inform about a preset selection change or a "modified" status change.
|
||||||
our $PRESETS_CHANGED_EVENT = Wx::NewEventType;
|
our $PRESETS_CHANGED_EVENT = Wx::NewEventType;
|
||||||
# 3) To inform about a click on Browse button
|
|
||||||
our $BUTTON_BROWSE_EVENT = Wx::NewEventType;
|
|
||||||
# 4) To inform about a click on Test button
|
|
||||||
our $BUTTON_TEST_EVENT = Wx::NewEventType;
|
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my ($class, %params) = @_;
|
my ($class, %params) = @_;
|
||||||
@ -169,54 +165,6 @@ sub _init_tabpanel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
# The following event is emited by the C++ Tab implementation ,
|
|
||||||
# when the Browse button was clicked
|
|
||||||
EVT_COMMAND($self, -1, $BUTTON_BROWSE_EVENT, sub {
|
|
||||||
my ($self, $event) = @_;
|
|
||||||
my $msg = $event->GetString;
|
|
||||||
|
|
||||||
# look for devices
|
|
||||||
my $entries;
|
|
||||||
{
|
|
||||||
my $res = Net::Bonjour->new('http');
|
|
||||||
$res->discover;
|
|
||||||
$entries = [ $res->entries ];
|
|
||||||
}
|
|
||||||
if (@{$entries}) {
|
|
||||||
my $dlg = Slic3r::GUI::BonjourBrowser->new($self, $entries);
|
|
||||||
my $tab = Slic3r::GUI::get_preset_tab("printer");
|
|
||||||
$tab->load_key_value('octoprint_host', $dlg->GetValue . ":" . $dlg->GetPort)
|
|
||||||
if $dlg->ShowModal == wxID_OK;
|
|
||||||
} else {
|
|
||||||
Wx::MessageDialog->new($self, L('No Bonjour device found'), L('Device Browser'), wxOK | wxICON_INFORMATION)->ShowModal;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
# The following event is emited by the C++ Tab implementation ,
|
|
||||||
# when the Test button was clicked
|
|
||||||
EVT_COMMAND($self, -1, $BUTTON_TEST_EVENT, sub {
|
|
||||||
my ($self, $event) = @_;
|
|
||||||
my $msg = $event->GetString;
|
|
||||||
|
|
||||||
my $ua = LWP::UserAgent->new;
|
|
||||||
$ua->timeout(10);
|
|
||||||
|
|
||||||
my $config = Slic3r::GUI::get_preset_tab("printer")->get_config;
|
|
||||||
my $res = $ua->get(
|
|
||||||
"http://" . $config->octoprint_host . "/api/version",
|
|
||||||
'X-Api-Key' => $config->octoprint_apikey,
|
|
||||||
);
|
|
||||||
if ($res->is_success) {
|
|
||||||
Slic3r::GUI::show_info($self, L("Connection to OctoPrint works correctly."), _L("Success!"));
|
|
||||||
} else {
|
|
||||||
Slic3r::GUI::show_error($self,
|
|
||||||
L("I wasn't able to connect to OctoPrint (") . $res->status_line .
|
|
||||||
L("). Check hostname and OctoPrint version (at least 1.1.0 is required)."));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
# A variable to inform C++ Tab implementation about disabling of Browse button
|
|
||||||
$self->{is_disabled_button_browse} = (!eval "use Net::Bonjour; 1") ? 1 : 0 ;
|
|
||||||
# A variable to inform C++ Tab implementation about user_agent
|
|
||||||
$self->{is_user_agent} = (eval "use LWP::UserAgent; 1") ? 1 : 0 ;
|
|
||||||
Slic3r::GUI::create_preset_tabs($self->{no_controller}, $VALUE_CHANGE_EVENT, $PRESETS_CHANGED_EVENT);
|
Slic3r::GUI::create_preset_tabs($self->{no_controller}, $VALUE_CHANGE_EVENT, $PRESETS_CHANGED_EVENT);
|
||||||
$self->{options_tabs} = {};
|
$self->{options_tabs} = {};
|
||||||
for my $tab_name (qw(print filament printer)) {
|
for my $tab_name (qw(print filament printer)) {
|
||||||
|
@ -8,7 +8,6 @@ use utf8;
|
|||||||
use File::Basename qw(basename dirname);
|
use File::Basename qw(basename dirname);
|
||||||
use List::Util qw(sum first max);
|
use List::Util qw(sum first max);
|
||||||
use Slic3r::Geometry qw(X Y Z scale unscale deg2rad rad2deg);
|
use Slic3r::Geometry qw(X Y Z scale unscale deg2rad rad2deg);
|
||||||
use LWP::UserAgent;
|
|
||||||
use threads::shared qw(shared_clone);
|
use threads::shared qw(shared_clone);
|
||||||
use Wx qw(:button :colour :cursor :dialog :filedialog :keycode :icon :font :id :listctrl :misc
|
use Wx qw(:button :colour :cursor :dialog :filedialog :keycode :icon :font :id :listctrl :misc
|
||||||
:panel :sizer :toolbar :window wxTheApp :notebook :combobox wxNullBitmap);
|
:panel :sizer :toolbar :window wxTheApp :notebook :combobox wxNullBitmap);
|
||||||
|
Loading…
Reference in New Issue
Block a user