Padre-Plugin-Shopify
view release on metacpan or search on metacpan
lib/Padre/Plugin/Shopify.pm view on Meta::CPAN
use JSON qw(decode_json encode_json);
use File::Slurp;
use WWW::Shopify;
use WWW::Shopify::Model::Shop;
use Padre::Plugin::Shopify::Task;
use WWW::Shopify::Liquid;
use Scalar::Util qw(weaken);
sub manifest { $_[0]->{manifest} = $_[1] if defined $_[1]; return $_[0]->{manifest}; }
sub update_combobox {
my ($self) = @_;
my $name = $self->panel->{theme_selector}->GetValue;
$self->panel->{theme_selector}->Clear;
$self->panel->{theme_selector}->Append("<< ALL >>");
my @themes = @{$self->manifest->{themes}};
$self->panel->{theme_selector}->Append($_->{name}) for (@themes);
$self->panel->{theme_selector}->SetStringSelection($name) if ($name);
}
lib/Padre/Plugin/Shopify.pm view on Meta::CPAN
}
elsif ($message =~ m/Error: /) {
$self->plugin->main->info($message);
}
}
sub task_finish {
my ($self, $task) = @_;
$self->plugin->main->status("Complete.");
$self->manifest($task->{manifest});
$self->update_combobox;
$self->set_buttons_state(1);
$self->progress(1);
}
sub task_run {
my ($self, $task) = @_;
$self->manifest($task->{manifest});
$self->progress(0);
}
lib/Padre/Plugin/Shopify.pm view on Meta::CPAN
my $self = bless { %$settings, directory => $directory, plugin => $plugin, sa => undef, panel => undef, autopush => 0, manifest => { themes => [] } }, $package;
my $height = 30;
#weaken($self->{plugin});
$self->{panel} = Padre::Plugin::Shopify::Panel->new( $self );
if (-e $directory . "/.shopmanifest") {
$self->manifest(decode_json(read_file($directory . "/.shopmanifest")));
}
else {
write_file($directory . "/.shopmanifest", encode_json($self->manifest));
}
$self->update_combobox;
return $self;
}
sub plugin { return shift->{plugin}; }
sub panel { return shift->{panel}; }
sub directory { return shift->{directory}; }
sub progress {
my ($self, $percent) = @_;
$self->panel->progress($percent);
( run in 0.678 second using v1.01-cache-2.11-cpan-39bf76dae61 )