line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PAR::Dist::InstallPPD::GUI; |
2
|
1
|
|
|
1
|
|
37054
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
41
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
44
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.05'; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
4
|
use File::Spec; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
19
|
|
8
|
1
|
|
|
1
|
|
3437
|
use Config::IniFiles; |
|
1
|
|
|
|
|
84807
|
|
|
1
|
|
|
|
|
49
|
|
9
|
1
|
|
|
1
|
|
3266
|
use Tk; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use Tk::NoteBook; |
11
|
|
|
|
|
|
|
use Tk::ROText; |
12
|
|
|
|
|
|
|
use IPC::Run (); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
use File::UserConfig (); |
15
|
|
|
|
|
|
|
use PAR::Dist::FromPPD (); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
use base 'PAR::Dist::InstallPPD::GUI::Install'; |
18
|
|
|
|
|
|
|
use base 'PAR::Dist::InstallPPD::GUI::Installed'; |
19
|
|
|
|
|
|
|
use base 'PAR::Dist::InstallPPD::GUI::Config'; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new { |
22
|
|
|
|
|
|
|
my $proto = shift; |
23
|
|
|
|
|
|
|
my $class = ref($proto)||$proto; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my $cfgdir = File::UserConfig->new( |
26
|
|
|
|
|
|
|
dist => 'PAR-Dist-InstallPPD-GUI', |
27
|
|
|
|
|
|
|
module => 'PAR::Dist::InstallPPD::GUI', |
28
|
|
|
|
|
|
|
dirname => '.PAR-Dist-InstallPPD-GUI', |
29
|
|
|
|
|
|
|
# sharedir => 'PARInstallPPDGUI', |
30
|
|
|
|
|
|
|
)->configdir(); |
31
|
|
|
|
|
|
|
my $cfgfile = File::Spec->catfile($cfgdir, 'config.ini'); |
32
|
|
|
|
|
|
|
chmod(oct('644'), $cfgfile); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
if (not -f $cfgfile) { |
35
|
|
|
|
|
|
|
require File::Path; |
36
|
|
|
|
|
|
|
File::Path::mkpath($cfgdir); |
37
|
|
|
|
|
|
|
open my $fh, '>', $cfgfile |
38
|
|
|
|
|
|
|
or die "Could not open configuration file: $!"; |
39
|
|
|
|
|
|
|
print $fh ; |
40
|
|
|
|
|
|
|
close $fh; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
tie my %cfg => 'Config::IniFiles', -file => $cfgfile; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
my $self = bless { |
45
|
|
|
|
|
|
|
ppduri => $cfg{main}{ppduri}, |
46
|
|
|
|
|
|
|
verbose => $cfg{main}{verbose}, |
47
|
|
|
|
|
|
|
shouldwrap => $cfg{main}{shouldwrap}, |
48
|
|
|
|
|
|
|
parinstallppd => $cfg{main}{parinstallppd}, |
49
|
|
|
|
|
|
|
saregex => $cfg{main}{saregex}, |
50
|
|
|
|
|
|
|
spregex => $cfg{main}{spregex}, |
51
|
|
|
|
|
|
|
} => $class; |
52
|
|
|
|
|
|
|
$self->{cfg} = \%cfg; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
my $mw = MainWindow->new(); |
55
|
|
|
|
|
|
|
$self->{mw} = $mw; |
56
|
|
|
|
|
|
|
$mw->geometry( "800x600" ); |
57
|
|
|
|
|
|
|
eval { # eval, in case fonts already exist |
58
|
|
|
|
|
|
|
$mw->fontCreate(qw/C_normal -family courier -size 10/); |
59
|
|
|
|
|
|
|
$mw->fontCreate(qw/C_bold -family courier -size 10 -weight bold/); |
60
|
|
|
|
|
|
|
}; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
my $nb = $mw->NoteBook()->pack(qw/-side top -fill both -expand 1/); |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# status bar |
65
|
|
|
|
|
|
|
my $statusframe = $mw->Frame( |
66
|
|
|
|
|
|
|
qw/-relief sunken/ |
67
|
|
|
|
|
|
|
)->pack(qw/-fill x -side bottom/); |
68
|
|
|
|
|
|
|
my $statuslabel = $statusframe->Label( |
69
|
|
|
|
|
|
|
qw/-text/, 'Welcome to PAR::Dist::InstallPPD::GUI' |
70
|
|
|
|
|
|
|
)->pack(qw/-side left -fill x -ipadx 4 -ipady 1/); |
71
|
|
|
|
|
|
|
$self->{statusbar} = $statuslabel; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
$self->{tabs} = {}; |
74
|
|
|
|
|
|
|
$self->{tabs}{welcome} = $nb->add( "welcome", -label => "Welcome" ); |
75
|
|
|
|
|
|
|
$self->{tabs}{install} = $nb->add( "install", -label => "Install" ); |
76
|
|
|
|
|
|
|
$self->{tabs}{installed} = $nb->add( |
77
|
|
|
|
|
|
|
"installed", -label => "Installed", |
78
|
|
|
|
|
|
|
-raisecmd => [$self, '_raise_installed'], |
79
|
|
|
|
|
|
|
); |
80
|
|
|
|
|
|
|
$self->{tabs}{config} = $nb->add( "config", -label => "Configuration" ); |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
$self->{tabs}{welcome}->Label( |
83
|
|
|
|
|
|
|
-text=>"Welcome to PAR-Install-PPD-GUI!" |
84
|
|
|
|
|
|
|
)->pack( ); |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
$self->_init_install_tab(); |
87
|
|
|
|
|
|
|
$self->_init_config_tab(); |
88
|
|
|
|
|
|
|
$self->_init_installed_tab(); |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
return $self; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub run { |
94
|
|
|
|
|
|
|
MainLoop; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub _status { |
98
|
|
|
|
|
|
|
my $self = shift; |
99
|
|
|
|
|
|
|
my $text = shift; |
100
|
|
|
|
|
|
|
$self->{statusbar}->configure('-text' => $text); |
101
|
|
|
|
|
|
|
$self->{mw}->update(); |
102
|
|
|
|
|
|
|
return 1; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub DESTROY { |
106
|
|
|
|
|
|
|
my $self = shift; |
107
|
|
|
|
|
|
|
$self->_save_config(); |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
1; |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 NAME |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
PAR::Dist::InstallPPD::GUI - GUI frontend for PAR::Dist::InstallPPD |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 SYNOPSIS |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
use PAR::Dist::InstallPPD::GUI; |
120
|
|
|
|
|
|
|
my $gui = PAR::Dist::InstallPPD::GUI->new(); |
121
|
|
|
|
|
|
|
$gui->run(); |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 DESCRIPTION |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
This module implements a Tk GUI front-end to the L |
126
|
|
|
|
|
|
|
module's C command. You will generally want to use the |
127
|
|
|
|
|
|
|
C command instead of using this module. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
The interface to C isn't done in code via an API. |
130
|
|
|
|
|
|
|
Instead C uses L to run C. |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head1 SEE ALSO |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
L, L, L, L |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
PAR has a mailing list, , that you can write to; send an empty mail to to join the list and participate in the discussion. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Please send bug reports to . |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
The official PAR website may be of help, too: http://par.perl.org |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
For details on the I, please refer to ActiveState's |
143
|
|
|
|
|
|
|
website at L. |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head1 AUTHOR |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
Steffen Mueller, Esmueller at cpan dot orgE |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Copyright (C) 2006-2007 by Steffen Mueller |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
154
|
|
|
|
|
|
|
it under the same terms as Perl itself, either Perl version 5.6 or, |
155
|
|
|
|
|
|
|
at your option, any later version of Perl 5 you may have available. |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=cut |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
__DATA__ |