Move all Tk code into its own module

This commit is contained in:
Duncan Ferguson 2017-12-23 11:42:40 +00:00
parent 3d571b2801
commit 3a7e832855
4 changed files with 1887 additions and 1898 deletions

File diff suppressed because it is too large Load diff

View file

@ -142,7 +142,15 @@ sub config {
);
}
return $app_configuration;
return $self->{parent}->{config} if $self->{parent} && $self->{parent}->{config};
#return $app_configuration;
}
sub options {
my ($self) = @_;
return $self->{parent}->{options} if $self->{parent} && $self->{parent}->{options};
return undef;
}
sub set_config {
@ -270,6 +278,30 @@ sub parent {
return $self->{parent};
}
sub sort {
my ($self) = @_;
my $sort = sub { sort @_ };
return $sort unless defined $self->config()->{'use_natural_sort'};
# if the user has asked for natural sorting we need to include an extra
# module
if ( $self->config()->{'use_natural_sort'} ) {
eval { Module::Load::load('Sort::Naturally'); };
if ($@) {
warn(
"natural sorting requested but unable to load Sort::Naturally: $@\n"
);
}
else {
$sort = sub { Sort::Naturally::nsort(@_) };
}
}
return $sort;
}
1;
=pod

View file

@ -10,15 +10,32 @@ use Carp;
use base qw/ App::ClusterSSH::Base /;
sub new {
# Module to contain window generic code and pull in specific code from
# an appropriate module
my $package = __PACKAGE__.'::Tk';
sub import {
my ($class) = @_;
require $package;
$package->import();
# Find what windows module we should be using and just overlay it into
# this object
my $package_name = __PACKAGE__ . '::Tk';
( my $package_path = $package_name ) =~ s{::}{/}g;
require "$package_path.pm";
$package_name->import();
{
no strict 'refs';
push @{ __PACKAGE__ . '::ISA' }, $package_name;
}
}
my %servers;
sub new {
my ( $class, %args ) = @_;
my $self = $class->SUPER::new(%args);
return $self;
}
1;

File diff suppressed because it is too large Load diff