texlive[50008] Master/tlpkg/installer/install-tl-gui.tcl: Sort

commits+siepo at tug.org commits+siepo at tug.org
Tue Feb 12 16:54:14 CET 2019


Revision: 50008
          http://tug.org/svn/texlive?view=revision&revision=50008
Author:   siepo
Date:     2019-02-12 16:54:14 +0100 (Tue, 12 Feb 2019)
Log Message:
-----------
Sort collections; all trees configurable; undo mixup sysvar/sysconfig

Modified Paths:
--------------
    trunk/Master/tlpkg/installer/install-tl-gui.tcl

Modified: trunk/Master/tlpkg/installer/install-tl-gui.tcl
===================================================================
--- trunk/Master/tlpkg/installer/install-tl-gui.tcl	2019-02-12 01:18:10 UTC (rev 50007)
+++ trunk/Master/tlpkg/installer/install-tl-gui.tcl	2019-02-12 15:54:14 UTC (rev 50008)
@@ -62,6 +62,10 @@
   set ::perlbin "${::instroot}/tlpkg/tlperl/bin/wperl.exe"
 }
 
+# menu modes
+set ::advanced 0
+set ::alltrees 0
+
 ### procedures, mostly organized bottom-up ###
 
 # the procedures which provide the menu with the necessary backend data,
@@ -382,7 +386,7 @@
 proc commit_root {} {
   set ::vars(TEXDIR) [forward_slashify [.tltd.path_l cget -text]]
   set ::vars(TEXMFSYSVAR) "$::vars(TEXDIR)/texmf-var"
-  set ::vars(TEXMFSYSCONFIG) "$::vars(TEXDIR)/texmf-var"
+  set ::vars(TEXMFSYSCONFIG) "$::vars(TEXDIR)/texmf-config"
   commit_canonical_local
 
   if {$::vars(instopt_portable)} reset_personal_dirs
@@ -813,6 +817,10 @@
   show_stats
 }; # save_coll_selections
 
+proc sort_colls_by_value {n m} {
+  return [string compare [__ $::coll_descs($n)] [__ $::coll_descs($m)]]
+}
+
 proc select_collections {} {
   # 2018: more than 40 collections
   # The tcl installer acquires collections from install-menu-extl.pl,
@@ -885,7 +893,7 @@
   grid rowconfigure .tlcoll.both 1 -weight 1
 
 
-  foreach c [array names ::coll_descs] {
+  foreach c [lsort -command sort_colls_by_value [array names ::coll_descs]] {
     if [string equal -length 15 "collection-lang" $c] {
       set wgt ".tlcoll.lang"
     } else {
@@ -1061,7 +1069,8 @@
 
 proc run_menu {} {
   if [info exists ::env(dbgui)] {
-    puts "dbgui: run_menu: advanced is now $::advanced"
+    puts "\ndbgui: run_menu: advanced is now $::advanced"
+    puts "dbgui: run_menu: alltrees is now $::alltrees"
   }
   wm withdraw .
   foreach c [winfo children .] {
@@ -1135,6 +1144,23 @@
     -in .dirf -row $rw -column 2 -sticky new
 
   if $::advanced {
+    if $::alltrees {
+      incr rw
+      pgrid [ttk::label .tsysvll -text "TEXMFSYSVAR"] \
+          -in .dirf -row $rw -column 0 -sticky nw
+      pgrid [ttk::label .tsysvvl -textvariable ::vars(TEXMFSYSVAR)] \
+          -in .dirf -row $rw -column 1 -sticky nw
+      ttk::button .tsysvb -text [__ "Change"] -command {edit_dir "TEXMFSYSVAR"}
+      pgrid .tsysvb -in .dirf -row $rw -column 2 -sticky new
+      incr rw
+      pgrid [ttk::label .tsyscll -text "TEXMFSYSCONFIG"] \
+          -in .dirf -row $rw -column 0 -sticky nw
+      pgrid [ttk::label .tsyscvl -textvariable ::vars(TEXMFSYSCONFIG)] \
+          -in .dirf -row $rw -column 1 -sticky nw
+      ttk::button .tsyscb -text [__ "Change"] \
+          -command {edit_dir "TEXMFSYSCONFIG"}
+      pgrid .tsyscb -in .dirf -row $rw -column 2 -sticky new
+    }
     incr rw
     set s [__ "Local additions"]
     pgrid [ttk::label .tlocll -text "TEXMFLOCAL:\n$s"] \
@@ -1152,8 +1178,34 @@
         -in .dirf -row $rw -column 1 -sticky nw
     ttk::button .thomeb -text [__ "Change"] -command {edit_dir "TEXMFHOME"}
     pgrid .thomeb -in .dirf -row $rw -column 2 -sticky ne
+    if $::alltrees {
+      incr rw
+      pgrid [ttk::label .tvll -text "TEXMFVAR"] \
+          -in .dirf -row $rw -column 0 -sticky nw
+      pgrid [ttk::label .tvvl -textvariable ::vars(TEXMFVAR)] \
+          -in .dirf -row $rw -column 1 -sticky nw
+      ttk::button .tvb -text [__ "Change"] -command {edit_dir "TEXMFVAR"}
+      pgrid .tvb -in .dirf -row $rw -column 2 -sticky new
+      incr rw
+      pgrid [ttk::label .tcll -text "TEXMFCONFIG"] \
+          -in .dirf -row $rw -column 0 -sticky nw
+      pgrid [ttk::label .tcvl -textvariable ::vars(TEXMFCONFIG)] \
+          -in .dirf -row $rw -column 1 -sticky nw
+      ttk::button .tcb -text [__ "Change"] \
+          -command {edit_dir "TEXMFCONFIG"}
+      pgrid .tcb -in .dirf -row $rw -column 2 -sticky new
+    }
 
     incr rw
+    if {!$::alltrees} {
+      ttk::button .tmoreb -text [__ "More..."] -command {
+        set ::menu_ans "alltrees"
+        if [info exists ::env(dbgui)] {puts "dbgui: requested alltrees"}
+      }
+      pgrid .tmoreb -in .dirf -row $rw -column 2 -sticky ne
+    }
+
+    incr rw
     pgrid [ttk::label .dirportll \
         -text [__ "Portable setup:\nMay reset TEXMFLOCAL\nand TEXMFHOME"]] \
         -in .dirf -row $rw -column 0 -sticky nw
@@ -1392,8 +1444,10 @@
   update
   wm state . normal
   raise .
+  if [info exists ::env(dbgui)] {puts "dbgui: unsetting menu_ans"}
   unset -nocomplain ::menu_ans
   vwait ::menu_ans
+  if [info exists ::env(dbgui)] {puts "dbgui0: menu_ans is $::menu_ans"}
   return $::menu_ans
 }; # run_menu
 
@@ -1630,12 +1684,19 @@
       read_menu_data
       show_time "read menu data from perl"
       set ::advanced 0
+      set ::alltrees 0
       set answer [run_menu]
+      if [info exists ::env(dbgui)] {puts "dbgui1: menu_ans is $::menu_ans"}
       if {$answer eq "advanced"} {
         # this could only happen if $::advanced was 0
         set ::advanced 1
         if [info exists ::env(dbgui)] {puts "dbgui: Setting advanced to 1"}
         set answer [run_menu]
+        if {$answer eq "alltrees"} {
+          set ::alltrees 1
+          if [info exists ::env(dbgui)] {puts "dbgui: Setting alltrees to 1"}
+          set answer [run_menu]
+        }
       }
       set ::did_gui 1
       break



More information about the tex-live-commits mailing list