diff options
author | Norbert Preining <preining@logic.at> | 2009-02-05 00:19:33 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2009-02-05 00:19:33 +0000 |
commit | 76921f32b8ab5b666941949be71f2bcc6a276640 (patch) | |
tree | 60fa480e59c5f8eaa4804de232b9789542542345 /Master/tlpkg/installer | |
parent | 5c8afec4982eb3f53cc05cc59a340851ad9be370 (diff) |
check on writability, and disable the Next button if not (wizard)
git-svn-id: svn://tug.org/texlive/trunk@12083 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/installer')
-rw-r--r-- | Master/tlpkg/installer/install-menu-wizard.pl | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/Master/tlpkg/installer/install-menu-wizard.pl b/Master/tlpkg/installer/install-menu-wizard.pl index 3d7b060041d..4f55bd6afbd 100644 --- a/Master/tlpkg/installer/install-menu-wizard.pl +++ b/Master/tlpkg/installer/install-menu-wizard.pl @@ -89,6 +89,7 @@ if (defined($::opt_lang)) { my $dest; my $mw; +my $usedfont; ###################################################################### @@ -218,7 +219,7 @@ my $INF = 300; my $fmain; my $counter; - +my $lineskip; ################# WELCOME SCREEN ###################################### sub run_menu_wizard { @@ -228,6 +229,8 @@ sub run_menu_wizard { $dest = $vars{'TEXDIR'}; $tit = $mw->Label(-text => "TeX Live 2008 Installation"); + $usedfont= $tit->cget("-font"); + $lineskip = $usedfont->metrics("-linespace"); $tit->place(-x => $LEFT, -y => $TOP); @@ -266,10 +269,13 @@ sub reset_start { $inf->place(-x => 0, -y => 100); $nxt->configure(-text => "Next >", -command => \&ask_path ); + $nxt->configure(-state => "normal"); } ################## PATH SCREEN ################################ +my $warning; + sub ask_path { for ($fmain->children) { $_->destroy; @@ -299,14 +305,18 @@ sub ask_path { $fmain->Label(-text => "The destination folder will contain the installation.\nIt is strongly recommended to keep the year as the last component.", -justify => "left")->place(-x => 0, -y => 30); my $ytmp = 100; - $lab->place(-x => 0, -y => $ytmp); - $lab->update; - $ytmp += $lab->height; - $ytmp += 10; + $lab->place(-x => 0, -y => $ytmp, -anchor => "w"); + $ytmp += ($lineskip + 10); $val->place(-x => 0, -y => $ytmp, -anchor => "w"); $but->place(-x => $fmain->width, -y => $ytmp, -anchor => "e"); + $warning = $fmain->Label(-foreground => "red"); + check_show_warning(); + $ytmp += ($lineskip + 10); + $warning->place(-x => 0, -y => $ytmp, -anchor => "w"); + + $pa->place(-x => 0, -y => $ytmp + 30); @@ -326,6 +336,16 @@ sub ask_path { $prv->place(-x => $rb, -y => $BOTTOM, -anchor => "ne"); } +sub check_show_warning { + if (TeXLive::TLUtils::texdir_check($vars{'TEXDIR'})) { + $warning->configure(-text => ""); + $nxt->configure(-state => "normal"); + } else { + $warning->configure(-text => $text{'notwritable'}); + $nxt->configure(-state => "disabled"); + } +} + sub change_path { my $val = $dest; my $sw = $mw->Toplevel(-title => "Changing TEXDIR"); @@ -371,6 +391,7 @@ sub callback_change_texdir { } $vars{'TEXDIRW'}=$vars{'TEXDIR'}; $dest = $vars{'TEXDIR'}; + check_show_warning(); } ################## INSTALL SCREEN ############################# @@ -399,13 +420,12 @@ sub wizard_installation_window { $::progressw = $fmain->Scrolled("ROText", -scrollbars => "e", -wrap => "word"); - my $fo = $::progressw->cget("-font"); - my $lines = int( ($fmain->height - 20) / $fo->metrics("-linespace")); + my $lines = int( ($fmain->height - 20) / $lineskip); $::progressw->configure(-height => $lines); #, -width => $wd); - my $pw = $fmain->height - ($lines * $fo->metrics("-linespace")) - 5; + my $pw = $fmain->height - ($lines * $lineskip) - 5; $::progressw->place(-x => 0, -y => 0, -width => $fmain->width); |