summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorSebastien Dupont <sdupont@mandriva.com>2001-10-23 15:25:44 +0000
committerSebastien Dupont <sdupont@mandriva.com>2001-10-23 15:25:44 +0000
commitcd645586700c488f4cf95bea692700418b2cece8 (patch)
tree4becc93d631e5292e881431a9378ab35b571c12a /perl-install
parent52fff70fa5bdfe0bc86e2f76322d2157b3998f7b (diff)
downloaddrakx-cd645586700c488f4cf95bea692700418b2cece8.tar
drakx-cd645586700c488f4cf95bea692700418b2cece8.tar.gz
drakx-cd645586700c488f4cf95bea692700418b2cece8.tar.bz2
drakx-cd645586700c488f4cf95bea692700418b2cece8.tar.xz
drakx-cd645586700c488f4cf95bea692700418b2cece8.zip
doc and progress bar.
Diffstat (limited to 'perl-install')
-rwxr-xr-xperl-install/standalone/drakfont187
1 files changed, 141 insertions, 46 deletions
diff --git a/perl-install/standalone/drakfont b/perl-install/standalone/drakfont
index 1cfb3ab15..769cc2727 100755
--- a/perl-install/standalone/drakfont
+++ b/perl-install/standalone/drakfont
@@ -70,6 +70,7 @@ if ("@ARGV" =~ /--help|-h/) {
exit(0);
}
+# global variables needed by each functions
my $xlsfonts = 0;
my $windows;
my $strong;
@@ -111,17 +112,14 @@ foreach my $i (@application) {
}
# only debug
-print "app : @application\n";
-print "install : @install\n";
-print "uninstall : @uninstall\n";
-print "applications supproted: so: $so gs: $gs \n";
+# print "app : @application\n";
+# print "install : @install\n";
+# print "uninstall : @uninstall\n";
+# print "applications supproted: so: $so gs: $gs \n";
# PATH and binary full path
my $xfs_conffile = '/etc/X11/fs/config';
-#my $drakfont_dir = '/home/seb/new_drackfont'; #/usr/X11R6/lib/X11/fonts/drakfont
-#my $drakfont_dir = '/usr/X11R6/lib/X11/fonts/drakfont';
-my $drakfont_dir = '/home/seb/new2_drakfont';
-#my $ttf2pt1_b = '/usr/sbin/ttf2pt1 -b';
+my $drakfont_dir = '/home/seb/new2_drakfont'; # '/usr/X11R6/lib/X11/fonts/drakfont';
my $ttf2pt1 = '/usr/sbin/ttf2pt1';
my $pfm2afm = '/usr/sbin/pfm2afm';
my $type1inst = '/usr/sbin/type1inst';
@@ -129,10 +127,14 @@ my $chkfontpath = '/usr/sbin/chkfontpath';
my $ttmkfdir = '/usr/sbin/ttmkfdir';
my $ghostscript;
-# global lists, just to manipulate it easily.
-my $part;
-my @list_part;
-my @test;
+# Global lists, just to manipulate it easily.
+# my @font_list => list of fonts to install.
+# my @installed_fonts; => list of installed fonts.
+# my @installed_fonts_path; => list of path included in xfs.
+# my @fontsdir_to_install; => list of fonts to uninstall.
+# my @fontsdir_to_uninstall; => path to remove in xfs font file.
+# my @installed_fonts_full_path; => full path list of fonts to uninstall.
+
my @font_list;
my @installed_fonts;
my @installed_fonts_path;
@@ -212,10 +214,10 @@ sub search_dir_font {
!grep /$fn/, (@installed_fonts) and push @font_list, "$fn";
}
}
- print "Fonts in directory ".$dir." : ".$_."\n" foreach (@font_list_tmp);
+ print "Fonts in directory " . $dir . " : " . $_ . "\n" foreach (@font_list_tmp);
}
print ".........................................\n\n";
- print "Font to install : ".$_."\n" foreach (@font_list);
+ print "Font to install : " . $_ . "\n" foreach (@font_list);
}
sub search_dir_font_uninstall {
@@ -233,7 +235,7 @@ sub search_dir_font_uninstall {
if ( $i =~ /$j/) { push @font_list, "$i" ;}
}
}
- print "Fonts to uninstal : ".$_."\n" foreach (@font_list);
+ print "Fonts to uninstal : " . $_ . "\n" foreach (@font_list);
}
@@ -254,7 +256,7 @@ sub put_font_dir {
-e "/usr/share/ghostscript" or $gs = 0 && print "ghostscript is not installed on your system...\n" ;
if (@font_list) {
dir_created();
- cp_af(@font_list, $drakfont_dir."/tmp/tmp");
+ cp_af(@font_list, $drakfont_dir . "/tmp/tmp");
system ("cd $drakfont_dir/tmp/tmp && cp *.ttf ../../ttf");
system ("cd $drakfont_dir/ttf && $ttmkfdir > fonts.dir" );
@@ -321,7 +323,7 @@ sub remove_gs_fonts {
sub remove_fonts {
my @list_dir;
my @toto;
- -e $drakfont_dir . "/remove" || mkdir_p($drakfont_dir."/remove");
+ -e $drakfont_dir . "/remove" || mkdir_p($drakfont_dir . "/remove");
foreach my $i (@font_list) {
$_ = $i;
if ( /.pfb$/ || /.gsf$/ || /.pfm$/ || /.pfa$/ ) {
@@ -377,7 +379,7 @@ sub backend_mod {
search_installed_fonts();
search_dir_font $_ foreach (@install);
print ".................................................\n\n";
- print "Font to install : ".$_."\n" foreach (@font_list);
+ print "Font to install : " . $_ . "\n" foreach (@font_list);
put_font_dir();
print "\n...............The End...................\n";
}
@@ -392,66 +394,159 @@ sub backend_mod {
}
}
+
+####################################### INTERACTIVE ######################################################################
+
+
+my $true;
+my $pbar;
+my $pbar1;
+my $pbar2;
+my $pbar3;
+my $adj;
+my $adj1;
+my $adj2;
+my $adj3;
+
sub interactive_mode {
init Gtk;
-my $window1 = $::isEmbedded ? new Gtk::Plug ($::XID) : new Gtk::Window -toplevel;
-$window1->signal_connect ( delete_event => sub { Gtk->exit(0); });
-$window1->set_position(1);
-$window1->set_title(_("Fonts Importation"));
-$window1->set_policy(1, 1, 1);
-$window1->set_border_width(5);
+
+sub result_gi {
+ my $window3 = $::isEmbedded ? new Gtk::Plug ($::XID) : new Gtk::Window -toplevel;
+ $window3->signal_connect ( delete_event => sub { Gtk->exit(0); });
+ $window3->set_position(1);
+ $window3->set_title(_("Fonts Importation"));
+ $window3->set_policy(1, 1, 1);
+ $window3->set_border_width(5);
+
+ gtkadd($window3,
+ gtkpack_(new Gtk::HBox(0,6),
+ 1, my $notebook = new Gtk::FontSelection,
+ 0, gtkadd(gtkset_layout(new Gtk::VButtonBox, -end),
+ _("DrakFont"),
+ gtksignal_connect(new Gtk::Button(_("Windows Importation")), clicked => sub { $windows = 1; backend_mod() }),
+ gtksignal_connect(new Gtk::Button(_("Advanced Importation")), clicked => sub { $window3->destroy(); install_gi() }),
+ gtksignal_connect(new Gtk::Button(_("Uninstall Fonts")), clicked => sub { Gtk->main_quit() }),
+ gtksignal_connect(new Gtk::Button(_("Close")), clicked => sub { Gtk->main_quit() }),
+ )
+ ),
+ );
+ $window3->show_all;
+ $window3->realize;
+ $window3->show_all();
+}
+
+
sub install_gi {
+ my $window2 = $::isEmbedded ? new Gtk::Plug ($::XID) : new Gtk::Window -toplevel;
+ my $align;
+
+ $window2->signal_connect ( delete_event => sub { $window2->destroy(); result_gi });
+ $window2->set_position(1);
+ $window2->set_title(_("Fonts Importation"));
+ $window2->set_policy(1, 1, 1);
+ $window2->set_border_width(5);
+ $adj = new Gtk::Adjustment( 0, 1, 300, 0, 0, 0 );
+ $adj1 = new Gtk::Adjustment( 0, 1, 300, 0, 0, 0 );
+ $adj2 = new Gtk::Adjustment( 0, 1, 300, 0, 0, 0 );
+ $adj3 = new Gtk::Adjustment( 0, 1, 300, 0, 0, 0 );
+ gtkadd($window2,
+ gtkpack_(new Gtk::VBox(0,6),
+ 0, $pbar = new_with_adjustment Gtk::ProgressBar( $adj ),
+ 0, $pbar1 = new_with_adjustment Gtk::ProgressBar( $adj1 ),
+ 0, $pbar2 = new_with_adjustment Gtk::ProgressBar( $adj2 ),
+ 0, $pbar3 = new_with_adjustment Gtk::ProgressBar( $adj3 ),
+ 0, gtkadd(gtkset_layout(new Gtk::VButtonBox, -end),
+ _("DrakFont"),
+ )
+ ),
+ );
+
+ my $timer = Gtk->timeout_add( 5, \&progress_timeout );
+ my $timer1 = Gtk->timeout_add( 10, \&progress_timeout1 );
+ my $timer2 = Gtk->timeout_add( 15, \&progress_timeout2 );
+ my $timer3 = Gtk->timeout_add( 20, \&progress_timeout3 );
+
+
+ $window2->show_all;
+ $window2->realize;
+ $window2->show_all();
+}
+
+sub main_gi {
my $window1 = $::isEmbedded ? new Gtk::Plug ($::XID) : new Gtk::Window -toplevel;
$window1->signal_connect ( delete_event => sub { Gtk->exit(0); });
$window1->set_position(1);
$window1->set_title(_("Fonts Importation"));
$window1->set_policy(1, 1, 1);
$window1->set_border_width(5);
-
+
gtkadd($window1,
gtkpack_(new Gtk::HBox(0,6),
- 1, my $notebook = new Gtk::FontSelection,
+ 1, my $notebook = new Gtk::FontSelection,
0, gtkadd(gtkset_layout(new Gtk::VButtonBox, -end),
_("DrakFont"),
- gtksignal_connect(new Gtk::Button(_("Windows Importation")), clicked => sub { $windows = 1; backend_mod() }),
- gtksignal_connect(new Gtk::Button(_("Advanced Importation")), clicked => sub { $window1->destroy(); install_gi() }),
+ gtksignal_connect(new Gtk::Button(_("Windows Importation")), clicked => sub { $windows = 1; backend_mod(); }),
+ gtksignal_connect(new Gtk::Button(_("Advanced Importation")), clicked => sub { $window1->destroy(); install_gi(); }),
gtksignal_connect(new Gtk::Button(_("Uninstall Fonts")), clicked => sub { Gtk->main_quit() }),
gtksignal_connect(new Gtk::Button(_("Close")), clicked => sub { Gtk->main_quit() }),
)
),
- );
+ );
$window1->show_all;
$window1->realize;
$window1->show_all();
}
-gtkadd($window1,
- gtkpack_(new Gtk::HBox(0,6),
- 1, my $notebook = new Gtk::FontSelection,
- 0, gtkadd(gtkset_layout(new Gtk::VButtonBox, -end),
- _("DrakFont"),
- gtksignal_connect(new Gtk::Button(_("Windows Importation")), clicked => sub { $windows = 1; backend_mod() }),
- gtksignal_connect(new Gtk::Button(_("Advanced Importation")), clicked => sub { $window1->destroy(); install_gi() }),
- gtksignal_connect(new Gtk::Button(_("Uninstall Fonts")), clicked => sub { Gtk->main_quit() }),
- gtksignal_connect(new Gtk::Button(_("Close")), clicked => sub { Gtk->main_quit() }),
- )
- ),
- );
-
-$window1->show_all;
-$window1->realize;
-$window1->show_all();
-
+main_gi;
Gtk->main;
Gtk->exit(0);
}
+sub progress_timeout {
+ my $new_val;
+ my $adjt;
+ $new_val = $pbar->get_value() + 5;
+ $adjt = $pbar->adjustment;
+ $pbar->set_value( $new_val );
+ 1;
+}
+
+
+sub progress_timeout1 {
+ my $new_val;
+ my $adjt;
+ $new_val = $pbar1->get_value() + 4;
+ $adjt = $pbar1->adjustment;
+ $pbar1->set_value( $new_val );
+ 1;
+}
+
+sub progress_timeout2 {
+ my $new_val;
+ my $adjt;
+ $new_val = $pbar2->get_value() + 3;
+ $adjt = $pbar2->adjustment;
+ $pbar2->set_value( $new_val );
+ 1;
+}
+
+sub progress_timeout3 {
+ my $new_val;
+ my $adjt;
+ $new_val = $pbar3->get_value() + 2;
+ $adjt = $pbar3->adjustment;
+ $pbar3->set_value( $new_val );
+ 1;
+}
+
+
#1, gtksignal_connect(my $button_connect = gtkset_sensitive(new Gtk::Button(), 0), clicked => \&connection),